Quanlse/QPlatform/Utilities.py
def numpyMatrixToDictMatrix(numpyMatrix: numpy.ndarray) -> Dict:
    """
    Convert numpy matrix to a dictionary. Must be C-contiguous.

    :param numpyMatrix: numpy matrix
    :return: returned dictionary
    """

    if not numpyMatrix.flags["C_CONTIGUOUS"]:
        raise Error.ArgumentError('Matrix must C-contiguous!')

    if numpyMatrix.size == 0:
        return {}

    array = []
    dictMatrix = {
        'shape': list(numpyMatrix.shape),
        'array': array
    }

    for value in numpy.nditer(numpyMatrix):
        val = value.reshape(1, 1)[0][0]
        array.append({
            'real': val.real,
            'imag': val.imag
        })
    return dictMatrix

    Convert numpy matrix to a dictionary. Must be C-contiguous.

    :param numpyMatrix: numpy matrix
    :return: returned dictionary
    
Convert numpy matrix to a dictionary. Must be C-contiguous.
Convert numpy matrix to a dictionary . Must be C - contiguous .
def numpyMatrixToDictMatrix(numpyMatrix: numpy.ndarray) -> Dict:
    if not numpyMatrix.flags["C_CONTIGUOUS"]:
        raise Error.ArgumentError('Matrix must C-contiguous!')
    if numpyMatrix.size == 0:
        return {}
    array = []
    dictMatrix = {
        'shape': list(numpyMatrix.shape),
        'array': array
    }
    for value in numpy.nditer(numpyMatrix):
        val = value.reshape(1, 1)[0][0]
        array.append({
            'real': val.real,
            'imag': val.imag
        })
    return dictMatrix
def numpyMatrixToDictMatrix ( numpyMatrix : numpy . ndarray ) -> Dict : if not numpyMatrix . flags [ "C_CONTIGUOUS" ] : raise Error . ArgumentError ( 'Matrix must C-contiguous!' ) if numpyMatrix . size == 0 : return { } array = [ ] dictMatrix = { 'shape' : list ( numpyMatrix . shape ) , 'array' : array } for value in numpy . nditer ( numpyMatrix ) : val = value . reshape ( 1 , 1 ) [ 0 ] [ 0 ] array . append ( { 'real' : val . real , 'imag' : val . imag } ) return dictMatrix
Convert numpy matrix to a dictionary.
Convert numpy matrix to a dictionary .
"""
    Convert numpy matrix to a dictionary. Must be C-contiguous.

    :param numpyMatrix: numpy matrix
    :return: returned dictionary
    """
None
numpyMatrix
numpy.ndarray
None