cppduals  0.5.4
Dual numbers for C++
Public Types | Public Member Functions | Private Attributes | List of all members
duals::dual< T > Class Template Reference
Collaboration diagram for duals::dual< T >:
[legend]

Public Types

typedef T value_type
 

Public Member Functions

constexpr dual (const value_type re=value_type(), const value_type du=value_type())
 Construct dual from optional real and dual parts.
 
template<class X , CPPDUALS_ONLY_SAME_DEPTH_AS_T(T, X) , CPPDUALS_ENABLE_IF(!is_complex< X >::value) >
 dual (const dual< X > &x)
 Copy construct from a dual of equal depth.
 
 operator std::complex< dual< T >> ()
 Cast to a complex<dual<>> with real part equal to *this.
 
template<class X , CPPDUALS_ENABLE_IF(std::is_arithmetic< X >::value &&!is_dual< X >::value) >
 operator X () const
 Explicit cast to an arithmetic type retains the rpart()
 
rpart () const
 Get the real part.
 
dpart () const
 Get the dual part.
 
void rpart (value_type re)
 Set the real part.
 
void dpart (value_type du)
 Get the dual part.
 
dual< T > operator- () const
 Unary negation.
 
dual< T > operator+ () const
 Unary nothing.
 
dual< T > & operator= (const T &x)
 Assignment of value_type assigns the real part and zeros the dual part.
 
dual< T > & operator+= (const T &x)
 Add a relatively-scalar to this dual.
 
dual< T > & operator-= (const T &x)
 Subtract a relatively-scalar from this dual.
 
dual< T > & operator*= (const T &x)
 Multiply a relatively-scalar with this dual.
 
dual< T > & operator/= (const T &x)
 Divide this dual by relatively-scalar.
 
template<class X , CPPDUALS_ONLY_SAME_DEPTH_AS_T(T, X) >
dual< T > & operator= (const dual< X > &x)
 
template<class X , CPPDUALS_ONLY_SAME_DEPTH_AS_T(T, X) >
dual< T > & operator+= (const dual< X > &x)
 Add a dual of the same depth to this dual.
 
template<class X , CPPDUALS_ONLY_SAME_DEPTH_AS_T(T, X) >
dual< T > & operator-= (const dual< X > &x)
 Subtract a dual of the same depth from this dual.
 
template<class X , CPPDUALS_ONLY_SAME_DEPTH_AS_T(T, X) >
dual< T > & operator*= (const dual< X > &x)
 Multiply this dual with a dual of same depth.
 
template<class X , CPPDUALS_ONLY_SAME_DEPTH_AS_T(T, X) >
dual< T > & operator/= (const dual< X > &x)
 Divide this dual by another dual of the same or lower depth.
 

Private Attributes

value_type _real
 The real part.
 
value_type _dual
 The dual part.
 

Detailed Description

template<class T>
class duals::dual< T >

Abstract dual number class. Can nest with other dual numbers and complex numbers.

Definition at line 508 of file dual.

Member Typedef Documentation

◆ value_type

template<class T>
typedef T duals::dual< T >::value_type

Class type of rpart() and dpart(). This type can be nested dual<> or std::complex<>.

Definition at line 513 of file dual.


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