MathFunc.h

Classes

MathFuncError -- Error class for MathFunc class (full description)
Global Functions -- Fred Schwab function to calculate spheriodal functions (full description)
Global Functions -- Enum used to identify function type for MathFunc class (full description)
FuncId -- Function ID, for use by MathFunc class (full description)
MathFunc -- A class to generate values of mathematical functions (full description)
Unary -- Unary (full description)
GaussianConv -- Gaussian (full description)
KB_Conv -- A Kaiser-Bessel function (full description)
Mod_KB_Conv -- A Kaiser-Bessel function multiplied by a Gaussian (full description)
Sinc_Conv -- Sine x / x function (full description)
Sph_Conv -- Spheroidal function (full description)
ExpSincConv -- Exponential times a Sinc (full description)

class MathFuncError : public AipsError

Interface

Public Members
MathFuncError() : AipsError("MathFuncError")
MathFuncError(const Char *m) : AipsError(m)
MathFuncError(const String &m) : AipsError(m)
virtual ~MathFuncError() throw()

Description

Synopsis

Error class for MathFunc class

Member Description

MathFuncError() : AipsError("MathFuncError")

MathFuncError(const Char *m) : AipsError(m)

MathFuncError(const String &m) : AipsError(m)

virtual ~MathFuncError() throw()


Fred Schwab function to calculate spheriodal functions (source)

Interface

float sphfn(Int ialf, Int im, float eta)

Description

Synopsis

Fred Schwab function to calculate spheriodal functions.

Member Description

float sphfn(Int ialf, Int im, float eta)

C++ wrapper to Fred Schwab function to calculate spheriodal functions.


Enum used to identify function type for MathFunc class (source)

Types

enum FUNCTYPE

UNARY
GAUSSIAN
KB
MOD_KB
SINC
SPHEROIDAL
EXP_SINC

Interface

Description

Synopsis

Enum used to identify function type for MathFunc class

Caution The following enum documentation is currently extracted by hand, and thus could be out of date if this documentation was not updated when the enum was modified.

The FUNCTYPE enum is:

    
    enum FUNCTYPE { UNARY, GAUSSIAN, KB, MOD_KB, SINC, SPHEROIDAL, EXP_SINC };
    
    

Member Description

enum FUNCTYPE


struct FuncId

Interface

Description

Synopsis

Function ID, for use by MathFunc class.

Member Description


class MathFunc

Interface

MathFunc(FUNCTYPE)
MathFunc(FUNCTYPE, T cutoff, T arg1 = 1.0e+30, T arg2 = 1.0e+30, T arg3 = 1.0e+30)
MathFunc(String &, Vector<double> &)
MathFunc(const MathFunc<T>&)
MathFunc(MathFunc<T> *)
virtual ~MathFunc()
MathFunc<T>& operator=(const MathFunc<T>&)
virtual T sup_value() const
virtual T value(const T &a) const
static MathFunc<T> *newMathFunc(const MathFunc<T>&)
virtual FuncId id() const
static T defcutoff()
static T defwidth()
static T defKBwidth()
static T defKBparm()
static T defmodKBparm()
static T defSphcutoff()
static T defSincparm()
static T defSphparm()
static T defExpPower()
static T defExpScale()
Protected Members
virtual MathFunc<T> * clone() const
MathFunc()

Description

Synopsis

This class is the abstract base class for 1-dimensional math functions.

Actual math functions are then an inherited class from the base class. This approach allows one to define actual function values for each derived class. Then, one can pass a generic MathFunc pointer to other objects, but the other objects will still get function values from the actual inherited function.

By defining each math function as an object, we can place parameters which will not change from one call to the function value to another in the class definition and they only have to be initialized once.

MathFunc is the base class for 1-dimensional math functions

Member Description

MathFunc(FUNCTYPE)

constructors

MathFunc(FUNCTYPE, T cutoff, T arg1 = 1.0e+30, T arg2 = 1.0e+30, T arg3 = 1.0e+30)

accept up to 4 arguments, the first being the support radius

MathFunc(String &, Vector<double> &)

MathFunc(const MathFunc<T>&)

MathFunc(MathFunc<T> *)

Copy constructor

virtual ~MathFunc()

Destructor

