numerical-collection-cpp 0.10.0
A collection of algorithms in numerical analysis implemented in C++
Loading...
Searching...
No Matches
num_collect::auto_diff::forward Namespace Reference

Namespace of forward-mode automatic differentiation. More...

Namespaces

namespace  impl
 Namespace of internal implementations.
 

Classes

class  variable
 Class of variables in forward-mode automatic differentiation [17]. More...
 

Typedefs

template<base::concepts::real_scalar_dense_vector ValueVector>
using variable_vector_type
 Get type of vectors of variables.
 

Functions

template<base::concepts::real_scalar Value>
auto create_diff_variable (const Value &value) -> variable< Value >
 Create a variable by which functions will be differentiated (for scalar differential coefficients).
 
template<base::concepts::real_scalar Value, base::concepts::real_scalar_dense_vector Diff>
auto create_diff_variable (const Value &value, index_type size, index_type index) -> variable< Value, Diff >
 Create a variable by which functions will be differentiated (for vector differential coefficients).
 
template<base::concepts::real_scalar_dense_vector ValueVector>
auto create_diff_variable_vector (const Eigen::MatrixBase< ValueVector > &value_vec) -> Eigen::CwiseNullaryOp< impl::create_diff_variable_vector_functor< ValueVector >, typename impl::create_diff_variable_vector_functor< ValueVector >::result_type >
 Create a vector of variables.
 
template<typename Value , typename Diff >
auto exp (const variable< Value, Diff > &x) -> variable< Value, Diff >
 Calculate exponential.
 
template<typename Value , typename Diff >
auto log (const variable< Value, Diff > &x) -> variable< Value, Diff >
 Calculate logarithm.
 
template<base::concepts::dense_vector VectorType>
auto make_jacobian (const Eigen::MatrixBase< VectorType > &vector) -> Eigen::CwiseNullaryOp< impl::make_jacobian_functor< VectorType >, typename impl::make_jacobian_functor< VectorType >::result_type >
 Make Jacobian from a vector of variables.
 
template<typename Value , typename Diff >
auto operator* (const Value &left, const variable< Value, Diff > &right) -> variable< Value, Diff >
 Multiply two variables.
 
template<typename Value , typename Diff >
auto operator* (const variable< Value, Diff > &left, const Value &right) -> variable< Value, Diff >
 Multiply two variables.
 
template<typename Value , typename Diff >
auto operator* (const variable< Value, Diff > &left, const variable< Value, Diff > &right) -> variable< Value, Diff >
 Multiply two variables.
 
template<typename Value , typename Diff >
auto operator+ (const Value &left, const variable< Value, Diff > &right) -> variable< Value, Diff >
 Add two variables.
 
template<typename Value , typename Diff >
auto operator+ (const variable< Value, Diff > &left, const Value &right) -> variable< Value, Diff >
 Add two variables.
 
template<typename Value , typename Diff >
auto operator+ (const variable< Value, Diff > &left, const variable< Value, Diff > &right) -> variable< Value, Diff >
 Add two variables.
 
template<typename Value , typename Diff >
auto operator- (const Value &left, const variable< Value, Diff > &right) -> variable< Value, Diff >
 Subtract a variable from another variable.
 
template<typename Value , typename Diff >
auto operator- (const variable< Value, Diff > &left, const Value &right) -> variable< Value, Diff >
 Subtract a variable from another variable.
 
template<typename Value , typename Diff >
auto operator- (const variable< Value, Diff > &left, const variable< Value, Diff > &right) -> variable< Value, Diff >
 Subtract a variable from another variable.
 
template<typename Value , typename Diff >
auto operator/ (const Value &left, const variable< Value, Diff > &right) -> variable< Value, Diff >
 Divide a variable by another variable.
 
template<typename Value , typename Diff >
auto operator/ (const variable< Value, Diff > &left, const Value &right) -> variable< Value, Diff >
 Divide a variable by another variable.
 
template<typename Value , typename Diff >
auto operator/ (const variable< Value, Diff > &left, const variable< Value, Diff > &right) -> variable< Value, Diff >
 Divide a variable by another variable.
 
template<typename Value , typename Diff >
auto sqrt (const variable< Value, Diff > &x) -> variable< Value, Diff >
 Calculate square root.
 

Detailed Description

Namespace of forward-mode automatic differentiation.

Typedef Documentation

◆ variable_vector_type

template<base::concepts::real_scalar_dense_vector ValueVector>
using num_collect::auto_diff::forward::variable_vector_type
Initial value:
Eigen::Matrix<variable<typename ValueVector::Scalar, ValueVector>,
ValueVector::RowsAtCompileTime, 1, Eigen::ColMajor,
ValueVector::MaxRowsAtCompileTime, 1>

Get type of vectors of variables.

