Namensräume
Varianten
Aktionen

Standardbibliotheks-Header <complex>

Von cppreference.com
< cpp‎ | header
 
 
Header der Standardbibliothek
Algorithmen
<algorithm>
<numeric>
Strings
<cctype>
<cstring>
<cuchar> (C++11)
<cwchar>
<cwctype>
<string_view> (C++17)
<string>
Textverarbeitung
<clocale>
<codecvt> (C++11/17/26*)
<locale>
<regex> (C++11)
<text_encoding> (C++26)   
Numerik
<cfenv> (C++11)
<cmath>
<complex>
<linalg> (C++26)
<numbers> (C++20)
<random> (C++11)
<simd> (C++26)
<valarray>
Zeit
<chrono> (C++11)
<ctime>
C Kompatibilität
<ccomplex> (C++11/17/20*)
<ciso646> (bis C++20)
<cstdalign> (C++11/17/20*)
<cstdbool> (C++11/17/20*)
<ctgmath> (C++11/17/20*)
 

Dieser Header ist Teil der numerischen Bibliothek.

Inhalt

[bearbeiten] Klassen

ein komplexer Zahlentyp
(Klassentemplate)

[bearbeiten] Funktionen

Operationen
wendet unäre Operatoren auf komplexe Zahlen an
(function template) [edit]
führt arithmetische Operationen mit komplexen Zahlen auf zwei komplexen Werten oder einer komplexen Zahl und einem Skalar durch
(function template) [edit]
(in C++20 entfernt)
vergleicht zwei komplexe Zahlen oder eine komplexe Zahl und einen Skalar
(function template) [edit]
serialisiert und deserialisiert eine komplexe Zahl
(function template) [edit]
gibt den Realteil zurück
(function template) [edit]
gibt den Imaginärteil zurück
(function template) [edit]
gibt den Betrag einer komplexen Zahl zurück
(function template) [edit]
gibt den Phasenwinkel zurück
(function template) [edit]
gibt das Quadrat des Betrags zurück
(function template) [edit]
gibt die komplexe Konjugation zurück
(function template) [edit]
(C++11)
gibt die Projektion auf die Riemann-Sphäre zurück
(Funktionsschablone) [bearbeiten]
konstruiert eine komplexe Zahl aus Betrag und Phasenwinkel
(function template) [edit]
Exponentialfunktionen
komplexer Basis-e-Exponentialwert
(function template) [edit]
komplexer natürlicher Logarithmus mit dem Schnitt entlang der negativen reellen Achse
(function template) [edit]
komplexer gemeinsamer Logarithmus mit dem Schnitt entlang der negativen reellen Achse
(function template) [edit]
Potenzfunktionen
komplexe Potenz, ein oder beide Argumente können komplexe Zahlen sein
(function template) [edit]
komplexe Quadratwurzel im Bereich der rechten Halbebene
(function template) [edit]
Trigonometrische Funktionen
berechnet den Sinus einer komplexen Zahl (sin(z))
(function template) [edit]
berechnet den Kosinus einer komplexen Zahl (cos(z))
(function template) [edit]
berechnet den Tangens einer komplexen Zahl (tan(z))
(function template) [edit]
berechnet den Arkussinus einer komplexen Zahl (arcsin(z))
(function template) [edit]
berechnet den Arkuskosinus einer komplexen Zahl (arccos(z))
(function template) [edit]
berechnet den Arkustangens einer komplexen Zahl (arctan(z))
(function template) [edit]
Hyperbolische Funktionen
berechnet den hyperbolischen Sinus einer komplexen Zahl (sinh(z))
(function template) [edit]
berechnet den hyperbolischen Kosinus einer komplexen Zahl (cosh(z))
(function template) [edit]
berechnet den hyperbolischen Tangens einer komplexen Zahl (tanh(z))
(function template) [edit]
berechnet denArea Hyperbolicus Sinus einer komplexen Zahl (arsinh(z))
(function template) [edit]
berechnet den Area Hyperbolicus Kosinus einer komplexen Zahl (arcosh(z))
(function template) [edit]
berechnet den Area Hyperbolicus Tangens einer komplexen Zahl (artanh(z))
(function template) [edit]
Literale
ein std::complex Literal, das eine rein imaginäre Zahl darstellt.
(function) [edit]

[bearbeiten] Synopsis

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>&);
 
    // tuple interface:
    template<class T> struct tuple_size;
    template<size_t I, class T> struct tuple_element;
    template<class T> struct tuple_size<complex<T>>;
    template<size_t I, class T> struct tuple_element<I, complex<T>>;
    template<size_t I, class T>
      constexpr T& get(complex<T>&) noexcept;
    template<size_t I, class T>
      constexpr T&& get(complex<T>&&) noexcept;
    template<size_t I, class T>
      constexpr const T& get(const complex<T>&) noexcept;
    template<size_t I, class T>
      constexpr const T&& get(const complex<T>&&) noexcept;
 
    // 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);
        }
    }
}

[bearbeiten] Klasse 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&) = default;
    template<class X> constexpr explicit(/* see constructor page */)
        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>&);
};

[bearbeiten] Fehlerberichte

Die folgenden Verhaltensändernden Fehlerberichte wurden rückwirkend auf zuvor veröffentlichte C++-Standards angewendet.

DR angewendet auf Verhalten wie veröffentlicht Korrigiertes Verhalten
LWG 79 C++98 das Standardargument des zweiten Parameters
von polar fehlte in der Synopsis
hinzugefügt