mimiqcircuits.operations.noisechannel.kraus¶
Functions
|
Check if a number is a power of 2. |
Classes
|
Kraus(kmatrices). |
- class mimiqcircuits.operations.noisechannel.kraus.Kraus(E, rtol=1e-12)[source]¶
Bases:
krauschannelKraus(kmatrices).
Custom N-qubit Kraus channel specified by a list of 2^N x 2^N Kraus matrices.
A Kraus channel is defined by:
\[\mathcal{E}(\rho) = \sum_k E_k \rho E_k^\dagger,\]where \(E_k\) are Kraus matrices that need to fulfill \(\sum_k E_k^\dagger E_k = I\).
If the Kraus matrices are all proportional to unitaries, use
MixedUnitary()instead.The Kraus matrices are defined in the computational basis in the usual textbook order (the first qubit corresponds to the left-most qubit). For 1 qubit, we have \(|0\rangle\), \(|1\rangle\). For 2 qubits, we have \(|00\rangle\), \(|01\rangle\), \(|10\rangle\), \(|11\rangle\).
Note: Currently, only 1 and 2-qubit custom Kraus channels are supported.
See also
MixedUnitaryGateCustom- Parameters:
kmatrices (list) – List of \(2^N \times 2^N\) complex matrices. The number of qubits is equal to \(N\).
Examples
>>> from mimiqcircuits import * >>> from symengine import * >>> c = Circuit() >>> c.push(Kraus([Matrix([[1, 0], [0, sqrt(0.9)]]), Matrix([[0, sqrt(0.1)], [0, 0]])]), 0) 1-qubit circuit with 1 instruction: └── Kraus(Operator([[1, 0], [0, 0.948683298050514]]), Operator([[0, 0.316227766016838], [0, 0]])) @ q[0]
Kraus Matrices
>>> g=Kraus([Matrix([[1, 0], [0, sqrt(0.9)]]), Matrix([[0, sqrt(0.1)], [0, 0]])]) >>> g.krausmatrices() [[1.0, 0] [0, 0.948683298050514] , [0, 0.316227766016838] [0, 0] ]
# Example 2: Kraus with Projector0 and Projector1
>>> c = Circuit() >>> c.push(Kraus([Projector0(), Projector1()]), 0) 1-qubit circuit with 1 instruction: └── Kraus(P₀(1), P₁(1)) @ q[0]
# Example 3: Kraus with a matrix and Projector1
>>> c = Circuit() >>> c.push(Kraus([Matrix([[1, 0], [0, 0]]), Projector1()]), 0) 1-qubit circuit with 1 instruction: └── Kraus(Operator([[1, 0], [0, 0]]), P₁(1)) @ q[0]