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

This class can be used like a reference for complex objects so that we can iterate over a vector (for example) of them. More...

#include <complex.hpp>

Inheritance diagram for gsl::complex_ref:
Inheritance graph
Collaboration diagram for gsl::complex_ref:
Collaboration graph

Public Member Functions

 complex_ref (double *dat)
 We use this in constructing complex_ptr objects. More...
 
 operator gsl_complex () const
 Make sure this is convertible to gsl_complex. More...
 
 operator complex () const
 Make sure this is convertible to complex. More...
 
 complex_ref ()
 The default constructor is only really useful for assigning to. More...
 
 complex_ref (complex &z)
 Make sure we can construct from a complex. More...
 
complex_refoperator= (complex const &z)
 Assignment from complex. More...
 
void set_complex (double x, double y)
 C++ version of GSL_SET_COMPLEX(). More...
 
double real () const
 C++ version of GSL_REAL(). More...
 
double imag () const
 C++ version of GSL_IMAG(). More...
 
void set_real (double x)
 C++ version of GSL_SET_REAL(). More...
 
void set_imag (double y)
 C++ version of GSL_SET_IMAG(). More...
 

Protected Attributes

double * dat
 The data. More...
 

Detailed Description

This class can be used like a reference for complex objects so that we can iterate over a vector (for example) of them.

Definition at line 613 of file complex.hpp.

Constructor & Destructor Documentation

◆ complex_ref() [1/3]

gsl::complex_ref::complex_ref ( double *  dat)
inline

We use this in constructing complex_ptr objects.

Parameters
datA pointer to the data

Definition at line 624 of file complex.hpp.

◆ complex_ref() [2/3]

gsl::complex_ref::complex_ref ( )
inline

The default constructor is only really useful for assigning to.

Definition at line 643 of file complex.hpp.

◆ complex_ref() [3/3]

gsl::complex_ref::complex_ref ( complex z)
inline

Make sure we can construct from a complex.

Parameters
zThe complex to construct from

Definition at line 648 of file complex.hpp.

Member Function Documentation

◆ imag()

double gsl::complex_ref::imag ( ) const
inline

C++ version of GSL_IMAG().

Returns
The real part of this

Definition at line 674 of file complex.hpp.

◆ operator complex()

gsl::complex_ref::operator complex ( ) const
inline

Make sure this is convertible to complex.

This is not ideal because it copies twice. But it gets round the problem that a gsl_complex must contain constant data.

Returns
A complex

Definition at line 637 of file complex.hpp.

References dat.

◆ operator gsl_complex()

gsl::complex_ref::operator gsl_complex ( ) const
inline

Make sure this is convertible to gsl_complex.

This is not ideal because it copies twice. But it gets round the problem that a gsl_complex must contain constant data.

Returns
A gsl_complex

Definition at line 630 of file complex.hpp.

References dat.

◆ operator=()

complex_ref & gsl::complex_ref::operator= ( complex const &  z)
inline

Assignment from complex.

Parameters
zThe complex to assign from

Definition at line 656 of file complex.hpp.

References dat.

◆ real()

double gsl::complex_ref::real ( ) const
inline

C++ version of GSL_REAL().

Returns
The real part of this

Definition at line 669 of file complex.hpp.

◆ set_complex()

void gsl::complex_ref::set_complex ( double  x,
double  y 
)
inline

C++ version of GSL_SET_COMPLEX().

Parameters
xReal part
yImaginary part

Definition at line 664 of file complex.hpp.

◆ set_imag()

void gsl::complex_ref::set_imag ( double  y)
inline

C++ version of GSL_SET_IMAG().

Parameters
yThe new imaginary part

Definition at line 684 of file complex.hpp.

◆ set_real()

void gsl::complex_ref::set_real ( double  x)
inline

C++ version of GSL_SET_REAL().

Parameters
xThe new real part

Definition at line 679 of file complex.hpp.

Member Data Documentation

◆ dat

double* gsl::complex_ref::dat
protected

The data.

Never initialised or destroyed within the class. Always precisely two elements.

Definition at line 618 of file complex.hpp.

Referenced by operator complex(), operator gsl_complex(), and operator=().


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