public function columns()
    {
        for ($i = 0; $i < $this->columns; ++$i) {
            yield $i + 1 => ($this->rows == 1)
                ? $this->grid[0][$i]
                : new static(array_column($this->grid, $i));
        }
    }
public function columns()
    {
        for ($i = 0; $i < $this->columns; ++$i) {
            yield $i + 1 => ($this->rows == 1)
                ? $this->grid[0][$i]
                : new static(array_column($this->grid, $i));
        }
    }
public function columns ( ) { for ( $ i = 0 ; $ i < $ this -> columns ; ++ $ i ) { yield $ i + 1 => ( $ this -> rows == 1 ) ? $ this -> grid [ 0 ] [ $ i ] : new static ( array_column ( $ this -> grid , $ i ) ) ; } }
Returns a Generator that will yield each column of the matrix in turn as a vector matrix
or the value of each cell if the matrix is a vector

@return \Generator|Matrix[]|mixed[]
Returns a Generator that will yield each column of the matrix in turn as a vector matrix or the value of each cell if the matrix is a vector