Заголовок стандартной библиотеки <complex>
Этот заголовок является частью библиотеки числовых функций.
Классы
| тип комплексного числа (шаблон класса) |
Функции
Операции |
|
| применяет унарные операторы к комплексным числам (шаблон функции) |
|
| выполняет арифметические операции над двумя комплексными числами или комплексным числом и скаляром (шаблон функции) |
|
|
(удалён в C++20) | сравнивает два комплексных числа или комплексное число и скаляр (шаблон функции) |
| сериализует и десериализует комплексное число (шаблон функции) |
|
| возвращает действительную часть (шаблон функции) |
|
| возвращает мнимую часть (шаблон функции) |
|
| возвращает модуль комплексного числа (шаблон функции) |
|
| возвращает аргумент (шаблон функции) |
|
| возвращает квадрат модуля (шаблон функции) |
|
| возвращает комплексно-сопряжённое число (шаблон функции) |
|
|
(C++11) | возвращает проекцию на сферу Римана (шаблон функции) |
| создаёт комплексное число по модулю и аргументу (шаблон функции) |
|
Экспоненциальные функции |
|
| комплексная экспонента с основанием e (шаблон функции) |
|
| комплексный натуральный логарифм с разрезом вдоль отрицательной вещественной оси (шаблон функции) |
|
| комплексный десятичный логарифм с разрезом вдоль отрицательной вещественной оси (шаблон функции) |
|
Степенные функции |
|
| комплексная степень; один или оба аргумента могут быть комплексными числами (шаблон функции) |
|
| комплексный квадратный корень со значениями в правой полуплоскости (шаблон функции) |
|
Тригонометрические функции |
|
| вычисляет синус комплексного числа (\({\small\sin{z}}\)sin(z)) (шаблон функции) |
|
| вычисляет косинус комплексного числа (\({\small\cos{z}}\)cos(z)) (шаблон функции) |
|
| вычисляет тангенс комплексного числа (\({\small\tan{z}}\)tan(z)) (шаблон функции) |
|
|
(C++11) | вычисляет арксинус комплексного числа (\({\small\arcsin{z}}\)arcsin(z)) (шаблон функции) |
|
(C++11) | вычисляет арккосинус комплексного числа (\({\small\arccos{z}}\)arccos(z)) (шаблон функции) |
|
(C++11) | вычисляет арктангенс комплексного числа (\({\small\arctan{z}}\)arctan(z)) (шаблон функции) |
Гиперболические функции |
|
| вычисляет гиперболический синус комплексного числа (\({\small\sinh{z}}\)sinh(z)) (шаблон функции) |
|
| вычисляет гиперболический косинус комплексного числа (\({\small\cosh{z}}\)cosh(z)) (шаблон функции) |
|
| вычисляет гиперболический тангенс комплексного числа (\({\small\tanh{z}}\)tanh(z)) (шаблон функции) |
|
|
(C++11) | вычисляет обратный гиперболический синус комплексного числа (\({\small\operatorname{arsinh}{z}}\)arsinh(z)) (шаблон функции) |
|
(C++11) | вычисляет обратный гиперболический косинус комплексного числа (\({\small\operatorname{arcosh}{z}}\)arcosh(z)) (шаблон функции) |
|
(C++11) | вычисляет обратный гиперболический тангенс комплексного числа (\({\small\operatorname{artanh}{z}}\)artanh(z)) (шаблон функции) |
Литералы |
|
|
(C++14) | литерал std::complex, представляющий чисто мнимое число (функция) |
Обзор
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);
}
}
}
Класс 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>&);
};
Отчёты об ошибках
Следующие отчёты об ошибках, изменяющие поведение, были ретроактивно применены к ранее опубликованным стандартам C++.
| DR | Применяется к | Опубликованное поведение | Корректное поведение |
|---|---|---|---|
| LWG 79 | C++98 | в обзоре отсутствовал аргумент по умолчанию второго параметра функции polar | добавлен |
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/cpp/header/complex