cppduals  0.5.4
Dual numbers for C++
Classes | Macros | Functions
dual_eigen File Reference

Nestable, vectorizable Dual numbers for Eigen. More...

#include "dual"
Include dependency graph for dual_eigen:

Go to the source code of this file.

Classes

struct  duals::CwiseRpartOp< ScalarSrc >
 
struct  duals::CwiseDpartOp< ScalarSrc >
 
struct  duals::CwiseDconjOp< Scalar >
 
struct  Eigen::NumTraits< duals::dual< T > >
 
struct  Eigen::ScalarBinaryOpTraits< duals::dual< T >, duals::dual< T >, BinaryOp >
 
struct  Eigen::ScalarBinaryOpTraits< duals::dual< T >, T, BinaryOp >
 
struct  Eigen::ScalarBinaryOpTraits< T, duals::dual< T >, BinaryOp >
 

Functions

template<typename XprType >
const RealType duals::rpart (const Eigen::EigenBase< XprType > &x)
 Extract the "real part" of a dual-valued matrix.
 
template<typename XprType >
const RealType duals::dpart (const Eigen::EigenBase< XprType > &x)
 Extract the "dual part" of a dual-valued matrix.
 
template<typename XprType >
const XprType duals::dconj (const Eigen::EigenBase< XprType > &x)
 Dual-conjugate a dual-valued matrix.
 

Detailed Description

Nestable, vectorizable Dual numbers for Eigen.

Include this file to enable use of the duals::dual<> class as a scalar type in Eigen. Some optimizations are performed using Eigen's vectorization facilities, which is particularly noticeable for multiplication and division. In certain cases the vectorization can be worse than the compiler's code, thus it can be disabled by #define CPPDUALS_DONT_VECTORIZE.

There is some also vectorization for dual-ized complex's (std::complex<duals::dual<T>>), which can be disabled by #define CPPDUALS_DONT_VECTORIZE_CDUAL.

The same type promotion that exists for duals::dual<T>: an operation between a 'scalar' T and dual<T> is promoted to dual<T>. This is enabled for Eigen matrices by default: multiplying an Eigen::Matrix<float> by 1_ef results in an expression with a basic POD type of Eigen::Matrix<duals::dual<float>,..>. This type of type promotion can be disabled (ie for correctness checking or to speed compilation) by #define CPPDUALS_NO_EIGEN_PROMOTION.

Definition in file dual_eigen.