MPFRCPP Extra Modules

Contents


1. Beta function [<mpfrcpp/extra/beta.hpp>]

Beta function could be defined as Beta (x,y) = Gamma(x)Gamma(y)/Gamma(x+y).
namespace mpfrcpp {
Real Beta (Real&, Real&) throw();
}

2. Complex Numbers [<mpfrcpp/extra/complex.hpp>]

Complex numbers implementation. Based on the GNU ISO C++ Library implementation by Gabriel Dos Reis. It's not a std::complex<T> specialization for T = mpfrcpp::Real because of distinctions in different std::complex<T> implementations (actually, not all of them are ISO-conforming).

namespace mpfrcpp {
typedef class nacre::complex::Complex<Real> Complex;
using namespace nacre::complex;
}

See the NACRE definitions.

3. FP-Comparator [<mpfrcpp/extra/fp_comparator.hpp>]

Comparison of two floating point numbers respecting to some epsilon, machine epsilon by default.

namespace mpfrcpp {
typedef class nacre::comparator::FpComparator<Real> FpComparator;
using nacre::comparator;
}

See the NACRE definitions.

4. Polynomials [<mpfrcpp/extra/polynomial.hpp>]

General polynomial class, orthogonal polynomials (Chebyshev, Hermite, Laguerre, Legendre), polynomial roots (Muller method).

namespace mpfrcpp {
typedef class nacre::polynomial::Polynomial<Real> Polynomial;
using namespace nacre::polynomial;
}

See the NACRE definitions.

5. Functors rounding to ±∞ [<mpfrcpp/extra/pminf.hpp>]

namespace mpfrcpp {
    extern AbsClass AbsMInf;
    extern AbsClass AbsPInf;

    extern AcosClass AcosMInf;
    extern AcosClass AcosPInf;

    extern AcoshClass AcoshMInf;
    extern AcoshClass AcoshPInf;

    extern AgmClass AgmMInf;
    extern AgmClass AgmPInf;

    extern AsinhClass AsinhMInf;
    extern AsinhClass AsinhPInf;

    extern AtanClass AtanMInf;
    extern AtanClass AtanPInf;

    extern AtanhClass AtanhMInf;
    extern AtanhClass AtanhPInf;

    extern CbrtClass CbrtMInf;
    extern CbrtClass CbrtPInf;

    extern ConstantClass ConstantMInf;
    extern ConstantClass ConstantPInf;

    extern CosClass CosMInf;
    extern CosClass CosPInf;

    extern CoshClass CoshMInf;
    extern CoshClass CoshPInf;

    extern CotClass CotMInf;
    extern CotClass CotPInf;

    extern CothClass CothMInf;
    extern CothClass CothPInf;

    extern CscClass CscMInf;
    extern CscClass CscPInf;

    extern CschClass CschMInf;
    extern CschClass CschPInf;

    extern DivClass DivMInf;
    extern DivClass DivPInf;

    extern EintClass EintMInf;
    extern EintClass EintPInf;

    extern ErfClass ErfMInf;
    extern ErfClass ErfPInf;

    extern ErfcClass ErfcMInf;
    extern ErfcClass ErfcPInf;

    extern ExpClass ExpMInf;
    extern ExpClass ExpPInf;

    extern Exp10Class Exp10MInf;
    extern Exp10Class Exp10PInf;

    extern Exp2Class Exp2MInf;
    extern Exp2Class Exp2PInf;

    extern Expm1Class Expm1MInf;
    extern Expm1Class Expm1PInf;

    extern FactorialClass FactorialMInf;
    extern FactorialClass FactorialPInf;

    extern FmaClass FmaMInf;
    extern FmaClass FmaPInf;

    extern FracClass FracMInf;
    extern FracClass FracPInf;

    extern GammaClass GammaMInf;
    extern GammaClass GammaPInf;

    extern HypotClass HypotMInf;
    extern HypotClass HypotPInf;

    extern LngammaClass LngammaMInf;
    extern LngammaClass LngammaPInf;

