mimiqcircuits.operations.krauschannel¶
Kraus channel definitions.
Classes
Supertype for all N-qubit Kraus channels. |
- class mimiqcircuits.operations.krauschannel.krauschannel[source]¶
Bases:
OperationSupertype for all N-qubit Kraus channels.
A Kraus channel is a quantum operation on a density matrix \(\\rho\) of the form:
\[\mathcal{E}(\rho) = \sum_k E_k \rho E_k^\dagger,\]where \(E_k\) are Kraus operators that need to fulfill \(\sum_k E_k^\dagger E_k \leq I\).
Special Properties:
isCPTP(): A Kraus channel is a completely positive and trace-preserving (CPTP) operation when \(\\sum_k E_k^\dagger E_k = I\). Currently, all noise channels are CPTP.ismixedunitary(): A Kraus channel is called a mixed unitary channel when the Kraus operators \(E_k\) are each proportional to a unitary matrix \(U_k\), i.e., when \(\\mathcal{E}(\\rho) = \\sum_k p_k U_k \\rho U_k^\dagger\) with some probabilities \(0 \leq p_k \leq 1\) that add up to 1 and \(U_k^\dagger U_k = I\).
- krausmatrices()[source]¶
Returns the Kraus matrices associated with the given Kraus channel.
A mixed unitary channel is written as:
\[\mathcal{E}(\rho) = \sum_k p_k U_k \rho U_k^\dagger,\]where \(U_k\) are the unitary matrices returned by this function.
If the Kraus channel is parametric, the matrix elements are wrapped in a symengine or sympy object.
- Returns:
A list of symengine matrices representing the Kraus operators.
- Return type:
- unwrappedkrausmatrices()[source]¶
Returns the unitary Kraus matrices associated to the mixed unitary Kraus channel without symbolic wrapper.
See also
Example
>>> from mimiqcircuits import * >>> op = PauliX(0.2) >>> op.unwrappedkrausmatrices() [[0.894427190999916, 0] [0, 0.894427190999916] , [0, 0.447213595499958] [0.447213595499958, 0] ]
- classmethod isCPTP()[source]¶
Determine whether the Kraus channel is Completely Positive and Trace Preserving (CPTP).
A quantum operation is CPTP if the Kraus operators fulfill the condition:
\[\sum_k E_k^\dagger E_k = I\]If the condition is:
\[\sum_k E_k^\dagger E_k < I\]then the operation is not CPTP.
Note
Currently, all noise channels are considered CPTP.
- Parameters:
krauschannel – The Kraus channel to check.
- Returns:
True if the channel is CPTP, False otherwise.
- Return type:
- classmethod ismixedunitary()[source]¶
Determine whether the quantum operation is a mixed unitary channel.
A channel is considered mixed unitary if all the Kraus operators \(E_k\) are proportional to a unitary matrix \(U_k\), i.e.,
\[\mathcal{E}(\rho) = \sum_k p_k U_k \rho U_k^\dagger,\]with some probabilities \(0 \leq p_k \leq 1\) that add up to 1, and \(U_k^\dagger U_k = I\).
- Parameters:
krauschannel – The Kraus channel to check.
- Returns:
True if the channel is a mixed unitary channel, False otherwise.
- Return type:
Examples
>>> from mimiqcircuits import * >>> PauliX(0.1).ismixedunitary() True
>>> AmplitudeDamping(0.1).ismixedunitary() False
- probabilities()[source]¶
Returns the probabilities for each Kraus operator in a mixed unitary channel.
A mixed unitary channel is written as:
\[\mathcal{E}(\rho) = \sum_k p_k U_k \rho U_k^\dagger,\]where \(p_k\) are the probabilities.
This method is valid only for mixed unitary channels.
- Returns:
A list of probabilities for each Kraus operator.
- Return type:
- cumprobabilities()[source]¶
Returns the cumulative sum of probabilities for each Kraus operator in a mixed unitary channel.
A mixed unitary channel is written as:
\[\mathcal{E}(\rho) = \sum_k p_k U_k \rho U_k^\dagger,\]where \(p_k\) are the probabilities.
This method is valid only for mixed unitary channels.
- Returns:
Cumulative probabilities for the Kraus operators.
- Return type:
Examples
>>> from mimiqcircuits import * >>> Depolarizing1(0.1).cumprobabilities() [0.9, 0.933333333333333, 0.966666666666667, 1.0]
- unwrappedcumprobabilities()[source]¶
Returns the cumulative sum of probabilities for the mixed unitary channel without symbolic wrapping.
See also
- Returns:
A list of cumulative probabilities as float values.
- Return type:
- krausoperators()[source]¶
Returns the Kraus operators associated with the given Kraus channel.
This should be implemented for each specific channel.
- Returns:
A list of matrices representing the Kraus operators.
- Return type:
- haslossybranch()[source]¶
Whether any branch of the channel loses qubits when drawn.
That is whether any of its Kraus operators is a
LossyOperator. It isFalsefor channels without loss branches, such asPauliX(0.1).Examples
>>> from mimiqcircuits import * >>> PauliX(0.1).haslossybranch() False >>> import numpy as np >>> survival = Operator(np.array([[1, 0], [0, np.sqrt(0.8)]])) >>> lossy = LossyOperator(np.array([[0, 0], [0, np.sqrt(0.2)]])) >>> Kraus([survival, lossy]).haslossybranch() True
- squaredkrausoperators()[source]¶
Returns the square of the Kraus operators (\(E_k^\dagger E_k\)). This computes the Hermitian conjugate (dagger) of each Kraus operator and multiplies it by the operator itself.
- Returns:
A list of squared Kraus operators.
- Return type:
- unitarymatrices()[source]¶
Unitary matrices associated with the given mixed unitary Kraus channel.
A mixed unitary channel is written as:
\[\mathcal{E}(\rho) = \sum_k p_k U_k \rho U_k^\dagger,\]where \(U_k\) are the unitary matrices.
An error is raised if the channel is not mixed unitary (i.e., ismixedunitary(self)==False).
Note
If the Kraus channel is parametric, the matrix elements are wrapped in a symbolic object (e.g., from sympy or symengine). To manipulate expressions, use the appropriate symbolic manipulation libraries.
Examples
>>> from mimiqcircuits import * >>> PauliX(0.2).unitarymatrices() [[1.0, 0] [0, 1.0] , [0, 1.0] [1.0, 0] ]