pub trait AmpLike<F: Field>:
Send
+ Sync
+ Debug
+ Display
+ AsTree
+ DynClone {
// Required methods
fn walk(&self) -> Vec<Amplitude<F>>;
fn walk_mut(&mut self) -> Vec<&mut Amplitude<F>>;
fn compute(&self, cache: &[Option<Complex<F>>]) -> Option<Complex<F>>;
// Provided methods
fn get_cloned_terms(&self) -> Option<Vec<Box<dyn AmpLike<F>>>> { ... }
fn real(&self) -> Real<F>
where Self: Sized + 'static { ... }
fn imag(&self) -> Imag<F>
where Self: Sized + 'static { ... }
fn prod(als: &Vec<Box<dyn AmpLike<F>>>) -> Product<F>
where Self: Sized + 'static { ... }
fn sum(als: &Vec<Box<dyn AmpLike<F>>>) -> Sum<F>
where Self: Sized + 'static { ... }
}
Expand description
This trait is used to implement operations which can be performed on Amplitude
s (and other
operations themselves). Currently, there are only a limited number of defined operations,
namely Real
, Imag
, and Product
. Others may be added in the future, but they
should probably only be added through this crate and not externally, since they require several
operator overloads to be implemented for nice syntax.
Required Methods§
Sourcefn walk_mut(&mut self) -> Vec<&mut Amplitude<F>>
fn walk_mut(&mut self) -> Vec<&mut Amplitude<F>>
This method is similar to AmpLike::walk
, but returns mutable references rather than
clones.
Provided Methods§
Sourcefn real(&self) -> Real<F>where
Self: Sized + 'static,
fn real(&self) -> Real<F>where
Self: Sized + 'static,
Take the real part of an Amplitude
or Amplitude-like
struct.
Sourcefn imag(&self) -> Imag<F>where
Self: Sized + 'static,
fn imag(&self) -> Imag<F>where
Self: Sized + 'static,
Take the imaginary part of an Amplitude
or Amplitude-like
struct.