7 #ifndef CPPQEDCORE_UTILS_MATHEXTENSIONS_H_INCLUDED
8 #define CPPQEDCORE_UTILS_MATHEXTENSIONS_H_INCLUDED
10 #include "MathExtensionsFwd.h"
21 extern const double PI ;
22 extern const double SQRTPI;
23 extern const double EULER ;
26 int fcmp(
double,
double,
double);
28 template<
class T>
const T sqr(T x) {
return x*x;}
32 double sqrAbs(
const dcomp&);
34 double fact (
unsigned ) throw(FactOverflow);
35 double choose(
unsigned,
unsigned);
38 bool parity(T n) {
return n & 1;}
42 inline int round(
double r) {
43 return (r>0) ? floor(r+0.5) : ceil(r-0.5);
47 char minusOneToThePowerOf(T n) {
return parity(n) ? -1 : 1;}
62 #endif // CPPQEDCORE_UTILS_MATHEXTENSIONS_H_INCLUDED
The class that is (meant to be, at least) the base of all exceptions in the framework.
dcomp coherentElement(unsigned long n, const dcomp &alpha)
Calculates relying on the Stirling formula if is too large for explicit calculation of factorial...
Additional helpers for dcomp.
Comprises wrapper functions for mathematical functions taken from libraries (Boost.Math, GSL), and several other mathematical functions.
std::complex< double > dcomp
Double-precision complex number.
Defines tentative base classes for the exception classes of the framework.