Public Types | Public Member Functions | Protected Attributes | Friends | List of all members
Eigen::AutoDiffScalar Class Reference

A scalar type replacement with automatic differentiation capability. More...

#include <AutoDiffScalar.h>

Public Types

typedef internal::auto_diff_special_op< DerivativeType, !internal::is_same< typename internal::traits< typename internal::remove_all< DerivativeType >::type >::Scalar, typename NumTraits< typename internal::traits< typename internal::remove_all< DerivativeType >::type >::Scalar >::Real >::valueBase
 
typedef internal::remove_all< DerivativeType >::type DerType
 
typedef NumTraits< Scalar >::Real Real
 
typedef internal::traits< DerType >::Scalar Scalar
 

Public Member Functions

 AutoDiffScalar ()
 
 AutoDiffScalar (const AutoDiffScalar &other)
 
template<typename OtherDerType >
 AutoDiffScalar (const AutoDiffScalar< OtherDerType > &other, typename internal::enable_if< internal::is_same< Scalar, typename internal::traits< typename internal::remove_all< OtherDerType >::type >::Scalar >::value &&internal::is_convertible< OtherDerType, DerType >::value, void * >::type=0)
 
 AutoDiffScalar (const Real &value)
 
 AutoDiffScalar (const Scalar &value, const DerType &der)
 
 AutoDiffScalar (const Scalar &value, int nbDer, int derNumber)
 
DerTypederivatives ()
 
const DerTypederivatives () const
 
template<typename OtherDerType >
bool operator!= (const AutoDiffScalar< OtherDerType > &b) const
 
bool operator!= (const Scalar &other) const
 
template<typename OtherDerType >
const AutoDiffScalar< CwiseBinaryOp< internal::scalar_sum_op< Scalar >, const EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(DerType, Scalar, product), const EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(typename internal::remove_all< OtherDerType >::type, Scalar, product) > > operator* (const AutoDiffScalar< OtherDerType > &other) const
 
const AutoDiffScalar< EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(DerType, Scalar, product) > operator* (const Scalar &other) const
 
template<typename OtherDerType >
AutoDiffScalaroperator*= (const AutoDiffScalar< OtherDerType > &other)
 
AutoDiffScalaroperator*= (const Scalar &other)
 
template<typename OtherDerType >
const AutoDiffScalar< CwiseBinaryOp< internal::scalar_sum_op< Scalar >, const DerType, const typename internal::remove_all< OtherDerType >::type > > operator+ (const AutoDiffScalar< OtherDerType > &other) const
 
const AutoDiffScalar< DerType & > operator+ (const Scalar &other) const
 
template<typename OtherDerType >
AutoDiffScalaroperator+= (const AutoDiffScalar< OtherDerType > &other)
 
AutoDiffScalaroperator+= (const Scalar &other)
 
const AutoDiffScalar< CwiseUnaryOp< internal::scalar_opposite_op< Scalar >, const DerType > > operator- () const
 
template<typename OtherDerType >
const AutoDiffScalar< CwiseBinaryOp< internal::scalar_difference_op< Scalar >, const DerType, const typename internal::remove_all< OtherDerType >::type > > operator- (const AutoDiffScalar< OtherDerType > &other) const
 
const AutoDiffScalar< DerType & > operator- (const Scalar &b) const
 
template<typename OtherDerType >
AutoDiffScalaroperator-= (const AutoDiffScalar< OtherDerType > &other)
 
AutoDiffScalaroperator-= (const Scalar &other)
 
template<typename OtherDerType >
const AutoDiffScalar< EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(CwiseBinaryOp< internal::scalar_difference_op< Scalar > EIGEN_COMMA const EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(DerType, Scalar, product) EIGEN_COMMA const EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(typename internal::remove_all< OtherDerType >::type, Scalar, product) >, Scalar, product) > operator/ (const AutoDiffScalar< OtherDerType > &other) const
 
const AutoDiffScalar< EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(DerType, Scalar, product) > operator/ (const Scalar &other) const
 
template<typename OtherDerType >
AutoDiffScalaroperator/= (const AutoDiffScalar< OtherDerType > &other)
 
AutoDiffScalaroperator/= (const Scalar &other)
 
