AutoDiffMath.h

Classes

Global Functions -- Implements all mathematical operators and functions for AutoDiff. (full description)

Implements all mathematical operators and functions for AutoDiff. (source)

Interface

AutoDiff<T> operator+(const AutoDiff<T> &other)
AutoDiff<T> operator-(const AutoDiff<T> &other)
AutoDiff<T> operator+(const AutoDiff<T> &left, const AutoDiff<T> &right)
AutoDiff<T> operator-(const AutoDiff<T> &left, const AutoDiff<T> &right)
AutoDiff<T> operator*(const AutoDiff<T> &left, const AutoDiff<T> &right)
AutoDiff<T> operator/(const AutoDiff<T> &left, const AutoDiff<T> &right)
AutoDiff<T> operator+(const AutoDiff<T> &left, const T &right)
AutoDiff<T> operator-(const AutoDiff<T> &left, const T &right)
AutoDiff<T> operator*(const AutoDiff<T> &left, const T &right)
AutoDiff<T> operator/(const AutoDiff<T> &left, const T &right)
AutoDiff<T> operator+(const T &left, const AutoDiff<T> &right)
AutoDiff<T> operator-(const T &left, const AutoDiff<T> &right)
AutoDiff<T> operator*(const T &left, const AutoDiff<T> &right)
AutoDiff<T> operator/(const T &left, const AutoDiff<T> &right)
AutoDiff<T> acos(const AutoDiff<T> &ad)
AutoDiff<T> asin(const AutoDiff<T> &ad)
AutoDiff<T> atan(const AutoDiff<T> &ad)
AutoDiff<T> atan2(const AutoDiff<T> &y, const AutoDiff<T> &x)
AutoDiff<T> cos(const AutoDiff<T> &ad)
AutoDiff<T> cosh(const AutoDiff<T> &ad)
AutoDiff<T> exp(const AutoDiff<T> &ad)
AutoDiff<T> log(const AutoDiff<T> &ad)
AutoDiff<T> log10(const AutoDiff<T> &ad)
AutoDiff<T> erf(const AutoDiff<T> &ad)
AutoDiff<T> erfc(const AutoDiff<T> &ad)
AutoDiff<T> pow(const AutoDiff<T> &a, const AutoDiff<T> &b)
AutoDiff<T> pow(const AutoDiff<T> &a, const T &b)
AutoDiff<T> square(const AutoDiff<T> &ad)
AutoDiff<T> cube(const AutoDiff<T> &ad)
AutoDiff<T> sin(const AutoDiff<T> &ad)
AutoDiff<T> sinh(const AutoDiff<T> &ad)
AutoDiff<T> sqrt(const AutoDiff<T> &ad)
AutoDiff<T> tan(const AutoDiff<T> &ad)
AutoDiff<T> tanh(const AutoDiff<T> &ad)
AutoDiff<T> abs(const AutoDiff<T> &ad)
AutoDiff<T> fmod(const AutoDiff<T> &x, const T &c)
AutoDiff<T> fmod(const AutoDiff<T> &x, const AutoDiff<T> &c)
AutoDiff<T> floor(const AutoDiff<T> &ad)
AutoDiff<T> ceil(const AutoDiff<T> &ad)
Bool operator>(const AutoDiff<T> &left, const AutoDiff<T> &right)
Bool operator<(const AutoDiff<T> &left, const AutoDiff<T> &right)
Bool operator>=(const AutoDiff<T> &left, const AutoDiff<T> &right)
Bool operator<=(const AutoDiff<T> &left, const AutoDiff<T> &right)
Bool operator==(const AutoDiff<T> &left, const AutoDiff<T> &right)
Bool operator!=(const AutoDiff<T> &left, const AutoDiff<T> &right)
Bool near(const AutoDiff<T> &left, const AutoDiff<T> &right)
Bool near(const AutoDiff<T> &left, const AutoDiff<T> &right, const Double tol)
Bool allnear(const AutoDiff<T> &left, const AutoDiff<T> &right, const Double tol)
Bool nearAbs(const AutoDiff<T> &left, const AutoDiff<T> &right, const Double tol)
Bool allnearAbs(const AutoDiff<T> &left, const AutoDiff<T> &right, const Double tol)
Bool operator>(const AutoDiff<T> &left, const T &right)
Bool operator<(const AutoDiff<T> &left, const T &right)
Bool operator>=(const AutoDiff<T> &left, const T &right)
Bool operator<=(const AutoDiff<T> &left, const T &right)
Bool operator==(const AutoDiff<T> &left, const T &right)
Bool operator!=(const AutoDiff<T> &left, const T &right)
Bool near(const AutoDiff<T> &left, const T &right)
Bool near(const AutoDiff<T> &left, const T &right, const Double tol)
Bool allnear(const AutoDiff<T> &left, const T &right, const Double tol)
Bool nearAbs(const AutoDiff<T> &left, const T &right, const Double tol)
Bool allnearAbs(const AutoDiff<T> &left, const T &right, const Double tol)
Bool operator>(const T &left, const AutoDiff<T> &right)
Bool operator<(const T &left, const AutoDiff<T> &right)
Bool operator>=(const T &left, const AutoDiff<T> &right)
Bool operator<=(const T &left, const AutoDiff<T> &right)
Bool operator==(const T &left, const AutoDiff<T> &right)
Bool operator!=(const T &left, const AutoDiff<T> &right)
Bool near(const T &left, const AutoDiff<T> &right, const Double tol)
Bool allnear(const T &left, const AutoDiff<T> &right, const Double tol)
Bool nearAbs(const T &left, const AutoDiff<T> &right, const Double tol)
Bool allnearAbs(const T &left, const AutoDiff<T> &right, const Double tol)
Bool isNaN(const AutoDiff<T> &val)
Bool isInf(AutoDiff<T> &val)
AutoDiff<T> min(const AutoDiff<T> &left, const AutoDiff<T> &right)
AutoDiff<T> max(const AutoDiff<T> &left, const AutoDiff<T> &right)

