pub struct Observable<R: RealField, const D: usize> { /* private fields */ }Expand description
A named projector carrying its own read-out.
This is the measurement boundary of the verdict law: the only site at which a verdict enters a
QCL pipeline. Every stage upstream carries operators; here a state meets a projection and a
number comes out, through the shipped born_projective_probability, or a Prob through
born_projective_prob. The observable folds no verdicts itself, because the fold rule depends
on which kind of verdict a world carries; it exposes its Projection so that adjudicate
can ask commutes_with of a pair before folding projection-valued verdicts.
Implementations§
Source§impl<R, const D: usize> Observable<R, D>
impl<R, const D: usize> Observable<R, D>
Sourcepub fn new(name: impl Into<String>, projection: Projection<R, D>) -> Self
pub fn new(name: impl Into<String>, projection: Projection<R, D>) -> Self
A named observable over a validated projection.
Sourcepub fn from_ket(
name: impl Into<String>,
ket: &CausalTensor<Complex<R>>,
) -> Result<Self, QuantumError>
pub fn from_ket( name: impl Into<String>, ket: &CausalTensor<Complex<R>>, ) -> Result<Self, QuantumError>
The rank-1 observable |ψ⟩⟨ψ| of a ket, validated by the shipped Projection::from_ket.
§Errors
As Projection::from_ket: a ket of the wrong shape or dimension, or a near-zero ket.
Sourcepub fn read_out(&self, plant: &QuantumPlant<R>) -> Result<R, QuantumError>
pub fn read_out(&self, plant: &QuantumPlant<R>) -> Result<R, QuantumError>
The Born probability Tr(Pρ) on the plant’s state, in [0, 1].
§Errors
QuantumError::DimensionMismatch naming both dimensions when the plant’s dim() differs
from D, which is the error born_projective_probability already raises.
Sourcepub fn read_out_prob(
&self,
plant: &QuantumPlant<R>,
) -> Result<Prob, QuantumError>
pub fn read_out_prob( &self, plant: &QuantumPlant<R>, ) -> Result<Prob, QuantumError>
Sourcepub fn sample(
&self,
plant: &QuantumPlant<R>,
shots: u64,
seed: u64,
) -> Result<CountHistogram, QuantumError>
pub fn sample( &self, plant: &QuantumPlant<R>, shots: u64, seed: u64, ) -> Result<CountHistogram, QuantumError>
Source§impl<R: RealField, const D: usize> Observable<R, D>
impl<R: RealField, const D: usize> Observable<R, D>
Sourcepub fn projection(&self) -> &Projection<R, D>
pub fn projection(&self) -> &Projection<R, D>
The projection, for adjudicate’s commutation guard.
Trait Implementations§
Source§impl<R: Clone + RealField, const D: usize> Clone for Observable<R, D>
impl<R: Clone + RealField, const D: usize> Clone for Observable<R, D>
Source§fn clone(&self) -> Observable<R, D>
fn clone(&self) -> Observable<R, D>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<R, const D: usize> Default for Observable<R, D>
The zero projection under an empty name, because the causal monad requires a Default for
every value it carries.
impl<R, const D: usize> Default for Observable<R, D>
The zero projection under an empty name, because the causal monad requires a Default for
every value it carries.