pub struct ExpectationComputer { /* private fields */ }Expand description
Compute expectation values of observables.
Implementations§
Source§impl ExpectationComputer
impl ExpectationComputer
Sourcepub fn new(n_qubits: usize) -> Self
pub fn new(n_qubits: usize) -> Self
Create a new expectation computer with default observables.
Sourcepub fn with_observables(observables: Vec<Array1<f64>>) -> Self
pub fn with_observables(observables: Vec<Array1<f64>>) -> Self
Create with custom observables.
Sourcepub fn add_observable(&mut self, observable: Array1<f64>)
pub fn add_observable(&mut self, observable: Array1<f64>)
Add an observable.
Sourcepub fn compute(&self, reservoir: &QuantumReservoir) -> QearResult<Array1<f64>>
pub fn compute(&self, reservoir: &QuantumReservoir) -> QearResult<Array1<f64>>
Compute expectation values for all observables.
Sourcepub fn compute_single(
&self,
reservoir: &QuantumReservoir,
observable_idx: usize,
) -> QearResult<f64>
pub fn compute_single( &self, reservoir: &QuantumReservoir, observable_idx: usize, ) -> QearResult<f64>
Compute expectation value for a single observable.
Sourcepub fn num_observables(&self) -> usize
pub fn num_observables(&self) -> usize
Get the number of observables.
Trait Implementations§
Source§impl Clone for ExpectationComputer
impl Clone for ExpectationComputer
Source§fn clone(&self) -> ExpectationComputer
fn clone(&self) -> ExpectationComputer
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ExpectationComputer
impl RefUnwindSafe for ExpectationComputer
impl Send for ExpectationComputer
impl Sync for ExpectationComputer
impl Unpin for ExpectationComputer
impl UnwindSafe for ExpectationComputer
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