Skip to main content

SparseBackend

Struct SparseBackend 

Source
pub struct SparseBackend { /* private fields */ }
Expand description

Sparse state-vector backend, O(k) where k is the number of non-zero amplitudes.

Implementations§

Source§

impl SparseBackend

Source

pub fn new(seed: u64) -> Self

Create a new sparse backend with the given RNG seed.

Trait Implementations§

Source§

impl Backend for SparseBackend

Source§

fn name(&self) -> &'static str

Human-readable backend name (for error messages, logging, and benchmarks).
Source§

fn init(&mut self, num_qubits: usize, num_classical_bits: usize) -> Result<()>

Initialize (or reset) state for a circuit with the given dimensions. Read more
Source§

fn apply(&mut self, instruction: &Instruction) -> Result<()>

Apply a single instruction to the current state. Read more
Source§

fn reset(&mut self, qubit: usize) -> Result<()>

Reset a qubit to |0⟩, discarding any prior amplitude on that qubit. Read more
Source§

fn reduced_density_matrix_1q(&self, qubit: usize) -> Result<[[Complex64; 2]; 2]>

Compute the one-qubit reduced density matrix without collapsing the state. Read more
Source§

fn classical_results(&self) -> &[bool]

Read classical measurement results. Read more
Source§

fn probabilities(&self) -> Result<Vec<f64>>

Compute the probability of each computational basis state. Read more
Source§

fn num_qubits(&self) -> usize

Number of qubits the backend is currently configured for.
Source§

fn export_statevector(&self) -> Result<Vec<Complex64>>

Export the current quantum state as a dense statevector. Read more
Source§

fn apply_instructions(&mut self, instructions: &[Instruction]) -> Result<()>

Apply a batch of instructions to the current state. Read more
Source§

fn supports_fused_gates(&self) -> bool

Whether this backend can handle Gate::Fused variants. Read more
Source§

fn supports_qft_block(&self) -> bool

Whether this backend has a native kernel for Gate::QftBlock. Read more
Source§

fn qubit_probability(&self, qubit: usize) -> Result<f64>

Compute P(qubit = |1⟩) without collapsing the state. Read more
Source§

fn apply_1q_matrix( &mut self, qubit: usize, matrix: &[[Complex64; 2]; 2], ) -> Result<()>

Apply a 2×2 matrix to a single qubit without allocating. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V