PSCF v1.4.0
Complex Arithmetic (CPU)

Complex arithmetic functions using the complex type fftw_complex defined by the FFTW fast Fourier transform library. More...

Functions

double Pscf::real (fftw_complex const &a)
 Return the real part of an fftw_complex number.
double Pscf::imag (fftw_complex const &a)
 Return the imaginary part of an fftw_complex number.
double Pscf::abs (fftw_complex const &a)
 Return absolute magnitude of an fftw_complex number.
double Pscf::absSq (fftw_complex const &a)
 Return square of absolute magnitude of an fftw_complex number.
void Pscf::conj (fftw_complex &z, fftw_complex const &a)
 Complex conjugate of an fftw_complex, z = a^*.
void Pscf::conj (fftw_complex &a)
 In-place complex conjugation of an fftw_complex number, a = a^* .
void Pscf::assign (fftw_complex &z, double const &a, double const &b)
 Create an fftw_complex from real and imaginary parts, z = a + ib.
void Pscf::assign (fftw_complex &z, double const &a)
 Assign a real input to an fftw_complex variable.
void Pscf::assign (fftw_complex &z, fftw_complex const &a)
 Assign an fftw_complex input to an fftw_complex variable.
void Pscf::assign (fftw_complex &z, std::complex< double > const &a)
 Assign a std::complex input to an fftw_complex variable.
void Pscf::assign (std::complex< double > &z, fftw_complex const &a)
 Assign an fftw_complex input to a std::complex variable.
void Pscf::add (fftw_complex &z, fftw_complex const &a, fftw_complex const &b)
 Addition of fftw_complex numbers, z = a + b.
void Pscf::add (fftw_complex &z, fftw_complex const &a, double const &b)
 Addition of a complex and real number, z = a + b.
void Pscf::addEq (fftw_complex &a, fftw_complex const &b)
 In-place addition of fftw_complex numbers, a += b.
void Pscf::addEq (fftw_complex &a, double const &b)
 In-place addition of a complex and real number, a += b.
void Pscf::sub (fftw_complex &z, fftw_complex const &a, fftw_complex const &b)
 Subtraction of fftw_complex numbers, z = a - b.
void Pscf::sub (fftw_complex &z, fftw_complex const &a, double const &b)
 Subtraction of a real number from an fftw_complex number, z = a - b.
void Pscf::subEq (fftw_complex &a, fftw_complex const &b)
 In-place subtraction of fftw_complex numbers, a -= b.
void Pscf::subEq (fftw_complex &a, double const &b)
 In-place subtraction of real from an fftw_complex number, a -= b.
double Pscf::absSqDiff (fftw_complex const &a, fftw_complex const &b)
 Return square of the absolute magnitude of a complex difference.
void Pscf::mul (fftw_complex &z, fftw_complex const &a, fftw_complex const &b)
 Multiplication of fftw_complex numbers, z = a * b.
void Pscf::mul (fftw_complex &z, fftw_complex const &a, double const &b)
 Multiplication of an fftw_complex and real number, z = a * b.
void Pscf::mulEq (fftw_complex &a, fftw_complex const &b)
 In-place multiplication of two complex number, a *= b.
void Pscf::mulEq (fftw_complex &a, double const &b)
 In-place multiplication of a complex and real number, a *= b.
void Pscf::square (fftw_complex &z, fftw_complex const &a)
 Complex square of an fftw_complex number, z = a * a.
void Pscf::div (fftw_complex &z, fftw_complex const &a, fftw_complex const &b)
 Division of fftw_complex numbers, z = a / b .
void Pscf::div (fftw_complex &z, fftw_complex const &a, double const &b)
 Division of an fftw_complex number by a real number, z = a / b .
void Pscf::divEq (fftw_complex &a, fftw_complex const &b)
 In-place division of fftw_complex numbers, a /= b.
void Pscf::divEq (fftw_complex &a, double const &b)
 In-place division of an fftw_complex number by a real number, a /= b.
void Pscf::inverse (fftw_complex &z, fftw_complex const &a)
 Inversion of an fftw_complex number, z = 1 / a .
void Pscf::assignExp (fftw_complex &z, fftw_complex const &a)
 Exponentation of a ffts_complex variable, z = exp(a).
void Pscf::assignLog (fftw_complex &z, fftw_complex const &a)
 Logarithm of an fftw_complex variable, z = log(a).
std::istream & Pscf::operator>> (std::istream &is, fftw_complex &z)
 Stream extraction operator for fftw_complex.
std::ostream & Pscf::operator<< (std::ostream &os, fftw_complex const &z)
 Stream insertion operator for fftw_complex.

Detailed Description

Complex arithmetic functions using the complex type fftw_complex defined by the FFTW fast Fourier transform library.

Function Documentation

◆ real()

double Pscf::real ( fftw_complex const & a)
inline

Return the real part of an fftw_complex number.

Parameters
acomplex argument (in)

Definition at line 38 of file cpu/complex.h.

Referenced by Pscf::Prdc::readBasisData(), Pscf::Prdc::writeCFieldData(), and Pscf::Prdc::writeCFieldsData().

