名前空間
変種
操作

標準ライブラリヘッダ <complex>

提供: cppreference.com
< cpp‎ | header
 
 
 

このヘッダは数値演算ライブラリの一部です。

目次

[編集] クラス

複素数型
(クラステンプレート)
複素数型
(クラステンプレートの特殊化)

[編集] 関数

操作
複素数に単項演算子を適用します
(関数テンプレート) [edit]
2つの複素数または複素数とスカラーに対して複素数算術を行います
(関数テンプレート) [edit]
(C++20で削除)
2つの複素数または複素数とスカラーを比較します
(関数テンプレート) [edit]
複素数をシリアライズおよびデシリアライズします
(関数テンプレート) [edit]
実部を返します
(関数テンプレート) [edit]
虚部を返します
(関数テンプレート) [edit]
複素数の絶対値を返します
(関数テンプレート) [edit]
複素数の偏角を返します
(関数テンプレート) [edit]
絶対値の平方を返します
(関数テンプレート) [edit]
複素共役を返します
(関数テンプレート) [edit]
(C++11)
リーマン球面への射影を返します
(関数テンプレート) [edit]
絶対値と偏角から複素数を構築します
(関数テンプレート) [edit]
指数関数
e を底とする複素指数関数
(関数テンプレー���) [edit]
負の実軸に沿って分岐切断する複素自然対数
(関数テンプレート) [edit]
負の実軸に沿って分岐切断する複素常用対数
(関数テンプレート) [edit]
冪関数
片方または両方の引数が複素数かもしれない複素冪関数
(関数テンプレート) [edit]
右半平面の範囲の複素数の平方根
(関数テンプレート) [edit]
三角関数
複素数の正弦 (sin(z)) を計算します
(関数テンプレート) [edit]
複素数の余弦 (cos(z)) を計算します
(関数テンプレート) [edit]
複素数の正接 (tan(z)) を計算します
(関数テンプレート) [edit]
複素数の逆正弦 (arcsin(z)) を計算します
(関数テンプレート) [edit]
複素数の逆余弦 (arccos(z)) を計算します
(関数テンプレート) [edit]
複素数の逆正接 (arctan(z)) を計算します
(関数テンプレート) [edit]
双曲線関数
複素数の双曲線正弦 (sinh(z)) を計算します
(関数テンプレート) [edit]
複素数の双曲線余弦 (cosh(z)) を計算します
(関数テンプレート) [edit]
複素数の双曲線正接 (tanh(z)) を計算します
(関数テンプレート) [edit]
複素数の逆双曲線正弦 (arsinh(z)) を計算します
(関数テンプレート) [edit]
複素数の逆双曲線余弦 (arcosh(z)) を計算します
(関数テンプレート) [edit]
複素数の逆双曲線正接 (artanh(z)) を計算します
(関数テンプレート) [edit]
リテラル
純虚数を表す std::complex リテラル
(関数) [edit]


[編集] 概要

namespace std {
 
    template<class T> class complex;
 
    template<> class complex<float>;
    template<> class complex<double>;
    template<> class complex<long double>;
 
    // operators:
    template<class T> constexpr complex<T> operator+(
        const complex<T>&, const complex<T>&);
    template<class T> constexpr complex<T> operator+(const complex<T>&, const T&);
    template<class T> constexpr complex<T> operator+(const T&, const complex<T>&);
 
    template<class T> constexpr complex<T> operator-(
        const complex<T>&, const complex<T>&);
    template<class T> constexpr complex<T> operator-(const complex<T>&, const T&);
    template<class T> constexpr complex<T> operator-(const T&, const complex<T>&);
 
    template<class T> constexpr complex<T> operator*(
        const complex<T>&, const complex<T>&);
    template<class T> constexpr complex<T> operator*(const complex<T>&, const T&);
    template<class T> constexpr complex<T> operator*(const T&, const complex<T>&);
 
    template<class T> constexpr complex<T> operator/(
        const complex<T>&, const complex<T>&);
    template<class T> constexpr complex<T> operator/(const complex<T>&, const T&);
    template<class T> constexpr complex<T> operator/(const T&, const complex<T>&);
 
    template<class T> constexpr complex<T> operator+(const complex<T>&);
    template<class T> constexpr complex<T> operator-(const complex<T>&);
 
    template<class T> constexpr bool operator==(
        const complex<T>&, const complex<T>&);
    template<class T> constexpr bool operator==(const complex<T>&, const T&);
    template<class T> constexpr bool operator==(const T&, const complex<T>&);
 
