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

📄 mathfunc.h

📁 数值计算工具库,C语言编写的,可以直接调用.
💻 H
📖 第 1 页 / 共 5 页
字号:
// Generated: genmathfunc.cpp Feb  3 1999 09:08:50

#ifndef BZ_MATHFUNC_H
#define BZ_MATHFUNC_H

#ifndef BZ_APPLICS_H
 #error <blitz/mathfunc.h> should be included via <blitz/applics.h>
#endif


#ifndef BZ_PRETTYPRINT_H
 #include <blitz/prettyprint.h>
#endif

BZ_NAMESPACE(blitz)

// abs(P_numtype1)    Absolute value
template<class P_numtype1>
class _bz_abs : public OneOperandApplicativeTemplatesBase {
public:
    typedef P_numtype1 T_numtype1;
    typedef P_numtype1 T_numtype;

    static inline T_numtype apply(T_numtype1 x)
    { return BZ_MATHFN_SCOPE(abs)(x); }

    template<class T1>
    static void prettyPrint(string& str, prettyPrintFormat& format,
        const T1& a)
    {
        str += "abs(";
        a.prettyPrint(str,format);
        str += ")";
    }
};

// abs(long)
template<>
class _bz_abs<long> : public OneOperandApplicativeTemplatesBase {
public:
    typedef long T_numtype1;
    typedef long T_numtype;

    static inline T_numtype apply(T_numtype1 x)
    { return BZ_MATHFN_SCOPE(labs)((long)x); }

    template<class T1>
    static void prettyPrint(string& str, prettyPrintFormat& format,
        const T1& a)
    {
        str += "labs(";
        a.prettyPrint(str,format);
        str += ")";
    }
};

// abs(float)
template<>
class _bz_abs<float> : public OneOperandApplicativeTemplatesBase {
public:
    typedef float T_numtype1;
    typedef float T_numtype;

    static inline T_numtype apply(T_numtype1 x)
    { return BZ_MATHFN_SCOPE(fabs)((float)x); }

    template<class T1>
    static void prettyPrint(string& str, prettyPrintFormat& format,
        const T1& a)
    {
        str += "fabs(";
        a.prettyPrint(str,format);
        str += ")";
    }
};

// abs(double)
template<>
class _bz_abs<double> : public OneOperandApplicativeTemplatesBase {
public:
    typedef double T_numtype1;
    typedef double T_numtype;

    static inline T_numtype apply(T_numtype1 x)
    { return BZ_MATHFN_SCOPE(fabs)((double)x); }

    template<class T1>
    static void prettyPrint(string& str, prettyPrintFormat& format,
        const T1& a)
    {
        str += "fabs(";
        a.prettyPrint(str,format);
        str += ")";
    }
};

// abs(long double)
template<>
class _bz_abs<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(fabs)((long double)x); }

    template<class T1>
    static void prettyPrint(string& str, prettyPrintFormat& format,
        const T1& a)
    {
        str += "fabs(";
        a.prettyPrint(str,format);
        str += ")";
    }
};

// abs(complex<float> )
#ifdef BZ_HAVE_COMPLEX_MATH
template<>
class _bz_abs<complex<float> > : public OneOperandApplicativeTemplatesBase {
public:
    typedef complex<float>  T_numtype1;
    typedef float T_numtype;

    static inline T_numtype apply(T_numtype1 x)
    { return BZ_CMATHFN_SCOPE(abs)((complex<float> )x); }

    template<class T1>
    static void prettyPrint(string& str, prettyPrintFormat& format,
        const T1& a)
    {
        str += "abs(";
        a.prettyPrint(str,format);
        str += ")";
    }
};
#endif

// abs(complex<double> )
#ifdef BZ_HAVE_COMPLEX_MATH
template<>
class _bz_abs<complex<double> > : public OneOperandApplicativeTemplatesBase {
public:
    typedef complex<double>  T_numtype1;
    typedef double T_numtype;

    static inline T_numtype apply(T_numtype1 x)
    { return BZ_CMATHFN_SCOPE(abs)((complex<double> )x); }

    template<class T1>
    static void prettyPrint(string& str, prettyPrintFormat& format,
        const T1& a)
    {
        str += "abs(";
        a.prettyPrint(str,format);
        str += ")";
    }
};
#endif

