pub trait QuantBackend {
// Required methods
fn capacity(&self) -> usize;
fn encode(
&self,
x: &[f64],
scheme: EncodingScheme,
) -> Result<StateVector, QuantError>;
fn evolve(
&self,
state: StateVector,
circuit: &VariationalCircuit,
) -> Result<StateVector, QuantError>;
fn measure(
&self,
state: &StateVector,
observable: &PauliSum,
) -> Result<f64, QuantError>;
fn kernel(
&self,
a: &StateVector,
b: &StateVector,
) -> Result<f64, QuantError>;
}Expand description
v2.4.0 — the algebraic-backend port (D1). The OSS crate ships the
ReferenceSimulator; the enterprise QuIDD / VRAM / QPU engine implements
the same trait (v2.4.0–i). A quant block’s pipeline is encode → evolve → {measure | kernel}.
Required Methods§
Sourcefn encode(
&self,
x: &[f64],
scheme: EncodingScheme,
) -> Result<StateVector, QuantError>
fn encode( &self, x: &[f64], scheme: EncodingScheme, ) -> Result<StateVector, QuantError>
Project a classical real vector into a Hilbert-space state (section 3.1).
Sourcefn evolve(
&self,
state: StateVector,
circuit: &VariationalCircuit,
) -> Result<StateVector, QuantError>
fn evolve( &self, state: StateVector, circuit: &VariationalCircuit, ) -> Result<StateVector, QuantError>
Evolve a state under a parametric circuit U(θ) (section 3.2).
Sourcefn measure(
&self,
state: &StateVector,
observable: &PauliSum,
) -> Result<f64, QuantError>
fn measure( &self, state: &StateVector, observable: &PauliSum, ) -> Result<f64, QuantError>
Expectation E(θ) = ⟨ψ| M |ψ⟩ of a Pauli-sum observable (real, since M is
Hermitian).
Sourcefn kernel(&self, a: &StateVector, b: &StateVector) -> Result<f64, QuantError>
fn kernel(&self, a: &StateVector, b: &StateVector) -> Result<f64, QuantError>
Quantum-kernel overlap K = |⟨ψ_a|ψ_b⟩|² (section 3.4, fidelity kernel).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".