casacore
Public Member Functions | List of all members
casacore::Complex_global_functions_Complex_desc Struct Reference

More...

#include <Complex.h>

Public Member Functions

Bool isNaN (const Complex &val)
 Complex NaN and Infinity. More...
 
void setNaN (Complex &val)
 
Bool isInf (const Complex &val)
 
void setInf (Complex &val)
 
Bool isFinite (const Complex &val)
 
Bool operator>= (const Complex &left, const Complex &right)
 Complex comparisons. More...
 
Bool operator> (const Complex &left, const Complex &right)
 
Bool operator<= (const Complex &left, const Complex &right)
 
Bool operator< (const Complex &left, const Complex &right)
 
Bool isNaN (const DComplex &val)
 DComplex NaN and Infinity. More...
 
void setNaN (DComplex &val)
 
Bool isInf (const DComplex &val)
 
void setInf (DComplex &val)
 
Bool isFinite (const DComplex &val)
 
Bool operator>= (const DComplex &left, const DComplex &right)
 DComplex comparisons. More...
 
Bool operator> (const DComplex &left, const DComplex &right)
 
Bool operator<= (const DComplex &left, const DComplex &right)
 
Bool operator< (const DComplex &left, const DComplex &right)
 
Double fabs (const DComplex &val)
 Additional complex mathematical functions. More...
 
Float fabs (const Complex &val)
 
DComplex square (const DComplex &val)
 
Complex square (const Complex &val)
 
DComplex cube (const DComplex &val)
 
Complex cube (const Complex &val)
 
DComplex operator+ (const DComplex &d, const Complex &c)
 ArrayMath::pow needs this pow function. More...
 
DComplex operator+ (const Complex &c, const DComplex &d)
 
DComplex operator- (const DComplex &d, const Complex &c)
 
DComplex operator- (const Complex &c, const DComplex &d)
 
Complex operator* (const Complex &val, Double f)
 QMath and scimath need these operators * and /. More...
 
Complex operator* (Double f, const Complex &val)
 
Complex operator/ (const Complex &val, Double f)
 
Complex operator/ (Double f, const Complex &val)
 
Complex operator* (const Complex &val, Int f)
 These operators are useful, otherwise both Float and Double are applicable for Ints. More...
 
Complex operator* (Int f, const Complex &val)
 
Complex operator/ (const Complex &val, Int f)
 
Complex operator/ (Int f, const Complex &val)
 
Bool near (const Complex &val1, const Complex &val2, Double tol=1.0e-5)
 The near functions. More...
 
Bool near (const DComplex &val1, const DComplex &val2, Double tol=1.0e-13)
 
Bool nearAbs (const Complex &val1, const Complex &val2, Double tol=1.0e-5)
 
Bool nearAbs (const DComplex &val1, const DComplex &val2, Double tol=1.0e-13)
 
Bool allNear (const Complex &val1, const Complex &val2, Double tol=1.0e-5)
 
Bool allNear (const DComplex &val1, const DComplex &val2, Double tol=1.0e-13)
 
Bool allNearAbs (const Complex &val1, const Complex &val2, Double tol=1.0e-5)
 
Bool allNearAbs (const DComplex &val1, const DComplex &val2, Double tol=1.0e-13)
 
Complex max (const Complex &x, const Complex &y)
 Max and min, floor and ceil functions. More...
 
DComplex max (const DComplex &x, const DComplex &y)
 
Complex min (const Complex &x, const Complex &y)
 
DComplex min (const DComplex &x, const DComplex &y)
 
Complex floor (const Complex &x)
 
DComplex floor (const DComplex &x)
 
Complex ceil (const Complex &x)
 
DComplex ceil (const DComplex &x)
 
DComplex fmod (const DComplex &in, const DComplex &f)
 fmod More...
 
Complex fmod (const Complex &in, const Complex &f)
 
DComplex atan (const DComplex &in)
 Inverse trigonometry. More...
 
Complex atan (const Complex &in)
 
DComplex asin (const DComplex &in)
 
Complex asin (const Complex &in)
 
DComplex acos (const DComplex &in)
 
Complex acos (const Complex &in)
 
DComplex atan2 (const DComplex &in, const DComplex &t2)
 
Complex atan2 (const Complex &in, const Complex &t2)
 
DComplex erf (const DComplex &in)
 Error function. More...
 
Complex erf (const Complex &in)
 
DComplex erfc (const DComplex &in)
 
Complex erfc (const Complex &in)
 

Detailed Description

Single and double precision complex numbers

