Quanlse/ErrorMitigation/Utils/Visualization.py
def polarVectorToState(vec) -> np.ndarray:
    """
    From the polar vector representation to the state representation.

    :param vec: polar vector, array_like, (3,)
    :return: density matrix: ndarray, (2, 2)
    """
    ops = [FixedGate.X.getMatrix(), FixedGate.Y.getMatrix(), FixedGate.Z.getMatrix()]
    return (np.identity(2) + vec[0] * ops[0] + vec[1] * ops[1] + vec[2] * ops[2]) / 2

    From the polar vector representation to the state representation.

    :param vec: polar vector, array_like, (3,)
    :return: density matrix: ndarray, (2, 2)
    
From the polar vector representation to the state representation.
From the polar vector representation to the state representation .
def polarVectorToState(vec) -> np.ndarray:
    ops = [FixedGate.X.getMatrix(), FixedGate.Y.getMatrix(), FixedGate.Z.getMatrix()]
    return (np.identity(2) + vec[0] * ops[0] + vec[1] * ops[1] + vec[2] * ops[2]) / 2
def polarVectorToState ( vec ) -> np . ndarray : ops = [ FixedGate . X . getMatrix ( ) , FixedGate . Y . getMatrix ( ) , FixedGate . Z . getMatrix ( ) ] return ( np . identity ( 2 ) + vec [ 0 ] * ops [ 0 ] + vec [ 1 ] * ops [ 1 ] + vec [ 2 ] * ops [ 2 ] ) / 2
From the polar vector representation to the state representation.
From the polar vector representation to the state representation .
"""
    From the polar vector representation to the state representation.

    :param vec: polar vector, array_like, (3,)
    :return: density matrix: ndarray, (2, 2)
    """
density matrix: ndarray, (2, 2)
density matrix : ndarray ( 2 2 )
vec
polar vector, array_like, (3,)
polar vector array_like ( 3 )