◆ imag()

double Pscf::imag ( fftw_complex const & a)
inline

Return the imaginary part of an fftw_complex number.

Parameters
acomplex argument (in)

Definition at line 49 of file cpu/complex.h.

Referenced by Pscf::Prdc::readBasisData(), Pscf::Prdc::writeCFieldData(), and Pscf::Prdc::writeCFieldsData().

◆ abs()

double Pscf::abs ( fftw_complex const & a)
inline

Return absolute magnitude of an fftw_complex number.

Parameters
acomplex argument (in)

Definition at line 62 of file cpu/complex.h.

◆ absSq()

double Pscf::absSq ( fftw_complex const & a)
inline

Return square of absolute magnitude of an fftw_complex number.

Parameters
acomplex argument (in)

Definition at line 73 of file cpu/complex.h.

Referenced by absSqDiff(), absSqDiff(), and Pscf::Rp::BinaryStructureFactor< D, T >::computeS().

◆ conj() [1/2]

void Pscf::conj ( fftw_complex & z,
fftw_complex const & a )
inline

Complex conjugate of an fftw_complex, z = a^*.

Parameters
zcomplex conjugate of argument (out)
acomplex argument (in)

Definition at line 87 of file cpu/complex.h.

◆ conj() [2/2]

void Pscf::conj ( fftw_complex & a)
inline

In-place complex conjugation of an fftw_complex number, a = a^* .

Parameters
aargument and output (in/out)

Definition at line 101 of file cpu/complex.h.

◆ assign() [1/5]

◆ assign() [2/5]

void Pscf::assign ( fftw_complex & z,
double const & a )
inline

Assign a real input to an fftw_complex variable.

Parameters
zcomplex (out)
areal (in)

Definition at line 134 of file cpu/complex.h.

◆ assign() [3/5]

void Pscf::assign ( fftw_complex & z,
fftw_complex const & a )
inline

Assign an fftw_complex input to an fftw_complex variable.

Parameters
zcomplex (out)
acomplex (in)

Definition at line 149 of file cpu/complex.h.

◆ assign() [4/5]

void Pscf::assign ( fftw_complex & z,
std::complex< double > const & a )
inline

Assign a std::complex input to an fftw_complex variable.

Parameters
zcomplex (out)
astd::complex (in)

Definition at line 164 of file cpu/complex.h.

◆ assign() [5/5]

void Pscf::assign ( std::complex< double > & z,
fftw_complex const & a )
inline

Assign an fftw_complex input to a std::complex variable.

Parameters
zstd::complex (out)
acomplex (in)

Definition at line 179 of file cpu/complex.h.

◆ add() [1/2]

void Pscf::add ( fftw_complex & z,
fftw_complex const & a,
fftw_complex const & b )
inline

Addition of fftw_complex numbers, z = a + b.

Parameters
zcomplex sum (out)
acomplex summand (in)
bcomplex summand (in)

Definition at line 194 of file cpu/complex.h.

Referenced by Pscf::Prdc::SymmetryGroup< Symmetry >::makeCompleteGroup().

◆ add() [2/2]

void Pscf::add ( fftw_complex & z,
fftw_complex const & a,
double const & b )
inline

Addition of a complex and real number, z = a + b.

Parameters
zcomplex sum (out)
acomplex summand (in)
breal summand (in)

Definition at line 210 of file cpu/complex.h.

◆ addEq() [1/2]

void Pscf::addEq ( fftw_complex & a,
fftw_complex const & b )
inline

◆ addEq() [2/2]

void Pscf::addEq ( fftw_complex & a,
double const & b )
inline

In-place addition of a complex and real number, a += b.

Parameters
acomplex summand (in) and sum (out)
breal summand (in)

Definition at line 240 of file cpu/complex.h.

◆ sub() [1/2]

void Pscf::sub ( fftw_complex & z,
fftw_complex const & a,
fftw_complex const & b )
inline

Subtraction of fftw_complex numbers, z = a - b.

Parameters
zcomplex difference (out)
acomplex 1st argument (in)
bcomplex 2nd argument (in)

Definition at line 257 of file cpu/complex.h.

Referenced by absSqDiff(), and absSqDiff().

◆ sub() [2/2]

void Pscf::sub ( fftw_complex & z,
fftw_complex const & a,
double const & b )
inline

Subtraction of a real number from an fftw_complex number, z = a - b.

Parameters
zcomplex difference (out)
acomplex 1st argument (in)
breal 2nd argument (in)

Definition at line 273 of file cpu/complex.h.

◆ subEq() [1/2]

void Pscf::subEq ( fftw_complex & a,
fftw_complex const & b )
inline

In-place subtraction of fftw_complex numbers, a -= b.

Parameters
acomplex argument (in) and difference (out)
bcomplex argument (in)

Definition at line 288 of file cpu/complex.h.

◆ subEq() [2/2]

void Pscf::subEq ( fftw_complex & a,
double const & b )
inline

In-place subtraction of real from an fftw_complex number, a -= b.

Parameters
acomplex argument (in) and difference (out)
breal argument (in)

Definition at line 303 of file cpu/complex.h.

