Drake
Drake C++ Documentation

## Classes

class  AutoDiff
A scalar type that performs automatic differentiation, similar to Eigen::AutoDiffScalar<Eigen::VectorXd>. More...

## Functions

Increment and decrement
AutoDiffoperator++ (AutoDiff &x)
Standard prefix increment operator (i.e., ++x). More...

AutoDiff operator++ (AutoDiff &x, int)
Standard postfix increment operator (i.e., x++). More...

AutoDiffoperator-- (AutoDiff &x)
Standard prefix decrement operator (i.e., --x). More...

AutoDiff operator-- (AutoDiff &x, int)
Standard postfix decrement operator (i.e., x--). More...

Arithmetic operators
AutoDiffoperator+= (AutoDiff &a, const AutoDiff &b)
Standard compound addition and assignment operator. More...

AutoDiffoperator+= (AutoDiff &a, double b)
Standard compound addition and assignment operator. More...

AutoDiffoperator-= (AutoDiff &a, const AutoDiff &b)
Standard compound subtraction and assignment operator. More...

AutoDiffoperator-= (AutoDiff &a, double b)
Standard compound subtraction and assignment operator. More...

AutoDiffoperator *= (AutoDiff &a, const AutoDiff &b)
Standard compound multiplication and assignment operator. More...

AutoDiffoperator *= (AutoDiff &a, double b)
Standard compound multiplication and assignment operator. More...

AutoDiffoperator/= (AutoDiff &a, const AutoDiff &b)
Standard compound division and assignment operator. More...

AutoDiffoperator/= (AutoDiff &a, double b)
Standard compound division and assignment operator. More...

AutoDiff operator+ (AutoDiff a, const AutoDiff &b)

AutoDiff operator+ (AutoDiff a, double b)

AutoDiff operator+ (double a, AutoDiff b)

AutoDiff operator+ (AutoDiff x)
Standard unary plus operator. More...

AutoDiff operator- (AutoDiff a, const AutoDiff &b)
Standard subtraction operator. More...

AutoDiff operator- (AutoDiff a, double b)
Standard subtraction operator. More...

AutoDiff operator- (double a, AutoDiff b)
Standard subtraction operator. More...

AutoDiff operator- (AutoDiff x)
Standard unary minus operator. More...

AutoDiff operator * (AutoDiff a, const AutoDiff &b)
Standard multiplication operator. More...

AutoDiff operator * (AutoDiff a, double b)
Standard multiplication operator. More...

AutoDiff operator * (double a, AutoDiff b)
Standard multiplication operator. More...

AutoDiff operator/ (AutoDiff a, const AutoDiff &b)
Standard division operator. More...

AutoDiff operator/ (AutoDiff a, double b)
Standard division operator. More...

AutoDiff operator/ (double a, const AutoDiff &b)
Standard division operator. More...

Comparison operators
bool operator< (const AutoDiff &a, const AutoDiff &b)
Standard comparison operator. More...

bool operator<= (const AutoDiff &a, const AutoDiff &b)
Standard comparison operator. More...

bool operator> (const AutoDiff &a, const AutoDiff &b)
Standard comparison operator. More...

bool operator>= (const AutoDiff &a, const AutoDiff &b)
Standard comparison operator. More...

bool operator== (const AutoDiff &a, const AutoDiff &b)
Standard comparison operator. More...

bool operator!= (const AutoDiff &a, const AutoDiff &b)
Standard comparison operator. More...

bool operator< (const AutoDiff &a, double b)
Standard comparison operator. More...

bool operator<= (const AutoDiff &a, double b)
Standard comparison operator. More...

bool operator> (const AutoDiff &a, double b)
Standard comparison operator. More...

bool operator>= (const AutoDiff &a, double b)
Standard comparison operator. More...

bool operator== (const AutoDiff &a, double b)
Standard comparison operator. More...

bool operator!= (const AutoDiff &a, double b)
Standard comparison operator. More...

bool operator< (double a, const AutoDiff &b)
Standard comparison operator. More...

bool operator<= (double a, const AutoDiff &b)
Standard comparison operator. More...

bool operator> (double a, const AutoDiff &b)
Standard comparison operator. More...

bool operator>= (double a, const AutoDiff &b)
Standard comparison operator. More...

bool operator== (double a, const AutoDiff &b)
Standard comparison operator. More...

bool operator!= (double a, const AutoDiff &b)
Standard comparison operator. More...

Minimum/maximum operations
const AutoDiffmax (const AutoDiff &a, const AutoDiff &b)

