20#ifndef ROOT_Math_ChebyshevPol
21#define ROOT_Math_ChebyshevPol
34 template<
int N>
double T(
double x) {
35 return (2.0 *
x * T<N-1>(
x)) -
T<
N-2>(
x);
38 template<>
double T<0> (
double );
39 template<>
double T<1> (
double x);
40 template<>
double T<2> (
double x);
41 template<>
double T<3> (
double x);
43 template<
int N>
double Eval(
double x,
const double *
c) {
47 template<>
double Eval<0> (
double ,
const double *
c);
48 template<>
double Eval<1> (
double x,
const double *
c);
49 template<>
double Eval<2> (
double x,
const double *
c);
50 template<>
double Eval<3> (
double x,
const double *
c);
64 return c0 +
c1*
x +
c2*(2.0*
x*
x - 1.0);
72 inline double Chebyshev5(
double x,
double c0,
double c1,
double c2,
double c3,
double c4,
double c5) {
75 inline double Chebyshev6(
double x,
double c0,
double c1,
double c2,
double c3,
double c4,
double c5,
double c6) {
78 inline double Chebyshev7(
double x,
double c0,
double c1,
double c2,
double c3,
double c4,
double c5,
double c6,
double c7) {
81 inline double Chebyshev8(
double x,
double c0,
double c1,
double c2,
double c3,
double c4,
double c5,
double c6,
double c7,
double c8) {
84 inline double Chebyshev9(
double x,
double c0,
double c1,
double c2,
double c3,
double c4,
double c5,
double c6,
double c7,
double c8,
double c9) {
87 inline double Chebyshev10(
double x,
double c0,
double c1,
double c2,
double c3,
double c4,
double c5,
double c6,
double c7,
double c8,
double c9,
double c10) {
88 return c10*Chebyshev::T<10>(
x) +
Chebyshev9(
x,c0,
c1,
c2,
c3,c4,c5,c6,c7,c8,c9);
116 for (i =
n; i >= 1; i--)
119 d1 = y2 * d1 - d2 +
c[i];
123 return x * d1 - d2 +
c[0];
ChebyshevPol(unsigned int n)
double operator()(const double *x, const double *coeff)
Namespace for new Math classes and functions.
double Eval< 3 >(double x, const double *c)
double Eval(double x, const double *c)
double Eval< 2 >(double x, const double *c)
double Eval< 0 >(double, const double *c)
double Eval< 1 >(double x, const double *c)
double Chebyshev10(double x, double c0, double c1, double c2, double c3, double c4, double c5, double c6, double c7, double c8, double c9, double c10)
double ChebyshevN(unsigned int n, double x, const double *c)
double Chebyshev0(double, double c0)
double Chebyshev2(double x, double c0, double c1, double c2)
double Chebyshev3(double x, double c0, double c1, double c2, double c3)
double Chebyshev4(double x, double c0, double c1, double c2, double c3, double c4)
double Chebyshev1(double x, double c0, double c1)
double Chebyshev6(double x, double c0, double c1, double c2, double c3, double c4, double c5, double c6)
double Chebyshev7(double x, double c0, double c1, double c2, double c3, double c4, double c5, double c6, double c7)
double Chebyshev5(double x, double c0, double c1, double c2, double c3, double c4, double c5)
double Chebyshev8(double x, double c0, double c1, double c2, double c3, double c4, double c5, double c6, double c7, double c8)
double Chebyshev9(double x, double c0, double c1, double c2, double c3, double c4, double c5, double c6, double c7, double c8, double c9)