Jpp  master_rocky-40-g5f0272dcd
the software that should make you happy
Public Types | Public Member Functions | Protected Attributes | Private Member Functions | Friends | List of all members
JMATH::JLegendre< JQuaternion3D, N > Struct Template Reference

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

#include <JEigen3D.hh>

Inheritance diagram for JMATH::JLegendre< JQuaternion3D, N >:
JMATH::JLegendre< JQuaternion3D,(size_t) -1 > JMATH::JLegendre_t< JQuaternion3D > std::vector< JElement_t, JAllocator_t >

Public Types

typedef std::vector< JQuaternion3D >::const_iterator const_iterator
 
typedef std::vector< JQuaternion3D >::iterator iterator
 
typedef std::vector< JQuaternion3D >::const_reverse_iterator const_reverse_iterator
 
typedef std::vector< JQuaternion3D >::reverse_iterator reverse_iterator
 

Public Member Functions

 JLegendre ()
 Default constructor. More...
 
 JLegendre (const double xmin, const double xmax)
 Constructor. More...
 
template<class T >
 JLegendre (T __begin, T __end)
 Constructor. More...
 
template<class T >
void set (T __begin, T __end)
 Set Legendre polynome of quaternions. More...
 
template<class T >
void set (T __begin, T __not, T __end)
 Set Legendre polynome of quaternions. More...
 
virtual JQuaternion3D getValue (const double x) const override
 Function value. More...
 
JQuaternion3D operator() (const double x) const
 Function value. More...
 
double getXmin () const
 Get minimal abscissa value. More...
 
double getXmax () const
 Get maximal abscissa value. More...
 
double getX (const double x) const
 Get normalised abscissa value. More...
 
void reset ()
 Reset. More...
 
void set (const double xmin, const double xmax)
 Set abscissa values. More...
 

Protected Attributes

double xmin
 minimal abscissa More...
 
double xmax
 maximal abscissa More...
 

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. More...
 

Detailed Description

template<size_t N>
struct JMATH::JLegendre< JQuaternion3D, N >

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

Definition at line 257 of file JEigen3D.hh.

Member Typedef Documentation

◆ const_iterator

Definition at line 29 of file JLegendre.hh.

◆ iterator

Definition at line 30 of file JLegendre.hh.

◆ const_reverse_iterator

Definition at line 31 of file JLegendre.hh.

◆ reverse_iterator

Definition at line 32 of file JLegendre.hh.

Constructor & Destructor Documentation

◆ JLegendre() [1/3]

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

Default constructor.

Definition at line 266 of file JEigen3D.hh.

267  {
269  }

◆ JLegendre() [2/3]

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

Constructor.

Parameters
xminminimal abscissa value
xmaxmaximal abscissa value

Definition at line 278 of file JEigen3D.hh.

280  {
282  this->set(xmin, xmax);
283  }
void set(T __begin, T __end)
Set Legendre polynome of quaternions.
Definition: JEigen3D.hh:319
double xmin
minimal abscissa
Definition: JLegendre.hh:204
double xmax
maximal abscissa
Definition: JLegendre.hh:205

◆ JLegendre() [3/3]

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

Constructor.

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

  • double first; // abscissa
  • JQuaternion3D second; // ordinate

which conforms with std::pair.

Parameters
__beginbegin of data
__endend of data

Definition at line 299 of file JEigen3D.hh.

300  {
302  this->set(__begin, __end);
303  }

Member Function Documentation

◆ set() [1/3]

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

Set Legendre polynome of quaternions.

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

  • double first; // abscissa
  • JQuaternion3D second; // ordinate

which conforms with std::pair.

Parameters
__beginbegin of data
__endend of data

Definition at line 319 of file JEigen3D.hh.

320  {
321  this->set(__begin, __end, __end);
322  }

◆ set() [2/3]

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

Set Legendre polynome of quaternions.

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

  • double first; // abscissa
  • JQuaternion3D second; // ordinate

which conforms with std::pair.

Parameters
__beginbegin of data
__notnot in data
__endend of data

Definition at line 339 of file JEigen3D.hh.

