TRIQS/TRIQS 4.0.0
Researching Interacting Quantum Systems
Loading...
Searching...
No Matches
triqs::utility::gmp_complex

#include <triqs/utility/pade_approximants.hpp>

Detailed Description

Lightweight complex number backed by GMP mpf_class floats, used during Padé coefficient computation.

Definition at line 49 of file pade_approximants.hpp.

Public Member Functions

mpf_class norm () const
 Squared magnitude of the complex number \( z \).
gmp_complex operator* (const gmp_complex &z) const
 Multiply two complex numbers.
gmp_complex operator+ (const gmp_complex &z) const
 Add two complex numbers.
gmp_complex operator- (const gmp_complex &z) const
 Subtract two complex numbers.
gmp_complex operator/ (const gmp_complex &z) const
 Divide two complex numbers.
gmp_complexoperator= (const std::complex< double > &z)
 Assign from a regular std::complex<double>.

Public Attributes

mpf_class im
 Imaginary part.
mpf_class re
 Real part.

Friends

mpf_class imag (const gmp_complex &z)
 Extract the imaginary part of a complex number.
gmp_complex inverse (const gmp_complex &z)
 Compute the multiplicative inverse of a complex number.
std::ostream & operator<< (std::ostream &out, gmp_complex const &z)
 Write a gmp_complex to an output stream.
mpf_class real (const gmp_complex &z)
 Extract the real part of a complex number.

Member Function Documentation

◆ norm()

mpf_class triqs::utility::gmp_complex::norm ( ) const
inlinenodiscard

Squared magnitude of the complex number \( z \).

Returns
\( |z|^2 = \Re(z)^2 + \Im(z)^2 \).

Definition at line 124 of file pade_approximants.hpp.

◆ operator*()

gmp_complex triqs::utility::gmp_complex::operator* ( const gmp_complex & z) const
inline

Multiply two complex numbers.

Parameters
zRight-hand operand.
Returns
Complex product.

Definition at line 62 of file pade_approximants.hpp.

◆ operator+()

gmp_complex triqs::utility::gmp_complex::operator+ ( const gmp_complex & z) const
inline

Add two complex numbers.

Parameters
zRight-hand operand.
Returns
Complex sum.

Definition at line 94 of file pade_approximants.hpp.

◆ operator-()

gmp_complex triqs::utility::gmp_complex::operator- ( const gmp_complex & z) const
inline

Subtract two complex numbers.

Parameters
zRight-hand operand (subtrahend).
Returns
Complex difference.

Definition at line 102 of file pade_approximants.hpp.

◆ operator/()

gmp_complex triqs::utility::gmp_complex::operator/ ( const gmp_complex & z) const
inline

Divide two complex numbers.

It throws a triqs::runtime_error on division by zero.

Parameters
zRight-hand operand (divisor).
Returns
Complex quotient.

Definition at line 86 of file pade_approximants.hpp.

◆ operator=()

gmp_complex & triqs::utility::gmp_complex::operator= ( const std::complex< double > & z)
inline

Assign from a regular std::complex<double>.

Parameters
zValue to assign from.
Returns
Reference to *this.

Definition at line 132 of file pade_approximants.hpp.

◆ imag

mpf_class imag ( const gmp_complex & z)
friend

Extract the imaginary part of a complex number.

Parameters
zNumber \( z \) to inspect.
Returns
Imaginary part \( \Im(z) \).

Definition at line 118 of file pade_approximants.hpp.

◆ inverse

gmp_complex inverse ( const gmp_complex & z)
friend

Compute the multiplicative inverse of a complex number.

It throws a triqs::runtime_error on division by zero.

Parameters
zComplex number \( z \) to invert.
Returns
Multiplicative inverse \( 1 / z \).

Definition at line 72 of file pade_approximants.hpp.

◆ operator<<

std::ostream & operator<< ( std::ostream & out,
gmp_complex const & z )
friend

Write a gmp_complex to an output stream.

Parameters
outOutput stream to write to.
zComplex number to print.
Returns
Reference to the output stream.

Definition at line 145 of file pade_approximants.hpp.

◆ real

mpf_class real ( const gmp_complex & z)
friend

Extract the real part of a complex number.

Parameters
zNumber \( z \) to inspect.
Returns
Real part \( \Re(z) \).

Definition at line 110 of file pade_approximants.hpp.


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