// abs(complex<long double> )
#ifdef BZ_HAVE_COMPLEX_MATH
template<>
class _bz_abs<complex<long double> > : public OneOperandApplicativeTemplatesBase {
public:
    typedef complex<long double>  T_numtype1;
    typedef long double T_numtype;

    static inline T_numtype apply(T_numtype1 x)
    { return BZ_CMATHFN_SCOPE(abs)((complex<long double> )x); }

    template<class T1>
    static void prettyPrint(string& str, prettyPrintFormat& format,
        const T1& a)
    {
        str += "abs(";
        a.prettyPrint(str,format);
        str += ")";
    }
};
#endif

// acos(P_numtype1)    Inverse cosine
template<class P_numtype1>
class _bz_acos : public OneOperandApplicativeTemplatesBase {
public:
    typedef P_numtype1 T_numtype1;
    typedef double T_numtype;

    static inline T_numtype apply(T_numtype1 x)
    { return BZ_MATHFN_SCOPE(acos)((double)x); }

    template<class T1>
    static void prettyPrint(string& str, prettyPrintFormat& format,
        const T1& a)
    {
        str += "acos(";
        a.prettyPrint(str,format);
        str += ")";
    }
};

// acos(float)
template<>
class _bz_acos<float> : public OneOperandApplicativeTemplatesBase {
public:
    typedef float T_numtype1;
    typedef float T_numtype;

    static inline T_numtype apply(T_numtype1 x)
    { return BZ_MATHFN_SCOPE(acos)((float)x); }

    template<class T1>
    static void prettyPrint(string& str, prettyPrintFormat& format,
        const T1& a)
    {
        str += "acos(";
        a.prettyPrint(str,format);
        str += ")";
    }
};

// acos(long double)
template<>
class _bz_acos<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(acos)((long double)x); }

    template<class T1>
    static void prettyPrint(string& str, prettyPrintFormat& format,
        const T1& a)
    {
        str += "acos(";
        a.prettyPrint(str,format);
        str += ")";
    }
};

// acosh(P_numtype1)    Inverse hyperbolic cosine
#ifdef BZ_HAVE_IEEE_MATH
template<class P_numtype1>
class _bz_acosh : public OneOperandApplicativeTemplatesBase {
public:
    typedef P_numtype1 T_numtype1;
    typedef double T_numtype;

    static inline T_numtype apply(T_numtype1 x)
    { return BZ_IEEEMATHFN_SCOPE(acosh)((double)x); }

    template<class T1>
    static void prettyPrint(string& str, prettyPrintFormat& format,
        const T1& a)
    {
        str += "acosh(";
        a.prettyPrint(str,format);
        str += ")";
    }
};
#endif

// asin(P_numtype1)    Inverse sine
template<class P_numtype1>
class _bz_asin : public OneOperandApplicativeTemplatesBase {
public:
    typedef P_numtype1 T_numtype1;
    typedef double T_numtype;

    static inline T_numtype apply(T_numtype1 x)
    { return BZ_MATHFN_SCOPE(asin)((double)x); }

    template<class T1>
    static void prettyPrint(string& str, prettyPrintFormat& format,
        const T1& a)
    {
        str += "asin(";
        a.prettyPrint(str,format);
        str += ")";
    }
};

// asin(float)
template<>
class _bz_asin<float> : public OneOperandApplicativeTemplatesBase {
public:
    typedef float T_numtype1;
    typedef float T_numtype;

    static inline T_numtype apply(T_numtype1 x)
    { return BZ_MATHFN_SCOPE(asin)((float)x); }

    template<class T1>
    static void prettyPrint(string& str, prettyPrintFormat& format,
        const T1& a)
    {
        str += "asin(";
        a.prettyPrint(str,format);
        str += ")";
    }
};

// asin(long double)
template<>
class _bz_asin<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(asin)((long double)x); }

    template<class T1>
    static void prettyPrint(string& str, prettyPrintFormat& format,
        const T1& a)
    {
        str += "asin(";
        a.prettyPrint(str,format);
        str += ")";
    }
};

// asinh(P_numtype1)    Inverse hyperbolic sine
#ifdef BZ_HAVE_IEEE_MATH
template<class P_numtype1>
class _bz_asinh : public OneOperandApplicativeTemplatesBase {
public:
    typedef P_numtype1 T_numtype1;
    typedef double T_numtype;

