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 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 88 of file SundanceMultipleDeriv.hpp.
MultipleDeriv::MultipleDeriv | ( | ) |
Construct an empty multiple derivative
Definition at line 38 of file SundanceMultipleDeriv.cpp.
Referenced by factorOutDeriv().
MultipleDeriv::MultipleDeriv | ( | const Deriv & | d | ) |
Construct a first-order multiple deriv
Definition at line 42 of file SundanceMultipleDeriv.cpp.
References Sundance::MultiSet< Deriv >::put().
Construct a second-order multiple deriv
Definition at line 47 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 228 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 142 of file SundanceMultipleDeriv.cpp.
MultiSet< int > MultipleDeriv::dofIDs | ( | ) | const |
Definition at line 96 of file SundanceMultipleDeriv.cpp.
References Sundance::MultiSet< Key >::put().
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 151 of file SundanceMultipleDeriv.cpp.
References MultipleDeriv().
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 127 of file SundanceMultipleDeriv.cpp.
References MultipleDeriv().
Referenced by Sundance::DiffOpEvaluator::backedDerivs(), and Sundance::DiffOpEvaluator::remainder().
MultiSet< FunctionIdentifier > MultipleDeriv::funcIDs | ( | ) | const |
Definition at line 81 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 168 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 105 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 244 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 112 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 183 of file SundanceMultipleDeriv.cpp.
References Sundance::bitsOfAnInteger(), Sundance::Map< Key, Value, Compare >::containsKey(), Sundance::Map< Key, Value, Compare >::get(), Sundance::pow2(), Sundance::MultiSet< Key >::put(), and Sundance::Map< Key, Value, Compare >::put().
Referenced by Sundance::ProductEvaluator::ProductEvaluator().
MultiIndex MultipleDeriv::spatialDeriv | ( | ) | const |
Return a multiindex representing the spatial derivs in this multiple derivative
Definition at line 67 of file SundanceMultipleDeriv.cpp.
int MultipleDeriv::spatialOrder | ( | ) | const |
Return the order of spatial differentiation in this derivative
Definition at line 54 of file SundanceMultipleDeriv.cpp.