首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

complex

此标头是数字图书馆。

complex

a complex number type (class template)

complex<float>complex<double>complex<long double>

a complex number type (class template specialization)

功能

操作

*。

运算符+运算符-将一元运算符应用于复数%28函数模板%29

运算符+运算符%2A运算符/在两个复数或复数和标量%28函数模板%29上执行复数算法

运算符==运算符%21=比较两个复数或复数和标量%28函数模板%29

运算符<<operator>>序列化和反序列化复数%28函数模板%29

实返回真实组件%28函数模板%29

IMAG返回虚分量%28函数模板%29

ABS%28std::Complex%29返回复数%28函数模板%29的大小

Arg返回相位角%28函数模板%29

范数返回平方数量级%28函数模板%29

返回复共轭%28函数模板%29

Proj%28C++11%29将投影返回到Riemann球面%28函数模板%29上。

极性从大小和相位角%28函数模板%29构造复数

指数函数

Exp%28 std::复数%29复合碱基e指数%28功能模板%29

LOG%28 std::复数%29复自然对数与分支沿负实轴切割%28功能模板%29

LOG 10%28 std::复数%29复数共对数与分支沿负实轴切割%28函数模板%29

幂函数

POW%28 std::复数%29复幂,一个或两个参数可能是复数%28函数模板%29

sqrt%28 std::右半平面%28函数模板%29范围内的复数%29复平方根

三角函数

SIN%28 std::复数%29计算复数的正弦数%28 sin%28Z%29%29%28函数模板%29

COS%28 std::复数%29计算复数的余弦%28 cos%28Z%29%29%28函数模板%29

TAN%28 std::复数%29计算复数数%28 tan%28Z%29%29%28函数模板%29的切线

Asin%28std::复数%29%28C++11%29计算复数的弧正弦%28 arcsin%28Z%29%29%28函数模板%29

ACOS%28std::复数%29%28C++11%29计算复数的弧余弦%28 arccos%28Z%29%29%28函数模板%29

Atan%28std::复数%29%28C++11%29计算复数的弧切线%28arctan%28Z%29%29%28函数模板%29

双曲函数

辛氏%28 std::复数%29计算复数的双曲正弦数%28 sh%28Z%29%29%28函数模板%29

COSH%28 std::复数%29计算复数的双曲余弦值%28ch%28Z%29%29%28函数模板%29

TANK%28 std::复数%29计算复数数%28函数模板%29的双曲切线

Asinh%28 std::复数%29%28C++11%29计算复数的面积双曲正弦数%28函数模板%29

ACOSH%28 std::复数%29%28C++11%29计算复数数%28函数模板%29的面积双曲余弦

ATANH%28 std::复数%29%28C++11%29计算复数数%28函数模板%29的面积双曲切线

简介

二次

代码语言:javascript
复制
namespace std {
 
    template<class T> class complex;
 
    template<> class complex<float>;
    template<> class complex<double>;
    template<> class complex<long double>;
 
    // operators:
    template<class T> complex<T> operator+(
        const complex<T>&, const complex<T>&);
    template<class T> complex<T> operator+(const complex<T>&, const T&);
    template<class T> complex<T> operator+(const T&, const complex<T>&);
 
    template<class T> complex<T> operator-(
        const complex<T>&, const complex<T>&);
    template<class T> complex<T> operator-(const complex<T>&, const T&);
    template<class T> complex<T> operator-(const T&, const complex<T>&);
 
    template<class T> complex<T> operator*(
        const complex<T>&, const complex<T>&);
    template<class T> complex<T> operator*(const complex<T>&, const T&);
    template<class T> complex<T> operator*(const T&, const complex<T>&);
 
    template<class T> complex<T> operator/(
        const complex<T>&, const complex<T>&);
    template<class T> complex<T> operator/(const complex<T>&, const T&);
    template<class T> complex<T> operator/(const T&, const complex<T>&);
 
    template<class T> complex<T> operator+(const complex<T>&);
    template<class T> complex<T> operator-(const complex<T>&);
 
    template<class T> bool operator==(
        const complex<T>&, const complex<T>&);
    template<class T> bool operator==(const complex<T>&, const T&);
    template<class T> bool operator==(const T&, const complex<T>&);
 
    template<class T> bool operator!=(const complex<T>&, const complex<T>&);
    template<class T> bool operator!=(const complex<T>&, const T&);
    template<class T> bool operator!=(const T&, const complex<T>&);
 
    template<class T, class charT, class traits>
    basic_istream<charT, traits>&
    operator>>(basic_istream<charT, traits>&, complex<T>&);
 
    template<class T, class charT, class traits>
    basic_ostream<charT, traits>&
    operator<<(basic_ostream<charT, traits>&, const complex<T>&);
 
    // values:
    template<class T> T real(const complex<T>&);
    template<class T> T imag(const complex<T>&);
 
    template<class T> T abs(const complex<T>&);
    template<class T> T arg(const complex<T>&);
    template<class T> T norm(const complex<T>&);
 
    template<class T> complex<T> conj(const complex<T>&);
    template <class T> complex<T> proj(const complex<T>&);
    template<class T> complex<T> polar(const T&, const T& = 0);
 