AutoDiff max (AutoDiff a, double b)

AutoDiff max (double a, AutoDiff b)

const AutoDiffmin (const AutoDiff &a, const AutoDiff &b)

AutoDiff min (AutoDiff a, double b)

AutoDiff min (double a, AutoDiff b)

Math functions: Basic operations
AutoDiff abs (AutoDiff x)

AutoDiff abs2 (AutoDiff x)

Math functions: Exponential and Power functions
AutoDiff exp (AutoDiff x)

AutoDiff log (AutoDiff x)

AutoDiff pow (AutoDiff base, const AutoDiff &exp)

AutoDiff pow (double base, const AutoDiff &exp)

AutoDiff pow (AutoDiff base, double exp)

AutoDiff sqrt (AutoDiff x)

Math functions: Trigonometric functions
AutoDiff sin (AutoDiff x)

AutoDiff cos (AutoDiff x)

AutoDiff tan (AutoDiff x)

AutoDiff asin (AutoDiff x)

AutoDiff acos (AutoDiff x)

AutoDiff atan (AutoDiff x)

AutoDiff atan2 (AutoDiff a, const AutoDiff &b)

AutoDiff atan2 (AutoDiff a, double b)

AutoDiff atan2 (double a, AutoDiff b)

Math functions: Hyperbolic functions
AutoDiff sinh (AutoDiff x)

AutoDiff cosh (AutoDiff x)

AutoDiff tanh (AutoDiff x)

Math functions: Nearest integer floating point operations
AutoDiff ceil (AutoDiff x)

AutoDiff floor (AutoDiff x)

AutoDiff round (AutoDiff x)

AutoDiff nexttoward (AutoDiff from, long double to)

bool isfinite (const AutoDiff &x)

bool isinf (const AutoDiff &x)

bool isnan (const AutoDiff &x)

Miscellaneous functions
std::ostream & operator<< (std::ostream &s, const AutoDiff &x)
Outputs the value() part of x to the stream. More...

## ◆ abs()

 AutoDiff drake::ad::abs ( AutoDiff x )

## ◆ abs2()

 AutoDiff drake::ad::abs2 ( AutoDiff x )

## ◆ acos()

 AutoDiff drake::ad::acos ( AutoDiff x )

## ◆ asin()

 AutoDiff drake::ad::asin ( AutoDiff x )

## ◆ atan()

 AutoDiff drake::ad::atan ( AutoDiff x )

## ◆ atan2() [1/3]

 AutoDiff drake::ad::atan2 ( AutoDiff a, const AutoDiff & b )

## ◆ atan2() [2/3]

 AutoDiff drake::ad::atan2 ( AutoDiff a, double b )

## ◆ atan2() [3/3]

 AutoDiff drake::ad::atan2 ( double a, AutoDiff b )

## ◆ ceil()

 AutoDiff drake::ad::ceil ( AutoDiff x )

The result's derivatives are always zero.

## ◆ cos()

 AutoDiff drake::ad::cos ( AutoDiff x )

## ◆ cosh()

 AutoDiff drake::ad::cosh ( AutoDiff x )

## ◆ exp()

 AutoDiff drake::ad::exp ( AutoDiff x )

## ◆ floor()

 AutoDiff drake::ad::floor ( AutoDiff x )

The result's derivatives are always zero.

## ◆ isfinite()

 bool drake::ad::isfinite ( const AutoDiff & x )

Because the return type is bool, the derivatives are not preserved.

## ◆ isinf()

 bool drake::ad::isinf ( const AutoDiff & x )

Because the return type is bool, the derivatives are not preserved.

## ◆ isnan()

 bool drake::ad::isnan ( const AutoDiff & x )

Because the return type is bool, the derivatives are not preserved.

## ◆ log()

 AutoDiff drake::ad::log ( AutoDiff x )

## ◆ max() [1/3]

 const AutoDiff& drake::ad::max ( const AutoDiff & a, const AutoDiff & b )

Note that like std::max, this function returns a reference to whichever argument was chosen; it does not make a copy. When a and b are equal, retains the derivatives of a (by returning a) unless a has empty derivatives, in which case b is returned.

## ◆ max() [2/3]

 AutoDiff drake::ad::max ( AutoDiff a, double b )

When a and b are equal, retains the derivatives of a.

## ◆ max() [3/3]

 AutoDiff drake::ad::max ( double a, AutoDiff b )

When a and b are equal, retains the derivatives of b.

