pub struct PtmChannel { /* private fields */ }Expand description
A one- or two-qubit gate or noise channel, stored as its Pauli-transfer matrix.
Built by the named constructors: the Cliffords hadamard, phase_gate, pauli_x, pauli_y, pauli_z, cnot, cz, swap;
the general unitaries unitary_1q, unitary_2q;
and the noise channels depolarizing, dephasing, pauli_channel, depolarizing_2q, amplitude_damping.
On the support, Paulis are indexed x | (z << 1) per qubit (I = 0, X = 1, Z = 2, Y = 3), the constructor’s first qubit in the low two bits.
Channel::apply maps input Pauli s to Σ_t ptm[s][t] · P_t, and Channel::apply_adjoint reads the transpose.
Channel::debug_name is the constructor’s name ("hadamard", "cnot", …), with _adjoint appended after adjoint.
Implementations§
Source§impl PtmChannel
impl PtmChannel
Source§impl PtmChannel
impl PtmChannel
Sourcepub fn depolarizing(qubit: usize, p: f64) -> Self
pub fn depolarizing(qubit: usize, p: f64) -> Self
Single-qubit depolarizing noise with error probability p: X, Y and Z are scaled by 1 - 4p/3.
§Panics
Unless p ∈ [0, 1].
Sourcepub fn dephasing(qubit: usize, p: f64) -> Self
pub fn dephasing(qubit: usize, p: f64) -> Self
Single-qubit dephasing noise with error probability p: X and Y are scaled by 1 - 2p.
§Panics
Unless p ∈ [0, 1].
Sourcepub fn pauli_channel(qubit: usize, px: f64, py: f64, pz: f64) -> Self
pub fn pauli_channel(qubit: usize, px: f64, py: f64, pz: f64) -> Self
Single-qubit Pauli channel E(ρ) = (1-px-py-pz)ρ + px·XρX + py·YρY + pz·ZρZ.
It scales X by 1 - 2(py + pz), Y by 1 - 2(px + pz) and Z by 1 - 2(px + py), so (p/3, p/3, p/3) is depolarizing and (0, 0, p) is dephasing.
§Panics
Unless each probability lies in [0, 1] and px + py + pz ≤ 1.
Sourcepub fn depolarizing_2q(q0: usize, q1: usize, p: f64) -> Self
pub fn depolarizing_2q(q0: usize, q1: usize, p: f64) -> Self
Two-qubit depolarizing noise E(ρ) = (1-p)ρ + (p/15)·Σ_k P_k ρ P_k over the 15 non-identity two-qubit Paulis.
Every Pauli that is non-identity on the pair is scaled by 1 - 16p/15.
§Panics
If q0 == q1, or unless p ∈ [0, 1].
Sourcepub fn amplitude_damping(qubit: usize, gamma: f64) -> Self
pub fn amplitude_damping(qubit: usize, gamma: f64) -> Self
Single-qubit amplitude damping with Kraus operators K_0 = |0⟩⟨0| + √(1-γ)|1⟩⟨1|, K_1 = √γ |0⟩⟨1|.
Not self-adjoint: apply is the Schrödinger map (I → I + γZ, Z → (1-γ)Z) and apply_adjoint its Heisenberg dual (I → I, Z → (1-γ)Z + γI); both scale X and Y by √(1-γ).
§Panics
Unless gamma ∈ [0, 1].
Source§impl PtmChannel
impl PtmChannel
Source§impl PtmChannel
impl PtmChannel
Trait Implementations§
Source§impl<const W: usize> Channel<W> for PtmChannel
impl<const W: usize> Channel<W> for PtmChannel
Source§fn support(&self) -> [u64; W]
fn support(&self) -> [u64; W]
support_mask. Read moreSource§fn debug_name(&self) -> &'static str
fn debug_name(&self) -> &'static str
Source§fn apply(
&self,
input_x: &[u64; W],
input_z: &[u64; W],
coeff: Complex64,
out: &mut OutputBuffer<W>,
)
fn apply( &self, input_x: &[u64; W], input_z: &[u64; W], coeff: Complex64, out: &mut OutputBuffer<W>, )
out.Source§fn apply_adjoint(
&self,
input_x: &[u64; W],
input_z: &[u64; W],
coeff: Complex64,
out: &mut OutputBuffer<W>,
)
fn apply_adjoint( &self, input_x: &[u64; W], input_z: &[u64; W], coeff: Complex64, out: &mut OutputBuffer<W>, )
Direction::Heisenberg. Read moreSource§impl Clone for PtmChannel
impl Clone for PtmChannel
Source§fn clone(&self) -> PtmChannel
fn clone(&self) -> PtmChannel
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for PtmChannel
impl RefUnwindSafe for PtmChannel
impl Send for PtmChannel
impl Sync for PtmChannel
impl Unpin for PtmChannel
impl UnwindSafe for PtmChannel
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more