    template<class T> constexpr bool operator!=(const complex<T>&, const complex<T>&);
    template<class T> constexpr bool operator!=(const complex<T>&, const T&);
    template<class T> constexpr 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> constexpr T real(const complex<T>&);
    template<class T> constexpr T imag(const complex<T>&);
 
    template<class T> T abs(const complex<T>&);
    template<class T> T arg(const complex<T>&);
    template<class T> constexpr T norm(const complex<T>&);
 
    template<class T> constexpr 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>&);
 
    // complex literals:
    inline namespace literals {
    inline namespace complex_literals {
        constexpr complex<long double> operator""il(long double);
        constexpr complex<long double> operator""il(unsigned long long);
        constexpr complex<double> operator""i(long double);
        constexpr complex<double> operator""i(unsigned long long);
        constexpr complex<float> operator""if(long double);
        constexpr complex<float> operator""if(unsigned long long);
    }
    }
}

[編集] クラス std::complex

template<class T>
class complex {
public:
    typedef T value_type;
    constexpr complex(const T& re = T(), const T& im = T());
    constexpr complex(const complex&);
    template<class X> constexpr complex(const complex<X>&);
 
    constexpr T real() const;
    constexpr void real(T);
    constexpr T imag() const;
    constexpr void imag(T);
 
    constexpr complex<T>& operator= (const T&);
    constexpr complex<T>& operator+=(const T&);
    constexpr complex<T>& operator-=(const T&);
    constexpr complex<T>& operator*=(const T&);
    constexpr complex<T>& operator/=(const T&);
 
    constexpr complex& operator=(const complex&);     
    template<class X> constexpr complex<T>& operator= (const complex<X>&);   
    template<class X> constexpr complex<T>& operator+=(const complex<X>&);   
    template<class X> constexpr complex<T>& operator-=(const complex<X>&);   
    template<class X> constexpr complex<T>& operator*=(const complex<X>&);   
    template<class X> constexpr complex<T>& operator/=(const complex<X>&);   
 
};

[編集] std::complex の特殊化

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() const;
    constexpr void real(float);
    constexpr float imag() const;
    constexpr void imag(float);
 
    constexpr complex<float>& operator= (float);
    constexpr complex<float>& operator+=(float);
    constexpr complex<float>& operator-=(float);
    constexpr complex<float>& operator*=(float);
    constexpr complex<float>& operator/=(float);
 
    constexpr complex<float>& operator=(const complex<float>&);
    template<class X> constexpr complex<float>& operator= (const complex<X>&);
    template<class X> constexpr complex<float>& operator+=(const complex<X>&);
    template<class X> constexpr complex<float>& operator-=(const complex<X>&);
    template<class X> constexpr complex<float>& operator*=(const complex<X>&);
    template<class X> constexpr 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() const;
    constexpr void real(double);
    constexpr double imag() const;
    constexpr void imag(double);
 
    constexpr complex<double>& operator= (double);
    constexpr complex<double>& operator+=(double);
    constexpr complex<double>& operator-=(double);
    constexpr complex<double>& operator*=(double);
    constexpr complex<double>& operator/=(double);
 
    constexpr complex<double>& operator=(const complex<double>&);
    template<class X> constexpr complex<double>& operator= (const complex<X>&);
    template<class X> constexpr complex<double>& operator+=(const complex<X>&);
    template<class X> constexpr complex<double>& operator-=(const complex<X>&);
    template<class X> constexpr complex<double>& operator*=(const complex<X>&);
    template<class X> constexpr 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() const;
    constexpr void real(long double);
    constexpr long double imag() const;
    constexpr void imag(long double);
 
    constexpr complex<long double>& operator=(const complex<long double>&);
    constexpr complex<long double>& operator= (long double);
    constexpr complex<long double>& operator+=(long double);
    constexpr complex<long double>& operator-=(long double);
    constexpr complex<long double>& operator*=(long double);
    constexpr complex<long double>& operator/=(long double);
 
    template<class X> constexpr complex<long double>& operator= (const complex<X>&);
    template<class X> constexpr complex<long double>& operator+=(const complex<X>&);
    template<class X> constexpr complex<long double>& operator-=(const complex<X>&);
    template<class X> constexpr complex<long double>& operator*=(const complex<X>&);
    template<class X> constexpr complex<long double>& operator/=(const complex<X>&);
 
};