|
Theoretica
Mathematical Library
|
Dual number class. More...
#include <dual.h>
Public Member Functions | |
| dual () | |
| Default constructor, initialize with null values. | |
| dual (real real_part, real dual_part) | |
| Initialize from two real numbers. | |
| dual (real real_part) | |
| Initialize from a real number. | |
| dual (const vec2 &v) | |
| Initialize from a vec2. | |
| dual & | operator= (const vec2 &v) |
| Initialize a dual number from a vec2. | |
| dual & | operator= (real x) |
| Initialize a dual number from a real number. | |
| dual & | operator= (const std::array< real, 2 > &v) |
| Initialize a dual number from a std::array. | |
| const real & | Re () const |
| Return real part. | |
| real & | Re () |
| Return real part. | |
| const real & | Dual () const |
| Return dual part. | |
| real & | Dual () |
| Return dual part. | |
| dual | conjugate () const |
| Get the dual conjugate. | |
| dual | inverse () const |
| Get the inverse of a dual number. | |
| dual | operator+ () const |
| Identity (for consistency) | |
| dual | operator+ (const dual &other) const |
| Sum two dual numbers. | |
| dual | operator+ (real r) const |
| Sum a real number to a dual number. | |
| dual | operator- () const |
| Get the opposite of a dual number. | |
| dual | operator- (const dual &other) const |
| Subtract two dual numbers. | |
| dual | operator- (real r) const |
| Subtract a real number from a dual number. | |
| dual | operator* (const dual &other) const |
| Multiply two dual numbers. | |
| dual | operator* (real r) const |
| Multiply a dual number by a real number. | |
| dual | operator/ (const dual &other) const |
| Dual division. | |
| dual | operator/ (real r) const |
| Divide a dual number by a real number. | |
| dual & | operator+= (const dual &other) |
| Add a dual number to this one. | |
| dual & | operator+= (real r) |
| Sum a real number to this dual number. | |
| dual & | operator-= (const dual &other) |
| Subtract a real number from this one. | |
| dual & | operator-= (real r) |
| Subtract a real number from this dual number. | |
| dual & | operator*= (const dual &other) |
| Multiply this dual number by another one. | |
| dual & | operator*= (real r) |
| Multiply this dual number by a real number. | |
| dual & | operator/= (const dual &other) |
| Divide this dual number by another one. | |
| dual & | operator/= (real r) |
| Divide a dual number by a real number. | |
| bool | operator== (const dual &other) |
| Check whether two dual numbers have the same real and dual parts. | |
| vec2 | to_vec () const |
| Convert a dual number to a vector. | |
| void | from_vec (const vec2 &v) |
| Initialize from a vector. | |
| mat2 | to_mat () const |
| Convert a dual number to matrix form. | |
| std::string | to_string (const std::string &epsilon="e") const |
| Convert the dual number to string representation. | |
| operator std::string () | |
| Convert the dual number to string representation. | |
Friends | |
| real | Re (const dual &d) |
| Extract the real part of the dual number. | |
| real & | Re (dual &d) |
| Extract the real part of the dual number. | |
| real | Dual (const dual &d) |
| Extract the real part of the dual number. | |
| real & | Dual (dual &d) |
| Extract the real part of the dual number. | |
| std::ostream & | operator<< (std::ostream &out, const dual &obj) |
| Stream the dual number in string representation to an output stream (std::ostream) | |
Dual number class.
Implemented as \(a + b \epsilon\) where \(\epsilon\) is such that \(\epsilon^2 = 0\)
|
inline |
Convert the dual number to string representation.
| epsilon | The character to use to represent epsilon |