Automatic differentiation scalar with first-order derivatives. More...
#include <mitsuba/core/autodiff.h>
Public Types | |
typedef _Scalar | Scalar |
typedef _Gradient | Gradient |
typedef Eigen::Matrix < DScalar1, 2, 1 > | DVector2 |
typedef Eigen::Matrix < DScalar1, 3, 1 > | DVector3 |
Public Member Functions | |
Constructors and accessors | |
DScalar1 (Scalar value=(Scalar) 0) | |
Create a new constant automatic differentiation scalar. More... | |
DScalar1 (size_t index, const Scalar &value) | |
Construct a new scalar with the specified value and one first derivative set to 1. More... | |
DScalar1 (Scalar value, const Gradient &grad) | |
Construct a scalar associated with the given gradient. More... | |
DScalar1 (const DScalar1 &s) | |
Copy constructor. More... | |
const Scalar & | getValue () const |
Create a new constant automatic differentiation scalar. More... | |
const Gradient & | getGradient () const |
Create a new constant automatic differentiation scalar. More... | |
Comparison and assignment | |
void | operator= (const DScalar1 &s) |
void | operator= (const Scalar &v) |
bool | operator< (const DScalar1 &s) const |
bool | operator<= (const DScalar1 &s) const |
bool | operator> (const DScalar1 &s) const |
bool | operator>= (const DScalar1 &s) const |
bool | operator< (const Scalar &s) const |
bool | operator<= (const Scalar &s) const |
bool | operator> (const Scalar &s) const |
bool | operator>= (const Scalar &s) const |
bool | operator== (const Scalar &s) const |
bool | operator!= (const Scalar &s) const |
Protected Attributes | |
Scalar | value |
Gradient | grad |
Friends | |
Miscellaneous functions | |
DScalar1 | sqrt (const DScalar1 &s) |
DScalar1 | pow (const DScalar1 &s, const Scalar &a) |
DScalar1 | exp (const DScalar1 &s) |
DScalar1 | log (const DScalar1 &s) |
DScalar1 | sin (const DScalar1 &s) |
DScalar1 | cos (const DScalar1 &s) |
DScalar1 | acos (const DScalar1 &s) |
DScalar1 | asin (const DScalar1 &s) |
DScalar1 | atan2 (const DScalar1 &y, const DScalar1 &x) |
Addition | |
DScalar1 & | operator+= (const DScalar1 &s) |
DScalar1 & | operator+= (const Scalar &v) |
DScalar1 | operator+ (const DScalar1 &lhs, const DScalar1 &rhs) |
DScalar1 | operator+ (const DScalar1 &lhs, const Scalar &rhs) |
DScalar1 | operator+ (const Scalar &lhs, const DScalar1 &rhs) |
Subtraction | |
DScalar1 & | operator-= (const DScalar1 &s) |
DScalar1 & | operator-= (const Scalar &v) |
DScalar1 | operator- (const DScalar1 &lhs, const DScalar1 &rhs) |
DScalar1 | operator- (const DScalar1 &lhs, const Scalar &rhs) |
DScalar1 | operator- (const Scalar &lhs, const DScalar1 &rhs) |
DScalar1 | operator- (const DScalar1 &s) |
Division | |
DScalar1 & | operator/= (const Scalar &v) |
DScalar1 | operator/ (const DScalar1 &lhs, const Scalar &rhs) |
DScalar1 | operator/ (const Scalar &lhs, const DScalar1 &rhs) |
DScalar1 | operator/ (const DScalar1 &lhs, const DScalar1 &rhs) |
DScalar1 | inverse (const DScalar1 &s) |
Multiplication | |
DScalar1 & | operator*= (const Scalar &v) |
DScalar1 | operator* (const DScalar1 &lhs, const Scalar &rhs) |
DScalar1 | operator* (const Scalar &lhs, const DScalar1 &rhs) |
DScalar1 | operator* (const DScalar1 &lhs, const DScalar1 &rhs) |
Additional Inherited Members | |
Static Public Member Functions inherited from DiffScalarBase | |
static void | setVariableCount (size_t value) |
Set the independent variable count used by the automatic differentiation layer. More... | |
static size_t | getVariableCount () |
Get the variable count used by the automatic differentiation layer. More... | |
Static Public Attributes inherited from DiffScalarBase | |
static __thread size_t | m_variableCount |
Automatic differentiation scalar with first-order derivatives.
This class provides an instrumented "scalar" value, which may be dependent on a number of independent variables. The implementation keeps tracks of first -order drivatives with respect to these variables using a set of overloaded operations and implementations of special functions (sin, tan, exp, ..).
This is extremely useful for numerical zero-finding, particularly when analytic derivatives from programs like Maple or Mathematica suffer from excessively complicated expressions.
The class relies on templates, which makes it possible to fix the number of independent variables at compile-time so that instances can be allocated on the stack. Otherwise, they will be placed on the heap.
This is an extended C++ port of Jon Kaldor's implementation, which is based on a C version by Eitan Grinspun at Caltech)
typedef Eigen::Matrix<DScalar1, 2, 1> DScalar1< _Scalar, _Gradient >::DVector2 |
typedef Eigen::Matrix<DScalar1, 3, 1> DScalar1< _Scalar, _Gradient >::DVector3 |
typedef _Gradient DScalar1< _Scalar, _Gradient >::Gradient |
typedef _Scalar DScalar1< _Scalar, _Gradient >::Scalar |
|
inlineexplicit |
Create a new constant automatic differentiation scalar.
|
inline |
Construct a new scalar with the specified value and one first derivative set to 1.
|
inline |
Construct a scalar associated with the given gradient.
|
inline |
Copy constructor.
|
inline |
Create a new constant automatic differentiation scalar.
|
inline |
Create a new constant automatic differentiation scalar.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
protected |
|
protected |