mimiqcircuits.operations.noisechannel.standards.pauli

Classes

PauliNoise(p, paulistr)

N-qubit Pauli noise channel specified by a list of probabilities and Pauli gates.

PauliX(p)

One-qubit Pauli X noise channel (bit flip error).

PauliY(p)

One-qubit Pauli Y noise channel (bit-phase flip error).

PauliZ(p)

One-qubit Pauli Z noise channel (phase flip error).

class mimiqcircuits.operations.noisechannel.standards.pauli.PauliNoise(p, paulistr)[source]

Bases: krauschannel

N-qubit Pauli noise channel specified by a list of probabilities and Pauli gates.

A Pauli channel is defined by:

\[\mathcal{E}(\rho) = \sum_k p_k P_k \rho P_k,\]

where \(0 \leq p_k \leq 1\) and \(P_k\) are Pauli string operators, defined as tensor products of one-qubit Pauli operators. The probabilities must fulfill \(\sum_k p_k = 1\).

This channel is a mixed unitary channel (see ismixedunitary()).

See also

Depolarizing, PauliX, PauliY, PauliZ, which are special cases of PauliNoise.

Parameters:
  • p (list) – List of probabilities that must add up to 1.

  • paulistrings (list) – List of strings, each of length \(N\), with each character being either “I”, “X”, “Y”, or “Z”. The number of qubits is equal to \(N\).

The lengths of p and paulistrings must be the same.

Examples

PauliNoise channels can be defined for any number of qubits, and for any number of Pauli strings:

>>> from mimiqcircuits import *
>>> c = Circuit()
>>> c.push(PauliNoise([0.8, 0.1, 0.1], ["I", "X", "Y"]), 1)
2-qubit circuit with 1 instruction:
└── PauliNoise((0.8, pauli"I"), (0.1, pauli"X"), (0.1, pauli"Y")) @ q[1]
>>> c.push(PauliNoise([0.9, 0.1], ["XY", "II"]), 1, 2)
3-qubit circuit with 2 instructions:
├── PauliNoise((0.8, pauli"I"), (0.1, pauli"X"), (0.1, pauli"Y")) @ q[1]
└── PauliNoise((0.9, pauli"XY"), (0.1, pauli"II")) @ q[1]
>>> c.push(PauliNoise([0.5, 0.2, 0.2, 0.1], ["IXIX", "XYXY", "ZZZZ", "IXYZ"]), 1, 2, 3, 4)
5-qubit circuit with 3 instructions:
├── PauliNoise((0.8, pauli"I"), (0.1, pauli"X"), (0.1, pauli"Y")) @ q[1]
├── PauliNoise((0.9, pauli"XY"), (0.1, pauli"II")) @ q[1]
└── PauliNoise((0.5, pauli"IXIX"), (0.2, pauli"XYXY"), (0.2, pauli"ZZZZ"), (0.1, pauli"IXYZ")) @ q[1]
__init__(p, paulistr)[source]
property num_qubits
property parnames
evaluate(d={})[source]
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:

list

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:

list

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:

list

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]
]
unitarygates()[source]

Returns the unitary gates associated with the given mixed unitary Kraus channel.

A mixed unitary channel is written as:

\[\sum_k p_k U_k \rho U_k^\dagger,\]

where \(U_k\) are the unitary operators.

This method is valid only for mixed unitary channels.

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:

bool

Examples

>>> from mimiqcircuits import *
>>> PauliX(0.1).ismixedunitary()
True
>>> AmplitudeDamping(0.1).ismixedunitary()
False
iswrapper()[source]
unwrappedkrausmatrices()[source]

Returns the unitary Kraus matrices associated to the mixed unitary Kraus channel without symbolic wrapper.

Example

>>> from mimiqcircuits import *
>>> op = PauliX(0.2)
>>> op.unwrappedkrausmatrices()
[[0.894427190999916, 0]
[0, 0.894427190999916]
, [0, 0.447213595499958]
[0.447213595499958, 0]
]
class mimiqcircuits.operations.noisechannel.standards.pauli.PauliX(p)[source]

Bases: krauschannel

One-qubit Pauli X noise channel (bit flip error).

This channel is defined by the Kraus operators:

\[E_1 = \sqrt{1-p}\,I, \quad E_2 = \sqrt{p}\,X,\]

where \(0 \leq p \leq 1\).

This channel is a mixed unitary channel (see ismixedunitary()), and is a special case of PauliNoise.

PauliX(p) is equivalent to PauliNoise([1-p, p], [“I”, “X”]).

Parameters:

p (float) – Probability of a bit flip error, must be in the range [0, 1].

Examples

>>> from mimiqcircuits import *
>>> c = Circuit()
>>> c.push(PauliX(0.1), 1)
2-qubit circuit with 1 instruction:
└── PauliX(0.1) @ q[1]
__init__(p)[source]
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:

list

evaluate(d={})[source]
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:

list

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:

list

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]
]
unitarygates()[source]

Returns the unitary gates associated with the given mixed unitary Kraus channel.

A mixed unitary channel is written as:

\[\sum_k p_k U_k \rho U_k^\dagger,\]

where \(U_k\) are the unitary operators.

This method is valid only for mixed unitary channels.

static 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:

bool

Examples

>>> from mimiqcircuits import *
>>> PauliX(0.1).ismixedunitary()
True
>>> AmplitudeDamping(0.1).ismixedunitary()
False
class mimiqcircuits.operations.noisechannel.standards.pauli.PauliY(p)[source]

Bases: krauschannel

One-qubit Pauli Y noise channel (bit-phase flip error).

This channel is determined by the Kraus operators:

\[E_1 = \sqrt{1-p}\,I, \quad E_2 = \sqrt{p}\,Y,\]

where \(0 \leq p \leq 1\).

This channel is a mixed unitary channel (see ismixedunitary()), and is a special case of PauliNoise.

PauliY(p) is equivalent to PauliNoise([1-p, p], [“I”, “Y”]).

Parameters:

p (float) – Probability of a bit-phase flip error, must be in the range [0, 1].

Examples

>>> from mimiqcircuits import *
>>> c = Circuit()
>>> c.push(PauliY(0.1), 1)
2-qubit circuit with 1 instruction:
└── PauliY(0.1) @ q[1]
__init__(p)[source]
evaluate(d={})[source]
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:

list

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:

list

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:

list

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]
]
unitarygates()[source]

Returns the unitary gates associated with the given mixed unitary Kraus channel.

A mixed unitary channel is written as:

\[\sum_k p_k U_k \rho U_k^\dagger,\]

where \(U_k\) are the unitary operators.

This method is valid only for mixed unitary channels.

static 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:

bool

Examples

>>> from mimiqcircuits import *
>>> PauliX(0.1).ismixedunitary()
True
>>> AmplitudeDamping(0.1).ismixedunitary()
False
class mimiqcircuits.operations.noisechannel.standards.pauli.PauliZ(p)[source]

Bases: krauschannel

One-qubit Pauli Z noise channel (phase flip error).

This channel is determined by the Kraus operators:

\[E_1 = \sqrt{1-p}\,I, \quad E_2 = \sqrt{p}\,Z,\]

where \(0 \leq p \leq 1\).

This channel is a mixed unitary channel (see ismixedunitary()), and is a special case of PauliNoise.

PauliZ(p) is equivalent to PauliNoise([1-p, p], [“I”, “Z”]).

Parameters:

p (float) – Probability of a phase flip error, must be in the range [0, 1].

Examples

>>> from mimiqcircuits import *
>>> c = Circuit()
>>> c.push(PauliZ(0.1), 1)
2-qubit circuit with 1 instruction:
└── PauliZ(0.1) @ q[1]
__init__(p)[source]
evaluate(d={})[source]
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:

list

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:

list

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:

list

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]
]
unitarygates()[source]

Returns the unitary gates associated with the given mixed unitary Kraus channel.

A mixed unitary channel is written as:

\[\sum_k p_k U_k \rho U_k^\dagger,\]

where \(U_k\) are the unitary operators.

This method is valid only for mixed unitary channels.

static 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:

bool

Examples

>>> from mimiqcircuits import *
>>> PauliX(0.1).ismixedunitary()
True
>>> AmplitudeDamping(0.1).ismixedunitary()
False