qiskit/quantum_info/operators/channel/transformations.py
def _stinespring_to_kraus(data, input_dim, output_dim):
    """Transform Stinespring representation to Kraus representation."""
    kraus_pair = []
    for stine in data:
        if stine is None:
            kraus_pair.append(None)
        else:
            trace_dim = stine.shape[0] // output_dim
            iden = np.eye(output_dim)
            kraus = []
            for j in range(trace_dim):
                vec = np.zeros(trace_dim)
                vec[j] = 1
                kraus.append(np.kron(iden, vec[None, :]).dot(stine))
            kraus_pair.append(kraus)
    return tuple(kraus_pair)
def _stinespring_to_kraus(data, input_dim, output_dim):
    kraus_pair = []
    for stine in data:
        if stine is None:
            kraus_pair.append(None)
        else:
            trace_dim = stine.shape[0] // output_dim
            iden = np.eye(output_dim)
            kraus = []
            for j in range(trace_dim):
                vec = np.zeros(trace_dim)
                vec[j] = 1
                kraus.append(np.kron(iden, vec[None, :]).dot(stine))
            kraus_pair.append(kraus)
    return tuple(kraus_pair)
def _stinespring_to_kraus ( data , input_dim , output_dim ) : kraus_pair = [ ] for stine in data : if stine is None : kraus_pair . append ( None ) else : trace_dim = stine . shape [ 0 ] // output_dim iden = np . eye ( output_dim ) kraus = [ ] for j in range ( trace_dim ) : vec = np . zeros ( trace_dim ) vec [ j ] = 1 kraus . append ( np . kron ( iden , vec [ None , : ] ) . dot ( stine ) ) kraus_pair . append ( kraus ) return tuple ( kraus_pair )
Transform Stinespring representation to Kraus representation.
Transform Stinespring representation to Kraus representation .