template<typename OtherDerType >
bool operator< (const AutoDiffScalar< OtherDerType > &b) const
 
bool operator< (const Scalar &other) const
 
template<typename OtherDerType >
bool operator<= (const AutoDiffScalar< OtherDerType > &b) const
 
bool operator<= (const Scalar &other) const
 
AutoDiffScalaroperator= (const AutoDiffScalar &other)
 
template<typename OtherDerType >
AutoDiffScalaroperator= (const AutoDiffScalar< OtherDerType > &other)
 
AutoDiffScalaroperator= (const Scalar &other)
 
template<typename OtherDerType >
bool operator== (const AutoDiffScalar< OtherDerType > &b) const
 
bool operator== (const Scalar &other) const
 
template<typename OtherDerType >
bool operator> (const AutoDiffScalar< OtherDerType > &b) const
 
bool operator> (const Scalar &other) const
 
template<typename OtherDerType >
bool operator>= (const AutoDiffScalar< OtherDerType > &b) const
 
bool operator>= (const Scalar &other) const
 
Scalarvalue ()
 
const Scalarvalue () const
 

Protected Attributes

DerType m_derivatives
 
Scalar m_value
 

Friends

bool operator!= (const Scalar &a, const AutoDiffScalar &b)
 
const friend AutoDiffScalar< EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(DerType, Scalar, product) > operator* (const Scalar &other, const AutoDiffScalar &a)
 
const friend AutoDiffScalar< DerType & > operator+ (const Scalar &a, const AutoDiffScalar &b)
 
const friend AutoDiffScalar< CwiseUnaryOp< internal::scalar_opposite_op< Scalar >, const DerType > > operator- (const Scalar &a, const AutoDiffScalar &b)
 
const friend AutoDiffScalar< EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(DerType, Scalar, product) > operator/ (const Scalar &other, const AutoDiffScalar &a)
 
bool operator< (const Scalar &a, const AutoDiffScalar &b)
 
std::ostream & operator<< (std::ostream &s, const AutoDiffScalar &a)
 
bool operator<= (const Scalar &a, const AutoDiffScalar &b)
 
bool operator== (const Scalar &a, const AutoDiffScalar &b)
 
bool operator> (const Scalar &a, const AutoDiffScalar &b)
 
bool operator>= (const Scalar &a, const AutoDiffScalar &b)
 

Detailed Description

A scalar type replacement with automatic differentiation capability.

Parameters
DerivativeTypethe vector type used to store/represent the derivatives. The base scalar type as well as the number of derivatives to compute are determined from this type. Typical choices include, e.g., Vector4f for 4 derivatives, or VectorXf if the number of derivatives is not known at compile time, and/or, the number of derivatives is large. Note that DerivativeType can also be a reference (e.g., VectorXf&) to wrap a existing vector into an AutoDiffScalar. Finally, DerivativeType can also be any Eigen compatible expression.

This class represents a scalar value while tracking its respective derivatives using Eigen's expression template mechanism.

It supports the following list of global math function:

AutoDiffScalar can be used as the scalar type of an Eigen::Matrix object. However, in that case, the expression template mechanism only occurs at the top Matrix level, while derivatives are computed right away.

Definition at line 33 of file AutoDiffScalar.h.

Member Typedef Documentation

◆ Base

typedef internal::auto_diff_special_op<DerivativeType, !internal::is_same<typename internal::traits<typename internal::remove_all<DerivativeType>::type>::Scalar, typename NumTraits<typename internal::traits<typename internal::remove_all<DerivativeType>::type>::Scalar>::Real>::value> Eigen::AutoDiffScalar::Base

Definition at line 75 of file AutoDiffScalar.h.

◆ DerType

Definition at line 76 of file AutoDiffScalar.h.

◆ Real

Definition at line 78 of file AutoDiffScalar.h.

◆ Scalar

Definition at line 77 of file AutoDiffScalar.h.

Constructor & Destructor Documentation

◆ AutoDiffScalar() [1/6]

Eigen::AutoDiffScalar::AutoDiffScalar ( )
inline

Default constructor without any initialization.

Definition at line 84 of file AutoDiffScalar.h.

