ccgsl 2.7.2
C++wrappersforGnuScientificLibrary
gsl::complex_float Class Reference

This class handles complex_float numbers. More...

#include <complex_float.hpp>

Inheritance diagram for gsl::complex_float:
Inheritance graph
Collaboration diagram for gsl::complex_float:
Collaboration graph

Public Member Functions

 complex_float ()
 The default constructor is only really useful for assigning to. More...
 
 complex_float (float *dat)
 Allow construction from raw data. More...
 
 complex_float (float const real, float const imag)
 Allow construction from real and imaginary values. More...
 
 complex_float (std::complex< float > const &z)
 Allow construction from a std::complex<float>. More...
 
 complex_float (gsl_complex_float const &z)
 Constructor from base class. More...
 
 operator std::complex< float > () const
 Convert to std::complex<float> More...
 
gsl_complex_float & get ()
 Get the base class object. More...
 
gsl_complex_float const & get () const
 Get the base class object. More...
 
void set_complex_float (float x, float y)
 C++ version of GSL_SET_COMPLEX(). More...
 
float real () const
 C++ version of GSL_REAL(). More...
 
float imag () const
 C++ version of GSL_IMAG(). More...
 
void set_real (float x)
 C++ version of GSL_SET_REAL(). More...
 
void set_imag (float y)
 C++ version of GSL_SET_IMAG(). More...
 
bool operator== (complex_float const &z) const
 A complex_float object must be less than comparable so that it can be used as a container value type. More...
 
bool operator!= (complex_float const &z) const
 A complex_float object must be less than comparable so that it can be used as a container value type. More...
 
bool operator< (complex_float const &z) const
 A complex_float object must be less than comparable so that it can be used as a container value type. More...
 
bool operator> (complex_float const &z) const
 A complex_float object must be less than comparable so that it can be used as a container value type. More...
 
bool operator<= (complex_float const &z) const
 A complex_float object must be less than comparable so that it can be used as a container value type. More...
 
bool operator>= (complex_float const &z) const
 A complex_float object must be less than comparable so that it can be used as a container value type. More...
 

Static Public Member Functions

static complex_float rect (float x, float y)
 C++ version of gsl_complex_float_rect(). More...
 
static complex_float polar (float r, float theta)
 C++ version of gsl_complex_float_rect(). More...
 

Friends

class complex_float_ptr
 
class complex_float_ref
 
class vector_complex_float
 
class matrix_complex_float
 

Detailed Description

This class handles complex_float numbers.

There is an ambiguity in translating gsl_complex_float to C++: gsl_complex_float is a struct and so should be represented by a C++ class. But gsl_complex_float is also used like a namespace and so it would be nice to have a C++ namespace gsl:: complex_float. However, we cannot have both. The compromise is to use static complex_float class functions. But, since we cannot use

using namespace gsl::complex_float
This class handles complex_float numbers.

and similar namespace operations with gsl::complex_float, we also define a namespace gsl::cpx_float with the same functions, again defined inline for efficiency.

Definition at line 42 of file complex_float.hpp.

Constructor & Destructor Documentation

◆ complex_float() [1/5]

gsl::complex_float::complex_float ( )
inline

The default constructor is only really useful for assigning to.

Definition at line 52 of file complex_float.hpp.

◆ complex_float() [2/5]

gsl::complex_float::complex_float ( float *  dat)
inlineexplicit

Allow construction from raw data.

This is mainly for use by the container classes.

Parameters
datRaw data

Definition at line 57 of file complex_float.hpp.

◆ complex_float() [3/5]

gsl::complex_float::complex_float ( float const  real,
float const  imag 
)
inline

Allow construction from real and imaginary values.

Parameters
realThe real part.
imagThe imaginary part.

Definition at line 65 of file complex_float.hpp.

References imag(), and real().

◆ complex_float() [4/5]

gsl::complex_float::complex_float ( std::complex< float > const &  z)
inline

Allow construction from a std::complex<float>.

Parameters
zThe std::complex_float

Definition at line 73 of file complex_float.hpp.

◆ complex_float() [5/5]

gsl::complex_float::complex_float ( gsl_complex_float const &  z)
inline

Constructor from base class.

Parameters
zA gsl_complex_float

Definition at line 84 of file complex_float.hpp.

Member Function Documentation

◆ get() [1/2]

◆ get() [2/2]

gsl_complex_float const & gsl::complex_float::get ( ) const
inline

Get the base class object.

Returns
the base class object.

Definition at line 111 of file complex_float.hpp.

◆ imag()

float gsl::complex_float::imag ( ) const
inline

C++ version of GSL_IMAG().

Returns
The real part of this

Definition at line 142 of file complex_float.hpp.

Referenced by complex_float().

◆ operator std::complex< float >()

gsl::complex_float::operator std::complex< float > ( ) const
inlineexplicit

Convert to std::complex<float>

Returns
std::complex<float> version of this (by copying).

Definition at line 93 of file complex_float.hpp.

◆ operator!=()

bool gsl::complex_float::operator!= ( complex_float const &  z) const
inline

A complex_float object must be less than comparable so that it can be used as a container value type.

This is the inequality operator.

Parameters
zAnother complex_float
Returns
false or true according as this equals z

Definition at line 166 of file complex_float.hpp.

◆ operator<()

bool gsl::complex_float::operator< ( complex_float const &  z) const
inline

A complex_float object must be less than comparable so that it can be used as a container value type.

This is the (lexicographic) less than operator.

Parameters
zAnother complex_float
Returns
true or false according as this is less than z

Definition at line 173 of file complex_float.hpp.

◆ operator<=()

bool gsl::complex_float::operator<= ( complex_float const &  z) const
inline

A complex_float object must be less than comparable so that it can be used as a container value type.

This is the (lexicographic) less than or equal to operator.

Parameters
zAnother complex_float
Returns
true or false according as this is less than or equal to z

Definition at line 189 of file complex_float.hpp.

◆ operator==()

bool gsl::complex_float::operator== ( complex_float const &  z) const
inline

A complex_float object must be less than comparable so that it can be used as a container value type.

This is the equality operator.

Parameters
zAnother complex_float
Returns
true or false according as this equals z

Definition at line 159 of file complex_float.hpp.

◆ operator>()

bool gsl::complex_float::operator> ( complex_float const &  z) const
inline

A complex_float object must be less than comparable so that it can be used as a container value type.

This is the (lexicographic) greater than operator.

Parameters
zAnother complex_float
Returns
true or false according as this is greater than than z

Definition at line 181 of file complex_float.hpp.

◆ operator>=()

bool gsl::complex_float::operator>= ( complex_float const &  z) const
inline

A complex_float object must be less than comparable so that it can be used as a container value type.

This is the (lexicographic) greater than or equal to operator.

Parameters
zAnother complex_float
Returns
true or false according as this is greater than or equal to z

Definition at line 196 of file complex_float.hpp.

◆ polar()

static complex_float gsl::complex_float::polar ( float  r,
float  theta 
)
inlinestatic

C++ version of gsl_complex_float_rect().

Parameters
rThe magnitude
thetaThe argument
Returns
complex_float

Definition at line 125 of file complex_float.hpp.

References gsl::cpx::cos(), and gsl::cpx::sin().

Referenced by gsl::cpx_float::polar().

◆ real()

float gsl::complex_float::real ( ) const
inline

C++ version of GSL_REAL().

Returns
The real part of this

Definition at line 137 of file complex_float.hpp.

Referenced by complex_float().

◆ rect()

static complex_float gsl::complex_float::rect ( float  x,
float  y 
)
inlinestatic

C++ version of gsl_complex_float_rect().

Parameters
xReal part
yImaginary part
Returns
complex_float

Definition at line 118 of file complex_float.hpp.

Referenced by gsl::cpx_float::rect().

◆ set_complex_float()

void gsl::complex_float::set_complex_float ( float  x,
float  y 
)
inline

C++ version of GSL_SET_COMPLEX().

Parameters
xReal part
yImaginary part

Definition at line 132 of file complex_float.hpp.

◆ set_imag()

void gsl::complex_float::set_imag ( float  y)
inline

C++ version of GSL_SET_IMAG().

Parameters
yThe new imaginary part

Definition at line 152 of file complex_float.hpp.

◆ set_real()

void gsl::complex_float::set_real ( float  x)
inline

C++ version of GSL_SET_REAL().

Parameters
xThe new real part

Definition at line 147 of file complex_float.hpp.

Friends And Related Function Documentation

◆ complex_float_ptr

friend class complex_float_ptr
friend

Definition at line 43 of file complex_float.hpp.

◆ complex_float_ref

friend class complex_float_ref
friend

Definition at line 44 of file complex_float.hpp.

◆ matrix_complex_float

friend class matrix_complex_float
friend

Definition at line 46 of file complex_float.hpp.

◆ vector_complex_float

friend class vector_complex_float
friend

Definition at line 45 of file complex_float.hpp.


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