Dedekind 0.0.0
A structuralist C++23 Module Library
Loading...
Searching...
No Matches
dedekind::linear_algebra::Complex< R > Class Template Reference
Collaboration diagram for dedekind::linear_algebra::Complex< R >:

Public Types

using Domain = Complex
using scalar_type = R
using ScalarCarrier = R

Public Member Functions

constexpr Complex (R re=R{}, R im=R{})
constexpr R real () const
constexpr R imag () const

Public Attributes

R first
R second

Friends

constexpr bool operator== (const Complex &, const Complex &)=default
constexpr Complex operator+ (const Complex &a, const Complex &b)
constexpr Complex operator- (const Complex &a, const Complex &b)
constexpr Complex operator- (const Complex &a)
constexpr Complex operator* (const Complex &a, const Complex &b)
constexpr Complex operator* (const R &s, const Complex &a)
constexpr Complex operator* (const Complex &a, const R &s)
constexpr Complex operator/ (const Complex &a, const Complex &b)
 Division via the conjugate identity: z / w = z · w̄ / |w|².

◆ operator/

template<typename R>
Complex operator/ ( const Complex< R > & a,
const Complex< R > & b )
friend

Division via the conjugate identity: z / w = z · w̄ / |w|².

(a + bi) / (c + di) = [(ac + bd) + (bc − ad)i] / (c² + d²).

Requires operator/ on the scalar R. Defined when |w|² ≠ 0; for the zero-division case the behaviour is inherited from R / R (e.g. Rational<Z> throws / asserts).

Lifts Complex<R> from HasRingOperators into HasFieldOperators (the a/b → S clause), which in turn lets Dual<Complex<R>> admit operator/ for holomorphic forward-mode automatic differentiation at compile time.


The documentation for this class was generated from the following file: