1#ifndef __JMATH__JLEGENDRE__
2#define __JMATH__JLEGENDRE__
18namespace JPP {
using namespace JMATH; }
25 template<
class JOrdinate_t>
70 virtual JOrdinate_t
getValue(
const double x)
const = 0;
113 double getX(
const double x)
const
124 for (
iterator i = this->begin(); i != this->end(); ++i) {
155 void set(T __begin, T __end)
157 this->
xmin = std::numeric_limits<double>::max();
158 this->
xmax = std::numeric_limits<double>::lowest();
160 for (T i = __begin; i != __end; ++i) {
161 if (i->first < this->xmin) { this->
xmin = i->first; }
162 if (i->first > this->xmax) { this->
xmax = i->first; }
178 for (JOrdinate_t x; in >> x; ) {
212 template<
class JOrdinate_t,
size_t N = (size_t) -1>
219 template<
class JOrdinate_t>
239 this->set(xmin, xmax);
249 virtual JOrdinate_t
getValue(
const double x)
const override
251 const double z = this->getX(x);
252 JOrdinate_t y =
zero;
254 for (
size_t n = 0; n != this->size(); ++n) {
266 template<
class JOrdinate_t,
size_t N>
292 this->set(xmin, xmax);
311 this->set(__begin, __end);
327 void set(T __begin, T __end)
332 for (
size_t n = 0; n != N + 1; ++n) {
334 JOrdinate_t V =
zero;
337 for (T i = __begin; i != __end; ++i) {
339 const double x = i->first;
340 const JOrdinate_t& y = i->second;
341 const double z = this->getX(x);
344 V += w * (y - (*this)(x));
362 for (
typename JLegendre::iterator i =
object.begin(); i !=
object.end(); ++i) {
Auxiliary methods for mathematics.
Definition of zero value for any class.
Auxiliary classes and methods for mathematical operations.
static const JZero zero
Function object to assign zero value.
double legendre(const size_t n, const double x)
Legendre polynome.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
JLegendre(const double xmin, const double xmax)
Constructor.
virtual JOrdinate_t getValue(const double x) const override
Function value.
JLegendre()
Default constructor.
Base class for Legendre polynome.
double getXmin() const
Get minimal abscissa value.
JLegendre_t()
Default constructor.
std::vector< JOrdinate_t >::const_reverse_iterator const_reverse_iterator
std::vector< JOrdinate_t >::const_iterator const_iterator
std::vector< JOrdinate_t >::iterator iterator
friend std::ostream & operator<<(std::ostream &out, const JLegendre_t &object)
Write Legendre polynome to output.
virtual JOrdinate_t getValue(const double x) const =0
Function value.
friend std::istream & operator>>(std::istream &in, JLegendre_t &object)
Read Legendre polynome from input.
double xmin
minimal abscissa
virtual ~JLegendre_t()
Virtual destructor.
double xmax
maximal abscissa
void set(const double xmin, const double xmax)
Set abscissa values.
JOrdinate_t operator()(const double x) const
Function value.
std::vector< JOrdinate_t >::reverse_iterator reverse_iterator
JLegendre_t(const double xmin, const double xmax)
Constructor.
double getX(const double x) const
Get normalised abscissa value.
double getXmax() const
Get maximal abscissa value.
void set(T __begin, T __end)
Set abscissa values.
Template definition for function evaluation of Legendre polynome.
void set(T __begin, T __end)
Set Legendre polynome.
JLegendre()
Default constructor.
friend std::istream & operator>>(std::istream &in, JLegendre &object)
Read Legendre polynome from input.
JLegendre(T __begin, T __end)
Constructor.
JLegendre(const double xmin, const double xmax)
Constructor.