pub struct Circuit<const W: usize> {
pub num_qubits: usize,
pub channels: Vec<Box<dyn Channel<W>>>,
}Expand description
A circuit on num_qubits qubits, stored as a heterogeneous list of
channels.
Channels are held as Box<dyn Channel> rather than a generic enum so
user-defined channel types can be appended at runtime; the engine sees only
the trait. The engine reads the list in order for
Direction::Forward propagation and in
reverse (using each channel’s adjoint) for
Direction::Heisenberg.
§Examples
use paulistrings::{Circuit, channel::Clifford1Q};
let mut c = Circuit::<1>::new(2);
c.push(Clifford1Q::h(0));
c.push(Clifford1Q::s(1));
assert_eq!(c.len(), 2);Fields§
§num_qubits: usizeNumber of qubits this circuit acts on. Constrains the support of channels that can be pushed.
channels: Vec<Box<dyn Channel<W>>>Channels in application order. Index 0 is applied first under
Direction::Forward.
Implementations§
Auto Trait Implementations§
impl<const W: usize> Freeze for Circuit<W>
impl<const W: usize> !RefUnwindSafe for Circuit<W>
impl<const W: usize> Send for Circuit<W>
impl<const W: usize> Sync for Circuit<W>
impl<const W: usize> Unpin for Circuit<W>
impl<const W: usize> !UnwindSafe for Circuit<W>
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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