    // transcendentals:
    template<class T> complex<T> acos(const complex<T>&);
    template<class T> complex<T> asin(const complex<T>&);
    template<class T> complex<T> atan(const complex<T>&);
 
    template<class T> complex<T> acosh(const complex<T>&);
    template<class T> complex<T> asinh(const complex<T>&);
    template<class T> complex<T> atanh(const complex<T>&);
 
    template<class T> complex<T> cos  (const complex<T>&);
    template<class T> complex<T> cosh (const complex<T>&);
    template<class T> complex<T> exp  (const complex<T>&);
    template<class T> complex<T> log  (const complex<T>&);
    template<class T> complex<T> log10(const complex<T>&);
 
    template<class T> complex<T> pow(const complex<T>&, const T&);
    template<class T> complex<T> pow(const complex<T>&, const complex<T>&);
    template<class T> complex<T> pow(const T&, const complex<T>&);
 
    template<class T> complex<T> sin    (const complex<T>&);
    template<class T> complex<T> sinh   (const complex<T>&);
    template<class T> complex<T> sqrt   (const complex<T>&);
    template<class T> complex<T> tan    (const complex<T>&);
    template<class T> complex<T> tanh   (const complex<T>&);
 
 
}

二次

std::complex

二次

代码语言:javascript
复制
template<class T>
class complex {
public:
    typedef T value_type;
    complex(const T& re = T(), const T& im = T());
    complex(const complex&);
    template<class X> complex(const complex<X>&);
 
    T real() const;
    void real(T);
    T imag() const;
    void imag(T);
 
    complex<T>& operator= (const T&);
    complex<T>& operator+=(const T&);
    complex<T>& operator-=(const T&);
    complex<T>& operator*=(const T&);
    complex<T>& operator/=(const T&);
 
    complex& operator=(const complex&);     
    template<class X> complex<T>& operator= (const complex<X>&);   
    template<class X> complex<T>& operator+=(const complex<X>&);   
    template<class X> complex<T>& operator-=(const complex<X>&);   
    template<class X> complex<T>& operator*=(const complex<X>&);   
    template<class X> complex<T>& operator/=(const complex<X>&);   
 
};

二次

std::complex专门性

二次

代码语言:javascript
复制
template<> class complex<float> {
public:
    typedef float value_type;
 
    constexpr complex(float re = 0.0f, float im = 0.0f);
    explicit constexpr complex(const complex<double>&);
    explicit constexpr complex(const complex<long double>&);
 
    constexpr float real();
    void real(float);
    constexpr float imag();
    void imag(float);
 
    complex<float>& operator= (float);
    complex<float>& operator+=(float);
    complex<float>& operator-=(float);
    complex<float>& operator*=(float);
    complex<float>& operator/=(float);
 
    complex<float>& operator=(const complex<float>&);
    template<class X> complex<float>& operator= (const complex<X>&);
    template<class X> complex<float>& operator+=(const complex<X>&);
    template<class X> complex<float>& operator-=(const complex<X>&);
    template<class X> complex<float>& operator*=(const complex<X>&);
    template<class X> complex<float>& operator/=(const complex<X>&);
};
 
template<> class complex<double> {
public:
    typedef double value_type;
 
    constexpr complex(double re = 0.0, double im = 0.0);
    constexpr complex(const complex<float>&);
    explicit constexpr complex(const complex<long double>&);
 
    constexpr double real();
    void real(double);
    constexpr double imag();
    void imag(double);
 
    complex<double>& operator= (double);
    complex<double>& operator+=(double);
    complex<double>& operator-=(double);
    complex<double>& operator*=(double);
    complex<double>& operator/=(double);
 
    complex<double>& operator=(const complex<double>&);
    template<class X> complex<double>& operator= (const complex<X>&);
    template<class X> complex<double>& operator+=(const complex<X>&);
    template<class X> complex<double>& operator-=(const complex<X>&);
    template<class X> complex<double>& operator*=(const complex<X>&);
    template<class X> complex<double>& operator/=(const complex<X>&);
};
 
template<> class complex<long double> {
public:
    typedef long double value_type;
 
    constexpr complex(long double re = 0.0L, long double im = 0.0L);
    constexpr complex(const complex<float>&);
    constexpr complex(const complex<double>&);
 
    constexpr long double real();
    void real(long double);
    constexpr long double imag();
    void imag(long double);
 
    complex<long double>& operator=(const complex<long double>&);
    complex<long double>& operator= (long double);
    complex<long double>& operator+=(long double);
    complex<long double>& operator-=(long double);
    complex<long double>& operator*=(long double);
    complex<long double>& operator/=(long double);
 
    template<class X> complex<long double>& operator= (const complex<X>&);
    template<class X> complex<long double>& operator+=(const complex<X>&);
    template<class X> complex<long double>& operator-=(const complex<X>&);
    template<class X> complex<long double>& operator*=(const complex<X>&);
    template<class X> complex<long double>& operator/=(const complex<X>&);
 
};

二次

代码语言:txt
复制
 © cppreference.com

在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。

扫码关注腾讯云开发者

领取腾讯云代金券