Quantum channels and noise models¶
Kraus channel¶
- class graphix.channels.KrausChannel(kraus_data: Iterable[KrausData])[source]¶
Quantum channel class in the Kraus representation.
Defined by Kraus operators \(K_i\) with scalar prefactors
coef) \(c_i\), where the channel act on density matrix as \(\rho' = \sum_i K_i^\dagger \rho K_i\). The data should satisfy \(\sum K_i^\dagger K_i = I\).- __init__(kraus_data: Iterable[KrausData]) None[source]¶
Initialize
KrausChannelgiven a Kraus operator.- Parameters:
kraus_data (Iterable[KrausData]) – Iterable of Kraus operator data.
- Raises:
ValueError – If kraus_data is empty.
- property nqubit: int¶
Return the number of qubits.
- graphix.channels.dephasing_channel(prob: float) KrausChannel[source]¶
Single-qubit dephasing channel, \((1-p) \rho + p Z \rho Z\).
- Parameters:
prob (float) – The probability associated to the channel
- Returns:
containing the corresponding Kraus operators
- Return type:
- graphix.channels.depolarising_channel(prob: float) KrausChannel[source]¶
Single-qubit depolarizing channel.
\[(1-p) \rho + \frac{p}{3} (X \rho X + Y \rho Y + Z \rho Z) = (1 - 4 \frac{p}{3}) \rho + 4 \frac{p}{3} id\]- Parameters:
prob (float) – The probability associated to the channel
- graphix.channels.pauli_channel(px: float, py: float, pz: float) KrausChannel[source]¶
Single-qubit Pauli channel.
\[(1-p_X-p_Y-p_Z) \rho + p_X X \rho X + p_Y Y \rho Y + p_Z Z \rho Z)\]
- graphix.channels.two_qubit_depolarising_channel(prob: float) KrausChannel[source]¶
Two-qubit depolarising channel.
\[\mathcal{E} (\rho) = (1-p) \rho + \frac{p}{15} \sum_{P_i \in \{id, X, Y ,Z\}^{\otimes 2}/(id \otimes id)}P_i \rho P_i\]- Parameters:
prob (float) – The probability associated to the channel
- Returns:
containing the corresponding Kraus operators
- Return type:
- graphix.channels.two_qubit_depolarising_tensor_channel(prob: float) KrausChannel[source]¶
Two-qubit tensor channel of single-qubit depolarising channels with same probability.
Kraus operators:
\[\Big\{ \sqrt{(1-p)} id, \sqrt{(p/3)} X, \sqrt{(p/3)} Y , \sqrt{(p/3)} Z \Big\} \otimes \Big\{ \sqrt{(1-p)} id, \sqrt{(p/3)} X, \sqrt{(p/3)} Y , \sqrt{(p/3)} Z \Big\}\]- Parameters:
prob (float) – The probability associated to the channel
- Returns:
containing the corresponding Kraus operators
- Return type:
Noise model classes¶
- class graphix.noise_models.noise_model.Noise[source]¶
Abstract base class for noise.
- abstract property nqubits: int¶
Return the number of qubits targetted by the noise.
- abstractmethod to_kraus_channel() KrausChannel[source]¶
Return the Kraus channel describing the noise.
- class graphix.noise_models.noise_model.ApplyNoise(noise: Noise, nodes: list[int], domain: set[int] | None = None)[source]¶
Apply noise command.
- Parameters:
noise (Noise) – noise to be applied
nodes (list[Node]) – list of node indices on which to apply noise
domain (set[Node] | None = None) – Optional domain for conditional noise. If
None, the noise is applied unconditionally. Otherwise, the noise is applied if there is an odd number of nodes amongdomainthat have been measured with outcome 1 (as forXandZcommands). Note that the noise is never applied ifdomainis the empty set.
- class graphix.noise_models.noise_model.NoiseModel[source]¶
Abstract base class for all noise models.
- abstractmethod command(cmd: CommandOrNoise, rng: Generator | None = None, *, stacklevel: int = 1) list[CommandOrNoise][source]¶
Return the noise to apply to the command
cmd.
- abstractmethod confuse_result(cmd: BaseM, result: Outcome, rng: Generator | None = None, *, stacklevel: int = 1) Outcome[source]¶
Return a possibly flipped measurement outcome.
- Parameters:
result (Outcome) – Ideal measurement result.
cmd (BaseM) – The measurement command that produced the given outcome.
- Returns:
Possibly corrupted result.
- Return type:
Outcome
- class graphix.noise_models.noise_model.NoiselessNoiseModel[source]¶
Noise model that performs no operation.
- command(cmd: CommandOrNoise, rng: Generator | None = None, *, stacklevel: int = 1) list[CommandOrNoise][source]¶
Return the noise to apply to the command
cmd.
- class graphix.noise_models.noise_model.ComposeNoiseModel(models: list[NoiseModel])[source]¶
Compose noise models.
- __init__(models: list[NoiseModel]) None¶
- command(cmd: CommandOrNoise, rng: Generator | None = None, *, stacklevel: int = 1) list[CommandOrNoise][source]¶
Return the noise to apply to the command
cmd.
- class graphix.noise_models.depolarising.DepolarisingNoise(prob: float)[source]¶
One-qubit depolarising noise with probabibity
prob.- __init__(prob: float) None[source]¶
Initialize one-qubit depolarizing noise.
- Parameters:
prob (float) – Probability parameter of the noise, between 0 and 1.
- property nqubits: int¶
Return the number of qubits targetted by the noise element.
- to_kraus_channel() KrausChannel[source]¶
Return the Kraus channel describing the noise element.
- class graphix.noise_models.depolarising.TwoQubitDepolarisingNoise(prob: float)[source]¶
Two-qubits depolarising noise with probabibity
prob.- __init__(prob: float) None[source]¶
Initialize two-qubit depolarizing noise.
- Parameters:
prob (float) – Probability parameter of the noise, between 0 and 1.
- property nqubits: int¶
Return the number of qubits targetted by the noise element.
- to_kraus_channel() KrausChannel[source]¶
Return the Kraus channel describing the noise element.
- class graphix.noise_models.depolarising.DepolarisingNoiseModel(prepare_error_prob: float = 0.0, x_error_prob: float = 0.0, z_error_prob: float = 0.0, entanglement_error_prob: float = 0.0, measure_channel_prob: float = 0.0, measure_error_prob: float = 0.0)[source]¶
Depolarising noise model.
- Parameters:
NoiseModel (class) – Parent abstract class class:
NoiseModel
- __init__(prepare_error_prob: float = 0.0, x_error_prob: float = 0.0, z_error_prob: float = 0.0, entanglement_error_prob: float = 0.0, measure_channel_prob: float = 0.0, measure_error_prob: float = 0.0) None[source]¶
- command(cmd: CommandOrNoise, rng: Generator | None = None, *, stacklevel: int = 1) list[CommandOrNoise][source]¶
Return the noise to apply to the command
cmd.