NanoStructures  1.0
DMFT solver for layered, strongly correlated nanostructures

Discretized complex-valued function for real arguments. More...

#include <cfunction.h>

Public Types

typedef std::complex< double >(* tIntegrandFunction )(double, std::complex< double >, void *)
 

Public Member Functions

 CFunction ()
 empty, default constructor
 
 CFunction (int length)
 allocates an instance for length data points. More...
 
 CFunction (const CFunction &orig)
 copy constructor More...
 
CFunctionoperator= (const CFunction &orig)
 operator= More...
 
virtual ~CFunction ()
 destructor frees all previously allocated memory.
 
void resize (int length)
 changes the size of the storage container to hold length argument-value pairs. More...
 
int getSize () const
 returns current size of the storage container More...
 
void set (int index, double argument, std::complex< double > value)
 sets the datapoint with indicated index. More...
 
void setArgument (int index, double argument)
 sets argument of the argument-value pair with index index to argument More...
 
void setValue (int index, std::complex< double > value)
 sets value of the argument-value pair with index index to value More...
 
double getArgument (int index) const
 returns the argument of the pair with index index. More...
 
std::complex< double > getValue (int index) const
 returns the value of the pair with index index. More...
 
double getValueReal (int index) const
 returns the value's real part of the pair with index index. More...
 
double getValueImag (int index) const
 returns the value's imaginary part of the pair with index index. More...
 
void write (std::string filename) const
 writes the data of the instance as a text file named filename. More...
 
void read (std::string filename)
 reads data from the text file named filename. More...
 
void writeBinary (std::string filename) const
 writes the data of the instance as a binary file named filename. More...
 
void readBinary (std::string filename)
 reads data to the instance as a binary file named filename. More...
 
void dump () const
 dumps the data of the instance to std::cout.
 
void rescale (double factor)
 multiplies all arguments and values by the factor factor. More...
 
bool operator== (const CFunction &rhs) const
 compares the current instance to the instance rhs More...
 
void createLogGrid (double maxFrequency, double lambda, int n)
 creates a logarithmic grid in argument space about 0. More...
 
math::CFunction transformPH () const
 
std::complex< double > interpolate (double x)
 finds the linear interpolation of the discretized function at x. More...
 
math::CFunction interpolate (double x1, double x2) const
 
math::CFunction interpolate (double x1, double x2, std::complex< double > C1, std::complex< double > C2, std::complex< double > D1, std::complex< double > D2) const
 
std::complex< double > integrate (double x_1, double x_2) const
 
std::complex< double > integrate (double x_1, double x_2, tIntegrandFunction g, void *parameters) const
 

Static Public Member Functions

static std::complex< double > one (double omega, std::complex< double > fomega, void *parameters)
 
static std::complex< double > arg (double omega, std::complex< double > fomega, void *parameters)
 

Protected Attributes

double * m_arguments
 
std::complex< double > * m_values
 
int m_length
 

Friends

class PFunction
 
class mpi::OpenMPI
 
math::CFunction operator* (std::complex< double > factor, const math::CFunction &f)
 
math::CFunction operator/ (const math::CFunction &f, const math::CFunction &g)
 
math::CFunction operator+ (const math::CFunction &f, const math::CFunction &g)
 
math::CFunction operator/ (const math::CFunction &f, double denominator)
 

Detailed Description

Discretized complex-valued function for real arguments.

The arguments should be added in ascending order. It is the programmer's job to ensure this.

Constructor & Destructor Documentation

math::CFunction::CFunction ( int  length)

allocates an instance for length data points.

Parameters
length# of data points
math::CFunction::CFunction ( const CFunction orig)

copy constructor

Parameters
[in]origreference to original instance

Member Function Documentation

void math::CFunction::createLogGrid ( double  maxFrequency,
double  lambda,
int  n 
)

creates a logarithmic grid in argument space about 0.

