pub struct Expression { /* private fields */ }Expand description
A holder struct that owns both an expression tree and the registered amplitudes.
Implementations§
Source§impl Expression
impl Expression
Sourcepub fn from_amplitude(amplitude: Box<dyn Amplitude>) -> LadduResult<Self>
pub fn from_amplitude(amplitude: Box<dyn Amplitude>) -> LadduResult<Self>
Build an Expression from a single Amplitude.
Sourcepub fn parameters(&self) -> Vec<String>
pub fn parameters(&self) -> Vec<String>
Get the list of parameter names in the order they appear in the underlying resources.
Sourcepub fn free_parameters(&self) -> Vec<String>
pub fn free_parameters(&self) -> Vec<String>
Get the list of free parameter names.
Sourcepub fn fixed_parameters(&self) -> Vec<String>
pub fn fixed_parameters(&self) -> Vec<String>
Get the list of fixed parameter names.
Sourcepub fn n_parameters(&self) -> usize
pub fn n_parameters(&self) -> usize
Total number of parameters.
Sourcepub fn fix(&self, name: &str, value: f64) -> LadduResult<Self>
pub fn fix(&self, name: &str, value: f64) -> LadduResult<Self>
Return a new Expression with the given parameter fixed to a value.
Sourcepub fn free(&self, name: &str) -> LadduResult<Self>
pub fn free(&self, name: &str) -> LadduResult<Self>
Return a new Expression with the given parameter freed.
Sourcepub fn rename_parameter(&self, old: &str, new: &str) -> LadduResult<Self>
pub fn rename_parameter(&self, old: &str, new: &str) -> LadduResult<Self>
Return a new Expression with a single parameter renamed.
Sourcepub fn rename_parameters(
&self,
mapping: &HashMap<String, String>,
) -> LadduResult<Self>
pub fn rename_parameters( &self, mapping: &HashMap<String, String>, ) -> LadduResult<Self>
Return a new Expression with several parameters renamed.
Sourcepub fn load(&self, dataset: &Arc<Dataset>) -> LadduResult<Evaluator>
pub fn load(&self, dataset: &Arc<Dataset>) -> LadduResult<Evaluator>
Load an Expression against a dataset, binding amplitudes and reserving caches.
Sourcepub fn real(&self) -> Self
pub fn real(&self) -> Self
Takes the real part of the given Expression.
Sourcepub fn imag(&self) -> Self
pub fn imag(&self) -> Self
Takes the imaginary part of the given Expression.
Sourcepub fn conj(&self) -> Self
pub fn conj(&self) -> Self
Takes the complex conjugate of the given Expression.
Sourcepub fn norm_sqr(&self) -> Self
pub fn norm_sqr(&self) -> Self
Takes the absolute square of the given Expression.
Trait Implementations§
Source§impl Add<&Expression> for &Expression
impl Add<&Expression> for &Expression
Source§type Output = Expression
type Output = Expression
+ operator.Source§impl Add<&Expression> for Expression
impl Add<&Expression> for Expression
Source§type Output = Expression
type Output = Expression
+ operator.Source§impl Add<Expression> for &Expression
impl Add<Expression> for &Expression
Source§type Output = Expression
type Output = Expression
+ operator.Source§impl Add for Expression
impl Add for Expression
Source§type Output = Expression
type Output = Expression
+ operator.Source§impl Clone for Expression
impl Clone for Expression
Source§fn clone(&self) -> Expression
fn clone(&self) -> Expression
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Expression
impl Debug for Expression
Source§impl<'de> Deserialize<'de> for Expression
impl<'de> Deserialize<'de> for Expression
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for Expression
impl Display for Expression
Source§impl Div<&Expression> for &Expression
impl Div<&Expression> for &Expression
Source§type Output = Expression
type Output = Expression
/ operator.Source§impl Div<&Expression> for Expression
impl Div<&Expression> for Expression
Source§type Output = Expression
type Output = Expression
/ operator.Source§impl Div<Expression> for &Expression
impl Div<Expression> for &Expression
Source§type Output = Expression
type Output = Expression
/ operator.Source§impl Div for Expression
impl Div for Expression
Source§type Output = Expression
type Output = Expression
/ operator.Source§impl Mul<&Expression> for &Expression
impl Mul<&Expression> for &Expression
Source§type Output = Expression
type Output = Expression
* operator.Source§impl Mul<&Expression> for Expression
impl Mul<&Expression> for Expression
Source§type Output = Expression
type Output = Expression
* operator.Source§impl Mul<Expression> for &Expression
impl Mul<Expression> for &Expression
Source§type Output = Expression
type Output = Expression
* operator.Source§impl Mul for Expression
impl Mul for Expression
Source§type Output = Expression
type Output = Expression
* operator.Source§impl Neg for &Expression
impl Neg for &Expression
Source§impl Neg for Expression
impl Neg for Expression
Source§impl ReadWrite for Expression
impl ReadWrite for Expression
Source§fn create_null() -> Self
fn create_null() -> Self
pickle module
can load data. This generally shouldn’t be used to construct the struct in regular code.Source§impl Serialize for Expression
impl Serialize for Expression
Source§impl Sub<&Expression> for &Expression
impl Sub<&Expression> for &Expression
Source§type Output = Expression
type Output = Expression
- operator.Source§impl Sub<&Expression> for Expression
impl Sub<&Expression> for Expression
Source§type Output = Expression
type Output = Expression
- operator.Source§impl Sub<Expression> for &Expression
impl Sub<Expression> for &Expression
Source§type Output = Expression
type Output = Expression
- operator.Source§impl Sub for Expression
impl Sub for Expression
Source§type Output = Expression
type Output = Expression
- operator.Auto Trait Implementations§
impl Freeze for Expression
impl !RefUnwindSafe for Expression
impl Send for Expression
impl Sync for Expression
impl Unpin for Expression
impl !UnwindSafe for Expression
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> Serialize for T
impl<T> Serialize for T
fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>
fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.