Developer documentation
Version 3.0.3-105-gd3941f44
MR::Math Namespace Reference

Namespaces

namespace  Bessel
 
namespace  Chebyshev
 
namespace  Gaussian
 
namespace  ICLS
 functionality for solving constrained least-squares problems
 
namespace  Legendre
 
namespace  Rician
 
namespace  Sech
 
namespace  SH
 
namespace  Sphere
 
namespace  Stats
 
namespace  ZSH
 

Classes

class  CubicSpline
 
class  GradientDescent
 Computes the minimum of a function using a gradient descent approach. More...
 
class  GradientDescentBB
 Computes the minimum of a function using a Barzilai Borwein gradient descent approach. ENH: implement stabilised version https://arxiv.org/abs/1907.06409. More...
 
class  Hermite
 
class  HermiteSpline
 
class  LinearUpdateBB
 
class  QuadraticLineSearch
 Computes the minimum of a 1D function using a quadratic line search. More...
 
class  RNG
 random number generator More...
 
class  Sinc
 
class  Sn_scale_estimator
 
class  UniformBSpline
 
class  Zstatistic
 

Enumerations

enum  SplineProcessingType { Value = 1 , Derivative = 2 , ValueAndDerivative = Value | Derivative }
 

Functions

double matrix_average (vector< Eigen::MatrixXd > const &mat_in, Eigen::MatrixXd &mat_avg, bool verbose=false)
 
default_type betaincreg (const default_type a, const default_type b, const default_type x)
 
float cauchy (float x, float s)
 
template<class Function >
Eigen::Matrix< typename Function::value_type, Eigen::Dynamic, Eigen::Dynamic > check_function_gradient (Function &function, Eigen::Matrix< typename Function::value_type, Eigen::Dynamic, 1 > x, typename Function::value_type increment, bool show_hessian=false, Eigen::Matrix< typename Function::value_type, Eigen::Dynamic, 1 > conditioner=Eigen::Matrix< typename Function::value_type, Eigen::Dynamic, 1 >())
 
template<class M >
default_type condition_number (const M &data)
 
default_type erfinv (const default_type)
 Compute the inverse of the error function. More...
 
default_type erfcinv (const default_type)
 Compute the inverse of the complementary error function. More...
 
template<typename T >
factorial (const T i)
 
template<class FunctionType , typename ValueType >
ValueType golden_section_search (FunctionType &function, const std::string &message, ValueType min_bound, ValueType init_estimate, ValueType max_bound, ValueType tolerance=0.01)
 Computes the minimum of a 1D function using a golden section search. More...
 
template<class MatrixType >
Eigen::Matrix< typename MatrixType::Scalar, Eigen::Dynamic, Eigen::Dynamic > pinv (const MatrixType &M)
 return Moore-Penrose pseudo-inverse of M More...
 
template<class MatrixType >
size_t rank (const MatrixType &M)
 
template<typename T >
constexpr T pow2 (const T &v)
 
template<typename T >
constexpr T pow3 (const T &v)
 
template<typename T >
constexpr T pow4 (const T &v)
 
template<typename T >
constexpr T pow5 (const T &v)
 
template<typename T >
constexpr T pow6 (const T &v)
 
template<typename T >
constexpr T pow7 (const T &v)
 
template<typename T >
constexpr T pow8 (const T &v)
 
template<typename T >
constexpr T pow9 (const T &v)
 
template<typename T >
constexpr T pow10 (const T &v)
 
template<typename I , typename T >
constexpr I round (const T x) throw ()
 
template<typename I , typename T >
constexpr I floor (const T x) throw ()
 template function with cast to different type More...
 
template<typename I , typename T >
constexpr I ceil (const T x) throw ()
 template function with cast to different type More...
 
template<class Container >
Container::value_type median (Container &list)
 
template<class MatrixType = Eigen::Matrix<default_type, 3, Eigen::Dynamic>, class VectorType = Eigen::Matrix<default_type, 3, 1>>
bool median_weiszfeld (const MatrixType &X, VectorType &median, const size_t numIter=300, const default_type precision=0.00001)
 
template<class Cont >
default_type polynomial (Cont &coeffs, const default_type x)
 Evaluate a polynomial expansion for a scalar term. More...
 
template<class VarArrayType , class CountArrayType >
default_type welch_satterthwaite (const VarArrayType &variances, const CountArrayType &counts)
 
default_type t2z (const default_type stat, const default_type dof)
 
default_type F2z (const default_type stat, const size_t rank, const default_type dof)
 
template<typename T >
int sgn (T val)
 

Variables

constexpr double e = 2.71828182845904523536
 
constexpr double pi = 3.14159265358979323846
 
constexpr double pi_2 = pi / 2.0
 
constexpr double pi_4 = pi / 4.0
 
constexpr double sqrt2 = 1.41421356237309504880
 
constexpr double sqrt1_2 = 1.0 / sqrt2
 

Enumeration Type Documentation

◆ SplineProcessingType

Enumerator
Value 
Derivative 
ValueAndDerivative 

Definition at line 23 of file cubic_spline.h.

Function Documentation

◆ betaincreg()

default_type MR::Math::betaincreg ( const default_type  a,
const default_type  b,
const default_type  x 
)

◆ cauchy()

float MR::Math::cauchy ( float  x,
float  s 
)
inline

Definition at line 25 of file cauchy.h.

◆ check_function_gradient()

template<class Function >
Eigen::Matrix< typename Function::value_type, Eigen::Dynamic, Eigen::Dynamic > MR::Math::check_function_gradient ( Function &  function,
Eigen::Matrix< typename Function::value_type, Eigen::Dynamic, 1 >  x,
typename Function::value_type  increment,
bool  show_hessian = false,
Eigen::Matrix< typename Function::value_type, Eigen::Dynamic, 1 >  conditioner = Eigen::Matrix<typename Function::value_type, Eigen::Dynamic, 1>() 
)

Definition at line 27 of file check_gradient.h.

◆ condition_number()

template<class M >
default_type MR::Math::condition_number ( const M &  data)
inline

Definition at line 32 of file condition_number.h.

◆ erfcinv()

default_type MR::Math::erfcinv ( const  default_type)

Compute the inverse of the complementary error function.

◆ erfinv()

default_type MR::Math::erfinv ( const  default_type)

Compute the inverse of the error function.

Implementation based on Boost Math (https://github.com/boostorg/math) While the erfinv() function is exposed in the API, it will encounter floating-point precision issues if provided with input values greater than approx. +0.999999 or smaller than approx. -0.999999. If such extreme values are likely to arise during processing, it is highly recommended that programmers instead operate natively on the values q = 1.0 - p and/or qc = 1.0 + p, and pass the appropriate value (q or qc) directly to the erfcinv() function. This will ensure full use of available floating-point precision within these functions, which is otherwise lost if performing one of the above conversions (either implicitly within one of these functions, or explicitly by the programmer prior to invoking erfinv()).

◆ F2z()

default_type MR::Math::F2z ( const default_type  stat,
const size_t  rank,
const default_type  dof 
)

◆ factorial()

template<typename T >
T MR::Math::factorial ( const T  i)

Definition at line 30 of file factorial.h.

◆ matrix_average()

double MR::Math::matrix_average ( vector< Eigen::MatrixXd > const &  mat_in,
Eigen::MatrixXd &  mat_avg,
bool  verbose = false 
)

◆ median()

template<class Container >
Container::value_type MR::Math::median ( Container &  list)
inline

Definition at line 45 of file median.h.

◆ median_weiszfeld()

template<class MatrixType = Eigen::Matrix<default_type, 3, Eigen::Dynamic>, class VectorType = Eigen::Matrix<default_type, 3, 1>>
bool MR::Math::median_weiszfeld ( const MatrixType &  X,
VectorType &  median,
const size_t  numIter = 300,
const default_type  precision = 0.00001 
)

Definition at line 74 of file median.h.

◆ polynomial()

template<class Cont >
default_type MR::Math::polynomial ( Cont &  coeffs,
const default_type  x 
)

Evaluate a polynomial expansion for a scalar term.

Definition at line 28 of file polynomial.h.

◆ sgn()

template<typename T >
int MR::Math::sgn ( val)
inline

Definition at line 24 of file robust_estimators.h.

◆ t2z()

default_type MR::Math::t2z ( const default_type  stat,
const default_type  dof 
)

◆ welch_satterthwaite()

template<class VarArrayType , class CountArrayType >
default_type MR::Math::welch_satterthwaite ( const VarArrayType &  variances,
const CountArrayType &  counts 
)

Definition at line 28 of file welch_satterthwaite.h.