autodiff_overloads.h File Reference

Overloads for STL mathematical operations on AutoDiffScalar. More...

#include <cmath>
#include <limits>
#include "drake/common/autodiffxd.h"
#include "drake/common/cond.h"
#include "drake/common/drake_assert.h"
#include "drake/common/dummy_value.h"
Include dependency graph for autodiff_overloads.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


struct  dummy_value< Eigen::AutoDiffScalar< DerType > >
 Specializes common/dummy_value.h. More...




template<typename DerType >
double round (const Eigen::AutoDiffScalar< DerType > &x)
 Overloads round to mimic std::round from <cmath>. More...
template<typename DerType >
bool isinf (const Eigen::AutoDiffScalar< DerType > &x)
 Overloads isinf to mimic std::isinf from <cmath>. More...
template<typename DerType >
bool isnan (const Eigen::AutoDiffScalar< DerType > &x)
 Overloads isnan to mimic std::isnan from <cmath>. More...
template<typename DerType >
double floor (const Eigen::AutoDiffScalar< DerType > &x)
 Overloads floor to mimic std::floor from <cmath>. More...
template<typename DerType >
double ceil (const Eigen::AutoDiffScalar< DerType > &x)
 Overloads ceil to mimic std::ceil from <cmath>. More...
template<typename DerType , typename T >
Eigen::AutoDiffScalar< DerType > copysign (const Eigen::AutoDiffScalar< DerType > &x, const T &y)
 Overloads copysign from <cmath>. More...
template<typename DerType >
double copysign (double x, const Eigen::AutoDiffScalar< DerType > &y)
 Overloads copysign from <cmath>. More...
template<typename DerTypeA , typename DerTypeB >
Eigen::AutoDiffScalar< typename internal::remove_all< DerTypeA >::type::PlainObject > pow (const Eigen::AutoDiffScalar< DerTypeA > &base, const Eigen::AutoDiffScalar< DerTypeB > &exponent)
 Overloads pow for an AutoDiffScalar base and exponent, implementing the chain rule. More...
template<typename DerType >
double ExtractDoubleOrThrow (const Eigen::AutoDiffScalar< DerType > &scalar)
 Returns the autodiff scalar's value() as a double. More...
template<typename DerType1 , typename DerType2 >
Eigen::AutoDiffScalar< typename Eigen::internal::remove_all< DerType1 >::type::PlainObject > if_then_else (bool f_cond, const Eigen::AutoDiffScalar< DerType1 > &x, const Eigen::AutoDiffScalar< DerType2 > &y)
 Provides if-then-else expression for Eigen::AutoDiffScalar type. More...
template<typename DerType , typename... Rest>
Eigen::AutoDiffScalar< typename Eigen::internal::remove_all< DerType >::type::PlainObject > cond (bool f_cond, const Eigen::AutoDiffScalar< DerType > &e_then, Rest...rest)
 Provides special case of cond expression for Eigen::AutoDiffScalar type. More...

Detailed Description

Overloads for STL mathematical operations on AutoDiffScalar.

Used via argument-dependent lookup (ADL). These functions appear in the Eigen namespace so that ADL can automatically choose between the STL version and the overloaded version to match the type of the arguments. The proper use would be e.g.

void mymethod() {
using std::isinf;


The if_then_else and cond functions for AutoDiffScalar are in namespace drake because cond is defined in namespace drake in "drake/common/cond.h" file.