Theoretica
A C++ numerical and automatic mathematical library
|
Multidual number algebra for functions of the form \(f: \mathbb{R}^n \rightarrow \mathbb{R}\). More...
#include <multidual.h>
Public Member Functions | |
multidual () | |
Construct a multidual number as \((0 + \vec 0)\). | |
multidual (real r, vec< real, N > u) | |
Construct a multidual number from a real number and an N dimensional vector. | |
multidual (real r) | |
Construct a multidual number from a real number. | |
multidual & | operator= (real x) |
Initialize a multidual number from a real number. | |
real | Re () const |
Get the real part. | |
real & | Re () |
Access the real part. | |
vec< real, N > | Dual () const |
Get the multidual part. | |
vec< real, N > & | Dual () |
Access the multidual part. | |
multidual | conjugate () const |
Get the multidual conjugate. | |
multidual | inverse () const |
Get the inverse of a multidual number. | |
multidual | operator+ () const |
Identity (for consistency) | |
multidual | operator+ (const multidual &other) const |
Sum two multidual numbers. | |
multidual | operator+ (real r) const |
Sum a real number to a multidual number. | |
multidual | operator- () const |
Get the opposite of a multidual number. | |
multidual | operator- (const multidual &other) const |
Subtract two multidual numbers. | |
multidual | operator- (real r) const |
Subtract a real number from a multidual number. | |
multidual | operator* (const multidual &other) const |
Multiply two multidual numbers. | |
multidual | operator* (real r) const |
Multiply a multidual number by a real number. | |
multidual | operator/ (const multidual &other) const |
Dual division. | |
multidual | operator/ (real r) const |
Divide a multidual number by a real number. | |
multidual & | operator+= (const multidual &other) |
Sum a real number to this one. | |
multidual & | operator+= (real r) |
Sum a real number to this multidual number. | |
multidual & | operator-= (const multidual &other) |
Subtract a real number from this one. | |
multidual & | operator-= (real r) |
Subtract a real number from this multidual number. | |
multidual & | operator*= (const multidual &other) |
Multiply this multidual number by another one. | |
multidual & | operator*= (real r) |
Multiply this multidual number by a real number. | |
multidual & | operator/= (const multidual &other) |
Divide this multidual number by another one. | |
multidual & | operator/= (real r) |
Divide a multidual number by a real number. | |
bool | operator== (const multidual &other) |
Check whether two multidual numbers have the same real and multidual parts. | |
unsigned int | size () const |
Get the number of independent variables associated with the multidual number. | |
void | resize (unsigned int size) |
Change the size of the dual part of the number (only for dynamically allocated vectors) | |
std::string | to_string (const std::string &epsilon="e") const |
Convert the multidual number to string representation. More... | |
operator std::string () | |
Convert the multidual number to string representation. | |
Static Public Member Functions | |
static vec< multidual< N >, N > | make_argument (const vec< real, N > &x) |
Construct an N-dimensional vector of multidual numbers to be passed as argument to a multidual function. More... | |
static vec< real, N > | extract_real (const vec< multidual< N >, N > &v) |
Extract the real vector from a vector of multidual numbers as a vec<real, N> | |
static mat< real, N, N > | extract_dual (const vec< multidual< N >, N > &v) |
Extract the dual matrix (Jacobian) from a vector of multidual numbers as a mat<N, N> | |
static void | extract (const vec< multidual< N >, N > &v, vec< real, N > &x, mat< real, N, N > &J) |
Extract the real vector and dual matrix from a vector of multidual numbers as a vec<real, N> and mat<real, N, N> | |
Public Attributes | |
real | a |
The real part of the multidimensional dual number. | |
vec< real, N > | v |
The dual part of the multidimensional dual number as a real vector. | |
Static Public Attributes | |
static constexpr size_t | vector_argument = N |
Friends | |
multidual | operator+ (real a, const multidual &d) |
multidual | operator- (real a, const multidual &d) |
multidual | operator* (real a, const multidual &d) |
multidual | operator/ (real a, const multidual &d) |
std::ostream & | operator<< (std::ostream &out, const multidual &obj) |
Stream the multidual number in string representation to an output stream (std::ostream) | |
Multidual number algebra for functions of the form \(f: \mathbb{R}^n \rightarrow \mathbb{R}\).
|
inlinestatic |
Construct an N-dimensional vector of multidual numbers to be passed as argument to a multidual function.
x | A vector of real numbers containing the variables to pass |
|
inline |
Convert the multidual number to string representation.
epsilon | The character to use to represent epsilon |