pub enum CircuitBox<R: RealField> {
Encoder {
input: WireId,
outputs: Vec<WireId>,
states: Vec<CausalTensor<Complex<R>>>,
},
Unitary {
wires: Vec<WireId>,
program: Vec<GateOp>,
},
Channel {
wires: Vec<WireId>,
channel: Channel<R>,
},
Kraus {
wires: Vec<WireId>,
kraus: Vec<CausalTensor<Complex<R>>>,
},
Instrument {
wires: Vec<WireId>,
outcome: WireId,
kraus: Vec<Vec<CausalTensor<Complex<R>>>>,
},
Measurement {
wires: Vec<WireId>,
outcome: WireId,
},
}Expand description
One box of a CircuitModel: a morphism of QC (Lorenz & Tull,
arXiv:2602.16612, Figure 2) on the wires it names.
Quantum wires are register lines and every box acts on them in place, so a box’s quantum wires
are both its inputs and its outputs. A classical wire is written by the one box that names it
as outcome and read by the encoders that name it as input.
Variants§
Encoder
Classical input to quantum: on reading value x from input, prepares states[x] on
outputs, which must be fresh lines in |0…0⟩. Each state is a ket of dimension the
product of the output dimensions.
Fields
states: Vec<CausalTensor<Complex<R>>>One ket per classical value.
Unitary
A gate program on qubit wires; gate indices are local to wires.
Fields
Channel
A CPTP map on quantum wires, the noise box.
Fields
Kraus
A CPTP map on quantum wires given by its Kraus operators, each 2^|wires| × 2^|wires|.
The numeric semantics is Kraus-level, so a wide box, an encoder unitary on every qubit of a
code for one, is held here without the Choi operator a Channel carries.
Fields
kraus: Vec<CausalTensor<Complex<R>>>The Kraus operators.
Instrument
A quantum instrument: for each classical outcome y, a Kraus family kraus[y] on the
wires; jointly trace-preserving over y.
Fields
kraus: Vec<Vec<CausalTensor<Complex<R>>>>One Kraus family per outcome.
Measurement
A computational-basis measurement of the wires, writing the outcome index (first wire most
significant) and leaving the wires in |0…0⟩.
Implementations§
Source§impl<R: RealField> CircuitBox<R>
impl<R: RealField> CircuitBox<R>
Sourcepub fn quantum_wires(&self) -> &[WireId] ⓘ
pub fn quantum_wires(&self) -> &[WireId] ⓘ
The quantum wires the box acts on, in the box’s own order.
Sourcepub fn classical_read(&self) -> Option<WireId>
pub fn classical_read(&self) -> Option<WireId>
The classical wire the box reads, if any.
Sourcepub fn classical_write(&self) -> Option<WireId>
pub fn classical_write(&self) -> Option<WireId>
The classical wire the box writes, if any.
Trait Implementations§
Source§impl<R: Clone + RealField> Clone for CircuitBox<R>
impl<R: Clone + RealField> Clone for CircuitBox<R>
Source§fn clone(&self) -> CircuitBox<R>
fn clone(&self) -> CircuitBox<R>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more