Jpp in_tag_pdf_build
the software that should make you happy
Loading...
Searching...
No Matches
JMATH Namespace Reference

Auxiliary classes and methods for mathematical operations. More...

Classes

struct  JAdd
 forward declaration for negate of function. More...
 
struct  JAdd< JF1_t, double >
 Addition of constant value. More...
 
struct  JAverage
 Auxiliary class to determine average of set of values. More...
 
struct  JAverage< JQuaternion3D >
 Template spacialisation for averaging quaternions. More...
 
struct  JBell
 Bell function object. More...
 
struct  JCalculator
 Auxiliary class for arithmetic operations on objects. More...
 
struct  JCalculus
 Auxiliary base class for mathematical operations on parameters of function. More...
 
struct  JCos
 Cosine of function. More...
 
struct  JDiv
 forward declaration for multiplication of fuction. More...
 
struct  JDiv< JF1_t, double >
 Division of constant value. More...
 
struct  JExp
 Exponent of function. More...
 
struct  JExp< JPolynome< ID_t, 0 > >
 Exponent of zero degree polynomial function. More...
 
struct  JFn
 forward declaration for division of fuction. More...
 
struct  JGauss
 Gauss function object. More...
 
struct  JGauss2D
 2D correlated Gauss function. More...
 
struct  JGauss3D
 3D correlated Gauss function. More...
 
struct  JGauss< ID_t, true >
 Gauss function. More...
 
struct  JGauss_t
 Gauss model. More...
 
struct  JLegendre
 Template definition for function evaluation of Legendre polynome. More...
 
struct  JLegendre< JOrdinate_t,(size_t) -1 >
 Template specialisation for function evaluation of of Legendre polynome for undefined number of degrees. More...
 
struct  JLegendre< JQuaternion3D, N >
 Template specialisation for function evaluation of Legendre polynome of quaternions for defined number of degrees. More...
 
struct  JLegendre< JQuaternion3D,(size_t) -1 >
 Template specialisation for function evaluation of Legendre polynome of quaternions for undefined number of degrees. More...
 
struct  JLegendre_t
 Base class for Legendre polynome. More...
 
struct  JLimits
 Auxiliary class for minimum and maximum values for any class. More...
 
struct  JLimits< T, false >
 Template spacialisation of JMATH::JRandom for other data types. More...
 
struct  JLimits< T, true >
 Template spacialisation of JMATH::JLimits for numerical values. More...
 
struct  JLog
 Logarithm of function. More...
 
struct  JMake2X
 Make 2D function of x from 1D function. More...
 
struct  JMake2Y
 Make 2D function of y from 1D function. More...
 
struct  JMake3X
 Make 3D function of x from 1D function. More...
 
struct  JMake3Y
 Make 3D function of y from 1D function. More...
 
struct  JMake3Z
 Make 3D function of z from 1D function. More...
 
struct  JMath
 Auxiliary base class for aritmetic operations of derived class types. More...
 
struct  JMath< T, JNullType >
 Template base class for data structures with arithmetic capabilities. More...
 
struct  JMath_t
 Auxiliary class to hide data type specific methods. More...
 
struct  JMathlib
 forward declaration for fixed power of function. More...
 
class  JMatrix1D
 1 x 1 matrix More...
 
class  JMatrix1S
 1 x 1 symmetric matrix More...
 
class  JMatrix2D
 2 x 2 matrix More...
 
class  JMatrix2S
 2 x 2 symmetric matrix More...
 
class  JMatrix3D
 3 x 3 matrix More...
 
class  JMatrix3S
 3 x 3 symmetric matrix More...
 
class  JMatrix4D
 4 x 4 matrix More...
 
class  JMatrix4S
 4 x 4 symmetric matrix More...
 
class  JMatrix5D
 5 x 5 matrix More...
 
class  JMatrix5S
 5 x 5 symmetric matrix More...
 
struct  JMatrixND
 NxN matrix. More...
 
struct  JMatrixND_t
 Basic NxN matrix. More...
 
struct  JMatrixNS
 N x N symmetric matrix. More...
 
struct  JModel_t
 Fit model. More...
 
struct  JMul
 forward declaration for subtraction of fuction. More...
 
struct  JMul< JF1_t, double >
 Multiplication of constant value. More...
 
struct  JNegate
 Negate of function. More...
 
struct  JNumber
 Simple wrapper around template data type to ensure that zero is the default value. More...
 
struct  JPair
 Auxiliary data structure for pair of functions. More...
 
struct  JPolynome
 Recursive template class for polynomial function. More...
 
struct  JPolynome< ID_t, 0 >
 Termination class for polynomial function. More...
 
struct  JPolynome_t
 Polynome model. More...
 
struct  JPow
 Power of function. More...
 
struct  JPow< ID_t, _vF >
 Power of x. More...
 
class  JPower
 Power law function object. More...
 
struct  JQuantile_t
 Auxiliary data structure for average. More...
 
struct  JRandom
 Template definition of random value generator. More...
 
struct  JRandom< T, false >
 Template spacialisation of JMATH::JRandom for non-numerical data types. More...
 
struct  JRandom< T, true >
 Template spacialisation of JMATH::JRandom for numerical values. More...
 
struct  JSin
 Sine of function. More...
 
struct  JSqrt
 Square root of function. More...
 
struct  JSqrt< _vF >
 Square root of x. More...
 
struct  JSub
 forward declaration for addition of fuction. More...
 
struct  JSub< JF1_t, double >
 Subtraction of constant value. More...
 
class  JSVD3D
 Singular value decomposition. More...
 
class  JTrigonometric
 Trigonometric function object for sin and cos. More...
 
struct  JVectorND
 Nx1 matrix. More...
 
struct  JXn
 Fixed power of x. More...
 
struct  JZero
 Auxiliary class to assign zero value. More...
 
struct  make_carray
 void function More...
 
struct  parameter_list
 Auxiliary data structure for list of parameters. More...
 

Typedefs

typedef JGauss_t JBell_t
 Type definition for Bell model.
 
template<int ID_t>
using JP0 = JPolynome<ID_t, 0>
 short hand for 0th degree polynome
 
template<int ID_t>
using JP1 = JPolynome<ID_t, 1>
 short hand for 1st degree polynome
 
template<int ID_t>
using JP2 = JPolynome<ID_t, 2>
 short hand for 2nd degree polynome
 
template<int ID_t>
using JP3 = JPolynome<ID_t, 3>
 short hand for 3rd degree polynome
 
template<int ID_t, size_t N>
using JPolynome2X = JMake2X< JPolynome<ID_t, N> >
 2D polynomial function of x.
 
template<int ID_t, size_t N>
using JPolynome2Y = JMake2Y< JPolynome<ID_t, N> >
 2D polynomial function of y.
 
template<int ID_t, bool normalise = false>
using JGauss2X = JMake2X< JGauss<ID_t, normalise> >
 2D Gauss function of x.
 
template<int ID_t, bool normalise = false>
using JGauss2Y = JMake2Y< JGauss<ID_t, normalise> >
 2D Gauss function of y.
 
template<int ID_t, class JF1_t = _vF>
using JPow2X = JMake2X< JPow<ID_t, JF1_t> >
 2D power of function of x.
 
template<int ID_t, class JF1_t = _vF>
using JPow2Y = JMake2Y< JPow<ID_t, JF1_t> >
 2D power of function of y.
 
template<int N>
using JXn2X = JMake2X< JXn<N> >
 2D fixed power of x.
 
template<int N>
using JXn2Y = JMake2Y< JXn<N> >
 2D fixed power of y.
 
template<class JF1_t = _vF>
using JSqrt2X = JMake2X< JSqrt<JF1_t> >
 2D square root of function of x.
 
template<class JF1_t = _vF>
using JSqrt2Y = JMake2Y< JSqrt<JF1_t> >
 2D square root of function of y.
 
template<class JF1_t >
using JSin2X = JMake2X< JSin<JF1_t> >
 2D sine of function of x.
 
template<class JF1_t >
using JSin2Y = JMake2Y< JSin<JF1_t> >
 2D sine of function of y.
 
template<class JF1_t >
using JCos2X = JMake2X< JCos<JF1_t> >
 2D cosine of function of x.
 
template<class JF1_t >
using JCos2Y = JMake2Y< JCos<JF1_t> >
 2D cosine of function of y.
 
template<class JF1_t >
using JExp2X = JMake2X< JExp<JF1_t> >
 2D exponent of function of x.
 
template<class JF1_t >
using JExp2Y = JMake2Y< JExp<JF1_t> >
 2D exponent of function of y.
 
template<class JF1_t >
using JLog2X = JMake2X< JLog<JF1_t> >
 2D logarithm of function of x.
 
template<class JF1_t >
using JLog2Y = JMake2Y< JLog<JF1_t> >
 2D logarithm of function of y.
 
template<int ID_t, size_t N>
using JPolynome3X = JMake3X< JPolynome<ID_t, N> >
 3D polynomial function of x.
 
template<int ID_t, size_t N>
using JPolynome3Y = JMake3Y< JPolynome<ID_t, N> >
 3D polynomial function of y.
 
template<int ID_t, size_t N>
using JPolynome3Z = JMake3Z< JPolynome<ID_t, N> >
 3D polynomial function of z.
 
template<int ID_t, bool normalise = false>
using JGauss3X = JMake3X< JGauss<ID_t, normalise> >
 3D Gauss function of x.
 
template<int ID_t, bool normalise = false>
using JGauss3Y = JMake3Y< JGauss<ID_t, normalise> >
 3D Gauss function of y.
 
template<int ID_t, bool normalise = false>
using JGauss3Z = JMake3Z< JGauss<ID_t, normalise> >
 3D Gauss function of z.
 
template<int ID_t, class JF1_t = _vF>
using JPow3X = JMake3X< JPow<ID_t, JF1_t> >
 3D power of function of x.
 
template<int ID_t, class JF1_t = _vF>
using JPow3Y = JMake3Y< JPow<ID_t, JF1_t> >
 3D power of function of y.
 
template<int ID_t, class JF1_t = _vF>
using JPow3Z = JMake3Z< JPow<ID_t, JF1_t> >
 3D power of function of z.
 
template<int N>
using JXn3X = JMake3X< JXn<N> >
 3D fixed power of x.
 
template<int N>
using JXn3Y = JMake3Y< JXn<N> >
 3D fixed power of y.
 
template<int N>
using JXn3Z = JMake3Z< JXn<N> >
 3D fixed power of z.
 
template<class JF1_t = _vF>
using JSqrt3X = JMake3X< JSqrt<JF1_t> >
 3D square root of function of x.
 
template<class JF1_t = _vF>
using JSqrt3Y = JMake3Y< JSqrt<JF1_t> >
 3D square root of function of y.
 
template<class JF1_t = _vF>
using JSqrt3Z = JMake3Z< JSqrt<JF1_t> >
 3D square root of function of z.
 
template<class JF1_t >
using JSin3X = JMake3X< JSin<JF1_t> >
 3D sine of function of x.
 
template<class JF1_t >
using JSin3Y = JMake3Y< JSin<JF1_t> >
 3D sine of function of y.
 
template<class JF1_t >
using JSin3Z = JMake3Z< JSin<JF1_t> >
 3D sine of function of z.
 
template<class JF1_t >
using JCos3X = JMake3X< JCos<JF1_t> >
 3D cosine of function of x.
 
template<class JF1_t >
using JCos3Y = JMake3Y< JCos<JF1_t> >
 3D cosine of function of y.
 
template<class JF1_t >
using JCos3Z = JMake3Z< JCos<JF1_t> >
 3D cosine of function of z.
 
template<class JF1_t >
using JExp3X = JMake3X< JExp<JF1_t> >
 3D exponent of function of x.
 
template<class JF1_t >
using JExp3Y = JMake3Y< JExp<JF1_t> >
 3D exponent of function of y.
 
template<class JF1_t >
using JExp3Z = JMake3Z< JExp<JF1_t> >
 3D exponent of function of z.
 
template<class JF1_t >
using JLog3X = JMake3X< JLog<JF1_t> >
 3D logarithm of function of x.
 
template<class JF1_t >
using JLog3Y = JMake3Y< JLog<JF1_t> >
 3D logarithm of function of y.
 
template<class JF1_t >
using JLog3Z = JMake3Z< JLog<JF1_t> >
 3D logarithm of function of z.
 

Functions

template<class T >
const JCalculator< T, 1 > & operator* (const T &first, const T &second)
 Product evaluation of objects.
 
template<class T , int N>
const JCalculator< T, N+1 > & operator* (const T &first, const JCalculator< T, N > &second)
 Recursive product evaluation of objects.
 
template<class T , int N>
const JCalculator< T, N+1 > & operator* (const JCalculator< T, N > &first, const T &second)
 Recursive product evaluation of objects.
 
template<class T >
pow (const T &x, const double y)
 Power $ x^{y} $.
 
template<class T >
interpolate (const T &first, const T &second, const double alpha)
 Interpolation between objects.
 
template<class T >
std::iterator_traits< T >::value_type getAverage (T __begin, T __end)
 Get average.
 
template<class JValue_t , size_t N>
JValue_t getAverage (const JValue_t(&array)[N])
 Get average.
 
template<class JElement_t , class JAllocator_t >
JElement_t getAverage (const array_type< JElement_t, JAllocator_t > &buffer)
 Get average.
 
template<class T >
std::iterator_traits< T >::value_type getAverage (T __begin, T __end, typename std::iterator_traits< T >::value_type value)
 Get average.
 
template<class JValue_t , size_t N>
JValue_t getAverage (const JValue_t(&array)[N], typename JLANG::JClass< JValue_t >::argument_type value)
 Get average.
 
template<class JElement_t , class JAllocator_t >
JElement_t getAverage (const array_type< JElement_t, JAllocator_t > &buffer, typename JLANG::JClass< JElement_t >::argument_type value)
 Get average.
 
template<class JF1_t >
size_t getNumberOfParameters ()
 Get number of parameters.
 
template<class JF1_t >
double getParameter (const JF1_t &f1, const size_t i)
 Get value of parameter at given index.
 
template<class JF1_t >
void setParameters (JF1_t *f1, const double *values)
 Set values of all parameters.
 
template<class JF1_t >
JPow< JF1_t::ID, JF1_t > Pow (const JF1_t &f1, const double alpha)
 Power of function.
 
template<class JF1_t >
JSqrt< JF1_t > Sqrt (const JF1_t &f1)
 Square root of function.
 
JSqrt Sqrt ()
 Square root of x.
 
template<class JF1_t >
JSin< JF1_t > Sin (const JF1_t &f1)
 Sine of function.
 
template<class JF1_t >
JCos< JF1_t > Cos (const JF1_t &f1)
 Cosine function.
 
template<class JF1_t >
JExp< JF1_t > Exp (const JF1_t &f1)
 Exponent of function.
 
template<class JF1_t >
JLog< JF1_t > Log (const JF1_t &f1)
 Logarithm of function.
 
long long int factorial (const long long int n)
 Determine factorial.
 
long long int factorial (const long long int n, const long long int m)
 Determine combinatorics.
 
double gauss (const double x, const double sigma)
 Gauss function (normalised to 1 at x = 0).
 
double gauss (const double x, const double x0, const double sigma)
 Gauss function (normalised to 1 at x = x0).
 
double Gauss (const double x, const double sigma)
 Normalised Gauss function.
 
double Gauss (const double x, const double x0, const double sigma)
 Normalised Gauss function.
 
double Gamma (const double a, const double x)
 Incomplete gamma function.
 
double legendre (const size_t n, const double x)
 Legendre polynome.
 
double binomial (const size_t n, const size_t k)
 Binomial function.
 
double poisson (const size_t n, const double mu)
 Poisson probability density distribition.
 
double Poisson (const size_t n, const double mu)
 Poisson cumulative density distribition.
 
double getP (const double stdev)
 Get single-sided Gaussian probability for given number of standard deviations.
 
size_t getNs (const double background, const double P)
 Get minimal number of events to exceed Poisson probability given number of background events.
 
double getFs (const double background, const double P, const double precision)
 Get minimal number of events to exceed Poisson probability given number of background events.
 
void randomize (JMatrix1D *p)
 Randomize matrix.
 
void randomize (JMatrix2D *p)
 Randomize matrix.
 
void randomize (JMatrix3D *p)
 Randomize matrix.
 
void randomize (JMatrix4D *p)
 Randomize matrix.
 
void randomize (JMatrix5D *p)
 Randomize matrix.
 
void randomize (JMatrix1S *p)
 Randomize matrix.
 
void randomize (JMatrix2S *p)
 Randomize matrix.
 
void randomize (JMatrix3S *p)
 Randomize matrix.
 
void randomize (JMatrix4S *p)
 Randomize matrix.
 
void randomize (JMatrix5S *p)
 Randomize matrix.
 
template<class JFirst_t , class JSecond_t >
bool equals (const JFirst_t &first, const JSecond_t &second, const double precision=std::numeric_limits< double >::min())
 Check equality.
 
template<class JFirst_t , class JSecond_t >
double getDistanceSquared (const JFirst_t &first, const JSecond_t &second)
 Get square of distance between objects.
 
template<class JFirst_t , class JSecond_t >
double getDistance (const JFirst_t &first, const JSecond_t &second)
 Get distance between objects.
 
template<class JFirst_t , class JSecond_t >
double getDot (const JFirst_t &first, const JSecond_t &second)
 Get dot product of objects.
 
template<class JFirst_t , class JSecond_t >
double getAngle (const JFirst_t &first, const JSecond_t &second)
 Get space angle between objects.
 
template<class JFirst_t , class JSecond_t >
double getPerpDot (const JFirst_t &first, const JSecond_t &second)
 Get perpendicular dot product of objects.
 
template<class T >
getCross (const T &first, const T &second)
 Get cross product of objects.
 
template<class T >
std::vector< T > convolve (const std::vector< T > &input, const std::vector< T > &kernel)
 Convolute data with given kernel.
 
template<class T >
getRandom ()
 Get random value.
 
template<class T >
getRandom (const T min, const T max)
 Get uniformly distributed random value between given limits.
 
template<class T >
getRandom (const T min, const T max, const T precision)
 Get uniformly distributed random value between given limits.
 
template<>
double getRandom (const double min, const double max, const double precision)
 Template specialisation for data type double.
 
template<class T >
getZero ()
 Get zero value for a given data type.
 
template<>
bool getZero< bool > ()
 Get zero value for bool.
 
template<>
float getZero< float > ()
 Get zero value for float.
 
template<>
double getZero< double > ()
 Get zero value for double.
 
template<>
long double getZero< long double > ()
 Get zero value for long double.
 

Variables

static const double PI = acos(-1.0)
 Mathematical constants.
 
static const double EULER = 0.577215664901533
 Euler number.
 
static const long long int KILOBYTE = 1024
 Computing quantities.
 
static const long long int MEGABYTE = KILOBYTE*KILOBYTE
 Number of bytes in a kilo-byte.
 
static const long long int GIGABYTE = MEGABYTE*KILOBYTE
 Number of bytes in a mega-byte.
 
template<int ID_t>
const parameter_list< JPolynome< ID_t, 0 > > JPolynome< ID_t, 0 >::parameters & JPolynome
 Set parameters.
 
template<int ID_t>
const parameter_list< JPow< ID_t > > JPow< ID_t >::parameters & JPow
 Set parameters.
 
static const JZero zero
 Function object to assign zero value.
 

Detailed Description

Auxiliary classes and methods for mathematical operations.

Author
mdejong

Typedef Documentation

◆ JBell_t

Type definition for Bell model.

Definition at line 21 of file JBell.hh.

◆ JP0

template<int ID_t>
using JMATH::JP0 = JPolynome<ID_t, 0>

short hand for 0th degree polynome

Definition at line 1570 of file JMathlib.hh.

◆ JP1

template<int ID_t>
using JMATH::JP1 = JPolynome<ID_t, 1>

short hand for 1st degree polynome

Definition at line 1573 of file JMathlib.hh.

◆ JP2

template<int ID_t>
using JMATH::JP2 = JPolynome<ID_t, 2>

short hand for 2nd degree polynome

Definition at line 1576 of file JMathlib.hh.

◆ JP3

template<int ID_t>
using JMATH::JP3 = JPolynome<ID_t, 3>

short hand for 3rd degree polynome

Definition at line 1579 of file JMathlib.hh.

◆ JPolynome2X

template<int ID_t, size_t N>
using JMATH::JPolynome2X = JMake2X< JPolynome<ID_t, N> >

2D polynomial function of x.

Definition at line 158 of file JMathlib2D.hh.

◆ JPolynome2Y

template<int ID_t, size_t N>
using JMATH::JPolynome2Y = JMake2Y< JPolynome<ID_t, N> >

2D polynomial function of y.

Definition at line 159 of file JMathlib2D.hh.

◆ JGauss2X

template<int ID_t, bool normalise = false>
using JMATH::JGauss2X = JMake2X< JGauss<ID_t, normalise> >

2D Gauss function of x.

Definition at line 160 of file JMathlib2D.hh.

◆ JGauss2Y

template<int ID_t, bool normalise = false>
using JMATH::JGauss2Y = JMake2Y< JGauss<ID_t, normalise> >

2D Gauss function of y.

Definition at line 161 of file JMathlib2D.hh.

◆ JPow2X

template<int ID_t, class JF1_t = _vF>
using JMATH::JPow2X = JMake2X< JPow<ID_t, JF1_t> >

2D power of function of x.

Definition at line 162 of file JMathlib2D.hh.

◆ JPow2Y

template<int ID_t, class JF1_t = _vF>
using JMATH::JPow2Y = JMake2Y< JPow<ID_t, JF1_t> >

2D power of function of y.

Definition at line 163 of file JMathlib2D.hh.

◆ JXn2X

template<int N>
using JMATH::JXn2X = JMake2X< JXn<N> >

2D fixed power of x.

Definition at line 164 of file JMathlib2D.hh.

◆ JXn2Y

template<int N>
using JMATH::JXn2Y = JMake2Y< JXn<N> >

2D fixed power of y.

Definition at line 165 of file JMathlib2D.hh.

◆ JSqrt2X

template<class JF1_t = _vF>
using JMATH::JSqrt2X = JMake2X< JSqrt<JF1_t> >

2D square root of function of x.

Definition at line 166 of file JMathlib2D.hh.

◆ JSqrt2Y

template<class JF1_t = _vF>
using JMATH::JSqrt2Y = JMake2Y< JSqrt<JF1_t> >

2D square root of function of y.

Definition at line 167 of file JMathlib2D.hh.

◆ JSin2X

template<class JF1_t >
using JMATH::JSin2X = JMake2X< JSin<JF1_t> >

2D sine of function of x.

Definition at line 168 of file JMathlib2D.hh.

◆ JSin2Y

template<class JF1_t >
using JMATH::JSin2Y = JMake2Y< JSin<JF1_t> >

2D sine of function of y.

Definition at line 169 of file JMathlib2D.hh.

◆ JCos2X

template<class JF1_t >
using JMATH::JCos2X = JMake2X< JCos<JF1_t> >

2D cosine of function of x.

Definition at line 170 of file JMathlib2D.hh.

◆ JCos2Y

template<class JF1_t >
using JMATH::JCos2Y = JMake2Y< JCos<JF1_t> >

2D cosine of function of y.

Definition at line 171 of file JMathlib2D.hh.

◆ JExp2X

template<class JF1_t >
using JMATH::JExp2X = JMake2X< JExp<JF1_t> >

2D exponent of function of x.

Definition at line 172 of file JMathlib2D.hh.

◆ JExp2Y

template<class JF1_t >
using JMATH::JExp2Y = JMake2Y< JExp<JF1_t> >

2D exponent of function of y.

Definition at line 173 of file JMathlib2D.hh.

◆ JLog2X

template<class JF1_t >
using JMATH::JLog2X = JMake2X< JLog<JF1_t> >

2D logarithm of function of x.

Definition at line 174 of file JMathlib2D.hh.

◆ JLog2Y

template<class JF1_t >
using JMATH::JLog2Y = JMake2Y< JLog<JF1_t> >

2D logarithm of function of y.

Definition at line 175 of file JMathlib2D.hh.

◆ JPolynome3X

template<int ID_t, size_t N>
using JMATH::JPolynome3X = JMake3X< JPolynome<ID_t, N> >

3D polynomial function of x.

Definition at line 234 of file JMathlib3D.hh.

◆ JPolynome3Y

template<int ID_t, size_t N>
using JMATH::JPolynome3Y = JMake3Y< JPolynome<ID_t, N> >

3D polynomial function of y.

Definition at line 235 of file JMathlib3D.hh.

◆ JPolynome3Z

template<int ID_t, size_t N>
using JMATH::JPolynome3Z = JMake3Z< JPolynome<ID_t, N> >

3D polynomial function of z.

Definition at line 236 of file JMathlib3D.hh.

◆ JGauss3X

template<int ID_t, bool normalise = false>
using JMATH::JGauss3X = JMake3X< JGauss<ID_t, normalise> >

3D Gauss function of x.

Definition at line 237 of file JMathlib3D.hh.

◆ JGauss3Y

template<int ID_t, bool normalise = false>
using JMATH::JGauss3Y = JMake3Y< JGauss<ID_t, normalise> >

3D Gauss function of y.

Definition at line 238 of file JMathlib3D.hh.

◆ JGauss3Z

template<int ID_t, bool normalise = false>
using JMATH::JGauss3Z = JMake3Z< JGauss<ID_t, normalise> >

3D Gauss function of z.

Definition at line 239 of file JMathlib3D.hh.

◆ JPow3X

template<int ID_t, class JF1_t = _vF>
using JMATH::JPow3X = JMake3X< JPow<ID_t, JF1_t> >

3D power of function of x.

Definition at line 240 of file JMathlib3D.hh.

◆ JPow3Y

template<int ID_t, class JF1_t = _vF>
using JMATH::JPow3Y = JMake3Y< JPow<ID_t, JF1_t> >

3D power of function of y.

Definition at line 241 of file JMathlib3D.hh.

◆ JPow3Z

template<int ID_t, class JF1_t = _vF>
using JMATH::JPow3Z = JMake3Z< JPow<ID_t, JF1_t> >

3D power of function of z.

Definition at line 242 of file JMathlib3D.hh.

◆ JXn3X

template<int N>
using JMATH::JXn3X = JMake3X< JXn<N> >

3D fixed power of x.

Definition at line 243 of file JMathlib3D.hh.

◆ JXn3Y

template<int N>
using JMATH::JXn3Y = JMake3Y< JXn<N> >

3D fixed power of y.

Definition at line 244 of file JMathlib3D.hh.

◆ JXn3Z

template<int N>
using JMATH::JXn3Z = JMake3Z< JXn<N> >

3D fixed power of z.

Definition at line 245 of file JMathlib3D.hh.

◆ JSqrt3X

template<class JF1_t = _vF>
using JMATH::JSqrt3X = JMake3X< JSqrt<JF1_t> >

3D square root of function of x.

Definition at line 246 of file JMathlib3D.hh.

◆ JSqrt3Y

template<class JF1_t = _vF>
using JMATH::JSqrt3Y = JMake3Y< JSqrt<JF1_t> >

3D square root of function of y.

Definition at line 247 of file JMathlib3D.hh.

◆ JSqrt3Z

template<class JF1_t = _vF>
using JMATH::JSqrt3Z = JMake3Z< JSqrt<JF1_t> >

3D square root of function of z.

Definition at line 248 of file JMathlib3D.hh.

◆ JSin3X

template<class JF1_t >
using JMATH::JSin3X = JMake3X< JSin<JF1_t> >

3D sine of function of x.

Definition at line 249 of file JMathlib3D.hh.

◆ JSin3Y

template<class JF1_t >
using JMATH::JSin3Y = JMake3Y< JSin<JF1_t> >

3D sine of function of y.

Definition at line 250 of file JMathlib3D.hh.

◆ JSin3Z

template<class JF1_t >
using JMATH::JSin3Z = JMake3Z< JSin<JF1_t> >

3D sine of function of z.

Definition at line 251 of file JMathlib3D.hh.

◆ JCos3X

template<class JF1_t >
using JMATH::JCos3X = JMake3X< JCos<JF1_t> >

3D cosine of function of x.

Definition at line 252 of file JMathlib3D.hh.

◆ JCos3Y

template<class JF1_t >
using JMATH::JCos3Y = JMake3Y< JCos<JF1_t> >

3D cosine of function of y.

Definition at line 253 of file JMathlib3D.hh.

◆ JCos3Z

template<class JF1_t >
using JMATH::JCos3Z = JMake3Z< JCos<JF1_t> >

3D cosine of function of z.

Definition at line 254 of file JMathlib3D.hh.

◆ JExp3X

template<class JF1_t >
using JMATH::JExp3X = JMake3X< JExp<JF1_t> >

3D exponent of function of x.

Definition at line 255 of file JMathlib3D.hh.

◆ JExp3Y

template<class JF1_t >
using JMATH::JExp3Y = JMake3Y< JExp<JF1_t> >

3D exponent of function of y.

Definition at line 256 of file JMathlib3D.hh.

◆ JExp3Z

template<class JF1_t >
using JMATH::JExp3Z = JMake3Z< JExp<JF1_t> >

3D exponent of function of z.

Definition at line 257 of file JMathlib3D.hh.

◆ JLog3X

template<class JF1_t >
using JMATH::JLog3X = JMake3X< JLog<JF1_t> >

3D logarithm of function of x.

Definition at line 258 of file JMathlib3D.hh.

◆ JLog3Y

template<class JF1_t >
using JMATH::JLog3Y = JMake3Y< JLog<JF1_t> >

3D logarithm of function of y.

Definition at line 259 of file JMathlib3D.hh.

◆ JLog3Z

template<class JF1_t >
using JMATH::JLog3Z = JMake3Z< JLog<JF1_t> >

3D logarithm of function of z.

Definition at line 260 of file JMathlib3D.hh.

Function Documentation

◆ operator*() [1/3]

template<class T >
const JCalculator< T, 1 > & JMATH::operator* ( const T & first,
const T & second )
inline

Product evaluation of objects.

Multiply objects.

Parameters
firstfirst object
secondsecond object
Returns
calculator

Definition at line 53 of file JCalculator.hh.

54 {
55 JCalculator<T, 1>::calculator.mul(first, second);
56
58 }
Auxiliary class for arithmetic operations on objects.

◆ operator*() [2/3]

template<class T , int N>
const JCalculator< T, N+1 > & JMATH::operator* ( const T & first,
const JCalculator< T, N > & second )
inline

Recursive product evaluation of objects.

Parameters
firstfirst object
secondsecond object
Returns
calculator

Definition at line 69 of file JCalculator.hh.

70 {
71 JCalculator<T, N+1>::calculator.mul(first, second);
72
74 }

◆ operator*() [3/3]

template<class T , int N>
const JCalculator< T, N+1 > & JMATH::operator* ( const JCalculator< T, N > & first,
const T & second )
inline

Recursive product evaluation of objects.

Parameters
firstfirst object
secondsecond object
Returns
calculator

Definition at line 85 of file JCalculator.hh.

86 {
87 JCalculator<T, N+1>::calculator.mul(first, second);
88
90 }

◆ pow()

template<class T >
T JMATH::pow ( const T & x,
const double y )
inline

Power $ x^{y} $.

Parameters
xvalue
ypower
Returns
result

Definition at line 97 of file JMath.hh.

98 {
99 using namespace JPP;
100
101 return JMath_t::pow(x, y, JBool<JClass<T>::is_primitive>());
102 }
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary template class for type bool.
Definition JBool.hh:21
Template for generic class types.
Definition JClass.hh:80

◆ interpolate()

template<class T >
T JMATH::interpolate ( const T & first,
const T & second,
const double alpha )
inline

Interpolation between objects.

The result is equal to result = (1 - alpha) * (first) + (alpha) * (second).

Parameters
firstfirst object
secondsecond object
alphainterpolation factor [0, 1]
Returns
result

Definition at line 397 of file JMath.hh.

400 {
401 return T(first).interpolate(second, alpha);
402 }

◆ getAverage() [1/6]

template<class T >
std::iterator_traits< T >::value_type JMATH::getAverage ( T __begin,
T __end )

Get average.

Parameters
__beginbegin of data
__endend of data
Returns
average value

Definition at line 494 of file JMath.hh.

495 {
496 typedef typename std::iterator_traits<T>::value_type value_type;
497
498 return JAverage<value_type>(__begin, __end);
499 }
Auxiliary class to determine average of set of values.
Definition JMath.hh:409

◆ getAverage() [2/6]

template<class JValue_t , size_t N>
JValue_t JMATH::getAverage ( const JValue_t(&) array[N])
inline

Get average.

Parameters
arrayc-array of values
Returns
average value

Definition at line 509 of file JMath.hh.

510 {
511 typedef JValue_t value_type;
512
513 return JAverage<value_type>((const value_type*) array, (const value_type*) array + N);
514 }

◆ getAverage() [3/6]

template<class JElement_t , class JAllocator_t >
JElement_t JMATH::getAverage ( const array_type< JElement_t, JAllocator_t > & buffer)

Get average.

Parameters
bufferinput data
Returns
average value

Definition at line 524 of file JMath.hh.

525 {
526 return JAverage<JElement_t>(buffer.begin(), buffer.end());
527 }

◆ getAverage() [4/6]

template<class T >
std::iterator_traits< T >::value_type JMATH::getAverage ( T __begin,
T __end,
typename std::iterator_traits< T >::value_type value )

Get average.

Parameters
__beginbegin of data
__endend of data
valuedefault value
Returns
average value

Definition at line 539 of file JMath.hh.

540 {
541 try {
542 return getAverage(__begin, __end);
543 }
544 catch(const std::exception&) {
545 return value;
546 }
547 }
std::iterator_traits< T >::value_type getAverage(T __begin, T __end)
Get average.
Definition JMath.hh:494

◆ getAverage() [5/6]

template<class JValue_t , size_t N>
JValue_t JMATH::getAverage ( const JValue_t(&) array[N],
typename JLANG::JClass< JValue_t >::argument_type value )
inline

Get average.

Parameters
arrayc-array of values
valuedefault value
Returns
average value

Definition at line 558 of file JMath.hh.

559 {
560 try {
561 return getAverage(array);
562 }
563 catch(const std::exception&) {
564 return value;
565 }
566 }

◆ getAverage() [6/6]

template<class JElement_t , class JAllocator_t >
JElement_t JMATH::getAverage ( const array_type< JElement_t, JAllocator_t > & buffer,
typename JLANG::JClass< JElement_t >::argument_type value )

Get average.

Parameters
bufferinput data
valuedefault value
Returns
average value

Definition at line 577 of file JMath.hh.

578 {
579 try {
580 return getAverage(buffer);
581 }
582 catch(const std::exception&) {
583 return value;
584 }
585 }

◆ getNumberOfParameters()

template<class JF1_t >
size_t JMATH::getNumberOfParameters ( )
inline

Get number of parameters.

Returns
number of parameters

Definition at line 155 of file JMathlib.hh.

156 {
157 return JF1_t::parameters.size();
158 }

◆ getParameter()

template<class JF1_t >
double JMATH::getParameter ( const JF1_t & f1,
const size_t i )
inline

Get value of parameter at given index.

Parameters
f1function
iindex
Returns
value

Definition at line 169 of file JMathlib.hh.

170 {
171 return f1.*JF1_t::parameters.at(i);
172 }

◆ setParameters()

template<class JF1_t >
void JMATH::setParameters ( JF1_t * f1,
const double * values )
inline

Set values of all parameters.

Parameters
f1pointer to function
valuespointer to list of values

Definition at line 182 of file JMathlib.hh.

183 {
184 if (f1 != NULL && values != NULL) {
185 for (size_t i = 0; i != JF1_t::parameters.size(); ++i) {
186 f1->*JF1_t::parameters[i] = values[i];
187 }
188 }
189 }

◆ Pow()

template<class JF1_t >
JPow< JF1_t::ID, JF1_t > JMATH::Pow ( const JF1_t & f1,
const double alpha )

Power of function.

Parameters
f1function
alphaalpha
Returns
result

Definition at line 1897 of file JMathlib.hh.

1898 {
1899 return JPow<JF1_t::ID, JF1_t>(f1, alpha);
1900 }
Power of function.
Definition JMathlib.hh:1801

◆ Sqrt() [1/2]

template<class JF1_t >
JSqrt< JF1_t > JMATH::Sqrt ( const JF1_t & f1)

Square root of function.

Parameters
f1function
Returns
result

Definition at line 2136 of file JMathlib.hh.

2137 {
2138 return JSqrt<JF1_t>(f1);
2139 }
Square root of function.
Definition JMathlib.hh:2058

◆ Sqrt() [2/2]

JSqrt JMATH::Sqrt ( )

Square root of x.

Returns
result

Definition at line 2211 of file JMathlib.hh.

2212 {
2213 return JSqrt<>();
2214 }

◆ Sin()

template<class JF1_t >
JSin< JF1_t > JMATH::Sin ( const JF1_t & f1)

Sine of function.

Parameters
f1function
Returns
result

Definition at line 2302 of file JMathlib.hh.

2303 {
2304 return JSin<JF1_t>(f1);
2305 }
Sine of function.
Definition JMathlib.hh:2224

◆ Cos()

template<class JF1_t >
JCos< JF1_t > JMATH::Cos ( const JF1_t & f1)

Cosine function.

Parameters
f1function
Returns
result

Definition at line 2393 of file JMathlib.hh.

2394 {
2395 return JCos<JF1_t>(f1);
2396 }
Cosine of function.
Definition JMathlib.hh:2315

◆ Exp()

template<class JF1_t >
JExp< JF1_t > JMATH::Exp ( const JF1_t & f1)

Exponent of function.

Parameters
f1function
Returns
result

Definition at line 2545 of file JMathlib.hh.

2546 {
2547 return JExp<JF1_t>(f1);
2548 }
Exponent of function.
Definition JMathlib.hh:2406

◆ Log()

template<class JF1_t >
JLog< JF1_t > JMATH::Log ( const JF1_t & f1)

Logarithm of function.

Parameters
f1function
Returns
result

Definition at line 2629 of file JMathlib.hh.

2630 {
2631 return JLog<JF1_t>(f1);
2632 }
Logarithm of function.
Definition JMathlib.hh:2558

◆ factorial() [1/2]

long long int JMATH::factorial ( const long long int n)
inline

Determine factorial.

Parameters
nnumber
Returns
factorial (= n!)

Definition at line 32 of file JMath/JMathSupportkit.hh.

33 {
34 if (n < 0) {
35 THROW(JValueOutOfRange, "JMATH::factorial(): invalid argument " << n);
36 }
37
38 if (n != 1)
39 return n * factorial(n - 1);
40 else
41 return 1;
42 }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Exception for accessing a value in a collection that is outside of its range.

◆ factorial() [2/2]

long long int JMATH::factorial ( const long long int n,
const long long int m )
inline

Determine combinatorics.

Parameters
nnumber
mnumber
Returns
n!/(m!*(n-m)!)

Definition at line 52 of file JMath/JMathSupportkit.hh.

53 {
54 if (n < 0 || m < 0 || n < m) {
55 THROW(JValueOutOfRange, "JMATH::factorial(): invalid argument " << n << ' ' << m);
56 }
57
58 if (n == m)
59 return 1;
60 else if (m == 0)
61 return 1;
62 else
63 return factorial(n - 1, m - 1) + factorial(n - 1, m);
64 }

◆ gauss() [1/2]

double JMATH::gauss ( const double x,
const double sigma )
inline

Gauss function (normalised to 1 at x = 0).

Parameters
xx
sigmasigma
Returns
function value

Definition at line 74 of file JMath/JMathSupportkit.hh.

75 {
76 const double u = x / sigma;
77
78 if (fabs(u) < 20.0)
79 return exp(-0.5*u*u);
80 else
81 return 0.0;
82 }

◆ gauss() [2/2]

double JMATH::gauss ( const double x,
const double x0,
const double sigma )
inline

Gauss function (normalised to 1 at x = x0).

Parameters
xx
x0central value
sigmasigma
Returns
function value

Definition at line 93 of file JMath/JMathSupportkit.hh.

94 {
95 return gauss(x - x0, sigma);
96 }
double gauss(const double x, const double sigma)
Gauss function (normalised to 1 at x = 0).

◆ Gauss() [1/2]

double JMATH::Gauss ( const double x,
const double sigma )
inline

Normalised Gauss function.

Parameters
xx
sigmasigma
Returns
function value

Definition at line 106 of file JMath/JMathSupportkit.hh.

107 {
108 return gauss(x, sigma) / sqrt(2.0*PI) / sigma;
109 }

◆ Gauss() [2/2]

double JMATH::Gauss ( const double x,
const double x0,
const double sigma )
inline

Normalised Gauss function.

Parameters
xx
x0central value
sigmasigma
Returns
function value

Definition at line 120 of file JMath/JMathSupportkit.hh.

121 {
122 return Gauss(x - x0, sigma);
123 }
double Gauss(const double x, const double sigma)
Normalised Gauss function.

◆ Gamma()

double JMATH::Gamma ( const double a,
const double x )
inline

Incomplete gamma function.

Source code is taken from reference: Numerical Recipes in C++, W.H. Press, S.A. Teukolsky, W.T. Vetterling and B.P. Flannery, Cambridge University Press.

Parameters
aa
xx
Returns
function value

Definition at line 137 of file JMath/JMathSupportkit.hh.

138 {
139 using namespace std;
140
141 const int max = 1000000;
142
143 if (x < 0.0) { THROW(JValueOutOfRange, "x < 0 " << x); }
144 if (a <= 0.0) { THROW(JValueOutOfRange, "a <= 0 " << a); }
145
146 const double gln = lgamma(a);
147
148 if (x < a + 1.0) {
149
150 if (x < 0.0) {
151 THROW(JValueOutOfRange, "x <= 0 " << x);
152 }
153
154 if (x == 0.0) {
155 return 0.0;
156 }
157
158 double ap = a;
159 double sum = 1.0 / a;
160 double del = sum;
161
162 for (int i = 0; i != max; ++i) {
163
164 ap += 1.0;
165 del *= x/ap;
166 sum += del;
167
168 if (fabs(del) < fabs(sum)*numeric_limits<double>::epsilon()) {
169 return sum*exp(-x + a*log(x) - gln);
170 }
171 }
172
173 THROW(JValueOutOfRange, "i == " << max);
174
175 } else {
176
177 const double FPMIN = numeric_limits<double>::min() / numeric_limits<double>::epsilon();
178
179 double b = x + 1.0 - a;
180 double c = 1.0 / FPMIN;
181 double d = 1.0 / b;
182 double h = d;
183
184 for (int i = 1; i != max; ++i) {
185
186 const double an = -i * (i-a);
187
188 b += 2.0;
189 d = an*d + b;
190
191 if (fabs(d) < FPMIN) {
192 d = FPMIN;
193 }
194
195 c = b + an/c;
196
197 if (fabs(c) < FPMIN) {
198 c = FPMIN;
199 }
200
201 d = 1.0/d;
202
203 const double del = d*c;
204
205 h *= del;
206
207 if (fabs(del - 1.0) < numeric_limits<double>::epsilon()) {
208 return 1.0 - exp(-x + a*log(x) - gln) * h;
209 }
210 }
211
212 THROW(JValueOutOfRange, "i == " << max);
213 }
214 }
const double a

◆ legendre()

double JMATH::legendre ( const size_t n,
const double x )
inline

Legendre polynome.

Parameters
ndegree
xx
Returns
function value

Definition at line 224 of file JMath/JMathSupportkit.hh.

225 {
226 switch (n) {
227
228 case 0:
229 return 1.0;
230
231 case 1:
232 return x;
233
234 default:
235 {
236 double p0;
237 double p1 = 1.0;
238 double p2 = x;
239
240 for (size_t i = 2; i <= n; ++i) {
241 p0 = p1;
242 p1 = p2;
243 p2 = ((2*i-1) * x*p1 - (i-1) * p0) / i;
244 }
245
246 return p2;
247 }
248 }
249 }
TPaveText * p1

◆ binomial()

double JMATH::binomial ( const size_t n,
const size_t k )
inline

Binomial function.

Parameters
nn
kk
Returns
function value

Definition at line 259 of file JMath/JMathSupportkit.hh.

260 {
261 if (n == 0 || n < k) {
262 return 0.0;
263 }
264
265 if (k == 0 || n == k) {
266 return 1.0;
267 }
268
269 const int k1 = std::min(k, n - k);
270 const int k2 = n - k1;
271
272 double value = k2 + 1;
273
274 for (int i = k1; i != 1; --i) {
275 value *= (double) (k2 + i) / (double) i;
276 }
277
278 return value;
279 }
const int n
Definition JPolint.hh:791

◆ poisson()

double JMATH::poisson ( const size_t n,
const double mu )
inline

Poisson probability density distribition.

Parameters
nnumber of occurences
muexpectation value
Returns
probability

Definition at line 289 of file JMath/JMathSupportkit.hh.

290 {
291 using namespace std;
292
293 if (mu > 0.0) {
294
295 if (n > 0)
296 return exp(n*log(mu) - lgamma(n+1) - mu);
297 else
298 return exp(-mu);
299 } else if (mu == 0.0) {
300
301 return (n == 0 ? 1.0 : 0.0);
302 }
303
304 THROW(JValueOutOfRange, "mu <= 0 " << mu);
305 }

◆ Poisson()

double JMATH::Poisson ( const size_t n,
const double mu )
inline

Poisson cumulative density distribition.

Parameters
nnumber of occurences
muexpectation value
Returns
probability

Definition at line 315 of file JMath/JMathSupportkit.hh.

316 {
317 return 1.0 - Gamma(n + 1, mu);
318 }
double Gamma(const double a, const double x)
Incomplete gamma function.

◆ getP()

double JMATH::getP ( const double stdev)
inline

Get single-sided Gaussian probability for given number of standard deviations.

Parameters
stdevnumber of standard deviations
Returns
probability

Definition at line 327 of file JMath/JMathSupportkit.hh.

328 {
329 return (2.0 * // single-sided Gauss
330 0.5 * // compensate factor 2 in C++ erfc
331 erfc(stdev / sqrt(2.0))); // compensate absent 1/2 in exponent of Gauss in C++ erfc
332 }

◆ getNs()

size_t JMATH::getNs ( const double background,
const double P )
inline

Get minimal number of events to exceed Poisson probability given number of background events.

Parameters
backgroundnumber of background events
Pprobability
Returns
number of events

Definition at line 342 of file JMath/JMathSupportkit.hh.

344 {
345 double y = exp(-background);
346 double Y = y; // P(0)
347 size_t k = 1;
348
349 for ( ; Y < 1.0 - P; ++k) {
350 y *= background / (double) k; // P(k)
351 Y += y;
352 }
353
354 return k;
355 }

◆ getFs()

double JMATH::getFs ( const double background,
const double P,
const double precision )
inline

Get minimal number of events to exceed Poisson probability given number of background events.

The precision refers to a step size. When set to one, the result is identical to that of method JMATH::getNs.

Parameters
backgroundnumber of background events
Pprobability
precisionprecision
Returns
number of events

Definition at line 368 of file JMath/JMathSupportkit.hh.

371 {
372 double u = 1.0 + floor(background);
373
374 for ( ; Gamma(u, background) > P; u += precision) {}
375
376 return u;
377 }

◆ randomize() [1/10]

void JMATH::randomize ( JMatrix1D * p)
inline

Randomize matrix.

Parameters
ppointer to valid object

Definition at line 33 of file JMathTestkit.hh.

34 {
35 new (p) JMatrix1D(getRandom<double>(-1.0, +1.0));
36 }
1 x 1 matrix
Definition JMatrix1D.hh:35

◆ randomize() [2/10]

void JMATH::randomize ( JMatrix2D * p)
inline

Randomize matrix.

Parameters
ppointer to valid object

Definition at line 44 of file JMathTestkit.hh.

45 {
46 new (p) JMatrix2D(getRandom<double>(-1.0,+1.0), getRandom<double>(-1.0,+1.0),
47 getRandom<double>(-1.0,+1.0), getRandom<double>(-1.0,+1.0));
48 }

◆ randomize() [3/10]

void JMATH::randomize ( JMatrix3D * p)
inline

Randomize matrix.

Parameters
ppointer to valid object

Definition at line 56 of file JMathTestkit.hh.

57 {
58 new (p) JMatrix3D(getRandom<double>(-1.0,+1.0), getRandom<double>(-1.0,+1.0), getRandom<double>(-1.0,+1.0),
59 getRandom<double>(-1.0,+1.0), getRandom<double>(-1.0,+1.0), getRandom<double>(-1.0,+1.0),
60 getRandom<double>(-1.0,+1.0), getRandom<double>(-1.0,+1.0), getRandom<double>(-1.0,+1.0));
61 }

◆ randomize() [4/10]

void JMATH::randomize ( JMatrix4D * p)
inline

Randomize matrix.

Parameters
ppointer to valid object

Definition at line 69 of file JMathTestkit.hh.

70 {
71 new (p) JMatrix4D(getRandom<double>(-1.0,+1.0), getRandom<double>(-1.0,+1.0), getRandom<double>(-1.0,+1.0), getRandom<double>(-1.0,+1.0),
72 getRandom<double>(-1.0,+1.0), getRandom<double>(-1.0,+1.0), getRandom<double>(-1.0,+1.0), getRandom<double>(-1.0,+1.0),
73 getRandom<double>(-1.0,+1.0), getRandom<double>(-1.0,+1.0), getRandom<double>(-1.0,+1.0), getRandom<double>(-1.0,+1.0),
74 getRandom<double>(-1.0,+1.0), getRandom<double>(-1.0,+1.0), getRandom<double>(-1.0,+1.0), getRandom<double>(-1.0,+1.0));
75 }
4 x 4 matrix
Definition JMatrix4D.hh:36

◆ randomize() [5/10]

void JMATH::randomize ( JMatrix5D * p)
inline

Randomize matrix.

Parameters
ppointer to valid object

Definition at line 83 of file JMathTestkit.hh.

84 {
85 new (p) JMatrix5D(getRandom<double>(-1.0,+1.0), getRandom<double>(-1.0,+1.0), getRandom<double>(-1.0,+1.0), getRandom<double>(-1.0,+1.0), getRandom<double>(-1.0,+1.0),
86 getRandom<double>(-1.0,+1.0), getRandom<double>(-1.0,+1.0), getRandom<double>(-1.0,+1.0), getRandom<double>(-1.0,+1.0), getRandom<double>(-1.0,+1.0),
87 getRandom<double>(-1.0,+1.0), getRandom<double>(-1.0,+1.0), getRandom<double>(-1.0,+1.0), getRandom<double>(-1.0,+1.0), getRandom<double>(-1.0,+1.0),
88 getRandom<double>(-1.0,+1.0), getRandom<double>(-1.0,+1.0), getRandom<double>(-1.0,+1.0), getRandom<double>(-1.0,+1.0), getRandom<double>(-1.0,+1.0),
89 getRandom<double>(-1.0,+1.0), getRandom<double>(-1.0,+1.0), getRandom<double>(-1.0,+1.0), getRandom<double>(-1.0,+1.0), getRandom<double>(-1.0,+1.0));
90 }
5 x 5 matrix
Definition JMatrix5D.hh:36

◆ randomize() [6/10]

void JMATH::randomize ( JMatrix1S * p)
inline

Randomize matrix.

Parameters
ppointer to valid object

Definition at line 98 of file JMathTestkit.hh.

99 {
100 new (p) JMatrix1S(getRandom<double>(-1.0, +1.0));
101 }
1 x 1 symmetric matrix
Definition JMatrix1S.hh:28

◆ randomize() [7/10]

void JMATH::randomize ( JMatrix2S * p)
inline

Randomize matrix.

Parameters
ppointer to valid object

Definition at line 109 of file JMathTestkit.hh.

110 {
111 new (p) JMatrix2S(getRandom<double>(-1.0,+1.0),
112 getRandom<double>(-1.0,+1.0), getRandom<double>(-1.0,+1.0));
113
114 p->a01 = p->a10;
115 }
2 x 2 symmetric matrix
Definition JMatrix2S.hh:28

◆ randomize() [8/10]

void JMATH::randomize ( JMatrix3S * p)
inline

Randomize matrix.

Parameters
ppointer to valid object

Definition at line 123 of file JMathTestkit.hh.

124 {
125 new (p) JMatrix3S(getRandom<double>(-1.0,+1.0),
126 getRandom<double>(-1.0,+1.0), getRandom<double>(-1.0,+1.0),
127 getRandom<double>(-1.0,+1.0), getRandom<double>(-1.0,+1.0), getRandom<double>(-1.0,+1.0));
128
129 p->a01 = p->a10;
130 p->a02 = p->a20;
131 p->a12 = p->a21;
132 }
3 x 3 symmetric matrix
Definition JMatrix3S.hh:31

◆ randomize() [9/10]

void JMATH::randomize ( JMatrix4S * p)
inline

Randomize matrix.

Parameters
ppointer to valid object

Definition at line 140 of file JMathTestkit.hh.

141 {
142 new (p) JMatrix4S(getRandom<double>(-1.0,+1.0),
143 getRandom<double>(-1.0,+1.0), getRandom<double>(-1.0,+1.0),
144 getRandom<double>(-1.0,+1.0), getRandom<double>(-1.0,+1.0), getRandom<double>(-1.0,+1.0),
145 getRandom<double>(-1.0,+1.0), getRandom<double>(-1.0,+1.0), getRandom<double>(-1.0,+1.0), getRandom<double>(-1.0,+1.0));
146
147 p->a01 = p->a10;
148 p->a02 = p->a20;
149 p->a03 = p->a30;
150 p->a12 = p->a21;
151 p->a13 = p->a31;
152 p->a23 = p->a32;
153 }
4 x 4 symmetric matrix
Definition JMatrix4S.hh:28

◆ randomize() [10/10]

void JMATH::randomize ( JMatrix5S * p)
inline

Randomize matrix.

Parameters
ppointer to valid object

Definition at line 161 of file JMathTestkit.hh.

162 {
163 new (p) JMatrix5S(getRandom<double>(-1.0,+1.0),
164 getRandom<double>(-1.0,+1.0), getRandom<double>(-1.0,+1.0),
165 getRandom<double>(-1.0,+1.0), getRandom<double>(-1.0,+1.0), getRandom<double>(-1.0,+1.0),
166 getRandom<double>(-1.0,+1.0), getRandom<double>(-1.0,+1.0), getRandom<double>(-1.0,+1.0), getRandom<double>(-1.0,+1.0),
167 getRandom<double>(-1.0,+1.0), getRandom<double>(-1.0,+1.0), getRandom<double>(-1.0,+1.0), getRandom<double>(-1.0,+1.0), getRandom<double>(-1.0,+1.0));
168
169 p->a01 = p->a10;
170 p->a02 = p->a20;
171 p->a03 = p->a30;
172 p->a04 = p->a40;
173 p->a12 = p->a21;
174 p->a13 = p->a31;
175 p->a14 = p->a41;
176 p->a23 = p->a32;
177 p->a24 = p->a42;
178 p->a34 = p->a43;
179 }
5 x 5 symmetric matrix
Definition JMatrix5S.hh:28

◆ equals()

template<class JFirst_t , class JSecond_t >
bool JMATH::equals ( const JFirst_t & first,
const JSecond_t & second,
const double precision = std::numeric_limits<double>::min() )
inline

Check equality.

Parameters
firstfirst object
secondsecond object
precisionprecision
Returns
true if two objects are equals; else false

Definition at line 42 of file JMathToolkit.hh.

45 {
46 return first.equals(second, precision);
47 }

◆ getDistanceSquared()

template<class JFirst_t , class JSecond_t >
double JMATH::getDistanceSquared ( const JFirst_t & first,
const JSecond_t & second )
inline

Get square of distance between objects.

Parameters
firstfirst object
secondsecond object
Returns
square of distance

Definition at line 58 of file JMathToolkit.hh.

60 {
61 return first.getDistanceSquared(second);
62 }

◆ getDistance()

template<class JFirst_t , class JSecond_t >
double JMATH::getDistance ( const JFirst_t & first,
const JSecond_t & second )
inline

Get distance between objects.

Parameters
firstfirst object
secondsecond object
Returns
distance

Definition at line 73 of file JMathToolkit.hh.

75 {
76 return first.getDistance(second);
77 }

◆ getDot()

template<class JFirst_t , class JSecond_t >
double JMATH::getDot ( const JFirst_t & first,
const JSecond_t & second )
inline

Get dot product of objects.

Parameters
firstfirst object
secondsecond object
Returns
dot product

Definition at line 88 of file JMathToolkit.hh.

90 {
91 return first.getDot(second);
92 }

◆ getAngle()

template<class JFirst_t , class JSecond_t >
double JMATH::getAngle ( const JFirst_t & first,
const JSecond_t & second )
inline

Get space angle between objects.

Parameters
firstfirst object
secondsecond object
Returns
angle [deg]

Definition at line 103 of file JMathToolkit.hh.

105 {
106 const double dot = getDot(first,second);
107
108 if (dot >= +1.0)
109 return 0.0;
110 else if (dot <= -1.0)
111 return 180.0;
112 else
113 return acos(dot) * 180.0 / acos(-1.0);
114 }

◆ getPerpDot()

template<class JFirst_t , class JSecond_t >
double JMATH::getPerpDot ( const JFirst_t & first,
const JSecond_t & second )
inline

Get perpendicular dot product of objects.

Parameters
firstfirst object
secondsecond object
Returns
perpendicular dot product

Definition at line 125 of file JMathToolkit.hh.

127 {
128 return first.getPerpDot(second);
129 }

◆ getCross()

template<class T >
T JMATH::getCross ( const T & first,
const T & second )
inline

Get cross product of objects.

Parameters
firstfirst object
secondsecond object
Returns
cross product

Definition at line 140 of file JMathToolkit.hh.

142 {
143 return T().getCross(first, second);
144 }

◆ convolve()

template<class T >
std::vector< T > JMATH::convolve ( const std::vector< T > & input,
const std::vector< T > & kernel )
inline

Convolute data with given kernel.

Parameters
inputinput data
kernelconvolution kernel
Returns
convoluted data

Definition at line 155 of file JMathToolkit.hh.

156 {
157 const size_t k = kernel.size();
158 const size_t n = input .size() - k + 1;
159
160 std::vector<T> out(n, getZero<T>());
161
162 for (size_t i = 0; i != n; ++i) {
163 for (size_t j = 0; j != k; ++j) {
164 out[i] += input[i + j] * kernel[k - j - 1];
165 }
166 }
167
168 return out;
169 }

◆ getRandom() [1/4]

template<class T >
T JMATH::getRandom ( )
inline

Get random value.

Returns
random value

Definition at line 113 of file JMath/JRandom.hh.

114 {
115 return JRandom<T>::getRandom();
116 }
Template definition of random value generator.

◆ getRandom() [2/4]

template<class T >
T JMATH::getRandom ( const T min,
const T max )
inline

Get uniformly distributed random value between given limits.

Parameters
minminimal value
maxmaximal value
Returns
random value

Definition at line 127 of file JMath/JRandom.hh.

129 {
130 return JRandom<T, true>::getRandom(min, max);
131 }

◆ getRandom() [3/4]

template<class T >
T JMATH::getRandom ( const T min,
const T max,
const T precision )
inline

Get uniformly distributed random value between given limits.

Parameters
minminimal value
maxmaximal value
precisionprecision
Returns
random value

Definition at line 143 of file JMath/JRandom.hh.

146 {
147 return JRandom<T, true>::getRandom(min, max);
148 }

◆ getRandom() [4/4]

template<>
double JMATH::getRandom ( const double min,
const double max,
const double precision )
inline

Template specialisation for data type double.

Definition at line 155 of file JMath/JRandom.hh.

158 {
159 double value = getRandom<double>(min, max);
160
161 if (precision != 0.0) {
162
163 const long long int ip = (long long int) (1.0 / precision);
164
165 value = ((double) ((long long int) (value * ip))) / ip;
166 }
167
168 return value;
169 }

◆ getZero()

template<class T >
T JMATH::getZero ( )
inline

Get zero value for a given data type.

The default implementation of this method returns an object which is created with the default constructor. This method should be specialised if this value does not correspond to the equivalent of a zero result.

Returns
zero

Definition at line 26 of file JZero.hh.

27 {
28 return T();
29 }

◆ getZero< bool >()

template<>
bool JMATH::getZero< bool > ( )
inline

Get zero value for bool.

Returns
false

Definition at line 37 of file JZero.hh.

38 {
39 return false;
40 }

◆ getZero< float >()

template<>
float JMATH::getZero< float > ( )
inline

Get zero value for float.

Returns
zero

Definition at line 48 of file JZero.hh.

49 {
50 return float(0.0);
51 }

◆ getZero< double >()

template<>
double JMATH::getZero< double > ( )
inline

Get zero value for double.

Returns
zero

Definition at line 60 of file JZero.hh.

61 {
62 return double(0.0);
63 }

◆ getZero< long double >()

template<>
long double JMATH::getZero< long double > ( )
inline

Get zero value for long double.

Returns
zero

Definition at line 72 of file JZero.hh.

73 {
74 return (long double)(0.0);
75 }

Variable Documentation

◆ PI

const double JMATH::PI = acos(-1.0)
static

Mathematical constants.

pi

Definition at line 20 of file JMath/JConstants.hh.

◆ EULER

const double JMATH::EULER = 0.577215664901533
static

Euler number.

Definition at line 21 of file JMath/JConstants.hh.

◆ KILOBYTE

const long long int JMATH::KILOBYTE = 1024
static

Computing quantities.

Definition at line 26 of file JMath/JConstants.hh.

◆ MEGABYTE

const long long int JMATH::MEGABYTE = KILOBYTE*KILOBYTE
static

Number of bytes in a kilo-byte.

Definition at line 27 of file JMath/JConstants.hh.

◆ GIGABYTE

const long long int JMATH::GIGABYTE = MEGABYTE*KILOBYTE
static

Number of bytes in a mega-byte.

Definition at line 28 of file JMath/JConstants.hh.

◆ JPolynome

template<int ID_t>
const parameter_list< JPolynome<ID_t, 0> > JPolynome<ID_t,0>::parameters& JMATH::JPolynome

Set parameters.

Definition at line 1566 of file JMathlib.hh.

◆ JPow

template<int ID_t>
const parameter_list< JPow<ID_t> > JPow<ID_t>::parameters& JMATH::JPow

Set parameters.

Definition at line 1979 of file JMathlib.hh.

◆ zero

const JZero JMATH::zero
static

Function object to assign zero value.

Definition at line 105 of file JZero.hh.