Enable Use of Eigen Linear Algebra Package with CppAD

Syntax
# include <cppad/example/cppad_eigen.hpp>

Purpose
Enables the use of the eigen linear algebra package with the type AD<Base> ; see custom scalar types .

Example
The files eigen_array.cpp and eigen_det.cpp contain an example and test of this include file. They return true if they succeed and false otherwise.

Include Files
The file cppad_eigen.hpp includes both <cppad/cppad.hpp> and <Eigen/Core>. The file eigen_plugin.hpp defines value_type in the Eigen matrix class so its vectors are simple vectors (not necessary for eigen-3.3.3 and later).

# include <Eigen/Core>


Eigen NumTraits
Eigen needs the following definitions to work properly with AD<Base> scalars:
namespace Eigen {
{     // type that corresponds to the real part of an AD<Base> value
// type for AD<Base> operations that result in non-integer values
//  type to use for numeric literals such as "2" or "0.5".
// type for nested value inside an AD<Base> expression tree

enum {
// does not support complex Base types
IsComplex             = 0 ,
// does not support integer Base types
IsInteger             = 0 ,
// only support signed Base types
IsSigned              = 1 ,
// must initialize an AD<Base> object
RequireInitialization = 1 ,
// computational cost of the corresponding operations
MulCost               = 2
};

// machine epsilon with type of real part of x
// (use assumption that Base is not complex)

// relaxed version of machine epsilon for comparison of different
// operations that should result in the same value
{     return 100. *
}

// minimum normalized positive value

// maximum finite value

// number of decimal digits that can be represented without change.
static int digits10(void)
};
}

Eigen also needs the following definitions to work properly with AD<Base> scalars:
namespace CppAD {
// functions that return references