## ◆ min() [1/3]

 const AutoDiff& drake::ad::min ( const AutoDiff & a, const AutoDiff & b )

Note that like std::min, this function returns a reference to whichever argument was chosen; it does not make a copy. When a and b are equal, retains the derivatives of a (by returning a) unless a has empty derivatives, in which case b is returned.

## ◆ min() [2/3]

 AutoDiff drake::ad::min ( AutoDiff a, double b )

When a and b are equal, retains the derivatives of a.

## ◆ min() [3/3]

 AutoDiff drake::ad::min ( double a, AutoDiff b )

When a and b are equal, retains the derivatives of b.

## ◆ nexttoward()

 AutoDiff drake::ad::nexttoward ( AutoDiff from, long double to )

The result's derivatives are always zero.

## ◆ operator *() [1/3]

 AutoDiff drake::ad::operator * ( AutoDiff a, const AutoDiff & b )

Standard multiplication operator.

## ◆ operator *() [2/3]

 AutoDiff drake::ad::operator * ( AutoDiff a, double b )

Standard multiplication operator.

## ◆ operator *() [3/3]

 AutoDiff drake::ad::operator * ( double a, AutoDiff b )

Standard multiplication operator.

## ◆ operator *=() [1/2]

 AutoDiff& drake::ad::operator *= ( AutoDiff & a, const AutoDiff & b )

Standard compound multiplication and assignment operator.

## ◆ operator *=() [2/2]

 AutoDiff& drake::ad::operator *= ( AutoDiff & a, double b )

Standard compound multiplication and assignment operator.

## ◆ operator!=() [1/3]

 bool drake::ad::operator!= ( const AutoDiff & a, const AutoDiff & b )

Standard comparison operator.

## ◆ operator!=() [2/3]

 bool drake::ad::operator!= ( const AutoDiff & a, double b )

Standard comparison operator.

## ◆ operator!=() [3/3]

 bool drake::ad::operator!= ( double a, const AutoDiff & b )

Standard comparison operator.

## ◆ operator+() [1/4]

 AutoDiff drake::ad::operator+ ( AutoDiff a, const AutoDiff & b )

## ◆ operator+() [2/4]

 AutoDiff drake::ad::operator+ ( AutoDiff a, double b )

## ◆ operator+() [3/4]

 AutoDiff drake::ad::operator+ ( double a, AutoDiff b )

## ◆ operator+() [4/4]

 AutoDiff drake::ad::operator+ ( AutoDiff x )

Standard unary plus operator.

## ◆ operator++() [1/2]

 AutoDiff& drake::ad::operator++ ( AutoDiff & x )

Standard prefix increment operator (i.e., ++x).

## ◆ operator++() [2/2]

 AutoDiff drake::ad::operator++ ( AutoDiff & x, int )

Standard postfix increment operator (i.e., x++).

## ◆ operator+=() [1/2]

 AutoDiff& drake::ad::operator+= ( AutoDiff & a, const AutoDiff & b )

Standard compound addition and assignment operator.

## ◆ operator+=() [2/2]

 AutoDiff& drake::ad::operator+= ( AutoDiff & a, double b )

Standard compound addition and assignment operator.

## ◆ operator-() [1/4]

 AutoDiff drake::ad::operator- ( AutoDiff a, const AutoDiff & b )

Standard subtraction operator.

## ◆ operator-() [2/4]

 AutoDiff drake::ad::operator- ( AutoDiff a, double b )

Standard subtraction operator.

## ◆ operator-() [3/4]

 AutoDiff drake::ad::operator- ( double a, AutoDiff b )

Standard subtraction operator.

## ◆ operator-() [4/4]

 AutoDiff drake::ad::operator- ( AutoDiff x )

Standard unary minus operator.

## ◆ operator--() [1/2]

 AutoDiff& drake::ad::operator-- ( AutoDiff & x )

Standard prefix decrement operator (i.e., --x).

## ◆ operator--() [2/2]

 AutoDiff drake::ad::operator-- ( AutoDiff & x, int )

Standard postfix decrement operator (i.e., x--).

## ◆ operator-=() [1/2]

 AutoDiff& drake::ad::operator-= ( AutoDiff & a, const AutoDiff & b )

Standard compound subtraction and assignment operator.

## ◆ operator-=() [2/2]

 AutoDiff& drake::ad::operator-= ( AutoDiff & a, double b )

Standard compound subtraction and assignment operator.