340  {
341  // factor to be applied as power to eigen value obtained with JAverage when degree larger than zero.
342 
343  static const double factor = 1.0 / (PI * 45.0 / 180.0);
344 
345  for (size_t n = 0; n != N + 1; ++n) {
346  (*this)[n] = JQuaternion3D();
347  }
348 
349  this->xmin = std::numeric_limits<double>::max();
350  this->xmax = std::numeric_limits<double>::lowest();
351 
352  for (T i = __begin; i != __end; ++i) {
353  if (i != __not) {
354  if (i->first < this->xmin) { this->xmin = i->first; }
355  if (i->first > this->xmax) { this->xmax = i->first; }
356  }
357  }
358 
359  for (size_t n = 0; n != N + 1; ++n) {
360 
361  JAverage<JQuaternion3D> Q;
362 
363  for (T i = __begin; i != __end; ++i) {
364 
365  if (i != __not) {
366  const double x = i->first;
367  const JQuaternion3D& y = i->second;
368  const double z = this->getX(x);
369  const double w = legendre(n, z);
370  const JQuaternion3D q = this->getValue(x).getConjugate() * y;
371 
372  Q.put(q, w);
373  }
374  }
375 
376  (*this)[n] = Q;
377 
378  if (n != 0) {
379  (*this)[n].pow(factor);
380  }
381  }
382  }
Data structure for unit quaternion in three dimensions.
JQuaternion3D getConjugate() const
Get conjugate of this quaternion.
static const double PI
Mathematical constants.
double legendre(const size_t n, const double x)
Legendre polynome.
data_type w[N+1][M+1]
Definition: JPolint.hh:867
const int n
Definition: JPolint.hh:786
virtual JQuaternion3D getValue(const double x) const override
Function value.
Definition: JEigen3D.hh:239
double getX(const double x) const
Get normalised abscissa value.
Definition: JLegendre.hh:113

◆ clear()

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

◆ resize()

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

◆ erase()

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

◆ push_back()

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

◆ pop_back()

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

◆ getValue()

virtual JQuaternion3D JMATH::JLegendre< JQuaternion3D,(size_t) -1 >::getValue ( const double  x) const
inlineoverridevirtualinherited

Function value.

Parameters
xabscissa value
Returns
function value

Implements JMATH::JLegendre_t< JQuaternion3D >.

Definition at line 239 of file JEigen3D.hh.

240  {
241  const double z = this->getX(x);
242  JQuaternion3D y = zero;
243 
244  for (size_t n = 0; n != this->size(); ++n) {
245  y *= pow((*this)[n], legendre(n,z));
246  }
247 
248  return y.normalise();
249  }
static const JZero zero
Function object to assign zero value.
Definition: JZero.hh:105
T pow(const T &x, const double y)
Power .
Definition: JMath.hh:97

◆ operator()()

JQuaternion3D JMATH::JLegendre_t< JQuaternion3D >::operator() ( const double  x) const
inlineinherited

Function value.

Parameters
xabscissa value
Returns
function value

Definition at line 79 of file JLegendre.hh.

80  {
81  return this->getValue(x);
82  }
virtual JQuaternion3D getValue(const double x) const=0
Function value.

◆ getXmin()

double JMATH::JLegendre_t< JQuaternion3D >::getXmin ( ) const
inlineinherited

Get minimal abscissa value.

Returns
minimal abscissa value

Definition at line 90 of file JLegendre.hh.

91  {
92  return xmin;
93  }

◆ getXmax()

double JMATH::JLegendre_t< JQuaternion3D >::getXmax ( ) const
inlineinherited

Get maximal abscissa value.

Returns
maximal abscissa value

Definition at line 101 of file JLegendre.hh.

102  {
103  return xmax;
104  }

◆ getX()

double JMATH::JLegendre_t< JQuaternion3D >::getX ( const double  x) const
inlineinherited

Get normalised abscissa value.

Parameters
xabscissa value
Returns
normalised abscissa value

Definition at line 113 of file JLegendre.hh.

114  {
115  return 2.0 * (x - xmin) / (xmax - xmin) - 1.0;
116  }

◆ reset()

void JMATH::JLegendre_t< JQuaternion3D >::reset ( )
inlineinherited

Reset.

Definition at line 122 of file JLegendre.hh.

123  {
124  for (iterator i = this->begin(); i != this->end(); ++i) {
125  *i = zero;
126  }
127  }
std::vector< JQuaternion3D >::iterator iterator
Definition: JLegendre.hh:30

◆ set() [3/3]

void JMATH::JLegendre_t< JQuaternion3D >::set ( const double  xmin,
const double  xmax 
)
inlineinherited

Set abscissa values.

Parameters
xminminimal abscissa value
xmaxmaximal abscissa value

Definition at line 136 of file JLegendre.hh.

138  {
139  this->xmin = xmin;
140  this->xmax = xmax;
141  }

Friends And Related Function Documentation

◆ operator>>

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

Read Legendre polynome from input.

Parameters
ininput stream
objectLegendre polynome
Returns
input stream

Definition at line 392 of file JEigen3D.hh.

393  {
394  for (typename JLegendre::iterator i = object.begin(); i != object.end(); ++i) {
395  in >> *i;
396  }
397 
398  return in;
399  }

Member Data Documentation

◆ xmin

double JMATH::JLegendre_t< JQuaternion3D >::xmin
protectedinherited

minimal abscissa

Definition at line 204 of file JLegendre.hh.

◆ xmax

double JMATH::JLegendre_t< JQuaternion3D >::xmax
protectedinherited

maximal abscissa

Definition at line 205 of file JLegendre.hh.


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