◆ AutoDiffScalar() [2/6]

Eigen::AutoDiffScalar::AutoDiffScalar ( const Scalar value,
int  nbDer,
int  derNumber 
)
inline

Constructs an active scalar from its value, and initializes the nbDer derivatives such that it corresponds to the derNumber -th variable

Definition at line 88 of file AutoDiffScalar.h.

◆ AutoDiffScalar() [3/6]

Eigen::AutoDiffScalar::AutoDiffScalar ( const Real value)
inline

Conversion from a scalar constant to an active scalar. The derivatives are set to zero.

Definition at line 96 of file AutoDiffScalar.h.

◆ AutoDiffScalar() [4/6]

Eigen::AutoDiffScalar::AutoDiffScalar ( const Scalar value,
const DerType der 
)
inline

Constructs an active scalar from its value and derivatives der

Definition at line 104 of file AutoDiffScalar.h.

◆ AutoDiffScalar() [5/6]

template<typename OtherDerType >
Eigen::AutoDiffScalar::AutoDiffScalar ( const AutoDiffScalar< OtherDerType > &  other,
typename internal::enable_if< internal::is_same< Scalar, typename internal::traits< typename internal::remove_all< OtherDerType >::type >::Scalar >::value &&internal::is_convertible< OtherDerType, DerType >::value, void * >::type  = 0 
)
inline

Definition at line 109 of file AutoDiffScalar.h.

◆ AutoDiffScalar() [6/6]

Eigen::AutoDiffScalar::AutoDiffScalar ( const AutoDiffScalar other)
inline

Definition at line 124 of file AutoDiffScalar.h.

Member Function Documentation

◆ derivatives() [1/2]

DerType& Eigen::AutoDiffScalar::derivatives ( )
inline

Definition at line 158 of file AutoDiffScalar.h.

◆ derivatives() [2/2]

const DerType& Eigen::AutoDiffScalar::derivatives ( ) const
inline

Definition at line 157 of file AutoDiffScalar.h.

◆ operator!=() [1/2]

template<typename OtherDerType >
bool Eigen::AutoDiffScalar::operator!= ( const AutoDiffScalar< OtherDerType > &  b) const
inline

Definition at line 179 of file AutoDiffScalar.h.

◆ operator!=() [2/2]

bool Eigen::AutoDiffScalar::operator!= ( const Scalar other) const
inline

Definition at line 165 of file AutoDiffScalar.h.

◆ operator*() [1/2]

template<typename OtherDerType >
const AutoDiffScalar<CwiseBinaryOp<internal::scalar_sum_op<Scalar>, const EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(DerType,Scalar,product), const EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(typename internal::remove_all<OtherDerType>::type,Scalar,product) > > Eigen::AutoDiffScalar::operator* ( const AutoDiffScalar< OtherDerType > &  other) const
inline

Definition at line 343 of file AutoDiffScalar.h.

◆ operator*() [2/2]

const AutoDiffScalar<EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(DerType,Scalar,product) > Eigen::AutoDiffScalar::operator* ( const Scalar other) const
inline

Definition at line 270 of file AutoDiffScalar.h.

◆ operator*=() [1/2]

template<typename OtherDerType >
AutoDiffScalar& Eigen::AutoDiffScalar::operator*= ( const AutoDiffScalar< OtherDerType > &  other)
inline

Definition at line 358 of file AutoDiffScalar.h.

◆ operator*=() [2/2]

AutoDiffScalar& Eigen::AutoDiffScalar::operator*= ( const Scalar other)
inline

Definition at line 351 of file AutoDiffScalar.h.

◆ operator+() [1/2]

template<typename OtherDerType >
const AutoDiffScalar<CwiseBinaryOp<internal::scalar_sum_op<Scalar>,const DerType,const typename internal::remove_all<OtherDerType>::type> > Eigen::AutoDiffScalar::operator+ ( const AutoDiffScalar< OtherDerType > &  other) const
inline

Definition at line 209 of file AutoDiffScalar.h.

◆ operator+() [2/2]

const AutoDiffScalar<DerType&> Eigen::AutoDiffScalar::operator+ ( const Scalar other) const
inline