Template Parameters
ValueVectorType of vectors of values.

Definition at line 76 of file create_diff_variable.h.

Function Documentation

◆ create_diff_variable() [1/2]

template<base::concepts::real_scalar Value>
auto num_collect::auto_diff::forward::create_diff_variable ( const Value & value) -> variable<Value>
inlinenodiscard

Create a variable by which functions will be differentiated (for scalar differential coefficients).

This will set the differential coefficient to one.

Template Parameters
ValueType of the value.
DiffType of the differential coefficient.
Parameters
[in]valueValue.
Returns
Variable.

Definition at line 47 of file create_diff_variable.h.

◆ create_diff_variable() [2/2]

template<base::concepts::real_scalar Value, base::concepts::real_scalar_dense_vector Diff>
auto num_collect::auto_diff::forward::create_diff_variable ( const Value & value,
index_type size,
index_type index ) -> variable<Value, Diff>
inlinenodiscard

Create a variable by which functions will be differentiated (for vector differential coefficients).

Template Parameters
ValueType of the value.
DiffType of the differential coefficients.
Parameters
[in]valueValue.
[in]sizeSize of Diff.
[in]indexIndex of the variable.
Returns
Variable.

Definition at line 65 of file create_diff_variable.h.

◆ create_diff_variable_vector()

template<base::concepts::real_scalar_dense_vector ValueVector>
auto num_collect::auto_diff::forward::create_diff_variable_vector ( const Eigen::MatrixBase< ValueVector > & value_vec) -> Eigen::CwiseNullaryOp< impl::create_diff_variable_vector_functor<ValueVector>, typename impl::create_diff_variable_vector_functor< ValueVector>::result_type>
inlinenodiscard

Create a vector of variables.

Template Parameters
ValueVectorType of vectors of values.
Parameters
[in]value_vecVector of values.
Returns
Vector of variables.

Definition at line 144 of file create_diff_variable.h.

◆ exp()

template<typename Value , typename Diff >
auto num_collect::auto_diff::forward::exp ( const variable< Value, Diff > & x) -> variable<Value, Diff>
inlinenodiscard

Calculate exponential.

Template Parameters
ValueType of values.
DiffType of differential coefficients.
Parameters
[in]xArgument.
Returns
Value.

Definition at line 61 of file variable_math.h.

◆ log()

template<typename Value , typename Diff >
auto num_collect::auto_diff::forward::log ( const variable< Value, Diff > & x) -> variable<Value, Diff>
inlinenodiscard

Calculate logarithm.

Template Parameters
ValueType of values.
DiffType of differential coefficients.
Parameters
[in]xArgument.
Returns
Value.

Definition at line 77 of file variable_math.h.

◆ make_jacobian()

template<base::concepts::dense_vector VectorType>
auto num_collect::auto_diff::forward::make_jacobian ( const Eigen::MatrixBase< VectorType > & vector) -> Eigen::CwiseNullaryOp<impl::make_jacobian_functor<VectorType>, typename impl::make_jacobian_functor<VectorType>::result_type>
inlinenodiscard

Make Jacobian from a vector of variables.

Template Parameters
VectorTypeType of vectors of variables.
Parameters
[in]vectorVector of variables.
Returns
Jacobian.

Definition at line 100 of file make_jacobian.h.

◆ operator*() [1/3]

template<typename Value , typename Diff >
auto num_collect::auto_diff::forward::operator* ( const Value & left,
const variable< Value, Diff > & right ) -> variable<Value, Diff>
inlinenodiscard

Multiply two variables.

Template Parameters
ValueType of value.
DiffType of differential coefficients.
Parameters
[in]leftLeft-hand-side variable.
[in]rightRight-hand-side variable.
Returns
Product.

Definition at line 320 of file variable.h.

◆ operator*() [2/3]

template<typename Value , typename Diff >
auto num_collect::auto_diff::forward::operator* ( const variable< Value, Diff > & left,
const Value & right ) -> variable<Value, Diff>
inlinenodiscard

Multiply two variables.

Template Parameters
ValueType of value.
DiffType of differential coefficients.
Parameters
[in]leftLeft-hand-side variable.
[in]rightRight-hand-side variable.
Returns
Product.

Definition at line 335 of file variable.h.

◆ operator*() [3/3]

template<typename Value , typename Diff >
auto num_collect::auto_diff::forward::operator* ( const variable< Value, Diff > & left,
const variable< Value, Diff > & right ) -> variable<Value, Diff>
inlinenodiscard

Multiply two variables.

Template Parameters
ValueType of value.
DiffType of differential coefficients.
Parameters
[in]leftLeft-hand-side variable.
[in]rightRight-hand-side variable.
Returns
Product.

Definition at line 305 of file variable.h.

◆ operator+() [1/3]

