CLHEP VERSION Reference Documentation
CLHEP Home Page CLHEP Documentation CLHEP Bug Reports |
00001 // -*- C++ -*- 00002 // $Id: 00003 // ------------------------------------------------------------------------------// 00004 // Lagrange's Interpolating Polynomial // 00005 // // 00006 // // 00007 // Joe Boudreau. // 00008 // // 00009 // ------------------------------------------------------------------------------// 00010 #ifndef _InterpolatingPolynomial_h_ 00011 #define _InterpolatingPolynomial_h_ 00012 #include "CLHEP/GenericFunctions/AbsFunction.hh" 00013 #include "CLHEP/GenericFunctions/Parameter.hh" 00014 #include <vector> 00015 namespace Genfun { 00016 00021 class InterpolatingPolynomial: public AbsFunction { 00022 00023 FUNCTION_OBJECT_DEF(InterpolatingPolynomial) 00024 00025 public: 00026 00027 // Constructor 00028 InterpolatingPolynomial(); 00029 00030 // Copy constructor 00031 InterpolatingPolynomial(const InterpolatingPolynomial &right); 00032 00033 // Destructor: 00034 virtual ~InterpolatingPolynomial(); 00035 00036 // Retreive function value 00037 virtual double operator ()(double argument) const; 00038 virtual double operator ()(const Argument & a) const {return operator() (a[0]);} 00039 00040 // Puncture this thing: 00041 void addPoint(double x, double y); 00042 00043 // Get the range: 00044 void getRange(double & min, double & max) const; 00045 00046 private: 00047 00048 // It is illegal to assign an adjustable constant 00049 const InterpolatingPolynomial & operator=(const InterpolatingPolynomial &right); 00050 00051 std::vector<std::pair<double,double> > xPoints; 00052 }; 00053 } // namespace Genfun 00054 #endif