AD Mode Interface

XAD provides a set of interface structures that conveniently allow access to the data types needed for different AD modes. These are described in the following.

First-Order Mode Interface

template <typename T>
class
 adj

Structure defining the data types for adjoint-mode first order differentiation.

The template parameter T is the underlying basic type, typically double or float.

typedef Tape<T> tape_type

The data type for the tape in adjoint mode

typedef AReal<T> active_type

Active data type for adjoint mode differentiation

typedef T passive_type

Passive data type

typedef passive_type value_type

Same as passive_type

template <typename T>
class
 fwd

Structure defining the data types for forward-mode (tangent-linear) first order differentiation.

The template parameter T is the underlying basic type, typically double or float.

typedef FReal<T> active_type

Active data type for forward-mode differentiation

typedef T passive_type

Passive data type

typedef passive_type value_type

Same as passive_type

typedef void tape_type

As forward mode does not require a tape, this is defined to void

Second-Order Mode Interface

Second order is performed by nesting two first-order modes.

template <typename T>
class
 fwd_adj

Structure defining the data types for second order forward-over-adjoint mode.

The template parameter T is the underlying basic type, typically double or float.

typedef FReal<T> inner_type

The type for the inner mode, applied for the second order. In this case this is a forward AD type.

typedef AReal<inner_type> active_type

Active data type for forward-over-adjoint mode differentiation

typedef Tape<inner_type> tape_type

Tape type for forward-over-adjoint mode differentiation

typedef T passive_type

Passive data type

typedef passive_type value_type

Same as passive_type

template <typename T>
class
 fwd_fwd

Structure defining the data types for second order forward-over-forward mode.

The template parameter T is the underlying basic type, typically double or float.

typedef FReal<T> inner_type

The type for the inner mode, applied for the second order. In this case this is a forward AD type.

typedef FReal<inner_type> active_type

Active data type for forward-over-forward mode differentiation

typedef T passive_type

Passive data type

typedef passive_type value_type

Same as passive_type

typedef void tape_type

As not tape is required in this mode, this is defined as void

template <typename T>
class
 adj_fwd

Structure defining the data types for second order adjoint-over-forward mode.

The template parameter T is the underlying basic type, typically double or float.

typedef AReal<T> inner_type

The type for the inner mode, applied for the second order. In this case this is a adjoint AD type.

typedef FReal<inner_type> active_type

Active data type for adjoint-over-forward mode differentiation

typedef Tape<T> tape_type

Tape type for adjoint-over-forward mode differentiation

typedef T passive_type

Passive data type

typedef passive_type value_type

Same as passive_type

template <typename T>
class
 adj_adj

Structure defining the data types for second order adjoint-over-adjoint mode.

The template parameter T is the underlying basic type, typically double or float.

typedef AReal<T> inner_type

The type for the inner mode, applied for the second order. In this case this is a adjoint AD type.

typedef AReal<inner_type> active_type

Active data type for adjoint-over-adjoint mode differentiation

typedef Tape<T> inner_tape_type

Tape type for the second order (inner) differentiation

typedef Tape<inner_type> outer_tape_type

Tape type for the first order (outer) differentiation

typedef T passive_type

Passive data type

typedef passive_type value_type

Same as passive_type


Last update: September 2022