Review Status

Reviewed By:
UNKNOWN
Date Reviewed:
before2004/08/25

Synopsis

The class Complex is a straight typedef as the standard library complex<float>.

In a similar way DComplex is typedef-ed as complex<double>.

IComplex is defined as a specific class. It is only used by the FITS classes.

lDComplex has not been defined: long double is not part of the standard Casacore data suite (yet)

A set of global functions are added for historic reasons (they were present in the original Casacore/gcc complex implementation).

See the standard library documentation for the expected behaviour of the Complex and DComplex classes.


Tip: In the following all references to Complex can be replaced with DComplex; with simultaneous replacement of Float with Double;

Complex numbers may be constructed and used in the following ways:

Complex x;

Declares an uninitialized Complex.

Complex x = 2; Complex y(2.0);

Set x and y to the Complex value (2.0, 0.0);

Complex x(2, 3);

Sets x to the Complex value (2, 3);

Complex u(x); Complex v = x;

Set u and v to the same value as x.

Float real(Complex& x);

returns the real part of x.

Float imag(Complex& x);

returns the imaginary part of x.

Float abs(Complex& x);

returns the magnitude of x.

Float norm(Complex& x);

returns the square of the magnitude of x.

Float arg(Complex& x);

returns the argument (amplitude) of x.

Complex polar(Float r, Float t = 0.0);

returns a Complex with abs of r and arg of t.

Complex conj(Complex& x);

returns the complex conjugate of x

Complex cos(Complex& x);

returns the complex cosine of x.

Complex sin(Complex& x);

returns the complex sine of x.

Complex cosh(Complex& x);

returns the complex hyperbolic cosine of x.

Complex sinh(Complex& x);

returns the complex hyperbolic sine of x.

Complex exp(Complex& x);

returns the exponential of x.

Complex log(Complex& x);

returns the natural log of x.

Complex pow(Complex& x, long p);

returns x raised to the p power.

Complex pow(Complex& x, Complex& p);

returns x raised to the p power.

Complex sqrt(Complex& x);

returns the square root of x.

Complex min(Complex x,Complex y);

Returns the minumum of x,y (using operator<=, i.e. the norm).

Complex max(Complex x,Complex y);

Returns the maximum of x,y (using operator>=, i.e. the norm).

Bool near(Complex val1, Complex val2, Double tol = 1.0e-5);

returns whether val1 is relatively near val2 (see Math.h). (Note the Double tolerance)

Bool nearAbs(Complex val1, Complex val2, Double tol = 1.0e-5);

returns whether val1 is absolutely near val2 (see Math.h). (Note the Double tolerance)

ostream << x;

prints x in the form (re, im).

istream >> x;
reads x in the form (re, im), or just (re) or re in which case the imaginary part is set to zero.


Definition at line 158 of file Complex.h.

Member Function Documentation

◆ acos() [1/2]

Complex casacore::Complex_global_functions_Complex_desc::acos ( const Complex &  in)

◆ acos() [2/2]

DComplex casacore::Complex_global_functions_Complex_desc::acos ( const DComplex &  in)

◆ allNear() [1/2]

Bool casacore::Complex_global_functions_Complex_desc::allNear ( const Complex &  val1,
const Complex &  val2,
Double  tol = 1.0e-5 
)
inline

Definition at line 273 of file Complex.h.

References near().

◆ allNear() [2/2]

Bool casacore::Complex_global_functions_Complex_desc::allNear ( const DComplex &  val1,
const DComplex &  val2,
Double  tol = 1.0e-13 
)
inline

Definition at line 276 of file Complex.h.

References near().

◆ allNearAbs() [1/2]

Bool casacore::Complex_global_functions_Complex_desc::allNearAbs ( const Complex &  val1,
const Complex &  val2,
Double  tol = 1.0e-5 
)
inline

Definition at line 279 of file Complex.h.

References nearAbs().

◆ allNearAbs() [2/2]

Bool casacore::Complex_global_functions_Complex_desc::allNearAbs ( const DComplex &  val1,
const DComplex &  val2,
Double  tol = 1.0e-13 
)
inline

Definition at line 282 of file Complex.h.

References nearAbs().

◆ asin() [1/2]

Complex casacore::Complex_global_functions_Complex_desc::asin ( const Complex &  in)

◆ asin() [2/2]

DComplex casacore::Complex_global_functions_Complex_desc::asin ( const DComplex &  in)

◆ atan()

Complex casacore::Complex_global_functions_Complex_desc::atan ( const Complex &  in)

