⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mathfunc.h

📁 A C++ class library for scientific computing
💻 H
📖 第 1 页 / 共 5 页
字号:
template<typename P_numtype>class _bz_negate : public OneOperandApplicativeTemplatesBase {public:    typedef BZ_SIGNEDTYPE(P_numtype) T_numtype;    static inline T_numtype apply(T_numtype x)    { return -x; }        template<typename T1>        static void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format, const T1& a)        {                str += "-(";                       a.prettyPrint(str,format);                       str += ")";        }};// norm(P_numtype1)#ifdef BZ_HAVE_COMPLEX_FCNStemplate<typename P_numtype1>class _bz_norm : public OneOperandApplicativeTemplatesBase {public:    typedef P_numtype1 T_numtype1;    typedef P_numtype1 T_numtype;    static inline T_numtype apply(T_numtype1 x)    { return BZ_CMATHFN_SCOPE(norm)(x); }    template<typename T1>    static void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format,        const T1& a)    {        str += "norm(";        a.prettyPrint(str,format);        str += ")";    }};#endif// polar(P_numtype1, P_numtype2)#ifdef BZ_HAVE_COMPLEX_FCNStemplate<typename P_numtype1, typename P_numtype2>class _bz_polar : public TwoOperandApplicativeTemplatesBase {public:    typedef P_numtype1 T_numtype1;    typedef P_numtype2 T_numtype2;    typedef complex<T_numtype1> T_numtype;    static inline T_numtype apply(T_numtype1 x, T_numtype2 y)    { return BZ_CMATHFN_SCOPE(polar)(x,y); }    template<typename T1, typename T2>    static void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format,        const T1& a, const T2& b)    {        str += "polar(";        a.prettyPrint(str,format);        str += ",";        b.prettyPrint(str,format);        str += ")";    }};#endif// pow(P_numtype1, P_numtype2)    Powertemplate<typename P_numtype1, typename P_numtype2>class _bz_pow : public TwoOperandApplicativeTemplatesBase {public:    typedef P_numtype1 T_numtype1;    typedef P_numtype2 T_numtype2;    typedef double T_numtype;    static inline T_numtype apply(T_numtype1 x, T_numtype2 y)    { return BZ_MATHFN_SCOPE(pow)((double)x,(double)y); }    template<typename T1, typename T2>    static void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format,        const T1& a, const T2& b)    {        str += "pow(";        a.prettyPrint(str,format);        str += ",";        b.prettyPrint(str,format);        str += ")";    }};#ifndef __PGI// pow(float, float)template<>class _bz_pow<float, float > : public TwoOperandApplicativeTemplatesBase {public:    typedef float T_numtype1;    typedef float T_numtype2;    typedef float T_numtype;    static inline T_numtype apply(T_numtype1 x, T_numtype2 y)    { return BZ_MATHFN_SCOPE(pow)((float)x,(float)y); }    template<typename T1, typename T2>    static void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format,        const T1& a, const T2& b)    {        str += "pow(";        a.prettyPrint(str,format);        str += ",";        b.prettyPrint(str,format);        str += ")";    }};#endif// pow(long double, long double)template<>class _bz_pow<long double, long double > : public TwoOperandApplicativeTemplatesBase {public:    typedef long double T_numtype1;    typedef long double T_numtype2;    typedef long double T_numtype;    static inline T_numtype apply(T_numtype1 x, T_numtype2 y)    { return BZ_MATHFN_SCOPE(pow)((long double)x,(long double)y); }    template<typename T1, typename T2>    static void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format,        const T1& a, const T2& b)    {        str += "pow(";        a.prettyPrint(str,format);        str += ",";        b.prettyPrint(str,format);        str += ")";    }};// pow(complex<float>, complex<float>)#ifdef BZ_HAVE_COMPLEX_MATH1template<>class _bz_pow<complex<float>, complex<float> > : public TwoOperandApplicativeTemplatesBase {public:    typedef complex<float> T_numtype1;    typedef complex<float> T_numtype2;    typedef complex<float> T_numtype;    static inline T_numtype apply(T_numtype1 x, T_numtype2 y)    { return BZ_CMATHFN_SCOPE(pow)((complex<float>)x,(complex<float>)y); }    template<typename T1, typename T2>    static void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format,        const T1& a, const T2& b)    {        str += "pow(";        a.prettyPrint(str,format);        str += ",";        b.prettyPrint(str,format);        str += ")";    }};#endif// pow(complex<double>, complex<double>)#ifdef BZ_HAVE_COMPLEX_MATH1template<>class _bz_pow<complex<double>, complex<double> > : public TwoOperandApplicativeTemplatesBase {public:    typedef complex<double> T_numtype1;    typedef complex<double> T_numtype2;    typedef complex<double> T_numtype;    static inline T_numtype apply(T_numtype1 x, T_numtype2 y)    { return BZ_CMATHFN_SCOPE(pow)((complex<double>)x,(complex<double>)y); }    template<typename T1, typename T2>    static void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format,        const T1& a, const T2& b)    {        str += "pow(";        a.prettyPrint(str,format);        str += ",";        b.prettyPrint(str,format);        str += ")";    }};#endif#ifndef __PGI// pow(complex<long double>, complex<long double>)#ifdef BZ_HAVE_COMPLEX_MATH1template<>class _bz_pow<complex<long double>, complex<long double> > : public TwoOperandApplicativeTemplatesBase {public:    typedef complex<long double> T_numtype1;    typedef complex<long double> T_numtype2;    typedef complex<long double> T_numtype;    static inline T_numtype apply(T_numtype1 x, T_numtype2 y)    { return BZ_CMATHFN_SCOPE(pow)((complex<long double>)x,(complex<long double>)y); }    template<typename T1, typename T2>    static void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format,        const T1& a, const T2& b)    {        str += "pow(";        a.prettyPrint(str,format);        str += ",";        b.prettyPrint(str,format);        str += ")";    }};#endif#endif// remainder(P_numtype1, P_numtype2)    Remainder#ifdef BZ_HAVE_SYSTEM_V_MATHtemplate<typename P_numtype1, typename P_numtype2>class _bz_remainder : public TwoOperandApplicativeTemplatesBase {public:    typedef P_numtype1 T_numtype1;    typedef P_numtype2 T_numtype2;    typedef double T_numtype;    static inline T_numtype apply(T_numtype1 x, T_numtype2 y)    { return BZ_IEEEMATHFN_SCOPE(remainder)((double)x,(double)y); }    template<typename T1, typename T2>    static void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format,        const T1& a, const T2& b)    {        str += "remainder(";        a.prettyPrint(str,format);        str += ",";        b.prettyPrint(str,format);        str += ")";    }};#endif// rint(P_numtype1)    Round to floating point integer#ifdef BZ_HAVE_IEEE_MATHtemplate<typename P_numtype1>class _bz_rint : public OneOperandApplicativeTemplatesBase {public:    typedef P_numtype1 T_numtype1;    typedef double T_numtype;    static inline T_numtype apply(T_numtype1 x)    { return BZ_IEEEMATHFN_SCOPE(rint)((double)x); }    template<typename T1>    static void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format,        const T1& a)    {        str += "rint(";        a.prettyPrint(str,format);        str += ")";    }};#endif// rsqrt(P_numtype1)    Reciprocal square root#ifdef BZ_HAVE_SYSTEM_V_MATHtemplate<typename P_numtype1>class _bz_rsqrt : public OneOperandApplicativeTemplatesBase {public:    typedef P_numtype1 T_numtype1;    typedef double T_numtype;    static inline T_numtype apply(T_numtype1 x)    { return BZ_IEEEMATHFN_SCOPE(rsqrt)((double)x); }    template<typename T1>    static void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format,        const T1& a)    {        str += "rsqrt(";        a.prettyPrint(str,format);        str += ")";    }};#endif// scalb(P_numtype1, P_numtype2)    x * (2**y)#ifdef BZ_HAVE_SYSTEM_V_MATHtemplate<typename P_numtype1, typename P_numtype2>class _bz_scalb : public TwoOperandApplicativeTemplatesBase {public:    typedef P_numtype1 T_numtype1;    typedef P_numtype2 T_numtype2;    typedef double T_numtype;    static inline T_numtype apply(T_numtype1 x, T_numtype2 y)    { return BZ_IEEEMATHFN_SCOPE(scalb)((double)x,(double)y); }    template<typename T1, typename T2>    static void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format,        const T1& a, const T2& b)    {        str += "scalb(";        a.prettyPrint(str,format);        str += ",";        b.prettyPrint(str,format);        str += ")";    }};#endif// sin(P_numtype1)    Sinetemplate<typename P_numtype1>class _bz_sin : public OneOperandApplicativeTemplatesBase {public:    typedef P_numtype1 T_numtype1;    typedef double T_numtype;    static inline T_numtype apply(T_numtype1 x)    { return BZ_MATHFN_SCOPE(sin)((double)x); }    template<typename T1>    static void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format,        const T1& a)    {        str += "sin(";        a.prettyPrint(str,format);        str += ")";    }};// sin(float)template<>class _bz_sin<float> : public OneOperandApplicativeTemplatesBase {public:    typedef float T_numtype1;    typedef float T_numtype;    static inline T_numtype apply(T_numtype1 x)    { return BZ_MATHFN_SCOPE(sin)((float)x); }    template<typename T1>    static void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format,        const T1& a)    {        str += "sin(";        a.prettyPrint(str,format);        str += ")";    }};// sin(long double)template<>class _bz_sin<long double> : public OneOperandApplicativeTemplatesBase {public:    typedef long double T_numtype1;    typedef long double T_numtype;    static inline T_numtype apply(T_numtype1 x)    { return BZ_MATHFN_SCOPE(sin)((long double)x); }    template<typename T1>    static void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format,        const T1& a)    {        str += "sin(";        a.prettyPrint(str,format);        str += ")";    }};// sin(complex<float> )#ifdef BZ_HAVE_COMPLEX_MATH1template<>class _bz_sin<complex<float> > : public OneOperandApplicativeTemplatesBase {public:    typedef complex<float>  T_numtype1;    typedef complex<float> T_numtype;    static inline T_numtype apply(T_numtype1 x)    { return BZ_CMATHFN_SCOPE(sin)((complex<float> )x); }    template<typename T1>    static void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format,        const T1& a)    {        str += "sin(";        a.prettyPrint(str,format);        str += ")";    }};#endif// sin(complex<double> )#ifdef BZ_HAVE_COMPLEX_MATH1template<>class _bz_sin<complex<double> > : public OneOperandApplicativeTemplatesBase {public:    typedef complex<double>  T_numtype1;    typedef complex<double> T_numtype;    static inline T_numtype apply(T_numtype1 x)    { return BZ_CMATHFN_SCOPE(sin)((complex<double> )x); }    template<typename T1>    static void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format,        const T1& a)    {        str += "sin(";        a.prettyPrint(str,format);        str += ")";    }};#endif#ifndef __PGI// sin(complex<long double> )#ifdef BZ_HAVE_COMPLEX_MATH1template<>class _bz_sin<complex<long double> > : public OneOperandApplicativeTemplatesBase {public:    typedef complex<long double>  T_numtype1;    typedef complex<long double> T_numtype;    static inline T_numtype apply(T_numtype1 x)    { return BZ_CMATHFN_SCOPE(sin)((complex<long double> )x); }    template<typename T1>    static void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format,        const T1& a)    {        str += "sin(";        a.prettyPrint(str,format);        str += ")";    }};#endif#endif// sinh(P_numtype1)    Hyperbolic sinetemplate<typename P_numtype1>class _bz_sinh : public OneOperandApplicativeTemplatesBase {public:    typedef P_numtype1 T_numtype1;    typedef double T_numtype;    static inline T_numtype apply(T_numtype1 x)    { return BZ_MATHFN_SCOPE(sinh)((double)x); }    template<typename T1>    static void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format,        const T1& a)    {        str += "sinh(";        a.prettyPrint(str,format);        str += ")";    }};// sinh(float)template<>class _bz_sinh<float> : public OneOperandApplicativeTemplatesBase {public:    typedef float T_numtype1;    typedef float T_numtype;    static inline T_numtype apply(T_numtype1 x)    { return BZ_MATHFN_SCOPE(sinh)((float)x); }    template<typename T1>    static void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format,        const T1& a)    {        str += "sinh(";        a.prettyPrint(str,format);        str += ")";    }};// sinh(long double)template<>class _bz_sinh<long double> : public OneOperandApplicativeTemplatesBase {public:    typedef long double T_numtype1;    typedef long double T_numtype;    static inline T_numtype apply(T_numtype1 x)    { return BZ_MATHFN_SCOPE(sinh)((long double)x); }    template<typename T1>    static void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format,        const T1& a)    {        str += "sinh(";        a.prettyPrint(str,format);        str += ")";    }};// sinh(complex<float> )#ifdef BZ_HAVE_COMPLEX_MATH1template<>class _bz_sinh<complex

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -