Skip to main content

ReferenceSimulator

Struct ReferenceSimulator 

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

v2.4.0 — a usable dense-statevector simulator over f64 complex amplitudes, capped at OSS_QUBIT_CAP.

Implementations§

Source§

impl ReferenceSimulator

Source

pub fn new() -> Self

Source

pub fn reupload_encode( &self, x: &[f64], layers: usize, ) -> Result<StateVector, QuantError>

v2.23.0 — data re-uploading: interleave an angle-encoding of x with a fixed entangling layer, layers times. For layers ≥ 2 the data x re-enters the circuit, so ⟨ψ(x)|ψ(y)⟩ is NO LONGER a quadratic form in x (it becomes a Fourier series in the data — Schuld 2021, arXiv:2008.08605). This is the ONLY provable escape from the amplitude+Pauli quadratic bound (v2.23.0 / the Havlíček route). layers = 1 reduces to a single angle layer (no re-uploading). HONEST: escaping the bound does NOT guarantee advantage on classical text — the v2.23.0 Advantage Witness still gates it.

Source§

impl ReferenceSimulator

Source

pub fn polynomial_kernel( a: &StateVector, b: &StateVector, degree: u32, ) -> Result<f64, QuantError>

v2.23.0 — multi-copy polynomial kernel (xᵀy)^d. Loading d copies of the state gives ⟨ψ(x)|ψ(y)⟩^d = (xᵀy)^d for amplitude encoding (Schuld & Killoran). It reaches beyond cosine (degree 1) — but it is still a CLASSICAL polynomial kernel (no quantum advantage), so like every fixed amplitude map it is gated by the v2.23.0 Advantage Witness. degree = 0 is the constant kernel 1; degree = 1 is the linear/cosine kernel xᵀy.

Trait Implementations§

Source§

impl Clone for ReferenceSimulator

Source§

fn clone(&self) -> ReferenceSimulator

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ReferenceSimulator

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ReferenceSimulator

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl QuantBackend for ReferenceSimulator

Source§

fn capacity(&self) -> usize

Maximum register width (qubits) this backend can realise.
Source§

fn encode( &self, x: &[f64], scheme: EncodingScheme, ) -> Result<StateVector, QuantError>

Project a classical real vector into a Hilbert-space state (section 3.1).
Source§

fn evolve( &self, state: StateVector, circuit: &VariationalCircuit, ) -> Result<StateVector, QuantError>

Evolve a state under a parametric circuit U(θ) (section 3.2).
Source§

fn measure( &self, state: &StateVector, observable: &PauliSum, ) -> Result<f64, QuantError>

Expectation E(θ) = ⟨ψ| M |ψ⟩ of a Pauli-sum observable (real, since M is Hermitian).
Source§

fn kernel(&self, a: &StateVector, b: &StateVector) -> Result<f64, QuantError>

Quantum-kernel overlap K = |⟨ψ_a|ψ_b⟩|² (section 3.4, fidelity kernel).

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more