Python numpy.block() Examples

The following are 30 code examples for showing how to use numpy.block(). These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example.

You may check out the related API usage on the sidebar.

You may also want to check out all available functions/classes of the module numpy , or try the search function .

Example 1
Project: pyscf   Author: pyscf   File: krhf_slow.py    License: Apache License 2.0 6 votes vote down vote up
def get_k_ix(self, item, like):
        """
        Retrieves block indexes: row and column.
        Args:
            item (str): a string of 'mknj' letters;
            like (tuple): a 2-tuple with sample pair of k-points;

        Returns:
            Row and column indexes of a sub-block with conserving momentum.
        """
        item_i = numpy.argsort(mknj2i(item))
        item_code = ''.join("++--"[i] for i in item_i)
        if item_code[0] == item_code[1]:
            kc = self.kconserv  # ++-- --++
        elif item_code[0] == item_code[2]:
            kc = self.kconserv.swapaxes(1, 2)  # +-+- -+-+
        elif item_code[1] == item_code[2]:
            kc = self.kconserv.transpose(2, 0, 1)  # +--+ -++-
        else:
            raise RuntimeError("Unknown case: {}".format(item_code))

        y = kc[like]
        x = kc[0, y[0]]

        return x, y 
Example 2
Project: pyscf   Author: pyscf   File: krhf_slow.py    License: Apache License 2.0 6 votes vote down vote up
def eri_mknj(self, item, pair_row, pair_column):
        """
        Retrieves the merged ERI block using 'mknj' notation with pairs of k-indexes (k1, k1, k2, k2).
        Args:
            item (str): a 4-character string of 'mknj' letters;
            pair_row (Iterable): a k-point pair `k2 = pair_row[k1]` for each k1 (row indexes in the final matrix);
            pair_column (Iterable): a k-point pair `k4 = pair_row[k3]` for each k3 (column indexes in the final matrix);

        Returns:
            The corresponding block of ERI (phys notation).
        """
        return super(PhysERI, self).eri_mknj(
            item,
            pairs_row=enumerate(pair_row),
            pairs_column=enumerate(pair_column),
        ) 
Example 3
Project: pyscf   Author: pyscf   File: krhf_slow.py    License: Apache License 2.0 6 votes vote down vote up
def tdhf_primary_form(self, k):
        """
        A primary form of TDHF matrixes (full).
        Args:
            k (tuple, int): momentum transfer: either a pair of k-point indexes specifying the momentum transfer
            vector or a single integer with the second index assuming the first index being zero;

        Returns:
            Output type: "full", and the corresponding matrix.
        """
        r1, r2, c1, c2 = get_block_k_ix(self, k)
        d1 = self.tdhf_diag(r1)
        d2 = self.tdhf_diag(r2)
        a = d1 + 2 * self["knmj", r1, c1] - self["knjm", r1, c1]
        b = 2 * self["kjmn", r1, c2] - self["kjnm", r1, c2]
        a_ = d2 + 2 * self["mjkn", r2, c2] - self["mjnk", r2, c2]
        b_ = 2 * self["mnkj", r2, c1] - self["mnjk", r2, c1]
        return "full", numpy.block([[a, b], [-b_, -a_]]) 
Example 4
Project: pyscf   Author: pyscf   File: krhf_slow_supercell.py    License: Apache License 2.0 6 votes vote down vote up
def eri_mknj(self, item, pairs_row=None, pairs_column=None):
        """
        Retrieves the merged ERI block using 'mknj' notation with all k-indexes.
        Args:
            item (str): a 4-character string of 'mknj' letters;
            pairs_row (Iterable): iterator for pairs of row k-points (first index in the output matrix);
            pairs_column (Iterable): iterator for pairs of column k-points (second index in the output matrix);

        Returns:
            The corresponding block of ERI (phys notation).
        """
        if pairs_row is None:
            pairs_row = product(range(len(self.model.kpts)), range(len(self.model.kpts)))
        if pairs_column is None:
            pairs_column = product(range(len(self.model.kpts)), range(len(self.model.kpts)))
        # Second index has to support re-iterations
        pairs_column = tuple(pairs_column)
        result = []
        for k1, k2 in pairs_row:
            result.append([])
            for k3, k4 in pairs_column:
                result[-1].append(self.eri_mknj_k(item, (k1, k2, k3, k4)))

        r = numpy.block(result)
        return r / len(self.model.kpts) 