MathFunc<T>& operator=(const MathFunc<T>&)

Assignment operator - Note: this function works only for envelops. Polymorphism flaws will let you pass a letter as an argument but an exception will be thrown at run time.

virtual T sup_value() const

return value of support width

virtual T value(const T &a) const

compute and return a value of the math function

static MathFunc<T> *newMathFunc(const MathFunc<T>&)

create a new math function

virtual FuncId id() const

return a FuncId structure for Table storage/retrieval.

static T defcutoff()

These functions return the static constants used as default parameters for the various derived functions

The default support radius

static T defwidth()

The default width for Gaussian_Conv

static T defKBwidth()

The default width for KB_Conv and Mod_KB_Conv

static T defKBparm()

A default parameter for KB_Conv and Mod_KB_Conv

static T defmodKBparm()

A default parameter for Mod_KB_Conv

static T defSphcutoff()

The default support radius for Sinc_Conv and Sph_Conv

static T defSincparm()

The default Sinc parameter for Sinc_Conv and Exp_Sinc_Conv

static T defSphparm()

The default parameter for Sph_Conv

static T defExpPower()

The default exponential power for Exp_Sinc_Conv

static T defExpScale()

The default exponential scale length for Exp_Sinc_Conv

virtual MathFunc<T> * clone() const

for every derived class, return new of that class with its own parameters

MathFunc()

Default constructor (Null)


class Unary: public MathFunc<T>

Interface

Public Members
Unary( T cut = cut<T>::defcutoff())
Unary(const Unary<T>&)
Unary<T>& operator=(const Unary<T>&)
T sup_value() const
T value(const T &) const
FuncId id() const
Private Members
MathFunc<T> * clone() const

Description

Synopsis

A Unary function (always returns the value 1.0)

Member Description

Unary( T cut = cut<T>::defcutoff())

default constructor

Unary(const Unary<T>&)

copy constructor

Unary<T>& operator=(const Unary<T>&)

T sup_value() const

T value(const T &) const

FuncId id() const

return a FuncId structure for Table storage/retrieval.

MathFunc<T> * clone() const


class GaussianConv: public MathFunc<T>

Interface

Public Members
GaussianConv( T cut = cut<T>::defcutoff(), T wparm = cut<T>::defwidth())
GaussianConv(const GaussianConv<T>&)
GaussianConv<T>& operator=(const GaussianConv<T>&)
T sup_value() const
T value(const T &) const
FuncId id() const
Private Members
MathFunc<T> * clone() const

Description

Synopsis

A Gaussian

Member Description

GaussianConv( T cut = cut<T>::defcutoff(), T wparm = cut<T>::defwidth())

default constructor

GaussianConv(const GaussianConv<T>&)

copy constructor

GaussianConv<T>& operator=(const GaussianConv<T>&)

T sup_value() const

T value(const T &) const

FuncId id() const

return a FuncId structure for Table storage/retrieval.

MathFunc<T> * clone() const


class KB_Conv: public MathFunc<T>

Interface

Public Members
KB_Conv(T cut = cut<T>::defcutoff(), T wparm = cut<T>::defKBwidth(), T kbparm = cut<T>::defKBparm())
KB_Conv(const KB_Conv<T> &)
KB_Conv<T>& operator=(const KB_Conv<T>&)
T sup_value() const
T value(const T &) const
FuncId id() const
Private Members
MathFunc<T> * clone() const

Description

Synopsis

A Kaiser-Bessel function

Member Description

KB_Conv(T cut = cut<T>::defcutoff(), T wparm = cut<T>::defKBwidth(), T kbparm = cut<T>::defKBparm())

default constructor

KB_Conv(const KB_Conv<T> &)

copy constructor

KB_Conv<T>& operator=(const KB_Conv<T>&)

T sup_value() const

T value(const T &) const

FuncId id() const

return a FuncId structure for Table storage/retrieval.

MathFunc<T> * clone() const


class Mod_KB_Conv: public MathFunc<T>

Interface

Public Members
Mod_KB_Conv (T cut = cut<T>::defcutoff(), T wparm = cut<T>::defKBwidth(), T kbparm = cut<T>::defKBparm(), T gwparm = cut<T>::defmodKBparm())
Mod_KB_Conv(const Mod_KB_Conv<T>&)
Mod_KB_Conv<T>& operator=(const Mod_KB_Conv<T>&)
T sup_value() const
T value(const T &) const
FuncId id() const
Private Members
MathFunc<T>* clone() const

