   # Sundance::MultipleDeriv Class Reference

Inheritance diagram for Sundance::MultipleDeriv: List of all members.

## 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< FunctionIdentifierfuncIDs () 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)

## Detailed Description

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.

### Product rule application

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.

## Constructor & Destructor Documentation

 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().

 MultipleDeriv::MultipleDeriv ( const Deriv & d1, const Deriv & d2 )

Construct a second-order multiple deriv

Definition at line 47 of file SundanceMultipleDeriv.cpp.

References Sundance::MultiSet< Deriv >::put().

## Member Function Documentation

 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().

 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

 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.

 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.

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.