Example 5
Project: pyscf   Author: pyscf   File: common_slow.py    License: Apache License 2.0 6 votes vote down vote up
def eri_mknj(self, item, *args):
        """
        Retrieves ERI block using 'mknj' notation.
        Args:
            item (str): a 4-character string of 'mknj' letters;
            *args: other arguments passed to `get_block_ov_notation`;

        Returns:
            The corresponding block of ERI (matrix with paired dimensions).
        """
        if len(item) != 4 or not isinstance(item, str) or set(item) != set('mknj'):
            raise ValueError("Unknown item: {}".format(repr(item)))

        item = mknj2i(item)
        n_ov = ''.join('o' if i % 2 == 0 else 'v' for i in item)
        args = tuple(
            tuple(arg[i] for i in item)
            for arg in args
        )
        result = self.eri_ov(n_ov, *args).transpose(*numpy.argsort(item))
        i, j, k, l = result.shape
        result = result.reshape((i * j, k * l))
        return result 
Example 6
Project: nevergrad   Author: facebookresearch   File: photonics.py    License: MIT License 6 votes vote down vote up
def cascade(T: np.ndarray, U: np.ndarray) -> np.ndarray:
    n = int(T.shape[1] / 2)
    J = np.linalg.inv(np.eye(n) - np.matmul(U[0:n, 0:n], T[n : 2 * n, n : 2 * n]))
    K = np.linalg.inv(np.eye(n) - np.matmul(T[n : 2 * n, n : 2 * n], U[0:n, 0:n]))
    S = np.block(
        [
            [
                T[0:n, 0:n]
                + np.matmul(
                    np.matmul(np.matmul(T[0:n, n : 2 * n], J), U[0:n, 0:n]),
                    T[n : 2 * n, 0:n],
                ),
                np.matmul(np.matmul(T[0:n, n : 2 * n], J), U[0:n, n : 2 * n]),
            ],
            [
                np.matmul(np.matmul(U[n : 2 * n, 0:n], K), T[n : 2 * n, 0:n]),
                U[n : 2 * n, n : 2 * n]
                + np.matmul(
                    np.matmul(np.matmul(U[n : 2 * n, 0:n], K), T[n : 2 * n, n : 2 * n]),
                    U[0:n, n : 2 * n],
                ),
            ],
        ]
    )
    return S  # type: ignore 
Example 7
Project: nevergrad   Author: facebookresearch   File: photonics.py    License: MIT License 6 votes vote down vote up
def creneau(k0: float, a0: float, pol: float, e1: float, e2: float, a: float, n: int, x0: float) -> tp.Tuple[np.ndarray, np.ndarray]:
    nmod = int(n / 2)
    alpha = np.diag(a0 + 2 * np.pi * np.arange(-nmod, nmod + 1))
    if pol == 0:
        M = alpha * alpha - k0 * k0 * marche(e1, e2, a, n, x0)
        L, E = np.linalg.eig(M)
        L = np.sqrt(-L + 0j)
        L = (1 - 2 * (np.imag(L) < -1e-15)) * L
        P = np.block([[E], [np.matmul(E, np.diag(L))]])
    else:
        U = marche(1 / e1, 1 / e2, a, n, x0)
        T = np.linalg.inv(U)
        M = (
            np.matmul(
                np.matmul(np.matmul(T, alpha), np.linalg.inv(marche(e1, e2, a, n, x0))),
                alpha,
            )
            - k0 * k0 * T
        )
        L, E = np.linalg.eig(M)
        L = np.sqrt(-L + 0j)
        L = (1 - 2 * (np.imag(L) < -1e-15)) * L
        P = np.block([[E], [np.matmul(np.matmul(U, E), np.diag(L))]])
    return P, L 