## ◆ operator/() [1/3]

 AutoDiff drake::ad::operator/ ( AutoDiff a, const AutoDiff & b )

Standard division operator.

## ◆ operator/() [2/3]

 AutoDiff drake::ad::operator/ ( AutoDiff a, double b )

Standard division operator.

## ◆ operator/() [3/3]

 AutoDiff drake::ad::operator/ ( double a, const AutoDiff & b )

Standard division operator.

## ◆ operator/=() [1/2]

 AutoDiff& drake::ad::operator/= ( AutoDiff & a, const AutoDiff & b )

Standard compound division and assignment operator.

## ◆ operator/=() [2/2]

 AutoDiff& drake::ad::operator/= ( AutoDiff & a, double b )

Standard compound division and assignment operator.

## ◆ operator<() [1/3]

 bool drake::ad::operator< ( const AutoDiff & a, const AutoDiff & b )

Standard comparison operator.

## ◆ operator<() [2/3]

 bool drake::ad::operator< ( const AutoDiff & a, double b )

Standard comparison operator.

## ◆ operator<() [3/3]

 bool drake::ad::operator< ( double a, const AutoDiff & b )

Standard comparison operator.

## ◆ operator<<()

 std::ostream& drake::ad::operator<< ( std::ostream & s, const AutoDiff & x )

Outputs the value() part of x to the stream.

To output the derivatives use << x.derivatives().transpose().

## ◆ operator<=() [1/3]

 bool drake::ad::operator<= ( const AutoDiff & a, const AutoDiff & b )

Standard comparison operator.

## ◆ operator<=() [2/3]

 bool drake::ad::operator<= ( const AutoDiff & a, double b )

Standard comparison operator.

## ◆ operator<=() [3/3]

 bool drake::ad::operator<= ( double a, const AutoDiff & b )

Standard comparison operator.

## ◆ operator==() [1/3]

 bool drake::ad::operator== ( const AutoDiff & a, const AutoDiff & b )

Standard comparison operator.

## ◆ operator==() [2/3]

 bool drake::ad::operator== ( const AutoDiff & a, double b )

Standard comparison operator.

## ◆ operator==() [3/3]

 bool drake::ad::operator== ( double a, const AutoDiff & b )

Standard comparison operator.

## ◆ operator>() [1/3]

 bool drake::ad::operator> ( const AutoDiff & a, const AutoDiff & b )

Standard comparison operator.

## ◆ operator>() [2/3]

 bool drake::ad::operator> ( const AutoDiff & a, double b )

Standard comparison operator.

## ◆ operator>() [3/3]

 bool drake::ad::operator> ( double a, const AutoDiff & b )

Standard comparison operator.

## ◆ operator>=() [1/3]

 bool drake::ad::operator>= ( const AutoDiff & a, const AutoDiff & b )

Standard comparison operator.

## ◆ operator>=() [2/3]

 bool drake::ad::operator>= ( const AutoDiff & a, double b )

Standard comparison operator.

## ◆ operator>=() [3/3]

 bool drake::ad::operator>= ( double a, const AutoDiff & b )

Standard comparison operator.

## ◆ pow() [1/3]

 AutoDiff drake::ad::pow ( AutoDiff base, const AutoDiff & exp )

The resulting partial derivative ∂/∂vᵢ is undefined (i.e., NaN) for all of the following cases:

• base is NaN
• exp is NaN
• pow(base, exp) is NaN
• ∂base/∂vᵢ is non-zero and either:
• base is zero or not finite, or
• exp is not finite
• ∂exp/∂vᵢ is non-zero and either:
• base is not positive-finite, or
• exp is not finite

In all other cases, if the base and exp partial derivatives were well-defined then the resulting partial derivatives will also be well-defined.

## ◆ pow() [2/3]

 AutoDiff drake::ad::pow ( double base, const AutoDiff & exp )

Refer to pow(AutoDiff,const AutoDiff&) for an explanation of special cases.

## ◆ pow() [3/3]

 AutoDiff drake::ad::pow ( AutoDiff base, double exp )

Refer to pow(AutoDiff,const AutoDiff&) for an explanation of special cases.

## ◆ round()

 AutoDiff drake::ad::round ( AutoDiff x )

The result's derivatives are always zero.

## ◆ sin()

 AutoDiff drake::ad::sin ( AutoDiff x )

## ◆ sinh()

 AutoDiff drake::ad::sinh ( AutoDiff x )

## ◆ sqrt()

 AutoDiff drake::ad::sqrt ( AutoDiff x )