pub trait Channel<const W: usize>: Send + Sync {
// Required methods
fn support(&self) -> [u64; W];
fn apply(
&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>,
);
// Provided method
fn debug_name(&self) -> &'static str { ... }
}Expand description
A gate or noise channel: maps a Pauli string to a small weighted sum of Pauli strings.
Built-ins: PtmChannel (every one- and two-qubit gate and noise channel) and PauliRotation.
A custom channel implements support, apply and apply_adjoint; the engine derives its per-layer form by probing apply on the at most 16 local basis Paulis.
Required Methods§
Sourcefn support(&self) -> [u64; W]
fn support(&self) -> [u64; W]
Qubits this channel acts on, as a bitmask built with support_mask.
Outputs must differ from their input only at these qubits, with amplitudes that depend on the input only through its bits here; the engine’s probe of apply is sound exactly then, and debug builds re-probe on an all-ones background to catch a violation.
Sourcefn 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>, )
Apply the channel to one input term, pushing its outputs to out.
Sourcefn 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>, )
Apply the channel’s adjoint to one input term; run by Direction::Heisenberg.
A self-adjoint channel calls apply.
Provided Methods§
Sourcefn debug_name(&self) -> &'static str
fn debug_name(&self) -> &'static str
Short name for the per-layer progress log.
The default is the type name without path or generics, which is unhelpful for tuples, closures and boxes; override it there.