Example 8
Project: vnpy_crypto   Author: birforce   File: test_shape_base.py    License: MIT License 6 votes vote down vote up
def test_block_complicated(self):
        # a bit more complicated
        one_2d = np.array([[1, 1, 1]])
        two_2d = np.array([[2, 2, 2]])
        three_2d = np.array([[3, 3, 3, 3, 3, 3]])
        four_1d = np.array([4, 4, 4, 4, 4, 4])
        five_0d = np.array(5)
        six_1d = np.array([6, 6, 6, 6, 6])
        zero_2d = np.zeros((2, 6))

        expected = np.array([[1, 1, 1, 2, 2, 2],
                             [3, 3, 3, 3, 3, 3],
                             [4, 4, 4, 4, 4, 4],
                             [5, 6, 6, 6, 6, 6],
                             [0, 0, 0, 0, 0, 0],
                             [0, 0, 0, 0, 0, 0]])

        result = block([[one_2d, two_2d],
                        [three_2d],
                        [four_1d],
                        [five_0d, six_1d],
                        [zero_2d]])
        assert_equal(result, expected) 
Example 9
Project: harold   Author: ilayn   File: _classes.py    License: MIT License 6 votes vote down vote up
def concatenate_state_matrices(G):
    """
    Takes a State() model as input and returns the A, B, C, D matrices
    combined into a full matrix. For static gain models, the feedthrough
    matrix D is returned.

    Parameters
    ----------
    G : State

    Returns
    -------
    M : ndarray
    """
    if not isinstance(G, State):
        raise ValueError('concatenate_state_matrices() works on state '
                         'representations, but I found \"{0}\" object '
                         'instead.'.format(type(G).__name__))
    if G._isgain:
        return G.d

    return np.block([[G.a, G.b], [G.c, G.d]]) 
Example 10
Project: GraphicDesignPatternByPython   Author: Relph1119   File: test_shape_base.py    License: MIT License 6 votes vote down vote up
def test_block_complicated(self):
        # a bit more complicated
        one_2d = np.array([[1, 1, 1]])
        two_2d = np.array([[2, 2, 2]])
        three_2d = np.array([[3, 3, 3, 3, 3, 3]])
        four_1d = np.array([4, 4, 4, 4, 4, 4])
        five_0d = np.array(5)
        six_1d = np.array([6, 6, 6, 6, 6])
        zero_2d = np.zeros((2, 6))

        expected = np.array([[1, 1, 1, 2, 2, 2],
                             [3, 3, 3, 3, 3, 3],
                             [4, 4, 4, 4, 4, 4],
                             [5, 6, 6, 6, 6, 6],
                             [0, 0, 0, 0, 0, 0],
                             [0, 0, 0, 0, 0, 0]])

        result = block([[one_2d, two_2d],
                        [three_2d],
                        [four_1d],
                        [five_0d, six_1d],
                        [zero_2d]])
        assert_equal(result, expected) 
Example 11
Project: pySINDy   Author: luckystarufo   File: test_shape_base.py    License: MIT License 6 votes vote down vote up
def test_block_complicated(self):
        # a bit more complicated
        one_2d = np.array([[1, 1, 1]])
        two_2d = np.array([[2, 2, 2]])
        three_2d = np.array([[3, 3, 3, 3, 3, 3]])
        four_1d = np.array([4, 4, 4, 4, 4, 4])
        five_0d = np.array(5)
        six_1d = np.array([6, 6, 6, 6, 6])
        zero_2d = np.zeros((2, 6))

        expected = np.array([[1, 1, 1, 2, 2, 2],
                             [3, 3, 3, 3, 3, 3],
                             [4, 4, 4, 4, 4, 4],
                             [5, 6, 6, 6, 6, 6],
                             [0, 0, 0, 0, 0, 0],
                             [0, 0, 0, 0, 0, 0]])

        result = block([[one_2d, two_2d],
                        [three_2d],
                        [four_1d],
                        [five_0d, six_1d],
                        [zero_2d]])
        assert_equal(result, expected) 
Example 12
Project: OpenFermion-Cirq   Author: quantumlib   File: bogoliubov_transform_test.py    License: Apache License 2.0 5 votes vote down vote up
def test_bogoliubov_transform_quadratic_hamiltonian_inverse_is_dagger(
        n_qubits, real, particle_conserving, atol):
    quad_ham = random_quadratic_hamiltonian(
            n_qubits,
            real=real,
            conserves_particle_number=particle_conserving,
            seed=46533)
    _, transformation_matrix, _ = quad_ham.diagonalizing_bogoliubov_transform()

    qubits = cirq.LineQubit.range(n_qubits)

    if transformation_matrix.shape == (n_qubits, n_qubits):
        daggered_transformation_matrix = transformation_matrix.T.conj()
    else:
        left_block = transformation_matrix[:, :n_qubits]
        right_block = transformation_matrix[:, n_qubits:]
        daggered_transformation_matrix = numpy.block(
            [left_block.T.conj(), right_block.T])

    circuit1 = cirq.Circuit(
            cirq.inverse(bogoliubov_transform(qubits, transformation_matrix)))

    circuit2 = cirq.Circuit(
            bogoliubov_transform(qubits, daggered_transformation_matrix))

    cirq.testing.assert_allclose_up_to_global_phase(
            circuit1.unitary(),
            circuit2.unitary(),
            atol=atol) 
