pub struct QuantumRegister { /* private fields */ }Expand description
An n-qubit quantum register holding 2^n complex amplitudes.
This is a higher-level wrapper around QuantumStatevector that tracks
qubit count explicitly and provides convenience initializers.
Implementations§
Source§impl QuantumRegister
impl QuantumRegister
Sourcepub fn apply_gate(&mut self, gate: &Gate2x2, qubit: usize)
pub fn apply_gate(&mut self, gate: &Gate2x2, qubit: usize)
Apply a single-qubit gate to qubit q.
Sourcepub fn apply_cnot(&mut self, control: usize, target: usize)
pub fn apply_cnot(&mut self, control: usize, target: usize)
Apply CNOT with given control and target qubits.
Sourcepub fn prepare_uniform_superposition(&mut self)
pub fn prepare_uniform_superposition(&mut self)
Prepare the uniform superposition state H^⊗n |0⟩.
Sourcepub fn measure_qubit(&self, qubit: usize, seed: u64) -> u8
pub fn measure_qubit(&self, qubit: usize, seed: u64) -> u8
Measure qubit q (deterministic via seed).
Sourcepub fn is_normalized(&self) -> bool
pub fn is_normalized(&self) -> bool
Check normalisation.
Sourcepub fn amplitudes(&self) -> &[Complex]
pub fn amplitudes(&self) -> &[Complex]
Amplitudes as a slice.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for QuantumRegister
impl RefUnwindSafe for QuantumRegister
impl Send for QuantumRegister
impl Sync for QuantumRegister
impl Unpin for QuantumRegister
impl UnsafeUnpin for QuantumRegister
impl UnwindSafe for QuantumRegister
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