[][src]Type Definition descent::expr::dynam::ExprDynSum

type ExprDynSum = Vec<ExprDyn>;

Represents the sum of multiple dynamic expressions.

Breaking up expressions into smaller sums of expressions can improve the performance of AD techniques for large sums. If an Expr consists of a large sum of terms, then when converted into an Expression, it will automatically get converted into this type. Alternatively, this type can be explicitly utilised as the addition operator is implement for it and Expr:

use descent::expr::Var;
use descent::expr::dynam::ExprDynSum;
let xs: Vec<Var> = (0..5).into_iter().map(|i| Var(i)).collect();

let mut e = ExprDynSum::new();
for &x in &xs {
    e = e + 3.0 * x;
}

let mut e = ExprDynSum::new();
for &x in &xs {
    e = e + x.into(); // variable needs to be converted to `Expr` first here
}

Trait Implementations

impl Add<Expr> for ExprDynSum[src]

type Output = ExprDynSum

The resulting type after applying the + operator.