Definition at line 181 of file AutoDiffScalar.h.

◆ operator+=() [1/2]

template<typename OtherDerType >
AutoDiffScalar& Eigen::AutoDiffScalar::operator+= ( const AutoDiffScalar< OtherDerType > &  other)
inline

Definition at line 219 of file AutoDiffScalar.h.

◆ operator+=() [2/2]

AutoDiffScalar& Eigen::AutoDiffScalar::operator+= ( const Scalar other)
inline

Definition at line 201 of file AutoDiffScalar.h.

◆ operator-() [1/3]

const AutoDiffScalar<CwiseUnaryOp<internal::scalar_opposite_op<Scalar>, const DerType> > Eigen::AutoDiffScalar::operator- ( ) const
inline

Definition at line 262 of file AutoDiffScalar.h.

◆ operator-() [2/3]

template<typename OtherDerType >
const AutoDiffScalar<CwiseBinaryOp<internal::scalar_difference_op<Scalar>, const DerType,const typename internal::remove_all<OtherDerType>::type> > Eigen::AutoDiffScalar::operator- ( const AutoDiffScalar< OtherDerType > &  other) const
inline

Definition at line 245 of file AutoDiffScalar.h.

◆ operator-() [3/3]

const AutoDiffScalar<DerType&> Eigen::AutoDiffScalar::operator- ( const Scalar b) const
inline

Definition at line 225 of file AutoDiffScalar.h.

◆ operator-=() [1/2]

template<typename OtherDerType >
AutoDiffScalar& Eigen::AutoDiffScalar::operator-= ( const AutoDiffScalar< OtherDerType > &  other)
inline

Definition at line 255 of file AutoDiffScalar.h.

◆ operator-=() [2/2]

AutoDiffScalar& Eigen::AutoDiffScalar::operator-= ( const Scalar other)
inline

Definition at line 237 of file AutoDiffScalar.h.

◆ operator/() [1/2]

Definition at line 330 of file AutoDiffScalar.h.

◆ operator/() [2/2]

const AutoDiffScalar<EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(DerType,Scalar,product) > Eigen::AutoDiffScalar::operator/ ( const Scalar other) const
inline

Definition at line 298 of file AutoDiffScalar.h.

◆ operator/=() [1/2]

template<typename OtherDerType >
AutoDiffScalar& Eigen::AutoDiffScalar::operator/= ( const AutoDiffScalar< OtherDerType > &  other)
inline

Definition at line 371 of file AutoDiffScalar.h.

◆ operator/=() [2/2]

AutoDiffScalar& Eigen::AutoDiffScalar::operator/= ( const Scalar other)
inline

Definition at line 364 of file AutoDiffScalar.h.

◆ operator<() [1/2]

template<typename OtherDerType >
bool Eigen::AutoDiffScalar::operator< ( const AutoDiffScalar< OtherDerType > &  b) const
inline

Definition at line 174 of file AutoDiffScalar.h.

◆ operator<() [2/2]

bool Eigen::AutoDiffScalar::operator< ( const Scalar other) const
inline

Definition at line 160 of file AutoDiffScalar.h.

◆ operator<=() [1/2]

template<typename OtherDerType >
bool Eigen::AutoDiffScalar::operator<= ( const AutoDiffScalar< OtherDerType > &  b) const
inline

Definition at line 175 of file AutoDiffScalar.h.

◆ operator<=() [2/2]

bool Eigen::AutoDiffScalar::operator<= ( const Scalar other) const
inline

Definition at line 161 of file AutoDiffScalar.h.

◆ operator=() [1/3]

AutoDiffScalar& Eigen::AutoDiffScalar::operator= ( const AutoDiffScalar other)
inline

Definition at line 136 of file AutoDiffScalar.h.

◆ operator=() [2/3]

template<typename OtherDerType >
AutoDiffScalar& Eigen::AutoDiffScalar::operator= ( const AutoDiffScalar< OtherDerType > &  other)
inline

Definition at line 129 of file AutoDiffScalar.h.

◆ operator=() [3/3]

AutoDiffScalar& Eigen::AutoDiffScalar::operator= ( const Scalar other)
inline

Definition at line 143 of file AutoDiffScalar.h.

