Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
ChebyshevApprox.h
Go to the documentation of this file.
1// @(#)root/mathmore:$Id$
2// Authors: L. Moneta, A. Zsenei 08/2005
3
4 /**********************************************************************
5 * *
6 * Copyright (c) 2004 ROOT Foundation, CERN/PH-SFT *
7 * *
8 * This library is free software; you can redistribute it and/or *
9 * modify it under the terms of the GNU General Public License *
10 * as published by the Free Software Foundation; either version 2 *
11 * of the License, or (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
16 * General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU General Public License *
19 * along with this library (see file COPYING); if not, write *
20 * to the Free Software Foundation, Inc., 59 Temple Place, Suite *
21 * 330, Boston, MA 02111-1307 USA, or contact the author. *
22 * *
23 **********************************************************************/
24
25// Header file for class ChebyshevApprox
26//
27// Created by: moneta at Thu Dec 2 14:51:15 2004
28//
29// Last update: Thu Dec 2 14:51:15 2004
30//
31#ifndef ROOT_Math_ChebyshevApprox
32#define ROOT_Math_ChebyshevApprox
33
34
35
36/**
37 @defgroup FuncApprox Function Approximation (ChebyshevApprox)
38 Numerical algorithm from the \ref MathMore library and implemented using the
39 <A HREF="http://www.gnu.org/software/gsl/manual/html_node/">GSL</A> library
40
41 @ingroup NumAlgo
42 */
43
44
45#include "Math/IFunctionfwd.h"
46
48
49#include <utility>
50#include <cstddef>
51
52
53namespace ROOT {
54namespace Math {
55
56class GSLChebSeries;
57class GSLFunctionWrapper;
58
59//____________________________________________________________________________
60/**
61 Class describing a Chebyshev series which can be used to approximate a
62 function in a defined range [a,b] using Chebyshev polynomials.
63 It uses the algorithm from
64 <A HREF="http://www.gnu.org/software/gsl/manual/html_node/Chebyshev-Approximations.html">GSL</A>
65
66 This class does not support copying
67 @ingroup FuncApprox
68 */
69
70
72
73public:
74
75
76 /**
77 Construct a Chebyshev series approximation to a Function f in range [a,b];
78 constructor based on functions of type IGenFunction
79 */
80
81 ChebyshevApprox(const ROOT::Math::IGenFunction & f, double a, double b, size_t n);
82
83 /**
84 Construct a Chebyshev series approximation to a Function f in range [a,b];
85 constructor based on free functions with gsl_function type signature
86 */
87 ChebyshevApprox(GSLFuncPointer f, void *p, double a, double b, size_t n);
88
89 // destructor
90 virtual ~ChebyshevApprox();
91
92
93private:
94
95 /**
96 construct a Chebyshev series or order n
97 The series must be initialized from a function
98 */
99 ChebyshevApprox(size_t n);
100
101public:
102
103// usually copying is non trivial, so we delete this
108
109 /**
110 Evaluate the series at a given point x
111 */
112 double operator() ( double x) const;
113
114 /**
115 Evaluate the series at a given point x estimating both the series result and its absolute error.
116 The error estimate is made from the first neglected term in the series.
117 A pair containing result and error is returned
118 */
119 std::pair<double, double> EvalErr( double x) const;
120
121 /**
122 Evaluate the series at a given point, to (at most) the given order n
123 */
124 double operator() ( double x, size_t n) const;
125
126 /**
127 evaluate the series at a given point x to the given order n,
128 estimating both the series result and its absolute error.
129 The error estimate is made from the first neglected term in the series.
130 A pair containing result and error is returned
131 */
132 std::pair<double, double> EvalErr( double x, size_t n) const;
133
134 /**
135 Compute the derivative of the series and return a pointer to a new Chebyshev series with the
136 derivatives coefficients. The returned pointer must be managed by the user.
137 */
138 //TO DO: implement copying to return by value
140
141 /**
142 Compute the integral of the series and return a pointer to a new Chebyshev series with the
143 integral coefficients. The lower limit of the integration is the left range value a.
144 The returned pointer must be managed by the user
145 */
146 //TO DO: implement copying to return by value
148
149protected:
150
151 /**
152 Initialize series passing function and range
153 */
154 void Initialize( GSLFuncPointer f, void * params, double a, double b);
155
156private:
157
158 size_t fOrder;
159
161 GSLFunctionWrapper * fFunction; // pointer to function
162
163};
164
165} // namespace Math
166} // namespace ROOT
167
168#endif /* ROOT_Math_ChebyshevApprox */
#define b(i)
Definition RSha256.hxx:100
#define f(i)
Definition RSha256.hxx:104
#define a(i)
Definition RSha256.hxx:99
winID h TVirtualViewer3D TVirtualGLPainter p
Class describing a Chebyshev series which can be used to approximate a function in a defined range [a...
ChebyshevApprox * Integral()
Compute the integral of the series and return a pointer to a new Chebyshev series with the integral c...
std::pair< double, double > EvalErr(double x) const
Evaluate the series at a given point x estimating both the series result and its absolute error.
double operator()(double x) const
Evaluate the series at a given point x.
void Initialize(GSLFuncPointer f, void *params, double a, double b)
Initialize series passing function and range.
ChebyshevApprox & operator=(const ChebyshevApprox &)=delete
ChebyshevApprox * Deriv()
Compute the derivative of the series and return a pointer to a new Chebyshev series with the derivati...
ChebyshevApprox(ChebyshevApprox &&)=delete
ChebyshevApprox(const ChebyshevApprox &)=delete
GSLFunctionWrapper * fFunction
wrapper class for C struct gsl_cheb_series
Wrapper class to the gsl_function C structure.
Interface (abstract class) for generic functions objects of one-dimension Provides a method to evalua...
Definition IFunction.h:112
Double_t x[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16
Namespace for new Math classes and functions.
double(* GSLFuncPointer)(double, void *)
Function pointer corresponding to gsl_function signature.
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...