◆ atan2() [1/2]

Complex casacore::Complex_global_functions_Complex_desc::atan2 ( const Complex &  in,
const Complex &  t2 
)

◆ atan2() [2/2]

DComplex casacore::Complex_global_functions_Complex_desc::atan2 ( const DComplex &  in,
const DComplex &  t2 
)

◆ ceil() [1/2]

Complex casacore::Complex_global_functions_Complex_desc::ceil ( const Complex &  x)
inline

Definition at line 305 of file Complex.h.

References casacore::ceil().

◆ ceil() [2/2]

DComplex casacore::Complex_global_functions_Complex_desc::ceil ( const DComplex &  x)
inline

Definition at line 307 of file Complex.h.

References casacore::ceil().

◆ cube() [1/2]

Complex casacore::Complex_global_functions_Complex_desc::cube ( const Complex &  val)
inline

Definition at line 225 of file Complex.h.

◆ cube() [2/2]

DComplex casacore::Complex_global_functions_Complex_desc::cube ( const DComplex &  val)
inline

Definition at line 224 of file Complex.h.

◆ erf()

Complex casacore::Complex_global_functions_Complex_desc::erf ( const Complex &  in)

◆ erfc() [1/2]

Complex casacore::Complex_global_functions_Complex_desc::erfc ( const Complex &  in)

◆ erfc() [2/2]

DComplex casacore::Complex_global_functions_Complex_desc::erfc ( const DComplex &  in)

◆ fabs()

Float casacore::Complex_global_functions_Complex_desc::fabs ( const Complex &  val)
inline

Definition at line 220 of file Complex.h.

References casacore::abs().

◆ floor() [1/2]

Complex casacore::Complex_global_functions_Complex_desc::floor ( const Complex &  x)
inline

Definition at line 300 of file Complex.h.

References casacore::floor().

◆ floor() [2/2]

DComplex casacore::Complex_global_functions_Complex_desc::floor ( const DComplex &  x)
inline

Definition at line 302 of file Complex.h.

References casacore::floor().

◆ fmod()

Complex casacore::Complex_global_functions_Complex_desc::fmod ( const Complex &  in,
const Complex &  f 
)

◆ isFinite() [1/2]

Bool casacore::Complex_global_functions_Complex_desc::isFinite ( const Complex &  val)

◆ isFinite() [2/2]

Bool casacore::Complex_global_functions_Complex_desc::isFinite ( const DComplex &  val)

◆ isInf() [1/2]

Bool casacore::Complex_global_functions_Complex_desc::isInf ( const Complex &  val)

◆ isInf() [2/2]

Bool casacore::Complex_global_functions_Complex_desc::isInf ( const DComplex &  val)

◆ max()

DComplex casacore::Complex_global_functions_Complex_desc::max ( const DComplex &  x,
const DComplex &  y 
)
inline

Definition at line 293 of file Complex.h.

◆ min() [1/2]

Complex casacore::Complex_global_functions_Complex_desc::min ( const Complex &  x,
const Complex &  y 
)
inline

Definition at line 295 of file Complex.h.

◆ min() [2/2]

DComplex casacore::Complex_global_functions_Complex_desc::min ( const DComplex &  x,
const DComplex &  y 
)
inline

Definition at line 297 of file Complex.h.

◆ near()

Bool casacore::Complex_global_functions_Complex_desc::near ( const DComplex &  val1,
const DComplex &  val2,
Double  tol = 1.0e-13 
)

◆ nearAbs() [1/2]

Bool casacore::Complex_global_functions_Complex_desc::nearAbs ( const Complex &  val1,
const Complex &  val2,
Double  tol = 1.0e-5 
)

Referenced by allNearAbs().

◆ nearAbs() [2/2]

Bool casacore::Complex_global_functions_Complex_desc::nearAbs ( const DComplex &  val1,
const DComplex &  val2,
Double  tol = 1.0e-13 
)

◆ operator*() [1/4]

Complex casacore::Complex_global_functions_Complex_desc::operator* ( const Complex &  val,
Double  f 
)
inline

QMath and scimath need these operators * and /.

Definition at line 249 of file Complex.h.

◆ operator*() [2/4]

Complex casacore::Complex_global_functions_Complex_desc::operator* ( const Complex &  val,
Int  f 
)
inline

These operators are useful, otherwise both Float and Double are applicable for Ints.

Definition at line 257 of file Complex.h.

◆ operator*() [3/4]