This function creates a function with \(n\) argument-value pairs with arguments \(-A \lambda^0, -A \lambda^1, \dots, -A \lambda^{-n/2},A \lambda^{-n/2},\dots,A \lambda^1,A \lambda^0\). If \(n%2==1\) an additional datapoint with argument 0 is created. The values are initialized with 0's.

Parameters
[in]maxFrequencymaximum frequency
[in]lambdadiscretization parameter
[in]n# of datapoints
double math::CFunction::getArgument ( int  index) const

returns the argument of the pair with index index.

Parameters
[in]indexindex of name-value pair
Returns
argument of the argument-value pair with index index.
int math::CFunction::getSize ( ) const
inline

returns current size of the storage container

Returns
size of the storage container
std::complex< double > math::CFunction::getValue ( int  index) const

returns the value of the pair with index index.

Parameters
[in]indexindex of name-value pair
Returns
value of the argument-value pair with index index.
double math::CFunction::getValueImag ( int  index) const

returns the value's imaginary part of the pair with index index.

Parameters
[in]indexindex of name-value pair
Returns
value's imaginary part of the argument-value pair with index index.
double math::CFunction::getValueReal ( int  index) const

returns the value's real part of the pair with index index.

Parameters
[in]indexindex of name-value pair
Returns
value's real part of the argument-value pair with index index.
std::complex< double > math::CFunction::interpolate ( double  x)

finds the linear interpolation of the discretized function at x.

If x lies outside the range of arguments, the function throws an error::math::OutOfBounds exception.

Parameters
[in]xinterpolation point
Returns
interpolated value
CFunction & math::CFunction::operator= ( const CFunction orig)

operator=

Parameters
[in]origreference to original instance
Returns
reference to self
bool math::CFunction::operator== ( const CFunction rhs) const

compares the current instance to the instance rhs

This function returns true if the # of argument-value pairs and all arguments and values of the two instances coincide.

Parameters
[in]rhsinstance to compare to
Returns
true if the two are same, false otherwise.
void math::CFunction::read ( std::string  filename)

reads data from the text file named filename.

Every line of the file should contain an argument-value pair with a space as a separator. The size of the storage container is adjusted. All previous data is discarded.

Parameters
[in]filenamefilename for the written file
void math::CFunction::readBinary ( std::string  filename)

reads data to the instance as a binary file named filename.

The first integer in the file should denote the # of name-value pairs. The size of the storage container is adjusted. All previous data is discarded.

Parameters
filenamefilename for the written file
void math::CFunction::rescale ( double  factor)

multiplies all arguments and values by the factor factor.

Parameters
factorscaling factor
void math::CFunction::resize ( int  length)

changes the size of the storage container to hold length argument-value pairs.

All previous data is discarded.

Parameters
[in]lengthnew size of the storage container.
void math::CFunction::set ( int  index,
double  argument,
std::complex< double >  value 
)

sets the datapoint with indicated index.

The function sets argument of the argument-value pair with index index to argument and value value.

Parameters
[in]indexindex of name-value pair
[in]argumentnew argument
valuenew value
void math::CFunction::setArgument ( int  index,
double  argument 
)

sets argument of the argument-value pair with index index to argument

Parameters
[in]indexindex of name-value pair
[in]argumentnew argument
void math::CFunction::setValue ( int  index,
std::complex< double >  value 
)

sets value of the argument-value pair with index index to value

Parameters
[in]indexindex of argument-value pair
[in]valuenew value
void math::CFunction::write ( std::string  filename) const

writes the data of the instance as a text file named filename.

Every line of the file contains an argument-value pair with a space as a separator.

Parameters
[in]filenamefilename for the written file
void math::CFunction::writeBinary ( std::string  filename) const

writes the data of the instance as a binary file named filename.

The first integer in the file denotes the # of name-value pairs.

Parameters
filenamefilename for the written file

The documentation for this class was generated from the following files:
  • /home/chris/Development/Release/NanoStructures/math/cfunction.h
  • /home/chris/Development/Release/NanoStructures/math/cfunction.cpp