Quanlse/Utils/Functions.py
def tensor(*args) -> ndarray:
    """
    Return the tensor product of all matrices in the list.

    :param matrixList: the list of matrices to take the tensor product
    :return: tensor product of matrices in the list
    """
    # We firstly need to check if all the matrix in the list a numpy.ndarray
    if len(args) == 1 and isinstance(args[0], List):
        args = tuple(args[0])
    else:
        if isinstance(args, ndarray):
            return args

    matrixReturn = array([[1.0]], dtype=complex)
    for matrixIndex, matrixItem in enumerate(args):
        matrixReturn = kron(matrixReturn, matrixItem)
    return matrixReturn

    Return the tensor product of all matrices in the list.

    :param matrixList: the list of matrices to take the tensor product
    :return: tensor product of matrices in the list
    
Return the tensor product of all matrices in the list.
Return the tensor product of all matrices in the list .
def tensor(*args) -> ndarray:
    if len(args) == 1 and isinstance(args[0], List):
        args = tuple(args[0])
    else:
        if isinstance(args, ndarray):
            return args
    matrixReturn = array([[1.0]], dtype=complex)
    for matrixIndex, matrixItem in enumerate(args):
        matrixReturn = kron(matrixReturn, matrixItem)
    return matrixReturn
def tensor ( * args ) -> ndarray : if len ( args ) == 1 and isinstance ( args [ 0 ] , List ) : args = tuple ( args [ 0 ] ) else : if isinstance ( args , ndarray ) : return args matrixReturn = array ( [ [ 1.0 ] ] , dtype = complex ) for matrixIndex , matrixItem in enumerate ( args ) : matrixReturn = kron ( matrixReturn , matrixItem ) return matrixReturn
Return the tensor product of all matrices in the list.
Return the tensor product of all matrices in the list .
"""
    Return the tensor product of all matrices in the list.

    :param matrixList: the list of matrices to take the tensor product
    :return: tensor product of matrices in the list
    """ # We firstly need to check if all the matrix in the list a numpy.ndarray
tensor product of matrices in the list
tensor product of matrices in the list
matrixList
the list of matrices to take the tensor product
the list of matrices to take the tensor product