Jpp 19.3.0-rc.3
the software that should make you happy
Loading...
Searching...
No Matches
JMATH::JLegendre< JOrdinate_t, N > Struct Template Reference

Template definition for function evaluation of Legendre polynome. More...

#include <JLegendre.hh>

Inheritance diagram for JMATH::JLegendre< JOrdinate_t, N >:
JFIT::JEstimator< JLegendre< JOrdinate_t, N > >

Public Member Functions

 JLegendre ()
 Default constructor.
 
 JLegendre (const double xmin, const double xmax)
 Constructor.
 
template<class T >
 JLegendre (T __begin, T __end)
 Constructor.
 
template<class T >
void set (T __begin, T __end)
 Set Legendre polynome.
 

Private Member Functions

void clear ()
 
void resize ()
 
void erase ()
 
void push_back ()
 
void pop_back ()
 

Friends

std::istream & operator>> (std::istream &in, JLegendre &object)
 Read Legendre polynome from input.
 

Detailed Description

template<class JOrdinate_t, size_t N>
struct JMATH::JLegendre< JOrdinate_t, N >

Template definition for function evaluation of Legendre polynome.

Template specialisation for function evaluation of of Legendre polynome for defined number of degrees.

Definition at line 267 of file JLegendre.hh.

Constructor & Destructor Documentation

◆ JLegendre() [1/3]

template<class JOrdinate_t , size_t N>
JMATH::JLegendre< JOrdinate_t, N >::JLegendre ( )
inline

Default constructor.

Definition at line 276 of file JLegendre.hh.

277 {
278 this->JLegendre<JOrdinate_t>::resize(N+1, getZero<JOrdinate_t>());
279 }

◆ JLegendre() [2/3]

template<class JOrdinate_t , size_t N>
JMATH::JLegendre< JOrdinate_t, N >::JLegendre ( const double xmin,
const double xmax )
inline

Constructor.

Parameters
xminminimal abscissa value
xmaxmaximal abscissa value

Definition at line 288 of file JLegendre.hh.

290 {
291 this->JLegendre<JOrdinate_t>::resize(N+1, getZero<JOrdinate_t>());
292 this->set(xmin, xmax);
293 }
void set(T __begin, T __end)
Set Legendre polynome.
Definition JLegendre.hh:327

◆ JLegendre() [3/3]

template<class JOrdinate_t , size_t N>
template<class T >
JMATH::JLegendre< JOrdinate_t, N >::JLegendre ( T __begin,
T __end )
inline

Constructor.

The template argument T refers to an iterator of a data structure which should have the following data members:

  • double first; //
  • JOrdinate_t second; // which conforms with std::pair.
Parameters
__beginbegin of data
__endend of data

Definition at line 308 of file JLegendre.hh.

309 {
310 this->JLegendre<JOrdinate_t>::resize(N+1, getZero<JOrdinate_t>());
311 this->set(__begin, __end);
312 }

Member Function Documentation

◆ set()

template<class JOrdinate_t , size_t N>
template<class T >
void JMATH::JLegendre< JOrdinate_t, N >::set ( T __begin,
T __end )
inline

Set Legendre polynome.

The template argument T refers to an iterator of a data structure which should have the following data members:

  • double first; //
  • JOrdinate_t second; // which conforms with std::pair.
Parameters
__beginbegin of data
__endend of data

Definition at line 327 of file JLegendre.hh.

328 {
329 this->reset();
330 this->JLegendre<JOrdinate_t>::set(__begin, __end);
331
332 for (size_t n = 0; n != N + 1; ++n) {
333
334 JOrdinate_t V = zero;
335 double W = 0.0;
336
337 for (T i = __begin; i != __end; ++i) {
338
339 const double x = i->first;
340 const JOrdinate_t& y = i->second;
341 const double z = this->getX(x);
342 const double w = legendre(n, z);
343
344 V += w * (y - (*this)(x));
345 W += w * (w);
346 }
347
348 (*this)[n] = V / W;
349 }
350 }
static const JZero zero
Function object to assign zero value.
Definition JZero.hh:105
double legendre(const size_t n, const double x)
Legendre polynome.
const int n
Definition JPolint.hh:791
void reset(T &value)
Reset value.

◆ clear()

template<class JOrdinate_t , size_t N>
void JMATH::JLegendre< JOrdinate_t, N >::clear ( )
private

◆ resize()

template<class JOrdinate_t , size_t N>
void JMATH::JLegendre< JOrdinate_t, N >::resize ( )
private

◆ erase()

template<class JOrdinate_t , size_t N>
void JMATH::JLegendre< JOrdinate_t, N >::erase ( )
private

◆ push_back()

template<class JOrdinate_t , size_t N>
void JMATH::JLegendre< JOrdinate_t, N >::push_back ( )
private

◆ pop_back()

template<class JOrdinate_t , size_t N>
void JMATH::JLegendre< JOrdinate_t, N >::pop_back ( )
private

Friends And Related Symbol Documentation

◆ operator>>

template<class JOrdinate_t , size_t N>
std::istream & operator>> ( std::istream & in,
JLegendre< JOrdinate_t, N > & object )
friend

Read Legendre polynome from input.

Parameters
ininput stream
objectLegendre polynome
Returns
input stream

Definition at line 360 of file JLegendre.hh.

361 {
362 for (typename JLegendre::iterator i = object.begin(); i != object.end(); ++i) {
363 in >> *i;
364 }
365
366 return in;
367 }

The documentation for this struct was generated from the following file: