specfun.h File Reference

Header file for collection of miscellaneous special functions for nanomagnFMM. More...

#include <cstdlib>
#include <complex>

Go to the source code of this file.

Defines

#define isnan(x)
#define isinf(x)
#define INFINITYCHECK
#define NANCHECK
#define SIGNCHECK

Typedefs

typedef std::complex< double > dcmplx
 Double complex type.

Functions

dcmplx ibeta (dcmplx z, dcmplx a, dcmplx b)
 Incomplete beta function of complex argument and complex parameters.
dcmplx lngamma (dcmplx z)
 Logarithm of Gamma function.
int GaussJacobiRule (double *x, double *w, const int Q, const double alpha, const double beta)
 abscissas and weights of Gauss-Jacobi quadrature rule.
bool tol_eq (double a, double b)
 Tolerant comparison for equality of two double numbers.
bool tol_eq (dcmplx a, dcmplx b)
 Tolerant comparison for equality of two complex double numbers.
double HeavisideTheta (double x)
 Left-handed theta function. It is equal to $ 1 $ if $ x>0 $ and $ 0 $ if $ x \leq 0 $.
int sign (double x)
bool IsInfinite (float A)
bool IsNan (float A)
int Sign (float A)
bool AlmostEqualUlps (float A, float B, int maxUlps)

Detailed Description

Header file for collection of miscellaneous special functions for nanomagnFMM.


Define Documentation

#define isinf ( x   ) 
Value:
(sizeof (x) == sizeof (long double) ? isinf_ld (x) \
               : sizeof (x) == sizeof (double) ? isinf_d (x) \
               : isinf_f (x))
#define isnan ( x   ) 
Value:
(sizeof (x) == sizeof (long double) ? isnan_ld (x) \
               : sizeof (x) == sizeof (double) ? isnan_d (x) \
               : isnan_f (x))

Function Documentation

int GaussJacobiRule ( double *  x,
double *  w,
const int  Q,
const double  alpha,
const double  beta 
)

abscissas and weights of Gauss-Jacobi quadrature rule.

The rule can be used to approximately represent the integral

\[ \int\limits_{-1}^{1} (1-x)^\alpha (1+x)^\beta f(x) d x \]

in the form

\[ \sum\limits_{i=0}^{Q-1} w_i f(x_i) . \]

For a given $ Q $ the rule integrates polynomials up to the order $ 2Q $ exactly.

Parameters:
x array of the length Q to hold the resulting abscissas (output).
w array of the length Q to hold the resulting weights (output).
Q order of the rule (of the corresponding Jacobi polynomial.
alpha weight parameter (at the right of the interval) must be >-1.
beta weight parameter (at the left of the interval) must be >-1.
Returns:
0 if evaluation is successful, GSL return code otherwise.

References jac_weights_gj(), and jac_zeros_gj().

double HeavisideTheta ( double  x  )  [inline]

Left-handed theta function. It is equal to $ 1 $ if $ x>0 $ and $ 0 $ if $ x \leq 0 $.

Parameters:
x argument.
dcmplx ibeta ( dcmplx  z,
dcmplx  a,
dcmplx  b 
)

Incomplete beta function of complex argument and complex parameters.

The incomplete beta function is defined as

\[ B(z;a,b)=\int\limits_0^z t^{a-1}(1-t)^{b-1} d t . \]

When parameters are real and $ x \in (0,1) $ the Beta function is real.

Parameters:
z argument of the Beta function (can be complex)
a parameter of Beta function
b parameter of Beta function
Returns:
value of Beta function.
dcmplx lngamma ( dcmplx  z  ) 

Logarithm of Gamma function.

It is calculated by GSL with phase (complex part) modified to match Mathematica definition.

That is lngamma(z) is analytic throughout the complex plane with a single branch cut discontinuity along the negative real axis ($ \log \Gamma(z) $ has more branch cuts).

Parameters:
z argument.
Returns:
value of analytically continued gamma function $ \log\Gamma(z) $.
bool tol_eq ( dcmplx  a,
dcmplx  b 
)

Tolerant comparison for equality of two complex double numbers.

See also:
tol_eq(double, double)
Parameters:
a number to compare
b another number to compare
Returns:
true if the numbers are tolerantly equal.

References EPS.

bool tol_eq ( double  a,
double  b 
)

Tolerant comparison for equality of two double numbers.

Compares numbers for equality with tolerance tol=100 * machine_epsilon. Formally, the numbers are equal if the absolute value of a-b is not greater than t, multiplied by the max(|a|,|b|).

Parameters:
a number to compare
b another number to compare
Returns:
true if the numbers are tolerantly equal.

References EPS.

Generated on Mon Oct 8 18:26:44 2012 for nanomagnFMM by  doxygen 1.6.3