◆ operator==() [1/2]

template<typename OtherDerType >
bool Eigen::AutoDiffScalar::operator== ( const AutoDiffScalar< OtherDerType > &  b) const
inline

Definition at line 178 of file AutoDiffScalar.h.

◆ operator==() [2/2]

bool Eigen::AutoDiffScalar::operator== ( const Scalar other) const
inline

Definition at line 164 of file AutoDiffScalar.h.

◆ operator>() [1/2]

template<typename OtherDerType >
bool Eigen::AutoDiffScalar::operator> ( const AutoDiffScalar< OtherDerType > &  b) const
inline

Definition at line 176 of file AutoDiffScalar.h.

◆ operator>() [2/2]

bool Eigen::AutoDiffScalar::operator> ( const Scalar other) const
inline

Definition at line 162 of file AutoDiffScalar.h.

◆ operator>=() [1/2]

template<typename OtherDerType >
bool Eigen::AutoDiffScalar::operator>= ( const AutoDiffScalar< OtherDerType > &  b) const
inline

Definition at line 177 of file AutoDiffScalar.h.

◆ operator>=() [2/2]

bool Eigen::AutoDiffScalar::operator>= ( const Scalar other) const
inline

Definition at line 163 of file AutoDiffScalar.h.

◆ value() [1/2]

Scalar& Eigen::AutoDiffScalar::value ( )
inline

Definition at line 155 of file AutoDiffScalar.h.

◆ value() [2/2]

const Scalar& Eigen::AutoDiffScalar::value ( ) const
inline

Definition at line 154 of file AutoDiffScalar.h.

Friends And Related Function Documentation

◆ operator!=

bool operator!= ( const Scalar a,
const AutoDiffScalar b 
)
friend

Definition at line 172 of file AutoDiffScalar.h.

◆ operator*

const friend AutoDiffScalar<EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(DerType,Scalar,product) > operator* ( const Scalar other,
const AutoDiffScalar a 
)
friend

Definition at line 276 of file AutoDiffScalar.h.

◆ operator+

const friend AutoDiffScalar<DerType&> operator+ ( const Scalar a,
const AutoDiffScalar b 
)
friend

Definition at line 186 of file AutoDiffScalar.h.

◆ operator-

const friend AutoDiffScalar<CwiseUnaryOp<internal::scalar_opposite_op<Scalar>, const DerType> > operator- ( const Scalar a,
const AutoDiffScalar b 
)
friend

Definition at line 231 of file AutoDiffScalar.h.

◆ operator/

const friend AutoDiffScalar<EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(DerType,Scalar,product) > operator/ ( const Scalar other,
const AutoDiffScalar a 
)
friend

Definition at line 304 of file AutoDiffScalar.h.

◆ operator<

bool operator< ( const Scalar a,
const AutoDiffScalar b 
)
friend

Definition at line 167 of file AutoDiffScalar.h.

◆ operator<<

std::ostream& operator<< ( std::ostream &  s,
const AutoDiffScalar a 
)
friend

Definition at line 119 of file AutoDiffScalar.h.

◆ operator<=

bool operator<= ( const Scalar a,
const AutoDiffScalar b 
)
friend

Definition at line 168 of file AutoDiffScalar.h.

◆ operator==

bool operator== ( const Scalar a,
const AutoDiffScalar b 
)
friend

Definition at line 171 of file AutoDiffScalar.h.

◆ operator>

bool operator> ( const Scalar a,
const AutoDiffScalar b 
)
friend

Definition at line 169 of file AutoDiffScalar.h.

◆ operator>=

bool operator>= ( const Scalar a,
const AutoDiffScalar b 
)
friend

Definition at line 170 of file AutoDiffScalar.h.

Member Data Documentation

◆ m_derivatives

DerType Eigen::AutoDiffScalar::m_derivatives
protected

Definition at line 379 of file AutoDiffScalar.h.

◆ m_value

Scalar Eigen::AutoDiffScalar::m_value
protected

Definition at line 378 of file AutoDiffScalar.h.


The documentation for this class was generated from the following file:


gtsam
Author(s):
autogenerated on Fri Nov 1 2024 03:44:25