qiskit/quantum_info/operators/channel/transformations.py
def _reravel(mat1, mat2, shape1, shape2):
    """Reravel two bipartite matrices."""
    # Reshuffle indicies
    left_dims = shape1[:2] + shape2[:2]
    right_dims = shape1[2:] + shape2[2:]
    tensor_shape = left_dims + right_dims
    final_shape = (np.product(left_dims), np.product(right_dims))
    # Tensor product matrices
    data = np.kron(mat1, mat2)
    data = np.reshape(
        np.transpose(np.reshape(data, tensor_shape), (0, 2, 1, 3, 4, 6, 5, 7)),
        final_shape)
    return data
def _reravel(mat1, mat2, shape1, shape2):
    # Reshuffle indicies
    left_dims = shape1[:2] + shape2[:2]
    right_dims = shape1[2:] + shape2[2:]
    tensor_shape = left_dims + right_dims
    final_shape = (np.product(left_dims), np.product(right_dims))
    # Tensor product matrices
    data = np.kron(mat1, mat2)
    data = np.reshape(
        np.transpose(np.reshape(data, tensor_shape), (0, 2, 1, 3, 4, 6, 5, 7)),
        final_shape)
    return data
def _reravel ( mat1 , mat2 , shape1 , shape2 ) : # Reshuffle indicies left_dims = shape1 [ : 2 ] + shape2 [ : 2 ] right_dims = shape1 [ 2 : ] + shape2 [ 2 : ] tensor_shape = left_dims + right_dims final_shape = ( np . product ( left_dims ) , np . product ( right_dims ) ) # Tensor product matrices data = np . kron ( mat1 , mat2 ) data = np . reshape ( np . transpose ( np . reshape ( data , tensor_shape ) , ( 0 , 2 , 1 , 3 , 4 , 6 , 5 , 7 ) ) , final_shape ) return data
Reravel two bipartite matrices.
Reravel two bipartite matrices .