template<typename Value , typename Diff >
auto num_collect::auto_diff::forward::operator+ ( const Value & left,
const variable< Value, Diff > & right ) -> variable<Value, Diff>
inlinenodiscard

Add two variables.

Template Parameters
ValueType of value.
DiffType of differential coefficients.
Parameters
[in]leftLeft-hand-side variable.
[in]rightRight-hand-side variable.
Returns
Sum.

Definition at line 230 of file variable.h.

◆ operator+() [2/3]

template<typename Value , typename Diff >
auto num_collect::auto_diff::forward::operator+ ( const variable< Value, Diff > & left,
const Value & right ) -> variable<Value, Diff>
inlinenodiscard

Add two variables.

Template Parameters
ValueType of value.
DiffType of differential coefficients.
Parameters
[in]leftLeft-hand-side variable.
[in]rightRight-hand-side variable.
Returns
Sum.

Definition at line 245 of file variable.h.

◆ operator+() [3/3]

template<typename Value , typename Diff >
auto num_collect::auto_diff::forward::operator+ ( const variable< Value, Diff > & left,
const variable< Value, Diff > & right ) -> variable<Value, Diff>
inlinenodiscard

Add two variables.

Template Parameters
ValueType of value.
DiffType of differential coefficients.
Parameters
[in]leftLeft-hand-side variable.
[in]rightRight-hand-side variable.
Returns
Sum.

Definition at line 215 of file variable.h.

◆ operator-() [1/3]

template<typename Value , typename Diff >
auto num_collect::auto_diff::forward::operator- ( const Value & left,
const variable< Value, Diff > & right ) -> variable<Value, Diff>
inlinenodiscard

Subtract a variable from another variable.

Template Parameters
ValueType of value.
DiffType of differential coefficients.
Parameters
[in]leftLeft-hand-side variable.
[in]rightRight-hand-side variable.
Returns
Difference.

Definition at line 275 of file variable.h.

◆ operator-() [2/3]

template<typename Value , typename Diff >
auto num_collect::auto_diff::forward::operator- ( const variable< Value, Diff > & left,
const Value & right ) -> variable<Value, Diff>
inlinenodiscard

Subtract a variable from another variable.

Template Parameters
ValueType of value.
DiffType of differential coefficients.
Parameters
[in]leftLeft-hand-side variable.
[in]rightRight-hand-side variable.
Returns
Difference.

Definition at line 290 of file variable.h.

◆ operator-() [3/3]

template<typename Value , typename Diff >
auto num_collect::auto_diff::forward::operator- ( const variable< Value, Diff > & left,
const variable< Value, Diff > & right ) -> variable<Value, Diff>
inlinenodiscard

Subtract a variable from another variable.

Template Parameters
ValueType of value.
DiffType of differential coefficients.
Parameters
[in]leftLeft-hand-side variable.
[in]rightRight-hand-side variable.
Returns
Difference.

Definition at line 260 of file variable.h.

◆ operator/() [1/3]

template<typename Value , typename Diff >
auto num_collect::auto_diff::forward::operator/ ( const Value & left,
const variable< Value, Diff > & right ) -> variable<Value, Diff>
inlinenodiscard

Divide a variable by another variable.

Template Parameters
ValueType of value.
DiffType of differential coefficients.
Parameters
[in]leftLeft-hand-side variable.
[in]rightRight-hand-side variable.
Returns
Quotient.

Definition at line 365 of file variable.h.

◆ operator/() [2/3]

template<typename Value , typename Diff >
auto num_collect::auto_diff::forward::operator/ ( const variable< Value, Diff > & left,
const Value & right ) -> variable<Value, Diff>
inlinenodiscard

Divide a variable by another variable.

Template Parameters
ValueType of value.
DiffType of differential coefficients.
Parameters
[in]leftLeft-hand-side variable.
[in]rightRight-hand-side variable.
Returns
Quotient.

Definition at line 380 of file variable.h.

◆ operator/() [3/3]

template<typename Value , typename Diff >
auto num_collect::auto_diff::forward::operator/ ( const variable< Value, Diff > & left,
const variable< Value, Diff > & right ) -> variable<Value, Diff>
inlinenodiscard

Divide a variable by another variable.

Template Parameters
ValueType of value.
DiffType of differential coefficients.
Parameters
[in]leftLeft-hand-side variable.
[in]rightRight-hand-side variable.
Returns
Quotient.

Definition at line 350 of file variable.h.

◆ sqrt()

template<typename Value , typename Diff >
auto num_collect::auto_diff::forward::sqrt ( const variable< Value, Diff > & x) -> variable<Value, Diff>
inlinenodiscard

Calculate square root.

Template Parameters
ValueType of values.
DiffType of differential coefficients.
Parameters
[in]xArgument.
Returns
Value.

Definition at line 93 of file variable_math.h.