Description

Review Status

Reviewed By:
UNKNOWN
Date Reviewed:
before2004/08/25
Programs:
Tests:

Prerequisite

Etymology

Implements all mathematical operators and functions for AutoDiff.

To Do

Member Description

AutoDiff<T> operator+(const AutoDiff<T> &other)
AutoDiff<T> operator-(const AutoDiff<T> &other)

Unary arithmetic operators.

AutoDiff<T> operator+(const AutoDiff<T> &left, const AutoDiff<T> &right)
AutoDiff<T> operator-(const AutoDiff<T> &left, const AutoDiff<T> &right)
AutoDiff<T> operator*(const AutoDiff<T> &left, const AutoDiff<T> &right)
AutoDiff<T> operator/(const AutoDiff<T> &left, const AutoDiff<T> &right)

Arithmetic on two AutoDiff objects, returning an AutoDiff object

AutoDiff<T> operator+(const AutoDiff<T> &left, const T &right)
AutoDiff<T> operator-(const AutoDiff<T> &left, const T &right)
AutoDiff<T> operator*(const AutoDiff<T> &left, const T &right)
AutoDiff<T> operator/(const AutoDiff<T> &left, const T &right)

Arithmetic on an AutoDiff and a scalar, returning an AutoDiff

AutoDiff<T> operator+(const T &left, const AutoDiff<T> &right)
AutoDiff<T> operator-(const T &left, const AutoDiff<T> &right)
AutoDiff<T> operator*(const T &left, const AutoDiff<T> &right)
AutoDiff<T> operator/(const T &left, const AutoDiff<T> &right)

Arithmetic between a scalar and an AutoDiff returning an AutoDiff

AutoDiff<T> acos(const AutoDiff<T> &ad)
AutoDiff<T> asin(const AutoDiff<T> &ad)
AutoDiff<T> atan(const AutoDiff<T> &ad)
AutoDiff<T> atan2(const AutoDiff<T> &y, const AutoDiff<T> &x)
AutoDiff<T> cos(const AutoDiff<T> &ad)
AutoDiff<T> cosh(const AutoDiff<T> &ad)
AutoDiff<T> exp(const AutoDiff<T> &ad)
AutoDiff<T> log(const AutoDiff<T> &ad)
AutoDiff<T> log10(const AutoDiff<T> &ad)
AutoDiff<T> erf(const AutoDiff<T> &ad)
AutoDiff<T> erfc(const AutoDiff<T> &ad)
AutoDiff<T> pow(const AutoDiff<T> &a, const AutoDiff<T> &b)
AutoDiff<T> pow(const AutoDiff<T> &a, const T &b)
AutoDiff<T> square(const AutoDiff<T> &ad)
AutoDiff<T> cube(const AutoDiff<T> &ad)
AutoDiff<T> sin(const AutoDiff<T> &ad)
AutoDiff<T> sinh(const AutoDiff<T> &ad)
AutoDiff<T> sqrt(const AutoDiff<T> &ad)
AutoDiff<T> tan(const AutoDiff<T> &ad)
AutoDiff<T> tanh(const AutoDiff<T> &ad)
AutoDiff<T> abs(const AutoDiff<T> &ad)

