qat.quops.QuantumChannelKraus
- class qat.quops.QuantumChannelKraus(kraus_operators, name='', check_trace_preserving: bool = False, check_trace_reducing: bool = False)
Implementation of a quantum channel with the Kraus representation
\[\mathcal{E}(\rho)=\sum_{k=0}^{K-1} E_k \rho E_k^\dagger\]with \(E_k\) the Kraus operators.
- Parameters
kraus_operators (list<np.array>) – list of Kraus operators
name (string, optional) – name. Defaults to “”.
check_trace_preserving (bool) – If True, check for trace preservation of the Kraus operators. Default to False.
check_trace_reducing (bool) – If True, check if Kraus operators are physical. Default to False.
Two channels in the Kraus representation can be composed with the * operator:
import numpy as np from qat.quops import QuantumChannelKraus p1, p2 = 0.2, 0.15 chan1 = QuantumChannelKraus([np.sqrt(1. - p1) * np.eye(2), np.array([[0., np.sqrt(p1)], [0., 0.]])]) chan2 = QuantumChannelKraus([np.sqrt(1. - p2) * np.eye(2), np.array([[0., np.sqrt(p2)], [0., 0.]])]) chan3 = chan1 * chan2 print(chan3.kraus_operators)
[array([[0.82462113, 0. ], [0. , 0.82462113]]), array([[0. , 0.34641016], [0. , 0. ]]), array([[0. , 0.41231056], [0. , 0. ]])]
- kraus_operators
the list of Kraus operators \(\lbrace E_k \rbrace_{k}\)
- Type
list<np.ndarray>
- name
name
- Type
string
- apply_to(density_matrix, qbits=None, old_method=True, n_threads=1, weights=None)
Apply the quantum channel to the density matrix
- Parameters
density_matrix (matrix) – the density matrix (sparse or dense repr)
qbits (list<int>, optional) – list of qubits in density_matrix to apply quantum channel to. Defaults to None, in which case: direct matrix product (sizes have to match)
old_method (bool) – whether to allocate kronecker (True) or not.
n_threads (int) – number of threads to use
- Returns
the resulting density matrix
- Return type
matrix
- apply_to_vector(index, qbits, psi, full_kronecker=True)
Apply one Kraus operator to a state vector E[index]*psi
- Parameters
index (int) – index of the Kraus operator
qbits (list) – list of qubits to apply Kraus operator to
psi (list) – state vector
full_kronecker (bool, optional) – whether to use an efficient kronecker product. Defaults to True.
- Returns
the resulting state vector
- kraus_rank()
- Returns
the Kraus rank of the quantum channel
- to_chi(matrix_basis=None)
Convert to Chi matrix representations
- Parameters
matrix_basis (list(np.array), optional) – matrix basis. Defaults to None, in which case take canonical basis.
- Returns
QuantumChannelChi
- to_choi()
Convert to Choi representation
- Returns
QuantumChannelChoi
- to_ptm()
Convert to PTM representation
- Returns
QuantumChannelPTM