#include <chebyshev.h>
Public Member Functions | |
CChebyshevApprox2D (void) | |
Plain vanilla constructor for a 2D approximation. | |
CChebyshevApprox2D (double upperlimit_x, double lowerlimit_x, double upperlimit_y, double lowerlimit_y, int ncoeff_x, int ncoeff_y, double(*func)(double, double, void *), void *pars) | |
CChebyshevApprox2D (double upperlimit_x, double lowerlimit_x, double upperlimit_y, double lowerlimit_y, int ncoeff_x, int ncoeff_y, const Array1D< double > &x_controlpts, const Array1D< double > &y_controlpts, const Array2D< double > &ftnvals) | |
~CChebyshevApprox2D (void) | |
Plain vanilla destructor for a 2D approximation. | |
CChebyshevApprox2D | Copy (const CChebyshevApprox2D &A) |
CChebyshevApprox2D | operator= (const CChebyshevApprox2D &A) |
int | Ncoeffs_x (void) const |
double | Upperlimit_x (void) const |
double | Lowerlimit_x (void) const |
int | Ncoeffs_y (void) const |
double | Upperlimit_y (void) const |
double | Lowerlimit_y (void) const |
double | Coeff (int i, int j) const |
Array2D< double > | CoeffMatrix (void) const |
void | SetParameters (double upperlimit_x, double lowerlimit_x, double upperlimit_y, double lowerlimit_y, int ncoeff_x, int ncoeff_y) |
Initializes some parameters of 2D approximation. | |
void | Setup (double upperlimit_x, double lowerlimit_x, double upperlimit_y, double lowerlimit_y, int ncoeff_x, int ncoeff_y, double(*func)(double, double, void *), void *pars) |
Routine to setup the 2d Chebyshev approximation. | |
void | SetupFit (double upperlimit_x, double lowerlimit_x, double upperlimit_y, double lowerlimit_y, int ncoeff_x, int ncoeff_y, const Array1D< double > &x_controlpts, const Array1D< double > &y_controlpts, const Array2D< double > &ftnvals) |
double | ColocPoint_x (int i) const |
Routine to return the x Colocations points of the 2d Chebyshev approximation. | |
double | ColocPoint_y (int i) const |
Routine to return the y Colocations points of the 2d Chebyshev approximation. | |
double | Val (double x, double y, int m_x, int m_y) const |
Routine to return the approximated value of the Chebyshev approximation using the first m_x coefficients in the x direction and the first m_y coefficients in the y direction. | |
double | Val (double x, double y) const |
double | operator() (double x, double y, int m_x, int m_y) const |
double | operator() (double x, double y) const |
Protected Attributes | |
int | nc_x |
int | nc_y |
double | uplim_x |
double | lolim_x |
double | uplim_y |
double | lolim_y |
Array2D< double > | c |
Friends | |
ostream & | operator<< (ostream &s, const CChebyshevApprox2D &A) |
istream & | operator>> (istream &s, CChebyshevApprox2D &A) |
Definition at line 84 of file chebyshev.h.
CChebyshevApprox2D::CChebyshevApprox2D | ( | void | ) |
CChebyshevApprox2D::CChebyshevApprox2D | ( | double | upperlimit_x, | |
double | lowerlimit_x, | |||
double | upperlimit_y, | |||
double | lowerlimit_y, | |||
int | ncoeff_x, | |||
int | ncoeff_y, | |||
double(*)(double, double, void *) | func, | |||
void * | pars | |||
) | [inline] |
Definition at line 94 of file chebyshev.h.
CChebyshevApprox2D::CChebyshevApprox2D | ( | double | upperlimit_x, | |
double | lowerlimit_x, | |||
double | upperlimit_y, | |||
double | lowerlimit_y, | |||
int | ncoeff_x, | |||
int | ncoeff_y, | |||
const Array1D< double > & | x_controlpts, | |||
const Array1D< double > & | y_controlpts, | |||
const Array2D< double > & | ftnvals | |||
) | [inline] |
Definition at line 104 of file chebyshev.h.
CChebyshevApprox2D::~CChebyshevApprox2D | ( | void | ) | [inline] |
double CChebyshevApprox2D::Coeff | ( | int | i, | |
int | j | |||
) | const [inline] |
Definition at line 130 of file chebyshev.h.
Array2D<double> CChebyshevApprox2D::CoeffMatrix | ( | void | ) | const [inline] |
Definition at line 131 of file chebyshev.h.
double CChebyshevApprox2D::ColocPoint_x | ( | int | i | ) | const |
Routine to return the x Colocations points of the 2d Chebyshev approximation.
i | index of the Colocation point you are after |
Definition at line 574 of file chebyshev.cc.
double CChebyshevApprox2D::ColocPoint_y | ( | int | i | ) | const |
Routine to return the y Colocations points of the 2d Chebyshev approximation.
i | index of the Colocation point you are after |
Definition at line 590 of file chebyshev.cc.
CChebyshevApprox2D CChebyshevApprox2D::Copy | ( | const CChebyshevApprox2D & | A | ) |
Definition at line 525 of file chebyshev.cc.
double CChebyshevApprox2D::Lowerlimit_x | ( | void | ) | const [inline] |
Definition at line 126 of file chebyshev.h.
double CChebyshevApprox2D::Lowerlimit_y | ( | void | ) | const [inline] |
Definition at line 129 of file chebyshev.h.
int CChebyshevApprox2D::Ncoeffs_x | ( | void | ) | const [inline] |
Definition at line 124 of file chebyshev.h.
int CChebyshevApprox2D::Ncoeffs_y | ( | void | ) | const [inline] |
Definition at line 127 of file chebyshev.h.
double CChebyshevApprox2D::operator() | ( | double | x, | |
double | y | |||
) | const [inline] |
Definition at line 158 of file chebyshev.h.
double CChebyshevApprox2D::operator() | ( | double | x, | |
double | y, | |||
int | m_x, | |||
int | m_y | |||
) | const [inline] |
Definition at line 156 of file chebyshev.h.
CChebyshevApprox2D CChebyshevApprox2D::operator= | ( | const CChebyshevApprox2D & | A | ) | [inline] |
Definition at line 121 of file chebyshev.h.
void CChebyshevApprox2D::SetParameters | ( | double | upperlimit_x, | |
double | lowerlimit_x, | |||
double | upperlimit_y, | |||
double | lowerlimit_y, | |||
int | ncoeff_x, | |||
int | ncoeff_y | |||
) |
Initializes some parameters of 2D approximation.
upperlimit_x | upper limit of the interval in the x direction | |
lowerlimit_x | lower limit of the interval in the x direction | |
upperlimit_y | upper limit of the interval in the y direction | |
lowerlimit_y | lower limit of the interval in the y direction | |
ncoeff_x | number of coefficients to use in the x direction | |
ncoeff_y | number of coefficients to use in the y direction |
Definition at line 549 of file chebyshev.cc.
void CChebyshevApprox2D::Setup | ( | double | upperlimit_x, | |
double | lowerlimit_x, | |||
double | upperlimit_y, | |||
double | lowerlimit_y, | |||
int | ncoeff_x, | |||
int | ncoeff_y, | |||
double(*)(double, double, void *) | func, | |||
void * | pars | |||
) |
Routine to setup the 2d Chebyshev approximation.
upperlimit_x | upper limit of approximation in x direction | |
lowerlimit_x | lower limit of approximation in x direction | |
upperlimit_y | upper limit of approximation in y direction | |
lowerlimit_y | lower limit of approximation in y direction | |
ncoeff_x | number of coefficients in x direction | |
ncoeff_y | number of coefficients in y direction | |
*func | pointer to function to be approximated |
c
using
the 2d generalization of the scheme used in the 1d approximation:
Definition at line 618 of file chebyshev.cc.
void CChebyshevApprox2D::SetupFit | ( | double | upperlimit_x, | |
double | lowerlimit_x, | |||
double | upperlimit_y, | |||
double | lowerlimit_y, | |||
int | ncoeff_x, | |||
int | ncoeff_y, | |||
const Array1D< double > & | x_controlpts, | |||
const Array1D< double > & | y_controlpts, | |||
const Array2D< double > & | ftnvals | |||
) |
Definition at line 698 of file chebyshev.cc.
double CChebyshevApprox2D::Upperlimit_x | ( | void | ) | const [inline] |
Definition at line 125 of file chebyshev.h.
double CChebyshevApprox2D::Upperlimit_y | ( | void | ) | const [inline] |
Definition at line 128 of file chebyshev.h.
double CChebyshevApprox2D::Val | ( | double | x, | |
double | y | |||
) | const [inline] |
Definition at line 154 of file chebyshev.h.
double CChebyshevApprox2D::Val | ( | double | x, | |
double | y, | |||
int | m_x, | |||
int | m_y | |||
) | const |
Routine to return the approximated value of the Chebyshev approximation using the first m_x coefficients in the x direction and the first m_y coefficients in the y direction.
x | x coordinate you want the approximation evaluated at | |
y | y coordinate you want the approximation evaluated at | |
m_x | number of coefficients to keep in the x direction | |
m_y | number of coefficients to keep in the y direction |
func(x,y)
in
the x direction as
where is the Chebyshev polynomial,
is the coefficient of the expansion as a function of
and
is the value of
rescaled by the upper and lower limits of the approximation:
The routine doesn't actually do the sum this way -- it actually uses the Clenshaw recurrance relation. See Numerical Recipes pp. 191-193 for more details.
How do we compute ? Well, basically the same way... we make a Chebyshev approximation of it:
Here the terms mean the same thing as above, but noting that the coefficient matrix
c
[k][l], which
we compute above in CChebyshevApprox2D::Setup.
Definition at line 843 of file chebyshev.cc.
ostream & CChebyshevApprox2D::operator<< | ( | ostream & | s, | |
const CChebyshevApprox2D & | A | |||
) | [friend] |
Definition at line 885 of file chebyshev.cc.
istream & CChebyshevApprox2D::operator>> | ( | istream & | s, | |
CChebyshevApprox2D & | A | |||
) | [friend] |
Definition at line 896 of file chebyshev.cc.
Array2D<double> CChebyshevApprox2D::c [protected] |
Definition at line 166 of file chebyshev.h.
double CChebyshevApprox2D::lolim_x [protected] |
Definition at line 164 of file chebyshev.h.
double CChebyshevApprox2D::lolim_y [protected] |
Definition at line 165 of file chebyshev.h.
int CChebyshevApprox2D::nc_x [protected] |
Definition at line 159 of file chebyshev.h.
int CChebyshevApprox2D::nc_y [protected] |
Definition at line 159 of file chebyshev.h.
double CChebyshevApprox2D::uplim_x [protected] |
Definition at line 164 of file chebyshev.h.
double CChebyshevApprox2D::uplim_y [protected] |
Definition at line 165 of file chebyshev.h.