    extern LogClass LogMInf;
    extern LogClass LogPInf;

    extern Log10Class Log10MInf;
    extern Log10Class Log10PInf;

    extern Log1pClass Log1pMInf;
    extern Log1pClass Log1pPInf;

    extern Log2Class Log2MInf;
    extern Log2Class Log2PInf;

    extern MulClass MulMInf;
    extern MulClass MulPInf;

    extern NegClass NegMInf;
    extern NegClass NegPInf;

    extern PowClass PowMInf;
    extern PowClass PowPInf;

    extern RootClass RootMInf;
    extern RootClass RootPInf;

    extern SecClass SecMInf;
    extern SecClass SecPInf;

    extern SechClass SechMInf;
    extern SechClass SechPInf;

    extern SinClass SinMInf;
    extern SinClass SinPInf;

    extern SinCosClass SinCosMInf;
    extern SinCosClass SinCosPInf;

    extern SinhClass SinhMInf;
    extern SinhClass SinhPInf;

    extern SqrClass SqrMInf;
    extern SqrClass SqrPInf;

    extern SqrtClass SqrtMInf;
    extern SqrtClass SqrtPInf;

    extern SubClass SubMInf;
    extern SubClass SubPInf;

    extern TanClass TanMInf;
    extern TanClass TanPInf;

    extern TanhClass TanhMInf;
    extern TanhClass TanhPInf;

    extern ZetaClass ZetaMInf;
    extern ZetaClass ZetaPInf;

    class ExtraNumericFunctions : public NumericFunctions;
    extern ExtraNumericFunctions ExtraFunctions;
}    // namespace mpfrcpp

6. Simple Functions [<mpfrcpp/extra/simple_functions.hpp>]

Overloads the folowing functions: abs, acos, acosh, agm, asin, asinh, atan2, atan, atanh, cbrt, ceil, cos, cosh, cot, coth, csc, csch, eint, erf, erfc, exp10, exp2, exp, expm1, factorial, floor, fma, frac, gamma, hypot, lngamma, log10, log1p, log2, log, pow, root, round, sec, sech, sin, sinh, sqr, sqrt, tan, tanh, trunc, zeta in the mpfrcpp namespace.

Could conflict with std_overloads.hpp, do not use with std_overloads.hpp.

namespace mpfrcpp {
    Real abs (const Real&) throw();
    Real acos (const Real&) throw();
    Real acosh (const Real&) throw();
    Real agm (const Real&, const Real&) throw();
    Real asin (const Real&) throw();
    Real asinh (const Real&) throw();
    Real atan2 (const Real&, const Real&) throw();
    Real atan (const Real&) throw();
    Real atanh (const Real&) throw();
    Real cbrt (const Real&) throw();
    Real ceil (const Real&) throw();
    Real cos (const Real&) throw();
    Real cosh (const Real&) throw();
    Real cot (const Real&) throw();
    Real coth (const Real&) throw();
    Real csc (const Real&) throw();
    Real csch (const Real&) throw();
    Real eint (const Real&) throw();
    Real erf (const Real&) throw();
    Real erfc (const Real&) throw();
    Real exp10 (const Real&) throw();
    Real exp2 (const Real&) throw();
    Real exp (const Real&) throw();
    Real expm1 (const Real&) throw();
    Real factorial (unsigned int) throw();
    Real floor (const Real&) throw();
    Real fma (const Real&, const Real&, const Real&) throw();
    Real frac (const Real&) throw();
    Real gamma (const Real&) throw();
    Real hypot (const Real&, const Real&) throw();
    Real lngamma (const Real&) throw();
    Real log10 (const Real&) throw();
    Real log1p (const Real&) throw();
    Real log2 (const Real&) throw();
    Real log (const Real&) throw();
    Real pow (const Real&, const Real&) throw();
    Real pow (const Real&, int&) throw();
    Real pow (const Real&, const mpz_t&) throw();
    Real pow (const Real&, const mpz_class&) throw();
    Real root (const Real&, unsigned int) throw();
    Real round (const Real&) throw();
    Real sec (const Real&) throw();
    Real sech (const Real&) throw();
    Real sin (const Real&) throw();
    Real sinh (const Real&) throw();
    Real sqr (const Real&) throw();
    Real sqrt (const Real&) throw();
    Real tan (const Real&) throw();
    Real tanh (const Real&) throw();
    Real trunc (const Real&) throw();
    Real zeta (const Real&) throw();
}     // namespace mpfrcpp