◆ absSqDiff()

double Pscf::absSqDiff ( fftw_complex const & a,
fftw_complex const & b )
inline

Return square of the absolute magnitude of a complex difference.

This function returns |a-b|^2 for complex a and b.

Parameters
acomplex 1st argument (in)
bcomplex 2nd argument (in)

Definition at line 319 of file cpu/complex.h.

References absSq(), and sub().

◆ mul() [1/2]

void Pscf::mul ( fftw_complex & z,
fftw_complex const & a,
fftw_complex const & b )
inline

◆ mul() [2/2]

void Pscf::mul ( fftw_complex & z,
fftw_complex const & a,
double const & b )
inline

Multiplication of an fftw_complex and real number, z = a * b.

Parameters
zcomplex product (out)
acomplex factor (in)
breal factor (in)

Definition at line 354 of file cpu/complex.h.

◆ mulEq() [1/2]

void Pscf::mulEq ( fftw_complex & a,
fftw_complex const & b )
inline

In-place multiplication of two complex number, a *= b.

Parameters
acomplex factor (in) and product (out)
bcomplex factor (in)

Definition at line 369 of file cpu/complex.h.

Referenced by Pscf::Cpc::Solvent< D >::compute(), Pscf::Cpc::Block< D >::computeConcentrationBead(), Pscf::Cpc::Block< D >::computeConcentrationThread(), Pscf::Cpc::Block< D >::stepFieldBead(), and Pscf::Cpc::Block< D >::stepThread().

◆ mulEq() [2/2]

void Pscf::mulEq ( fftw_complex & a,
double const & b )
inline

In-place multiplication of a complex and real number, a *= b.

Parameters
acomplex factor (in) and product (out)
breal factor (in)

Definition at line 386 of file cpu/complex.h.

◆ square()

void Pscf::square ( fftw_complex & z,
fftw_complex const & a )
inline

Complex square of an fftw_complex number, z = a * a.

Parameters
zcomplex product (out)
acomplex factor (in)

Definition at line 401 of file cpu/complex.h.

◆ div() [1/2]

void Pscf::div ( fftw_complex & z,
fftw_complex const & a,
fftw_complex const & b )
inline

Division of fftw_complex numbers, z = a / b .

Parameters
zcomplex ratio (out)
acomplex numerator (in)
bcomplex denominator (in)

Definition at line 419 of file cpu/complex.h.

Referenced by Pscf::Cpc::Solvent< D >::compute(), and Pscf::Species< WT >::setQ().

◆ div() [2/2]

void Pscf::div ( fftw_complex & z,
fftw_complex const & a,
double const & b )
inline

Division of an fftw_complex number by a real number, z = a / b .

Parameters
zcomplex ratio (out)
acomplex numerator (in)
breal denominator (in)

Definition at line 436 of file cpu/complex.h.

◆ divEq() [1/2]

void Pscf::divEq ( fftw_complex & a,
fftw_complex const & b )
inline

In-place division of fftw_complex numbers, a /= b.

Parameters
acomplex numerator (in) and ratio (out)
bcomplex denominator (in)

Definition at line 451 of file cpu/complex.h.

Referenced by Pscf::Cpc::Solvent< D >::compute(), and Pscf::Cpc::Propagator< D >::computeQ().

◆ divEq() [2/2]

void Pscf::divEq ( fftw_complex & a,
double const & b )
inline

In-place division of an fftw_complex number by a real number, a /= b.

Parameters
acomplex numerator (in) and ratio (out)
breal denominator (in)

Definition at line 468 of file cpu/complex.h.

◆ inverse()

void Pscf::inverse ( fftw_complex & z,
fftw_complex const & a )
inline

Inversion of an fftw_complex number, z = 1 / a .

Parameters
zinverse (out)
aargument (in)

Definition at line 485 of file cpu/complex.h.

Referenced by Pscf::Cpc::Block< D >::setupSolver().

◆ assignExp()

void Pscf::assignExp ( fftw_complex & z,
fftw_complex const & a )
inline

Exponentation of a ffts_complex variable, z = exp(a).

Parameters
zexponent (out)
aargument (in)

Definition at line 503 of file cpu/complex.h.

Referenced by Pscf::Cpc::Solvent< D >::compute(), Pscf::Species< WT >::setQ(), and Pscf::Cpc::Block< D >::setupSolver().

◆ assignLog()

void Pscf::assignLog ( fftw_complex & z,
fftw_complex const & a )
inline

Logarithm of an fftw_complex variable, z = log(a).

Parameters
zlogarithm (out)
aargument (in)

Definition at line 520 of file cpu/complex.h.

Referenced by Pscf::Species< WT >::setQ().

◆ operator>>()

std::istream & Pscf::operator>> ( std::istream & is,
fftw_complex & z )

Stream extraction operator for fftw_complex.

Parameters
isinput stream
zcomplex number

◆ operator<<()

std::ostream & Pscf::operator<< ( std::ostream & os,
fftw_complex const & z )

Stream insertion operator for fftw_complex.

Parameters
osoutput stream
zcomplex number
Returns
modified output stream