Public Member Functions | |
| MultipleDeriv () | |
| MultipleDeriv (const Deriv &d) | |
| MultipleDeriv (const Deriv &d1, const Deriv &d2) | |
| int | order () const |
| int | spatialOrder () const |
| MultiIndex | spatialDeriv () const |
| void | productRulePermutations (ProductRulePerms &perms) const |
| MultipleDeriv | product (const MultipleDeriv &other) const |
| MultipleDeriv | factorOutDeriv (const Deriv &x) const |
| MultipleDeriv | factorOutDeriv (const MultipleDeriv &x) const |
| bool | containsDeriv (const MultipleDeriv &x) const |
| bool | isInRequiredSet (const Set< MultiSet< int > > &funcCombinations, const Set< MultiIndex > &multiIndices) const |
| MultiSet< FunctionIdentifier > | funcIDs () const |
| MultiSet< int > | dofIDs () const |
Static Public Member Functions | |
Utilities used in computing product rule permutations | |
| static int | pow2 (int n) |
| static Array< int > | bitsOfAnInteger (int x, int n) |
Class MultipleDeriv is a multiple functional derivative operator represented as a multiset of first-order derivatives. The derivatives are each Deriv objects, so the multiple derivative can be an arbitrary mixture of spatial and functional derivatives.
Class MultipleDeriv contains a utility method for computing the derivatives that appear in the general product rule, as used in automatic differentiation of products and spatial derivatives. The arbitrary order, multivariable product rule gives the derivative of a product
with respect to a multiset of variables
as the sum
where
is the
-th bit in the binary representation of
. Method productRulePermutations() enumerates all the permutations that apply to the left and right operands in this sum, and returns the arrays of left operators and right operators through non-const reference arguments. The left and right arguments return
Each element in these arrays is a multiple derivative, and is naturally represented with a MultipleDeriv object.
Definition at line 99 of file SundanceMultipleDeriv.hpp.
Construct an empty multiple derivative
Definition at line 49 of file SundanceMultipleDeriv.cpp.
Referenced by factorOutDeriv().
| MultipleDeriv::MultipleDeriv | ( | const Deriv & | d | ) |
Construct a first-order multiple deriv
Definition at line 53 of file SundanceMultipleDeriv.cpp.
References Sundance::MultiSet< Deriv >::put().
| MultipleDeriv::MultipleDeriv | ( | const Deriv & | d1, |
| const Deriv & | d2 | ||
| ) |
Construct a second-order multiple deriv
Definition at line 58 of file SundanceMultipleDeriv.cpp.
References Sundance::MultiSet< Deriv >::put().
| Array< int > MultipleDeriv::bitsOfAnInteger | ( | int | x, |
| int | n | ||
| ) | [static] |
Compute the n bits of an integer x < 2^n. The bits are ordered least-to-most significant.
Definition at line 239 of file SundanceMultipleDeriv.cpp.
References pow2().
| bool MultipleDeriv::containsDeriv | ( | const MultipleDeriv & | x | ) | const |
Return true is all single derivatives appearing in x also appear in this.
Definition at line 153 of file SundanceMultipleDeriv.cpp.
| MultiSet< int > MultipleDeriv::dofIDs | ( | ) | const |
Definition at line 107 of file SundanceMultipleDeriv.cpp.
References Sundance::MultiSet< Key >::put().
| MultipleDeriv MultipleDeriv::factorOutDeriv | ( | const Deriv & | x | ) | const |
Return a copy of this derivative, but with the specified single derivative removed. For example, if <t>this</t> is
, calling <t>factorOutDeriv(v)</t> will return
.
Definition at line 138 of file SundanceMultipleDeriv.cpp.
References MultipleDeriv().
Referenced by Sundance::DiffOpEvaluator::backedDerivs(), Sundance::DiffOpEvaluator::remainder(), and Sundance::EvaluatableExpr::setDivision().
| MultipleDeriv MultipleDeriv::factorOutDeriv | ( | const MultipleDeriv & | x | ) | const |
Return a copy of this derivative, but with all single derivs in the the argument removed. For example, if <t>this</t> is
, calling <t>factorOutDeriv(u,v)</t> will return
.
Definition at line 162 of file SundanceMultipleDeriv.cpp.
References MultipleDeriv().
| MultiSet< FunctionIdentifier > MultipleDeriv::funcIDs | ( | ) | const |
Definition at line 92 of file SundanceMultipleDeriv.cpp.
References Sundance::MultiSet< Key >::put().
| bool MultipleDeriv::isInRequiredSet | ( | const Set< MultiSet< int > > & | funcCombinations, |
| const Set< MultiIndex > & | multiIndices | ||
| ) | const |
Definition at line 179 of file SundanceMultipleDeriv.cpp.
References Sundance::Set< Key, Compare >::contains().
Referenced by Sundance::EvaluatableExpr::computeInputR().
| int Sundance::MultipleDeriv::order | ( | ) | const [inline] |
Return the order of this derivative. Since a multiple derivative is a multiset of first-order derivatives, the order of the multiple derivative is the size of the set.
Definition at line 116 of file SundanceMultipleDeriv.hpp.
Referenced by Sundance::SparsitySuperset::addDeriv(), Sundance::EquationSet::addToVarUnkPairs(), Sundance::applyZx(), Sundance::DiffOpEvaluator::backedDerivs(), Sundance::CellDiameterExprEvaluator::CellDiameterExprEvaluator(), Sundance::CellVectorEvaluator::CellVectorEvaluator(), Sundance::chainRuleDerivsOfArgs(), Sundance::ConstantEvaluator::ConstantEvaluator(), Sundance::CoordExprEvaluator::CoordExprEvaluator(), Sundance::CurveNormEvaluator::CurveNormEvaluator(), Sundance::ChainRuleEvaluator::derivComboMultiplicity(), Sundance::DiffOpEvaluator::DiffOpEvaluator(), Sundance::TrivialGrouper::findGroups(), Sundance::DiffOpEvaluator::increasedDerivs(), Sundance::increasingOrder< MultipleDeriv >::operator()(), Sundance::ProductEvaluator::ProductEvaluator(), Sundance::DiffOpEvaluator::remainder(), Sundance::UserDefOpCommonEvaluator::UserDefOpCommonEvaluator(), and Sundance::UserDefOpEvaluator::UserDefOpEvaluator().
| int MultipleDeriv::pow2 | ( | int | n | ) | [static] |
Compute the n-th power of 2
Definition at line 255 of file SundanceMultipleDeriv.cpp.
Referenced by bitsOfAnInteger().
| MultipleDeriv MultipleDeriv::product | ( | const MultipleDeriv & | other | ) | const |
return the product of two multiple derivatives, which is the union of the two multisets
Definition at line 123 of file SundanceMultipleDeriv.cpp.
References Sundance::MultiSet< Key >::put().
Referenced by Sundance::chainRuleTerms(), and Sundance::FunctionalPolynomial::multiplyPoly().
| void MultipleDeriv::productRulePermutations | ( | ProductRulePerms & | perms | ) | const |
Return by reference argument the partitioning of derivatives when this derivative is applied to a product.
Definition at line 194 of file SundanceMultipleDeriv.cpp.
References Sundance::bitsOfAnInteger(), Sundance::Map< Key, Value, Compare >::containsKey(), Sundance::Map< Key, Value, Compare >::get(), Sundance::pow2(), Sundance::Map< Key, Value, Compare >::put(), and Sundance::MultiSet< Key >::put().
Referenced by Sundance::ProductEvaluator::ProductEvaluator().
| MultiIndex MultipleDeriv::spatialDeriv | ( | ) | const |
Return a multiindex representing the spatial derivs in this multiple derivative
Definition at line 78 of file SundanceMultipleDeriv.cpp.
| int MultipleDeriv::spatialOrder | ( | ) | const |
Return the order of spatial differentiation in this derivative
Definition at line 65 of file SundanceMultipleDeriv.cpp.