Transcendental functions

AutoDiff<T> fmod(const AutoDiff<T> &x, const T &c)
AutoDiff<T> fmod(const AutoDiff<T> &x, const AutoDiff<T> &c)

Floating-point remainder of x/c, with the same sign as x, where c is a constant.

AutoDiff<T> floor(const AutoDiff<T> &ad)
AutoDiff<T> ceil(const AutoDiff<T> &ad)

Floor and ceil of values

Bool operator>(const AutoDiff<T> &left, const AutoDiff<T> &right)
Bool operator<(const AutoDiff<T> &left, const AutoDiff<T> &right)
Bool operator>=(const AutoDiff<T> &left, const AutoDiff<T> &right)
Bool operator<=(const AutoDiff<T> &left, const AutoDiff<T> &right)
Bool operator==(const AutoDiff<T> &left, const AutoDiff<T> &right)
Bool operator!=(const AutoDiff<T> &left, const AutoDiff<T> &right)
Bool near(const AutoDiff<T> &left, const AutoDiff<T> &right)
Bool near(const AutoDiff<T> &left, const AutoDiff<T> &right, const Double tol)
Bool allnear(const AutoDiff<T> &left, const AutoDiff<T> &right, const Double tol)
Bool nearAbs(const AutoDiff<T> &left, const AutoDiff<T> &right, const Double tol)
Bool allnearAbs(const AutoDiff<T> &left, const AutoDiff<T> &right, const Double tol)

Comparison operators. Only the values are compared: in the actual functions, comparisons are used to decide on algorithms. To check if two AutoDiff values are equal, use comparison for both value and derivatives.

Tip To check if two AutoDiff values are equal, use the member method equals() (e.g. for debugging and testing).

Bool operator>(const AutoDiff<T> &left, const T &right)
Bool operator<(const AutoDiff<T> &left, const T &right)
Bool operator>=(const AutoDiff<T> &left, const T &right)
Bool operator<=(const AutoDiff<T> &left, const T &right)
Bool operator==(const AutoDiff<T> &left, const T &right)
Bool operator!=(const AutoDiff<T> &left, const T &right)
Bool near(const AutoDiff<T> &left, const T &right)
Bool near(const AutoDiff<T> &left, const T &right, const Double tol)
Bool allnear(const AutoDiff<T> &left, const T &right, const Double tol)
Bool nearAbs(const AutoDiff<T> &left, const T &right, const Double tol)
Bool allnearAbs(const AutoDiff<T> &left, const T &right, const Double tol)

Compare an AutoDiff and a constant

Bool operator>(const T &left, const AutoDiff<T> &right)
Bool operator<(const T &left, const AutoDiff<T> &right)
Bool operator>=(const T &left, const AutoDiff<T> &right)
Bool operator<=(const T &left, const AutoDiff<T> &right)
Bool operator==(const T &left, const AutoDiff<T> &right)
Bool operator!=(const T &left, const AutoDiff<T> &right)
Bool near(const T &left, const AutoDiff<T> &right, const Double tol)
Bool allnear(const T &left, const AutoDiff<T> &right, const Double tol)
Bool nearAbs(const T &left, const AutoDiff<T> &right, const Double tol)
Bool allnearAbs(const T &left, const AutoDiff<T> &right, const Double tol)

Compare a constant and an AutoDiff

Bool isNaN(const AutoDiff<T> &val)
Bool isInf(AutoDiff<T> &val)

Test special values

AutoDiff<T> min(const AutoDiff<T> &left, const AutoDiff<T> &right)
AutoDiff<T> max(const AutoDiff<T> &left, const AutoDiff<T> &right)

Minimum/maximum