Complex casacore::Complex_global_functions_Complex_desc::operator* ( Double  f,
const Complex &  val 
)
inline

Definition at line 250 of file Complex.h.

◆ operator*() [4/4]

Complex casacore::Complex_global_functions_Complex_desc::operator* ( Int  f,
const Complex &  val 
)
inline

Definition at line 258 of file Complex.h.

◆ operator+() [1/2]

DComplex casacore::Complex_global_functions_Complex_desc::operator+ ( const Complex &  c,
const DComplex &  d 
)
inline

Definition at line 235 of file Complex.h.

References casacore::C::c.

◆ operator+() [2/2]

DComplex casacore::Complex_global_functions_Complex_desc::operator+ ( const DComplex &  d,
const Complex &  c 
)
inline

ArrayMath::pow needs this pow function.

inline Complex pow(const Complex& val, Double p) { return std::pow(val,Float(p)); } We have to explicitly implement these for different type operands

Definition at line 231 of file Complex.h.

References casacore::C::c.

◆ operator-() [1/2]

DComplex casacore::Complex_global_functions_Complex_desc::operator- ( const Complex &  c,
const DComplex &  d 
)
inline

Definition at line 243 of file Complex.h.

References casacore::C::c.

◆ operator-() [2/2]

DComplex casacore::Complex_global_functions_Complex_desc::operator- ( const DComplex &  d,
const Complex &  c 
)
inline

Definition at line 239 of file Complex.h.

References casacore::C::c.

◆ operator/() [1/4]

Complex casacore::Complex_global_functions_Complex_desc::operator/ ( const Complex &  val,
Double  f 
)
inline

Definition at line 251 of file Complex.h.

◆ operator/() [2/4]

Complex casacore::Complex_global_functions_Complex_desc::operator/ ( const Complex &  val,
Int  f 
)
inline

Definition at line 259 of file Complex.h.

◆ operator/() [3/4]

Complex casacore::Complex_global_functions_Complex_desc::operator/ ( Double  f,
const Complex &  val 
)
inline

Definition at line 252 of file Complex.h.

◆ operator/() [4/4]

Complex casacore::Complex_global_functions_Complex_desc::operator/ ( Int  f,
const Complex &  val 
)
inline

Definition at line 260 of file Complex.h.

◆ operator<() [1/2]

Bool casacore::Complex_global_functions_Complex_desc::operator< ( const Complex &  left,
const Complex &  right 
)
inline

Definition at line 182 of file Complex.h.

References casacore::False, and casacore::norm().

◆ operator<() [2/2]

Bool casacore::Complex_global_functions_Complex_desc::operator< ( const DComplex &  left,
const DComplex &  right 
)
inline

Definition at line 209 of file Complex.h.

References casacore::norm().

◆ operator<=() [1/2]

Bool casacore::Complex_global_functions_Complex_desc::operator<= ( const Complex &  left,
const Complex &  right 
)
inline

Definition at line 180 of file Complex.h.

References casacore::norm(), and casacore::True.

◆ operator<=() [2/2]

Bool casacore::Complex_global_functions_Complex_desc::operator<= ( const DComplex &  left,
const DComplex &  right 
)
inline

Definition at line 207 of file Complex.h.

References casacore::norm().

◆ operator>() [1/2]

Bool casacore::Complex_global_functions_Complex_desc::operator> ( const Complex &  left,
const Complex &  right 
)
inline

Definition at line 178 of file Complex.h.

References casacore::False, and casacore::norm().

◆ operator>() [2/2]

Bool casacore::Complex_global_functions_Complex_desc::operator> ( const DComplex &  left,
const DComplex &  right 
)
inline

Definition at line 205 of file Complex.h.

References casacore::norm().

◆ setInf() [1/2]

void casacore::Complex_global_functions_Complex_desc::setInf ( Complex &  val)

◆ setInf() [2/2]

void casacore::Complex_global_functions_Complex_desc::setInf ( DComplex &  val)

◆ setNaN() [1/2]

void casacore::Complex_global_functions_Complex_desc::setNaN ( Complex &  val)

◆ setNaN() [2/2]

void casacore::Complex_global_functions_Complex_desc::setNaN ( DComplex &  val)

◆ square() [1/2]

Complex casacore::Complex_global_functions_Complex_desc::square ( const Complex &  val)
inline

Definition at line 222 of file Complex.h.

◆ square() [2/2]

DComplex casacore::Complex_global_functions_Complex_desc::square ( const DComplex &  val)
inline

Definition at line 221 of file Complex.h.


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