7. Namespace std Overloads [<mpfrcpp/extra/std_overloads.hpp>]

Overloads the folowing functions: abs, acos, asin, atan, atan2, ceil, cos, cosh, exp, fabs, floor, fmod, frexp, ldexp, log, log10, modf, pow, sin, sinh, sqrt, swap, tan, tanh in the std namespace.

Partial std::numeric_limits<Real> specification. Could conflict with simple_functions.hpp, do not use with simple_functions.hpp.

namespace std {
    void swap (mpfrcpp::Real&, mpfrcpp::Real&) throw();

    mpfrcpp::Real abs (const mpfrcpp::Real&) throw();
    mpfrcpp::Real acos (const mpfrcpp::Real&) throw();
    mpfrcpp::Real asin (const mpfrcpp::Real&) throw();
    mpfrcpp::Real atan (const mpfrcpp::Real&) throw();
    mpfrcpp::Real atan2 (const mpfrcpp::Real&, const mpfrcpp::Real&);
    mpfrcpp::Real ceil (const mpfrcpp::Real&) throw();
    mpfrcpp::Real cos (const mpfrcpp::Real&) throw();
    mpfrcpp::Real cosh (const mpfrcpp::Real&) throw();
    mpfrcpp::Real exp (const mpfrcpp::Real&) throw();
    mpfrcpp::Real fabs (const mpfrcpp::Real&) throw();
    mpfrcpp::Real floor (const mpfrcpp::Real&) throw();
    mpfrcpp::Real fmod (const mpfrcpp::Real&, const mpfrcpp::Real&) throw();
    mpfrcpp::Real frexp (const mpfrcpp::Real&, int*) throw();
    mpfrcpp::Real ldexp (const mpfrcpp::Real&, int) throw();
    mpfrcpp::Real log (const mpfrcpp::Real&) throw();
    mpfrcpp::Real log10 (const mpfrcpp::Real&) throw();
    mpfrcpp::Real modf (const mpfrcpp::Real&, mpfrcpp::Real*) throw();
    mpfrcpp::Real pow (const mpfrcpp::Real&, const mpfrcpp::Real&) throw();
    mpfrcpp::Real pow (const mpfrcpp::Real&, int&) throw();
    mpfrcpp::Real sin (const mpfrcpp::Real&) throw();
    mpfrcpp::Real sinh (const mpfrcpp::Real&) throw();
    mpfrcpp::Real sqrt (const mpfrcpp::Real&) throw();
    mpfrcpp::Real tan (const mpfrcpp::Real&) throw();
    mpfrcpp::Real tanh (const mpfrcpp::Real&) throw();

    template<> class numeric_limits<mpfrcpp::Real> {
    public:
        static const bool is_specialized = false; // FIXME
        static const int radix = 2;
        static const bool is_signed = true;
        static const bool is_integer = false;
        static const bool is_iec559 = true;
        static const bool has_infinity = true;
        static const bool has_quiet_NaN = true;
        static const bool is_bounded = true;
        static const bool is_modulo = false;
        static const bool is_exact = false;

        static mpfrcpp::Real epsilon () throw();
        static mpfrcpp::Real quiet_NaN() throw();
        static mpfrcpp::Real signaling_NaN() throw();
        static mpfrcpp::Real infinity() throw();
    };
}    // namespace std

numeric_limits<mpfrcpp::Real>::is_specialized == false since the complete specification depends on type precision. Current code should be used to get epsilon / NaN / Infinity only.