Description

Synopsis

A Kaiser-Bessel function multiplied by a Gaussian

Member Description

Mod_KB_Conv (T cut = cut<T>::defcutoff(), T wparm = cut<T>::defKBwidth(), T kbparm = cut<T>::defKBparm(), T gwparm = cut<T>::defmodKBparm())

default constructor

Mod_KB_Conv(const Mod_KB_Conv<T>&)

copy constructor

Mod_KB_Conv<T>& operator=(const Mod_KB_Conv<T>&)

T sup_value() const

T value(const T &) const

FuncId id() const

return a FuncId structure for Table storage/retrieval.

MathFunc<T>* clone() const


class Sinc_Conv: public MathFunc<T>

Interface

Public Members
Sinc_Conv(T cut = cut<T>::defSphcutoff(), T sincparm = cut<T>::defSincparm())
Sinc_Conv(const Sinc_Conv<T>&)
Sinc_Conv<T>& operator=(const Sinc_Conv<T>&)
T sup_value() const
T value(const T &) const
FuncId id() const
Private Members
MathFunc<T> * clone() const

Description

Synopsis

Sine x / x function

Member Description

Sinc_Conv(T cut = cut<T>::defSphcutoff(), T sincparm = cut<T>::defSincparm())

default constructor

Sinc_Conv(const Sinc_Conv<T>&)

copy constructor

Sinc_Conv<T>& operator=(const Sinc_Conv<T>&)

T sup_value() const

T value(const T &) const

FuncId id() const

return a FuncId structure for Table storage/retrieval.

MathFunc<T> * clone() const


class Sph_Conv: public MathFunc<T>

Interface

Public Members
Sph_Conv(T cut = cut<T>::defSphcutoff(), T Sphparm = cut<T>::defSphparm())
Sph_Conv(const Sph_Conv<T>&)
Sph_Conv<T>& operator=(const Sph_Conv<T>&)
T sup_value() const
float value(const float &) const
FuncId id() const
Private Members
MathFunc<T> * clone() const

Description

Synopsis

Spheroidal function - calls Fred Schwab function converted by f2c

Member Description

Sph_Conv(T cut = cut<T>::defSphcutoff(), T Sphparm = cut<T>::defSphparm())

default constructor

Sph_Conv(const Sph_Conv<T>&)

copy constructor

Sph_Conv<T>& operator=(const Sph_Conv<T>&)

T sup_value() const

float value(const float &) const

FuncId id() const

return a FuncId structure for Table storage/retrieval.

MathFunc<T> * clone() const


class ExpSincConv: public MathFunc<T>

Interface

Public Members
ExpSincConv ( T cut = cut<T>::defcutoff(), T sincparm = cut<T>::defSincparm(), T exppow = cut<T>::defExpPower(), T expscale = cut<T>::defExpScale())
ExpSincConv (const ExpSincConv<T>&)
ExpSincConv<T>& operator=(const ExpSincConv<T>&)
T sup_value() const
T value(const T &) const
FuncId id() const
Private Members
MathFunc<T> * clone() const

Description

Synopsis

An Exponential times a Sinc

The value(T &x) is given by Exp(-(abs(x) / expscale) ** exppow) * Sinc( pi * x / sincparm)

where the 3 paramaters correspond to those in the default constructor Note that the default case of exppow = 2 is a Gaussian times a Sinc. Since this is often a useful case, that parameter appears last in the constructor.

Member Description

ExpSincConv ( T cut = cut<T>::defcutoff(), T sincparm = cut<T>::defSincparm(), T exppow = cut<T>::defExpPower(), T expscale = cut<T>::defExpScale())

default constructor

ExpSincConv (const ExpSincConv<T>&)

copy constructor

ExpSincConv<T>& operator=(const ExpSincConv<T>&)

assignment operator

T sup_value() const

get access to the support width

T value(const T &) const

and get the value of the function

FuncId id() const

return FuncID structure for Table storage/retrieval.

MathFunc<T> * clone() const