Functions
Marmot::Math Namespace Reference

Functions

template<typename T >
bool isNaN (T x)
 
double linearInterpolation (double x, double x0, double x1, double y0, double y1)
 
double exp (double x)
 
int getExponentPowerTen (const double x)
 
constexpr double radToDeg (const double alpha)
 
constexpr double degToRad (const double alpha)
 
constexpr double macauly (double scalar)
 
constexpr int heaviside (double scalar)
 
template<typename T >
constexpr T sgn (T val)
 
double makeReal (const double &value)
 
double makeReal (const std::complex< double > &value)
 
double makeReal (const autodiff::real &value)
 
template<typename T , typename G >
double makeReal (const autodiff::detail::Dual< T, G > &number)
 
template<int nRows, int nCols>
Eigen::Matrix< double, nRows, nCols > macaulyMatrix (const Eigen::Matrix< double, nRows, nCols > &mat)
 
template<typename functionType , typename yType , typename... Args>
yType explicitEuler (yType yN, const double dt, functionType fRate, Args &&... fRateArgs)
 
template<int ySize, typename functionType , typename... Args>
Eigen::Matrix< double, ySize, 1 > semiImplicitEuler (Eigen::Matrix< double, ySize, 1 > yN, const double dt, functionType fRate, Args &&... fRateArgs)
 
template<int nRows, int nCols, typename functionType >
Eigen::Matrix< double, nRows, nCols > centralDiff (functionType f, const Eigen::Matrix< double, nCols, 1 > &X)
 
template<typename functionType , typename yType , typename... Args>
yType explicitEulerRichardson (yType yN, const double dt, functionType fRate, Args &&... fRateArgs)
 
template<int ySize, typename functionType , typename... Args>
std::tuple< Eigen::Matrix< double, ySize, 1 >, double > explicitEulerRichardsonWithErrorEstimator (Eigen::Matrix< double, ySize, 1 > yN, const double dt, const double TOL, functionType fRate, Args &&... fRateArgs)
 
Matrix3d directionCosines (const Matrix3d &transformedCoordinateSystem)
 
Matrix3d orthonormalCoordinateSystem (Vector3d &normalVector)
 
double makeReal (const autodiff::dual &value)
 

Function Documentation

◆ isNaN()

template<typename T >
bool Marmot::Math::isNaN ( x)

Check if value x is a valid floating point number

◆ linearInterpolation()

double Marmot::Math::linearInterpolation ( double  x,
double  x0,
double  x1,
double  y0,
double  y1 
)

Linear interpolation at location x between two points (x0|y0) and (x1|y1)

◆ exp()

double Marmot::Math::exp ( double  x)

exponential of value x with numerical limits check

◆ getExponentPowerTen()

int Marmot::Math::getExponentPowerTen ( const double  x)

compute the exponent to the power of ten of an expression, e.g., 5*10^5 --> return 5

◆ radToDeg()

constexpr double Marmot::Math::radToDeg ( const double  alpha)
constexpr

convert angle alpha in radiant to degree

◆ degToRad()

constexpr double Marmot::Math::degToRad ( const double  alpha)
constexpr

convert angle alpha in degree to radiant

◆ macauly()

constexpr double Marmot::Math::macauly ( double  scalar)
constexpr

Macaulay function applied to scalar

◆ heaviside()

constexpr int Marmot::Math::heaviside ( double  scalar)
constexpr

Heaviside function applied to scalar

◆ sgn()

template<typename T >
constexpr T Marmot::Math::sgn ( val)
constexpr

Extract sign of value val

◆ makeReal() [1/5]

double Marmot::Math::makeReal ( const double &  value)

◆ makeReal() [2/5]

double Marmot::Math::makeReal ( const std::complex< double > &  value)

◆ makeReal() [3/5]

double Marmot::Math::makeReal ( const autodiff::real &  value)

◆ makeReal() [4/5]

template<typename T , typename G >
double Marmot::Math::makeReal ( const autodiff::detail::Dual< T, G > &  number)

◆ macaulyMatrix()

template<int nRows, int nCols>
Eigen::Matrix< double, nRows, nCols > Marmot::Math::macaulyMatrix ( const Eigen::Matrix< double, nRows, nCols > &  mat)

apply Macaulay function to a matrix

Todo:
: Can be replaced easily with Eigen's array() functionality ???

◆ explicitEuler()

template<typename functionType , typename yType , typename... Args>
yType Marmot::Math::explicitEuler ( yType  yN,
const double  dt,
functionType  fRate,
Args &&...  fRateArgs 
)

Explicit Euler integration of function fRate taking arguments fRateArgs and initial value a yN

◆ semiImplicitEuler()

template<int ySize, typename functionType , typename... Args>
Eigen::Matrix< double, ySize, 1 > Marmot::Math::semiImplicitEuler ( Eigen::Matrix< double, ySize, 1 >  yN,
const double  dt,
functionType  fRate,
Args &&...  fRateArgs 
)

Semi-implicit Euler integration of function fRate taking arguments fRateArgs and initial value yN using central difference scheme for computing

Todo:

: Replace inverse bei solving equation system?

: Use external central difference function?

◆ centralDiff()

template<int nRows, int nCols, typename functionType >
Eigen::Matrix< double, nRows, nCols > Marmot::Math::centralDiff ( functionType  f,
const Eigen::Matrix< double, nCols, 1 > &  X 
)

returns central numerical differentiation of a vector-valued function f with respect to vector X --> use std::bind to create function f(x) from function with multiple arguments

◆ explicitEulerRichardson()

template<typename functionType , typename yType , typename... Args>
yType Marmot::Math::explicitEulerRichardson ( yType  yN,
const double  dt,
functionType  fRate,
Args &&...  fRateArgs 
)

Explicit Euler integration with Richardson extrapolation of function fRate taking arguments fRateArgs and initial value yN

◆ explicitEulerRichardsonWithErrorEstimator()

template<int ySize, typename functionType , typename... Args>
std::tuple< Eigen::Matrix< double, ySize, 1 >, double > Marmot::Math::explicitEulerRichardsonWithErrorEstimator ( Eigen::Matrix< double, ySize, 1 >  yN,
const double  dt,
const double  TOL,
functionType  fRate,
Args &&...  fRateArgs 
)

Explicit Euler integration with error estimation based on Richardson extrapolation of function fRate taking arguments fRateArgs and initial value yN .

◆ directionCosines()

Matrix3d Marmot::Math::directionCosines ( const Matrix3d transformedCoordinateSystem)

Computes the directional cosines between a transformed and the global cartesian coordinate system.

◆ orthonormalCoordinateSystem()

Matrix3d Marmot::Math::orthonormalCoordinateSystem ( Vector3d normalVector)

Computes an orthonormal coordinate system from an unit normal vector as \( x_1 \) - axis.

◆ makeReal() [5/5]

double Marmot::Math::makeReal ( const autodiff::dual &  value)