Drake
autodiff_overloads.h File Reference

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;
isinf(myval);
}

{}

Note
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.
#include <cmath>
#include <limits>
#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:

Namespaces

 drake
 

Functions

template<typename DerType >
double ExtractDoubleOrThrow (const Eigen::AutoDiffScalar< DerType > &scalar)
 Returns the autodiff scalar's value() as a double. More...
 
template<typename DerType , int RowsAtCompileTime, int ColsAtCompileTime, int Options, int MaxRowsAtCompileTime, int MaxColsAtCompileTime>
auto ExtractDoubleOrThrow (const Eigen::MatrixBase< Eigen::Matrix< Eigen::AutoDiffScalar< DerType >, RowsAtCompileTime, ColsAtCompileTime, Options, MaxRowsAtCompileTime, MaxColsAtCompileTime >> &matrix)
 Returns matrix as an Eigen::Matrix<double, ...> with the same size allocation as matrix. 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...