Loading...
Searching...
No Matches
casacore::ChebyshevParam< T > Class Template Reference
Functionals_module_internal_classes

Parameter handling for Chebyshev polynomial parameters. More...

`#include <ChebyshevParam.h>`

## Public Member Functions

| ChebyshevParam ()
| create a zero-th order Chebyshev polynomial with the first coefficient equal to zero.
| ChebyshevParam (const uInt n)
| create an n-th order Chebyshev polynomial with the coefficients equal to zero.
| ChebyshevParam (const T &min, const T &max, ChebyshevEnums::OutOfIntervalMode mode=ChebyshevEnums::CONSTANT, const T &defval=T(0))
| create a zero-th order Chebyshev polynomical with the first coefficient equal to one.
| ChebyshevParam (const Vector< T > &coeffs, const T &min, const T &max, ChebyshevEnums::OutOfIntervalMode mode=ChebyshevEnums::CONSTANT, const T &defval=T(0))
| create a fully specified Chebyshev polynomial.
| ChebyshevParam (uInt order, const RecordInterface &mode)
| create a fully specified Chebyshev polynomial.
| ChebyshevParam (const Vector< T > &coeffs, const RecordInterface &mode)
| ChebyshevParam (const ChebyshevParam &other)
| create a deep copy of another Chebyshev polynomial
template<class W>
| ChebyshevParam (const ChebyshevParam< W > &other)
ChebyshevParam< T > & | operator= (const ChebyshevParam< T > &other)
| make a (deep) copy of another Chebyshev polynomial
virtual | ~ChebyshevParam ()
| Destructor.
void | setCoefficients (const Vector< T > &coeffs)
| set the Chebyshev coefficients.
void | setCoefficient (const uInt which, const T &value)
| set a particular Chebyshev coefficient.
const Vector< T > & | getCoefficients () const
| return the current set of coefficients into a given Vector.
T | getCoefficient (const uInt which) const
| return a particular coefficient.
uInt | nCoefficients () const
| return the number of coeefficients currently loaded.
void | setInterval (T xmin, T xmax)
| set the Chebyshev interval for this function.
T | getIntervalMin () const
| return the minimum value for the currently Chebyshev interval.
T | getIntervalMax () const
| return the maximum value for the currently Chebyshev interval.
void | setOutOfIntervalMode (ChebyshevEnums::OutOfIntervalMode mode)
| set the behavior of this function when it is evaluated outside its Chebyshev interval
ChebyshevEnums::OutOfIntervalMode | getOutOfIntervalMode () const
| return the behavior of this function when it is evaluated outside of its Chebyshev interval.
void | setDefault (const T &val)
| set the default value of this function.
const T & | getDefault () const
| return the currently set default value.
uInt | order () const
| return the order of this polynomial.
virtual const String & | name () const
| Give name of function.
Public Member Functions inherited from casacore::Function1D< T, U >
| Function1D ()
| Constructors.
| Function1D (const uInt n)
| Function1D (const Vector< T > &in)
| Function1D (const FunctionParam< T > &other)
template<class W, class X>
| Function1D (const Function1D< W, X > &other)
virtual | ~Function1D ()
| Destructor.
virtual uInt | ndim () const
| Returns the number of dimensions of function.
Public Member Functions inherited from casacore::Function< T, T >
| Function ()
| Constructors.
virtual | ~Function ()
| Destructor.
uInt | nparameters () const
| Returns the number of parameters.
virtual T | eval (FunctionArg x) const=0
| Evaluate the function object.
T & | operator[] (const uInt n)
| Manipulate the nth parameter (0-based) with no index check.
virtual T | operator() () const
| Evaluate this function object at xor at x, y.
Bool & | mask (const uInt n)
| Manipulate the mask associated with the nth parameter (e.g.
const FunctionParam< T > & | parameters () const
| Return the parameter interface.
const Vector< ArgType > & | argp () const
| Get arg_p and parset_p.
Bool | parsetp () const
void | lockParam ()
| Compiler cannot always find the correct 'const' version of parameter access.
void | unlockParam ()
virtual void | setMode (const RecordInterface &mode)
| get/set the function mode.
virtual void | getMode (RecordInterface &mode) const
virtual Bool | hasMode () const
| return True if the implementing function supports a mode.
ostream & | print (ostream &os) const
| Print the function (i.e.
virtual Function< T, T > * | clone () const=0
| Return a copy of this object from the heap.
virtual Function< typename FunctionTraits< T >::DiffType > * | cloneAD () const
virtual Function< typename FunctionTraits< T >::BaseType > * | cloneNonAD () const
Public Member Functions inherited from casacore::Functional< FunctionTraits< T >::ArgType, T >
virtual | ~Functional ()
| Destructor.
virtual T | operator() (const FunctionTraits< T >::ArgType &x) const=0
| Map a Domain x into a Range y value.
Public Member Functions inherited from casacore::Functional< Vector< FunctionTraits< T >::ArgType >, T >
virtual | ~Functional ()
| Destructor.
virtual T | operator() (const Vector< FunctionTraits< T >::ArgType > &x) const=0
| Map a Domain x into a Range y value.

## Static Public Member Functions

static void | derivativeCoeffs (Vector< T > &coeffs, const T &xmin=T(-1), const T &xmax=T(1))
| transform a set of Chebyshev polynomial coefficients into a set representing the series' derivative.
static void | chebyshevToPower (Vector< T > &coeffs)
| convert a set of Chebyshev polynomial coefficients to power series coefficients.
static void | powerToChebyshev (Vector< T > &coeffs)
| convert a set of power series coefficients to Chebyshev polynomial coefficients.

## Protected Attributes

T | def_p
| Default value if outside interval.
T | minx_p
| Lowest interval bound.
T | maxx_p
| Highest inetrval bound.
ChebyshevEnums::OutOfIntervalMode | mode_p
| Out-of-interval handling type.
Protected Attributes inherited from casacore::Function< T, T >
FunctionParam< T > | param_p
| The parameters and masks.
Vector< ArgType > | arg_p
| Aid for non-contiguous argument storage.
Bool | parset_p
| Indicate parameter written.
Bool | locked_p
| Indicate that parameters are expected to be locked from changing.

## Static Protected Attributes

static Vector< String > | modes_s

## Additional Inherited Members

Public Types inherited from casacore::Function1D< T, U >
typedef const T * | FunctionArg
Public Types inherited from casacore::Function< T, T >
typedef FunctionTraits< T >::ArgType | ArgType
typedef const ArgType * | FunctionArg

## Detailed Description

template<class T>
class casacore::ChebyshevParam< T >

Parameter handling for Chebyshev polynomial parameters.

### Intended use:

Internal

### Review Status

Reviewed By:
  wbrouw
Date Reviewed:
  2001/11/12
Test programs:
  tChebyshev

### Prerequisite

- FunctionParam class
- Function1D
- Chebyshev

### Etymology

This class is named after Chebyshev Type I polynomials; it handles the "fixed" parameters for the function.

### Synopsis

This class assists in forming and evaluating a function as a Chebyshev series, a linear combination of so-called Chebyshev polynomials. Users do not instantiate this abstract class directly; instead they instantiate the child class Chebyshev. This class holds the part of the implementation used by the Chebyshev class that manages the "fixed" parameters of the function (e.g. the polynomial coefficients, interval of interest, etc.)

For a full description, see the Chebyshev class.

### Example

In this example, a 2nd order Chebyshev polynomial series is created.

// set coeffs to desired values
Vector<Double> coeffs(3, 1);
// configure the function
Chebyshev<Double> cheb;
cheb.setInterval(-0.8, 7.2);
cheb.setDefault(1.0);
cheb.setCoefficients(coeffs);
// evaluate the function as necessary
Double z = cheb(-0.5); // -0.5 is within range, z = 0.78625
z = cheb(4.2); // 4.2 is within range, z = 0.375
z = cheb(-3); // -3 is out of the interval, z = 1
casacore::ChebyshevParam::setCoefficients
void setCoefficients(const Vector< T > &coeffs)
set the Chebyshev coefficients.
casacore::ChebyshevParam::setDefault
void setDefault(const T &val)
set the default value of this function.
Definition ChebyshevParam.h:298
casacore::ChebyshevParam::setInterval
void setInterval(T xmin, T xmax)
set the Chebyshev interval for this function.
Definition ChebyshevParam.h:272
casacore::Chebyshev
Definition Chebyshev.h:233
casacore::Vector
Definition Vector.h:82
casacore::Double
double Double
Definition aipstype.h:53

### Motivation

This class was created to support systematic errors in the simulator tool.
It can be used by Jones matrix classes to vary gains in a predictable way, mimicing natural processes of the atmosphere or instrumental effects.

The Chebyshev implementation is split between this class, ChebyshevParam and its child Chebyshev to better support the AutoDiff framework for evaluating derivatives.

### Template Type Argument Requirements (T)

- T should have standard numerical operators. Current implementation only tested for real types (and their AutoDiffs).

### Thrown Exceptions

- Assertion if indices out-of-range

### To Do

- It would be helpful to be able to convert to and from the Polynomial<T> type; this would be supported via a function, Polynomial<T> polynomial(), and constructor, Chebyshev(Polynomial<T>)

Definition at line 166 of file ChebyshevParam.h.

## Constructor & Destructor Documentation

## ChebyshevParam() [1/8]

template<class T>

casacore::ChebyshevParam< T >::ChebyshevParam | ( |  | ) |

create a zero-th order Chebyshev polynomial with the first coefficient equal to zero.

The bounded domain is [T(-1), T(1)]. The OutOfDomainMode is CONSTANT, and the default value is T(0).

Referenced by ChebyshevParam(), ChebyshevParam(), casacore::ChebyshevParamModeImpl< T >::ChebyshevParamModeImpl(), casacore::ChebyshevParamModeImpl< T >::ChebyshevParamModeImpl(), casacore::ChebyshevParamModeImpl< T >::ChebyshevParamModeImpl(), casacore::ChebyshevParamModeImpl< T >::ChebyshevParamModeImpl(), casacore::ChebyshevParamModeImpl< T >::ChebyshevParamModeImpl(), casacore::ChebyshevParamModeImpl< T >::ChebyshevParamModeImpl(), casacore::ChebyshevParamModeImpl< T >::ChebyshevParamModeImpl(), casacore::ChebyshevParamModeImpl< T >::hasMode(), and operator=().

## ChebyshevParam() [2/8]

template<class T>

casacore::ChebyshevParam< T >::ChebyshevParam | ( | const uInt | n | ) |

explicit

create an n-th order Chebyshev polynomial with the coefficients equal to zero.

The bounded domain is [T(-1), T(1)]. The OutOfDomainMode is CONSTANT, and the default value is T(0).

## ChebyshevParam() [3/8]

template<class T>

casacore::ChebyshevParam< T >::ChebyshevParam | ( | const T & | min,
|  | const T & | max,
|  | ChebyshevEnums::OutOfIntervalMode | mode = ChebyshevEnums::CONSTANT,
|  | const T & | defval = T(0) )

create a zero-th order Chebyshev polynomical with the first coefficient equal to one.

min is the minimum value of its Chebyshev interval, and max is the maximum value.
mode sets the behavior of the function outside the Chebyshev interval (see setOutOfIntervalMode() and OutOfIntervalMode enumeration definition for details).
defval is the value returned when the function is evaluated outside the Chebyshev interval and mode=CONSTANT.

References casacore::ChebyshevEnums::CONSTANT, casacore::max(), and casacore::min().

## ChebyshevParam() [4/8]

template<class T>

casacore::ChebyshevParam< T >::ChebyshevParam | ( | const Vector< T > & | coeffs,
|  | const T & | min,
|  | const T & | max,
|  | ChebyshevEnums::OutOfIntervalMode | mode = ChebyshevEnums::CONSTANT,
|  | const T & | defval = T(0) )

create a fully specified Chebyshev polynomial.

coeffs holds the coefficients of the Chebyshev polynomial (see setCoefficients() for details). min is the minimum value of its canonical range, and max is the maximum value.
mode sets the behavior of the function outside the Chebyshev interval (see setOutOfIntervalMode() and OutOfIntervalMode enumeration definition for details).
defval is the value returned when the function is evaluated outside the canonical range and mode=CONSTANT.

References casacore::ChebyshevEnums::CONSTANT, casacore::max(), and casacore::min().

## ChebyshevParam() [5/8]

template<class T>

casacore::ChebyshevParam< T >::ChebyshevParam | ( | uInt | order,
|  | const RecordInterface & | mode )

create a fully specified Chebyshev polynomial.

config is a record that contains the non-coefficient data that configures this class. The fields recognized by this class are those documented for the setMode() function below.

References order(), and casacore::RecordInterface().

## ChebyshevParam() [6/8]

template<class T>

casacore::ChebyshevParam< T >::ChebyshevParam | ( | const Vector< T > & | coeffs,
|  | const RecordInterface & | mode )

References casacore::RecordInterface().

## ChebyshevParam() [7/8]

template<class T>

casacore::ChebyshevParam< T >::ChebyshevParam | ( | const ChebyshevParam< T > & | other | ) |

create a deep copy of another Chebyshev polynomial

References ChebyshevParam().

## ChebyshevParam() [8/8]

template<class T>
template<class W>

casacore::ChebyshevParam< T >::ChebyshevParam | ( | const ChebyshevParam< W > & | other | ) |

inline

Definition at line 222 of file ChebyshevParam.h.

References ChebyshevParam(), def_p, casacore::Function1D< T, U >::Function1D(), getDefault(), getIntervalMax(), getIntervalMin(), getOutOfIntervalMode(), maxx_p, minx_p, and mode_p.

## ~ChebyshevParam()

template<class T>

virtual casacore::ChebyshevParam< T >::~ChebyshevParam | ( |  | ) |

virtual

Destructor.

## Member Function Documentation

## chebyshevToPower()

template<class T>

void casacore::ChebyshevParam< T >::chebyshevToPower | ( | Vector< T > & | coeffs | ) |

static

convert a set of Chebyshev polynomial coefficients to power series coefficients.

The values passed in coeffs are taken to be chebyshev coefficients; these values will be replaced with the power series coefficients. They should be ordered beginning with the zero-th order coefficient.

## derivativeCoeffs()

template<class T>

void casacore::ChebyshevParam< T >::derivativeCoeffs | ( | Vector< T > & | coeffs,
|  | const T & | xmin = T(-1),
|  | const T & | xmax = T(1) )

static

transform a set of Chebyshev polynomial coefficients into a set representing the series' derivative.

coeffs should be assuming an interval of [-1, 1]. xmin and xmax can be provided to transform the series to another interval.

## getCoefficient()

template<class T>

T casacore::ChebyshevParam< T >::getCoefficient | ( | const uInt | which | ) | const

inline

return a particular coefficient.

which is the coefficient order (i.e. 0 refers to the constant offset). If which is out of range, zero is returned.

Definition at line 258 of file ChebyshevParam.h.

References casacore::Function< T, T >::nparameters(), and casacore::Function< T, T >::param_p.

## getCoefficients()

template<class T>

const Vector< T > & casacore::ChebyshevParam< T >::getCoefficients | ( |  | ) | const

return the current set of coefficients into a given Vector.

## getDefault()

template<class T>

const T & casacore::ChebyshevParam< T >::getDefault | ( |  | ) | const

inline

return the currently set default value.

See setDefault() for details on the use of this value.

Definition at line 302 of file ChebyshevParam.h.

References def_p.

Referenced by ChebyshevParam(), and casacore::ChebyshevParamModeImpl< T >::hasMode().

## getIntervalMax()

template<class T>

T casacore::ChebyshevParam< T >::getIntervalMax | ( |  | ) | const

inline

return the maximum value for the currently Chebyshev interval.

See setInterval() for additional details.

Definition at line 282 of file ChebyshevParam.h.

References maxx_p.

Referenced by ChebyshevParam(), and casacore::ChebyshevParamModeImpl< T >::hasMode().

## getIntervalMin()

template<class T>

T casacore::ChebyshevParam< T >::getIntervalMin | ( |  | ) | const

inline

return the minimum value for the currently Chebyshev interval.

See setInterval() for additional details.

Definition at line 278 of file ChebyshevParam.h.

References minx_p.

Referenced by ChebyshevParam(), and casacore::ChebyshevParamModeImpl< T >::hasMode().

## getOutOfIntervalMode()

template<class T>

ChebyshevEnums::OutOfIntervalMode casacore::ChebyshevParam< T >::getOutOfIntervalMode | ( |  | ) | const

inline

return the behavior of this function when it is evaluated outside of its Chebyshev interval.

Definition at line 291 of file ChebyshevParam.h.

References mode_p.

Referenced by ChebyshevParam(), and casacore::ChebyshevParamModeImpl< T >::hasMode().

## name()

template<class T>

virtual const String & casacore::ChebyshevParam< T >::name | ( |  | ) | const

inline virtual

Give name of function.

Reimplemented from casacore::Function< T, T >.

Definition at line 330 of file ChebyshevParam.h.

## nCoefficients()

template<class T>

uInt casacore::ChebyshevParam< T >::nCoefficients | ( |  | ) | const

inline

return the number of coeefficients currently loaded.

This does not guarantee that the coefficients are non-zero

Definition at line 263 of file ChebyshevParam.h.

References casacore::Function< T, T >::nparameters().

## operator=()

template<class T>

ChebyshevParam< T > & casacore::ChebyshevParam< T >::operator= | ( | const ChebyshevParam< T > & | other | ) |

make a (deep) copy of another Chebyshev polynomial

References ChebyshevParam().

Referenced by casacore::Chebyshev< T >::operator=().

## order()

template<class T>

uInt casacore::ChebyshevParam< T >::order | ( |  | ) | const

inline

return the order of this polynomial.

This returns the value of nCoefficients()-1;

Definition at line 306 of file ChebyshevParam.h.

References casacore::Function< T, T >::param_p.

Referenced by casacore::Chebyshev< T >::Chebyshev(), ChebyshevParam(), and casacore::ChebyshevParamModeImpl< T >::ChebyshevParamModeImpl().

## powerToChebyshev()

template<class T>

void casacore::ChebyshevParam< T >::powerToChebyshev | ( | Vector< T > & | coeffs | ) |

static

convert a set of power series coefficients to Chebyshev polynomial coefficients.

The values passed in coeffs are taken to be power series coefficients; these values will be replaced with the Chebyshev polynomial coefficients. They should be ordered beginning with the zero-th order coefficient.

## setCoefficient()

template<class T>

void casacore::ChebyshevParam< T >::setCoefficient | ( | const uInt | which,
|  | const T & | value )

set a particular Chebyshev coefficient.

which is the coefficient order (i.e. 0 refers to the constant offset). value is the coefficient value. If which is larger than current order of the function, the order will be increased to the value of which, and that coefficient is set to value; missing coefficients less than this value will be set to zero. Thus, the order can be increased with this function; however, it cannot be decreased (even if the highest order coefficient is set to zero). To lower the order, use setCoefficients() with a Vector having the desired number of coefficients.

References casacore::NewDelAllocator< T >::value.

## setCoefficients()

template<class T>

void casacore::ChebyshevParam< T >::setCoefficients | ( | const Vector< T > & | coeffs | ) |

set the Chebyshev coefficients.

coeffs holds the coefficients in order, beginning with the zero-th order term. The order of the polynomial, then, would be the size of the Vector minus one.

## setDefault()

template<class T>

void casacore::ChebyshevParam< T >::setDefault | ( | const T & | val | ) |

inline

set the default value of this function.

This value is used when the getOutOfIntervalMode() returns Chebyshev::CONSTANT; it is returned when the a value outside of the Chebyshev interval is passed to the () operator.

Definition at line 298 of file ChebyshevParam.h.

References def_p.

## setInterval()

template<class T>

void casacore::ChebyshevParam< T >::setInterval | ( | T | xmin,
|  | T | xmax )

inline

set the Chebyshev interval for this function.

The function will be scaled and shifted to such that the central bounded range of the Chebyshev polynomials ([-1, 1] in untransformed space) spans the given range.
min is the minimum value for the interval, and max is the maximum value. See setOutOfIntervalMode() for the behavior of this function outside the set range.

Definition at line 272 of file ChebyshevParam.h.

References maxx_p, and minx_p.

## setOutOfIntervalMode()

template<class T>

void casacore::ChebyshevParam< T >::setOutOfIntervalMode | ( | ChebyshevEnums::OutOfIntervalMode | mode | ) |

inline

set the behavior of this function when it is evaluated outside its Chebyshev interval

Definition at line 286 of file ChebyshevParam.h.

References mode_p.

Referenced by casacore::ChebyshevParamModeImpl< T >::hasMode().

## Member Data Documentation

## def_p

template<class T>

T casacore::ChebyshevParam< T >::def_p

protected

Default value if outside interval.

Definition at line 336 of file ChebyshevParam.h.

Referenced by ChebyshevParam(), getDefault(), and setDefault().

## maxx_p

template<class T>

T casacore::ChebyshevParam< T >::maxx_p

protected

Highest inetrval bound.

Definition at line 340 of file ChebyshevParam.h.

Referenced by ChebyshevParam(), getIntervalMax(), and setInterval().

## minx_p

template<class T>

T casacore::ChebyshevParam< T >::minx_p

protected

Lowest interval bound.

Definition at line 338 of file ChebyshevParam.h.

Referenced by ChebyshevParam(), getIntervalMin(), and setInterval().

## mode_p

template<class T>

ChebyshevEnums::OutOfIntervalMode casacore::ChebyshevParam< T >::mode_p

protected

Out-of-interval handling type.

Definition at line 342 of file ChebyshevParam.h.

Referenced by ChebyshevParam(), getOutOfIntervalMode(), and setOutOfIntervalMode().

## modes_s

template<class T>

Vector<String> casacore::ChebyshevParam< T >::modes_s

static protected

Definition at line 344 of file ChebyshevParam.h.

Referenced by casacore::ChebyshevParamModeImpl< T >::hasMode().

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

- scimath/Functionals/ChebyshevParam.h