pub struct DeepEx<'a, T, OF = FloatOpsFactory<T>, LM = NumberMatcher>{ /* private fields */ }
Expand description
A deep expression evaluates co-recursively since its nodes can contain other deep
expressions. Compared to FlatEx
, this is slower to evaluate but
easier to calculate with.
Implementations§
source§impl<'a, T, OF, LM> DeepEx<'a, T, OF, LM>
impl<'a, T, OF, LM> DeepEx<'a, T, OF, LM>
pub fn one() -> Selfwhere
T: NeutralElts,
pub fn zero() -> Selfwhere
T: NeutralElts,
pub fn ops(&self) -> &Vec<Operator<'a, T>>
pub fn pow( self, exponent: DeepEx<'a, T, OF, LM>, ) -> ExResult<DeepEx<'a, T, OF, LM>>
pub fn abs(self) -> ExResult<Self>
pub fn sin(self) -> ExResult<Self>
pub fn cos(self) -> ExResult<Self>
pub fn tan(self) -> ExResult<Self>
pub fn sinh(self) -> ExResult<Self>
pub fn cosh(self) -> ExResult<Self>
pub fn tanh(self) -> ExResult<Self>
pub fn asin(self) -> ExResult<Self>
pub fn acos(self) -> ExResult<Self>
pub fn atan(self) -> ExResult<Self>
pub fn signum(self) -> ExResult<Self>
pub fn log(self) -> ExResult<Self>
pub fn log2(self) -> ExResult<Self>
pub fn log10(self) -> ExResult<Self>
pub fn ln(self) -> ExResult<Self>
pub fn round(self) -> ExResult<Self>
pub fn floor(self) -> ExResult<Self>
pub fn ceil(self) -> ExResult<Self>
pub fn exp(self) -> ExResult<Self>
pub fn sqrt(self) -> ExResult<Self>
pub fn cbrt(self) -> ExResult<Self>
pub fn fract(self) -> ExResult<Self>
pub fn trunc(self) -> ExResult<Self>
pub fn pi() -> Self
pub fn e() -> Self
pub fn tau() -> Self
Trait Implementations§
source§impl<'a, T, OF, LM> Add for DeepEx<'a, T, OF, LM>where
T: DataType + NeutralElts,
OF: MakeOperators<T>,
LM: MatchLiteral,
<T as FromStr>::Err: Debug,
Self: Sized,
impl<'a, T, OF, LM> Add for DeepEx<'a, T, OF, LM>where
T: DataType + NeutralElts,
OF: MakeOperators<T>,
LM: MatchLiteral,
<T as FromStr>::Err: Debug,
Self: Sized,
source§impl<'a, T, OF, LM> Calculate<'a, T> for DeepEx<'a, T, OF, LM>
impl<'a, T, OF, LM> Calculate<'a, T> for DeepEx<'a, T, OF, LM>
source§impl<'a, T, OF, LM> Clone for DeepEx<'a, T, OF, LM>where
T: DataType + Clone,
OF: MakeOperators<T> + Clone,
LM: MatchLiteral + Clone,
<T as FromStr>::Err: Debug,
impl<'a, T, OF, LM> Clone for DeepEx<'a, T, OF, LM>where
T: DataType + Clone,
OF: MakeOperators<T> + Clone,
LM: MatchLiteral + Clone,
<T as FromStr>::Err: Debug,
source§impl<'a, T, OF, LM> Differentiate<'a, T> for DeepEx<'a, T, OF, LM>where
T: DiffDataType,
OF: MakeOperators<T> + Debug,
LM: MatchLiteral + Debug,
<T as FromStr>::Err: Debug,
impl<'a, T, OF, LM> Differentiate<'a, T> for DeepEx<'a, T, OF, LM>where
T: DiffDataType,
OF: MakeOperators<T> + Debug,
LM: MatchLiteral + Debug,
<T as FromStr>::Err: Debug,
source§fn partial(self, var_idx: usize) -> ExResult<Self>
fn partial(self, var_idx: usize) -> ExResult<Self>
feature = "partial"
- This method computes a new expression
that is the partial derivative of self
with default operators. Read moresource§fn partial_relaxed(
self,
var_idx: usize,
missing_op_mode: MissingOpMode,
) -> ExResult<Self>
fn partial_relaxed( self, var_idx: usize, missing_op_mode: MissingOpMode, ) -> ExResult<Self>
Like
Differentiate::partial
. The only difference is that in case there is no differentation defined for
a binary operator this will not necessarily throw an error depending on missing_op_mode
, see MissingOpMode
.source§fn partial_nth(self, var_idx: usize, n: usize) -> ExResult<Self>
fn partial_nth(self, var_idx: usize, n: usize) -> ExResult<Self>
feature = "partial"
- Computes the nth partial derivative with respect to one variable Read moresource§fn partial_nth_relaxed(
self,
var_idx: usize,
n: usize,
missing_op_mode: MissingOpMode,
) -> ExResult<Self>
fn partial_nth_relaxed( self, var_idx: usize, n: usize, missing_op_mode: MissingOpMode, ) -> ExResult<Self>
Like
Differentiate::partial_nth
. The only difference is that in case there is no differentation defined for
a binary operator this will not necessarily throw an error depending on missing_op_mode
, see MissingOpMode
.source§fn partial_iter<I>(self, var_idxs: I) -> ExResult<Self>
fn partial_iter<I>(self, var_idxs: I) -> ExResult<Self>
feature = "partial"
- Computes a chain of partial derivatives with respect to the variables passed as iterator Read moresource§fn partial_iter_relaxed<I>(
self,
var_idxs: I,
missing_op_mode: MissingOpMode,
) -> ExResult<Self>
fn partial_iter_relaxed<I>( self, var_idxs: I, missing_op_mode: MissingOpMode, ) -> ExResult<Self>
Like
Differentiate::partial_iter
. The only difference is that in case there is no differentation defined for
a binary this will not necessarily throw an error depending on missing_op_mode
, see MissingOpMode
.source§impl<'a, T, OF, LM> Div for DeepEx<'a, T, OF, LM>where
T: DataType + NeutralElts,
OF: MakeOperators<T>,
LM: MatchLiteral,
<T as FromStr>::Err: Debug,
Self: Sized,
impl<'a, T, OF, LM> Div for DeepEx<'a, T, OF, LM>where
T: DataType + NeutralElts,
OF: MakeOperators<T>,
LM: MatchLiteral,
<T as FromStr>::Err: Debug,
Self: Sized,
source§impl<'a, T, OF, LM> Express<'a, T> for DeepEx<'a, T, OF, LM>
impl<'a, T, OF, LM> Express<'a, T> for DeepEx<'a, T, OF, LM>
type LiteralMatcher = LM
type OperatorFactory = OF
source§fn eval_relaxed(&self, vars: &[T]) -> ExResult<T>
fn eval_relaxed(&self, vars: &[T]) -> ExResult<T>
Evaluates an expression with the given variable values and returns the computed
result. If more variables are passed than necessary the unnecessary ones are ignored. Read more
source§fn eval(&self, vars: &[T]) -> ExResult<T>
fn eval(&self, vars: &[T]) -> ExResult<T>
Evaluates an expression with the given variable values and returns the computed
result. Read more
fn from_deepex(deepex: DeepEx<'a, T, OF, LM>) -> ExResult<DeepEx<'a, T, OF, LM>>
source§fn to_deepex(self) -> ExResult<DeepEx<'a, T, OF, LM>>
fn to_deepex(self) -> ExResult<DeepEx<'a, T, OF, LM>>
Conversion to a deep expression necessary for computations with expressions
source§fn unparse(&self) -> &str
fn unparse(&self) -> &str
Creates an expression string that corresponds to the
FlatEx
instance. Read morefn parse(text: &'a str) -> ExResult<Self>where
Self: Sized,
source§fn binary_reprs(&self) -> SmallVec<[String; 16]>
fn binary_reprs(&self) -> SmallVec<[String; 16]>
Returns an alphabetically sorted list of all binary operators without duplicates in the expression.
source§impl<'a, T, OF, LM> Mul for DeepEx<'a, T, OF, LM>where
T: DataType + NeutralElts,
OF: MakeOperators<T>,
LM: MatchLiteral,
<T as FromStr>::Err: Debug,
Self: Sized,
impl<'a, T, OF, LM> Mul for DeepEx<'a, T, OF, LM>where
T: DataType + NeutralElts,
OF: MakeOperators<T>,
LM: MatchLiteral,
<T as FromStr>::Err: Debug,
Self: Sized,
source§impl<'a, T, OF, LM> Ord for DeepEx<'a, T, OF, LM>where
T: DataType + Ord,
OF: MakeOperators<T> + Ord,
LM: MatchLiteral + Ord,
<T as FromStr>::Err: Debug,
impl<'a, T, OF, LM> Ord for DeepEx<'a, T, OF, LM>where
T: DataType + Ord,
OF: MakeOperators<T> + Ord,
LM: MatchLiteral + Ord,
<T as FromStr>::Err: Debug,
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl<'a, T, OF, LM> PartialEq for DeepEx<'a, T, OF, LM>where
T: DataType + PartialEq,
OF: MakeOperators<T> + PartialEq,
LM: MatchLiteral + PartialEq,
<T as FromStr>::Err: Debug,
impl<'a, T, OF, LM> PartialEq for DeepEx<'a, T, OF, LM>where
T: DataType + PartialEq,
OF: MakeOperators<T> + PartialEq,
LM: MatchLiteral + PartialEq,
<T as FromStr>::Err: Debug,
source§impl<'a, T, OF, LM> PartialOrd for DeepEx<'a, T, OF, LM>where
T: DataType + PartialOrd,
OF: MakeOperators<T> + PartialOrd,
LM: MatchLiteral + PartialOrd,
<T as FromStr>::Err: Debug,
impl<'a, T, OF, LM> PartialOrd for DeepEx<'a, T, OF, LM>where
T: DataType + PartialOrd,
OF: MakeOperators<T> + PartialOrd,
LM: MatchLiteral + PartialOrd,
<T as FromStr>::Err: Debug,
impl<'a, T, OF, LM> Eq for DeepEx<'a, T, OF, LM>where
T: DataType + Eq,
OF: MakeOperators<T> + Eq,
LM: MatchLiteral + Eq,
<T as FromStr>::Err: Debug,
impl<'a, T, OF, LM> StructuralPartialEq for DeepEx<'a, T, OF, LM>
Auto Trait Implementations§
impl<'a, T, OF, LM> Freeze for DeepEx<'a, T, OF, LM>
impl<'a, T, OF, LM> RefUnwindSafe for DeepEx<'a, T, OF, LM>
impl<'a, T, OF, LM> Send for DeepEx<'a, T, OF, LM>
impl<'a, T, OF, LM> Sync for DeepEx<'a, T, OF, LM>
impl<'a, T, OF, LM> Unpin for DeepEx<'a, T, OF, LM>
impl<'a, T, OF, LM> UnwindSafe for DeepEx<'a, T, OF, LM>
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)