Example 13
Project: OpenFermion-Cirq   Author: quantumlib   File: bogoliubov_transform.py    License: Apache License 2.0 5 votes vote down vote up
def _gaussian_basis_change(qubits: Sequence[cirq.Qid],
                           transformation_matrix: numpy.ndarray,
                           initially_occupied_orbitals: Optional[Sequence[int]]
                           ) -> cirq.OP_TREE:
    n_qubits = len(qubits)

    # Rearrange the transformation matrix because the OpenFermion routine
    # expects it to describe annihilation operators rather than creation
    # operators
    left_block = transformation_matrix[:, :n_qubits]
    right_block = transformation_matrix[:, n_qubits:]
    transformation_matrix = numpy.block(
            [numpy.conjugate(right_block), numpy.conjugate(left_block)])

    decomposition, left_decomposition, _, left_diagonal = (
        fermionic_gaussian_decomposition(transformation_matrix))

    if (initially_occupied_orbitals is not None and
            len(initially_occupied_orbitals) == 0):
        # Starting with the vacuum state yields additional symmetry
        circuit_description = list(reversed(decomposition))
    else:
        if initially_occupied_orbitals is None:
            # The initial state is not a computational basis state so the
            # phases left on the diagonal in the Givens decomposition matter
            yield (cirq.rz(rads=
                       numpy.angle(left_diagonal[j])).on(qubits[j])
                   for j in range(n_qubits))
        circuit_description = list(reversed(decomposition + left_decomposition))

    yield _ops_from_givens_rotations_circuit_description(
            qubits, circuit_description) 
Example 14
Project: pyscf   Author: pyscf   File: kgw_slow_supercell.py    License: Apache License 2.0 5 votes vote down vote up
def eri_ov(self, item):
        result = []
        k = numpy.arange(self.nk)
        for k1 in k:
            result.append([])
            for k2 in k:
                result[-1].append([])
                for k3 in k:
                    result[-1][-1].append([])
                    for k4 in k:
                        result[-1][-1][-1].append(self.eri.eri_ov(item, (k1, k2, k3, k4)))

        r = numpy.block(result)
        return r / len(k) 
Example 15
Project: pyscf   Author: pyscf   File: krhf_slow.py    License: Apache License 2.0 5 votes vote down vote up
def tdhf_diag(self, block):
        """
        Retrieves the merged diagonal block only with specific pairs of k-indexes (k, block[k]).
        Args:
            block (Iterable): a k-point pair `k2 = pair[k1]` for each k1;

        Returns:
            The diagonal block.
        """
        return super(PhysERI, self).tdhf_diag(pairs=enumerate(block)) 
Example 16
Project: pyscf   Author: pyscf   File: kproxy.py    License: Apache License 2.0 5 votes vote down vote up
def tdhf_primary_form(self, k):
        """
        A primary form of TD matrices (full).
        Args:
            k (tuple, int): momentum transfer: either a pair of k-point indexes specifying the momentum transfer
            vector or a single integer with the second index assuming the first index being zero;

        Returns:
            Output type: "full", and the corresponding matrix.
        """
        r1, r2, c1, c2 = krhf_slow.get_block_k_ix(self, k)
        (a, _), (_, b), (_, b_star), (a_star, _) = self.proxy_response_ov_batch((r1, r1, r2, r2), (c1, c2, c1, c2))
        return "full", numpy.block([[a, b], [-b_star.conj(), -a_star.conj()]]) 
Example 17
Project: pyscf   Author: pyscf   File: krhf_slow_supercell.py    License: Apache License 2.0 5 votes vote down vote up
def tdhf_diag_k(self, k1, k2):
        """
        Retrieves the diagonal block.
        Args:
            k1 (int): first k-index (row);
            k2 (int): second k-index (column);

        Returns:
            The diagonal block.
        """
        # Everything is already implemented in molecular code
        return super(PhysERI, self).tdhf_diag(k1, k2) 