    static inline T_numtype apply(T_numtype1 x)
    { return BZ_IEEEMATHFN_SCOPE(asinh)((double)x); }

    template<class T1>
    static void prettyPrint(string& str, prettyPrintFormat& format,
        const T1& a)
    {
        str += "asinh(";
        a.prettyPrint(str,format);
        str += ")";
    }
};
#endif

// arg(P_numtype1)
#ifdef BZ_HAVE_COMPLEX_MATH
template<class P_numtype1>
class _bz_arg : public OneOperandApplicativeTemplatesBase {
public:
    typedef P_numtype1 T_numtype1;
    typedef P_numtype1 T_numtype;

    static inline T_numtype apply(T_numtype1 x)
    { return 0; }

    template<class T1>
    static void prettyPrint(string& str, prettyPrintFormat& format,
        const T1& a)
    {
        str += "0(";
        a.prettyPrint(str,format);
        str += ")";
    }
};
#endif

// arg(complex<float> )
#ifdef BZ_HAVE_COMPLEX_MATH
template<>
class _bz_arg<complex<float> > : public OneOperandApplicativeTemplatesBase {
public:
    typedef complex<float>  T_numtype1;
    typedef float T_numtype;

    static inline T_numtype apply(T_numtype1 x)
    { return BZ_CMATHFN_SCOPE(arg)((complex<float> )x); }

    template<class T1>
    static void prettyPrint(string& str, prettyPrintFormat& format,
        const T1& a)
    {
        str += "arg(";
        a.prettyPrint(str,format);
        str += ")";
    }
};
#endif

// arg(complex<double> )
#ifdef BZ_HAVE_COMPLEX_MATH
template<>
class _bz_arg<complex<double> > : public OneOperandApplicativeTemplatesBase {
public:
    typedef complex<double>  T_numtype1;
    typedef double T_numtype;

    static inline T_numtype apply(T_numtype1 x)
    { return BZ_CMATHFN_SCOPE(arg)((complex<double> )x); }

    template<class T1>
    static void prettyPrint(string& str, prettyPrintFormat& format,
        const T1& a)
    {
        str += "arg(";
        a.prettyPrint(str,format);
        str += ")";
    }
};
#endif

// arg(complex<long double> )
#ifdef BZ_HAVE_COMPLEX_MATH
template<>
class _bz_arg<complex<long double> > : public OneOperandApplicativeTemplatesBase {
public:
    typedef complex<long double>  T_numtype1;
    typedef long double T_numtype;

    static inline T_numtype apply(T_numtype1 x)
    { return BZ_CMATHFN_SCOPE(arg)((complex<long double> )x); }

    template<class T1>
    static void prettyPrint(string& str, prettyPrintFormat& format,
        const T1& a)
    {
        str += "arg(";
        a.prettyPrint(str,format);
        str += ")";
    }
};
#endif

// atan(P_numtype1)    Inverse tangent
template<class P_numtype1>
class _bz_atan : public OneOperandApplicativeTemplatesBase {
public:
    typedef P_numtype1 T_numtype1;
    typedef double T_numtype;

    static inline T_numtype apply(T_numtype1 x)
    { return BZ_MATHFN_SCOPE(atan)((double)x); }

    template<class T1>
    static void prettyPrint(string& str, prettyPrintFormat& format,
        const T1& a)
    {
        str += "atan(";
        a.prettyPrint(str,format);
        str += ")";
    }
};

// atan(float)
template<>
class _bz_atan<float> : public OneOperandApplicativeTemplatesBase {
public:
    typedef float T_numtype1;
    typedef float T_numtype;

    static inline T_numtype apply(T_numtype1 x)
    { return BZ_MATHFN_SCOPE(atan)((float)x); }

    template<class T1>
    static void prettyPrint(string& str, prettyPrintFormat& format,
        const T1& a)
    {
        str += "atan(";
        a.prettyPrint(str,format);
        str += ")";
    }
};

// atan(long double)
template<>
class _bz_atan<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(atan)((long double)x); }

    template<class T1>
    static void prettyPrint(string& str, prettyPrintFormat& format,
        const T1& a)
    {
        str += "atan(";
        a.prettyPrint(str,format);
        str += ")";
    }
};

// atanh(P_numtype1)    Inverse hyperbolic tangent
#ifdef BZ_HAVE_IEEE_MATH
template<class P_numtype1>

⌨️ 快捷键说明

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