Example 18
Project: pyscf   Author: pyscf   File: krhf_slow_supercell.py    License: Apache License 2.0 5 votes vote down vote up
def tdhf_diag(self, pairs=None):
        """
        Retrieves the merged diagonal block with specified or all possible k-index pairs.
        Args:
            pairs (Iterable): pairs of k-points to assmble;

        Returns:
            The diagonal block.
        """
        if pairs is None:
            pairs = product(range(len(self.model.kpts)), range(len(self.model.kpts)))
        result = []
        for k1, k2 in pairs:
            result.append(self.tdhf_diag_k(k1, k2))
        return scipy.linalg.block_diag(*result) 
Example 19
Project: pyscf   Author: pyscf   File: krhf_slow_supercell.py    License: Apache License 2.0 5 votes vote down vote up
def eri_mknj_k(self, item, k):
        """
        Retrieves ERI block using 'mknj' notation.
        Args:
            item (str): a 4-character string of 'mknj' letters;
            k (Iterable): k indexes;

        Returns:
            The corresponding block of ERI (phys notation).
        """
        # Everything is already implemented in molecular code
        return super(PhysERI, self).eri_mknj(item, k) 
Example 20
Project: pyscf   Author: pyscf   File: common_slow.py    License: Apache License 2.0 5 votes vote down vote up
def tdhf_diag(self, *args):
        """
        Retrieves the diagonal block.
        Args:
            *args: args passed to `__get_mo_energies__`;

        Returns:
            The diagonal block.
        """
        e_occ, e_virt = self.__get_mo_energies__(*args)
        diag = (- e_occ[:, numpy.newaxis] + e_virt[numpy.newaxis, :]).reshape(-1)
        return numpy.diag(diag).reshape((len(e_occ) * len(e_virt), len(e_occ) * len(e_virt))) 
Example 21
Project: pyscf   Author: pyscf   File: common_slow.py    License: Apache License 2.0 5 votes vote down vote up
def eri_ov(self, item, *args):
        """
        Retrieves ERI block using 'ov' notation.
        Args:
            item (str): a 4-character string of 'o' and 'v' letters;
            *args: other args passed to `__calc_block__`;

        Returns:
            The corresponding block of ERI (4-tensor, phys notation).
        """
        if len(item) != 4 or not isinstance(item, str) or not set(item).issubset('ov'):
            raise ValueError("Unknown item: {}".format(repr(item)))

        args = (tuple(item), ) + args
        if args in self.__eri__:
            return self.__eri__[args]

        result = self.__calc_block__(*args)

        for permutation, conjugation in self.symmetries:
            permuted_args = tuple(
                tuple(arg[_i] for _i in permutation)
                for arg in args
            )
            if conjugation:
                self.__eri__[permuted_args] = result.transpose(*permutation).conj()
            else:
                self.__eri__[permuted_args] = result.transpose(*permutation)
        return result 
Example 22
Project: burnman   Author: geodynamics   File: anisotropy.py    License: GNU General Public License v2.0 5 votes vote down vote up
def full_compliance_tensor(self):
        try: # numpy.block was new in numpy version 1.13.0.
            block = np.block([[ np.ones((3, 3)), 2.*np.ones((3, 3))],
                              [2.*np.ones((3, 3)), 4.*np.ones((3, 3))]])
        except:
            block = np.array(np.bmat( [[[[1.]*3]*3, [[2.]*3]*3], [[[2.]*3]*3, [[4.]*3]*3]] ))
        return self._voigt_notation_to_stiffness_tensor(np.divide(self.compliance_tensor, block)) 
Example 23
Project: nevergrad   Author: facebookresearch   File: photonics.py    License: MIT License 5 votes vote down vote up
def c_bas(A: np.ndarray, V: np.ndarray, h: float) -> np.ndarray:
    n = int(A.shape[1] / 2)
    D = np.diag(np.exp(1j * V * h))
    S = np.block(
        [
            [A[0:n, 0:n], np.matmul(A[0:n, n : 2 * n], D)],
            [
                np.matmul(D, A[n : 2 * n, 0:n]),
                np.matmul(np.matmul(D, A[n : 2 * n, n : 2 * n]), D),
            ],
        ]
    )
    return S  # type: ignore 
Example 24
Project: nevergrad   Author: facebookresearch   File: photonics.py    License: MIT License 5 votes vote down vote up
def homogene(k0: float, a0: float, pol: float, epsilon: float, n: int) -> tp.Tuple[np.ndarray, np.ndarray]:
    nmod = int(n / 2)
    valp = np.sqrt(
        epsilon * k0 * k0 - (a0 + 2 * np.pi * np.arange(-nmod, nmod + 1)) ** 2 + 0j
    )
    valp = valp * (1 - 2 * (valp < 0)) * (pol / epsilon + (1 - pol))
    P = np.block([[np.eye(n)], [np.diag(valp)]])
    return P, valp 
Example 25
Project: nevergrad   Author: facebookresearch   File: photonics.py    License: MIT License 5 votes vote down vote up
def interface(P: np.ndarray, Q: np.ndarray) -> np.ndarray:
    n = int(P.shape[1])
    S = np.matmul(
        np.linalg.inv(
            np.block(
                [[P[0:n, 0:n], -Q[0:n, 0:n]], [P[n : 2 * n, 0:n], Q[n : 2 * n, 0:n]]]
            )
        ),
        np.block([[-P[0:n, 0:n], Q[0:n, 0:n]], [P[n : 2 * n, 0:n], Q[n : 2 * n, 0:n]]]),
    )
    return S  # type: ignore 
Example 26
Project: CEASIOMpy   Author: cfsengineering   File: su2.py    License: Apache License 2.0 5 votes vote down vote up
def _write_su2_disp_file(self):
        """Write the SU2 displacement file"""

        # Fetch the FEM deformation fields
        def_fields = self.shared.structure.def_fields

        # TODO: make work for multiple wings
        orig_mesh = self.undeformed_mesh['Wing']
        def_field = self.shared.structure.def_fields['Wing']

        def_mesh = get_deformed_mesh(orig_mesh, def_field)

        # Indices and displacements at discrete mesh points
        num_mesh_points = orig_mesh.shape[0]
        idx = np.arange(start=0, stop=num_mesh_points, step=1).reshape((num_mesh_points, 1))
        u_xyz = def_mesh - orig_mesh

        # Write the displacement file
        header = f'{num_mesh_points}\t2\t1\t0'
        output_data = np.block([idx, orig_mesh+u_xyz])
        fmt = ['%d'] + ['%.10e' for _ in range(3)]
        np.savetxt(
            self.paths['f_disp'],
            output_data,
            fmt=fmt,
            delimiter='\t',
            header=header
        ) 
Example 27
Project: vnpy_crypto   Author: birforce   File: test_shape_base.py    License: MIT License 5 votes vote down vote up
def test_block_simple_row_wise(self):
        a_2d = np.ones((2, 2))
        b_2d = 2 * a_2d
        desired = np.array([[1, 1, 2, 2],
                            [1, 1, 2, 2]])
        result = block([a_2d, b_2d])
        assert_equal(desired, result) 
Example 28
Project: vnpy_crypto   Author: birforce   File: test_shape_base.py    License: MIT License 5 votes vote down vote up
def test_block_simple_column_wise(self):
        a_2d = np.ones((2, 2))
        b_2d = 2 * a_2d
        expected = np.array([[1, 1],
                             [1, 1],
                             [2, 2],
                             [2, 2]])
        result = block([[a_2d], [b_2d]])
        assert_equal(expected, result) 
Example 29
Project: vnpy_crypto   Author: birforce   File: test_shape_base.py    License: MIT License 5 votes vote down vote up
def test_block_with_1d_arrays_row_wise(self):
        # # # 1-D vectors are treated as row arrays
        a = np.array([1, 2, 3])
        b = np.array([2, 3, 4])
        expected = np.array([1, 2, 3, 2, 3, 4])
        result = block([a, b])
        assert_equal(expected, result) 
Example 30
Project: vnpy_crypto   Author: birforce   File: test_shape_base.py    License: MIT License 5 votes vote down vote up
def test_block_with_1d_arrays_multiple_rows(self):
        a = np.array([1, 2, 3])
        b = np.array([2, 3, 4])
        expected = np.array([[1, 2, 3, 2, 3, 4],
                             [1, 2, 3, 2, 3, 4]])
        result = block([[a, b], [a, b]])
        assert_equal(expected, result)