Jpp
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
JTOOLS::JGaussHermite Class Referenceabstract

Numerical integrator for W(x) = e^-(x^2). More...

#include <JQuadrature.hh>

Inheritance diagram for JTOOLS::JGaussHermite:
JTOOLS::JQuadrature JTOOLS::JCollection< JElement2D_t > std::vector< JElement_t, JAllocator_t > JTOOLS::JMappableCollection< JKey_t, JValue_t > JTOOLS::JAbstractCollection< JAbscissa_t > JMATH::JMath< JFirst_t, JSecond_t >

Public Types

typedef JElement2D_t ::abscissa_type abscissa_type
 
typedef JElement2D_t ::ordinate_type ordinate_type
 
typedef JElement2D_t value_type
 
typedef JDistance< typename JElement2D_t ::abscissa_typedistance_type
 
typedef JCollection< JElement2D_t, JDistance< typename JElement2D_t ::abscissa_type > > collection_type
 
typedef std::vector< value_typecontainer_type
 
typedef container_type::const_iterator const_iterator
 
typedef container_type::const_reverse_iterator const_reverse_iterator
 
typedef container_type::iterator iterator
 
typedef container_type::reverse_iterator reverse_iterator
 
typedef JCollectionElementTransformer< value_typetransformer_type
 
typedef std::pair< const_iterator, bool > pair_type
 
typedef JKey_t key_type
 
typedef JValue_t mapped_type
 

Public Member Functions

 JGaussHermite (const int n, const double eps=1.0e-12)
 Constructor. More...
 
virtual void clear ()
 Clear. More...
 
virtual ordinate_typeget (typename JClass< abscissa_type >::argument_type x)
 Get ordinate value. More...
 
virtual mapped_typeget (typename JClass< key_type >::argument_type key)=0
 Get mapped value. More...
 
virtual int getSize () const
 Get number of elements. More...
 
virtual abscissa_type getX (int index) const
 Get abscissa value. More...
 
virtual abscissa_type getXmin () const
 Get minimal abscissa value. More...
 
virtual abscissa_type getXmax () const
 Get maximal abscissa value. More...
 
const ordinate_typegetY (int index) const
 Get ordinate value. More...
 
ordinate_typegetY (int index)
 Get ordinate value. More...
 
void transform (const transformer_type &transformer)
 Transform collection. More...
 
void sort ()
 Sort elements. More...
 
const_iterator lower_bound (typename JClass< abscissa_type >::argument_type x) const
 Get first position of element i, where x >= i->getX(). More...
 
iterator lower_bound (typename JClass< abscissa_type >::argument_type x)
 Get first position of element i, where x >= i->getX(). More...
 
pair_type insert (const value_type &element)
 Insert element. More...
 
void configure (const JAbstractCollection< abscissa_type > &bounds)
 Configure collection. More...
 
void configure (const JAbstractCollection< abscissa_type > &bounds, typename JClass< ordinate_type >::argument_type value)
 Configure collection. More...
 
void configure (const JAbstractCollection< abscissa_type > &bounds, const JFunction1D_t &function)
 Configure collection. More...
 
bool is_compatible (const JCollection &collection) const
 Test whether collections are compatible. More...
 
JCollectionnegate ()
 Negate collection. More...
 
JCollectionadd (const JCollection &collection)
 Add collection. More...
 
JCollectionadd (typename JClass< ordinate_type >::argument_type value)
 Add offset. More...
 
JCollectionadd (const JFunction1D_t &function)
 Add function. More...
 
JCollectionsub (const JCollection &collection)
 Subtract collection. More...
 
JCollectionsub (typename JClass< ordinate_type >::argument_type value)
 Subtract offset. More...
 
JCollectionsub (const JFunction1D_t &function)
 Subtract function. More...
 
JCollectionmul (const double value)
 Scale contents. More...
 
JFirst_t & mul (const JSecond_t &object)
 Multiply with object. More...
 
JCollectiondiv (const double value)
 Scale contents. More...
 
const JComparatorgetComparator () const
 Get comparator. More...
 
mapped_typeoperator[] (typename JClass< key_type >::argument_type key)
 Get mapped value. More...
 
void put (typename JClass< key_type > ::argument_type key, typename JClass< mapped_type >::argument_type value)
 Put pair-wise element (key,value) into collection. More...
 
bool is_equal (const JAbstractCollection &collection) const
 Test whether abstract collections are equal. More...
 

Public Attributes

JDistance< typename JElement2D_t ::abscissa_typegetDistance
 Function object for distance evaluation. More...
 

Protected Member Functions

void resize (typename container_type::size_type size)
 Resize collection. More...
 

Protected Attributes

JComparator compare
 Function object for comparison. More...
 

Private Member Functions

void erase ()
 
void push_back ()
 
void pop_back ()
 

Detailed Description

Numerical integrator for W(x) = e^-(x^2).

Gauss-Hermite integration code is taken from reference: Numerical Recipes in C++, W.H. Press, S.A. Teukolsky, W.T. Vetterling and B.P. Flannery, Cambridge University Press.

Definition at line 253 of file JQuadrature.hh.

Member Typedef Documentation

◆ abscissa_type

Definition at line 80 of file JCollection.hh.

◆ ordinate_type

Definition at line 81 of file JCollection.hh.

◆ value_type

Definition at line 82 of file JCollection.hh.

◆ distance_type

Definition at line 83 of file JCollection.hh.

◆ collection_type

Definition at line 85 of file JCollection.hh.

◆ container_type

Definition at line 87 of file JCollection.hh.

◆ const_iterator

typedef container_type::const_iterator JTOOLS::JCollection< JElement2D_t , JDistance<typename JElement2D_t ::abscissa_type> >::const_iterator
inherited

Definition at line 89 of file JCollection.hh.

◆ const_reverse_iterator

typedef container_type::const_reverse_iterator JTOOLS::JCollection< JElement2D_t , JDistance<typename JElement2D_t ::abscissa_type> >::const_reverse_iterator
inherited

Definition at line 90 of file JCollection.hh.

◆ iterator

typedef container_type::iterator JTOOLS::JCollection< JElement2D_t , JDistance<typename JElement2D_t ::abscissa_type> >::iterator
inherited

Definition at line 91 of file JCollection.hh.

◆ reverse_iterator

typedef container_type::reverse_iterator JTOOLS::JCollection< JElement2D_t , JDistance<typename JElement2D_t ::abscissa_type> >::reverse_iterator
inherited

Definition at line 92 of file JCollection.hh.

◆ transformer_type

Definition at line 94 of file JCollection.hh.

◆ pair_type

Definition at line 95 of file JCollection.hh.

◆ key_type

template<class JKey_t, class JValue_t>
typedef JKey_t JTOOLS::JMappableCollection< JKey_t, JValue_t >::key_type
inherited

Definition at line 33 of file JMappableCollection.hh.

◆ mapped_type

template<class JKey_t, class JValue_t>
typedef JValue_t JTOOLS::JMappableCollection< JKey_t, JValue_t >::mapped_type
inherited

Definition at line 34 of file JMappableCollection.hh.

Constructor & Destructor Documentation

◆ JGaussHermite()

JTOOLS::JGaussHermite::JGaussHermite ( const int  n,
const double  eps = 1.0e-12 
)
inline

Constructor.

Parameters
nnumber of points
epsprecision

Definition at line 263 of file JQuadrature.hh.

264  :
265  JQuadrature()
266  {
267  resize(n);
268 
269  const double pii = 1.0 / pow(PI,0.25);
270 
271  const int number_of_iterations = 100;
272 
273  const int M = (n + 1) / 2;
274 
275  double p0, p1, p2, pp;
276  double z = 0.0;
277  double z1;
278 
279  for (int i = 0; i < M; ++i) {
280 
281  switch (i) {
282 
283  case 0:
284  z = sqrt((double) (2*n+1)) - 1.85575 * pow((double) (2*n+1),-0.16667);
285  break;
286 
287  case 1:
288  z -= 1.14 * pow((double) n,0.426) / z;
289  break;
290 
291  case 2:
292  z = 1.86*z + 0.86*at( 0 ).getX();
293  break;
294 
295  case 3:
296  z = 1.91*z + 0.91*at( 1 ).getX();
297  break;
298 
299  default:
300  z = 2.00*z + 1.00*at(i-2).getX();
301  break;
302  }
303 
304  for (int k = 0; k != number_of_iterations; ++k) {
305 
306  p1 = 0.0;
307  p2 = pii;
308 
309  // recurrence relation
310 
311  for (int j = 0; j < n; ++j) {
312  p0 = p1;
313  p1 = p2;
314  p2 = z * sqrt(2.0/(double) (j+1)) * p1 - sqrt((double) j / (double) (j+1)) * p0;
315  }
316 
317  pp = sqrt((double) (2*n)) * p1;
318 
319  z1 = z;
320  z = z1 - p2/pp;
321 
322  if (fabs(z-z1) < eps)
323  break;
324  }
325 
326  const double y = 2.0 / (pp*pp);
327 
328  at( i ) = JElement2D_t(-z,y);
329  at(n-i-1) = JElement2D_t(+z,y);
330  }
331  }

Member Function Documentation

◆ clear()

virtual void JTOOLS::JCollection< JElement2D_t , JDistance<typename JElement2D_t ::abscissa_type> >::clear ( )
inlinevirtualinherited

Clear.

Implements JTOOLS::JMappableCollection< JKey_t, JValue_t >.

Definition at line 148 of file JCollection.hh.

149  {
150  container_type::clear();
151  }

◆ get() [1/2]

virtual ordinate_type& JTOOLS::JCollection< JElement2D_t , JDistance<typename JElement2D_t ::abscissa_type> >::get ( typename JClass< abscissa_type >::argument_type  x)
inlinevirtualinherited

Get ordinate value.

Parameters
xabscissa value
Returns
ordinate value

Definition at line 160 of file JCollection.hh.

161  {
162  iterator i = this->lower_bound(x);
163 
164  if (i == this->end() || this->getDistance(x, i->getX()) > distance_type::precision) {
165  i = container_type::insert(i, value_type(x, ordinate_type()));
166  }
167 
168  return i->getY();
169  }

◆ get() [2/2]

template<class JKey_t, class JValue_t>
virtual mapped_type& JTOOLS::JMappableCollection< JKey_t, JValue_t >::get ( typename JClass< key_type >::argument_type  key)
pure virtualinherited

◆ getSize()

virtual int JTOOLS::JCollection< JElement2D_t , JDistance<typename JElement2D_t ::abscissa_type> >::getSize ( ) const
inlinevirtualinherited

Get number of elements.

Returns
number of elements

Implements JTOOLS::JAbstractCollection< JAbscissa_t >.

Definition at line 177 of file JCollection.hh.

178  {
179  return (int) this->size();
180  }

◆ getX()

virtual abscissa_type JTOOLS::JCollection< JElement2D_t , JDistance<typename JElement2D_t ::abscissa_type> >::getX ( int  index) const
inlinevirtualinherited

Get abscissa value.

Parameters
indexindex
Returns
abscissa value

Implements JTOOLS::JAbstractCollection< JAbscissa_t >.

Definition at line 189 of file JCollection.hh.

190  {
191  return this->at(index).getX();
192  }

◆ getXmin()

virtual abscissa_type JTOOLS::JCollection< JElement2D_t , JDistance<typename JElement2D_t ::abscissa_type> >::getXmin ( ) const
inlinevirtualinherited

Get minimal abscissa value.

Returns
abscissa value

Implements JTOOLS::JAbstractCollection< JAbscissa_t >.

Definition at line 200 of file JCollection.hh.

201  {
202  return this->begin()->getX();
203  }

◆ getXmax()

virtual abscissa_type JTOOLS::JCollection< JElement2D_t , JDistance<typename JElement2D_t ::abscissa_type> >::getXmax ( ) const
inlinevirtualinherited

Get maximal abscissa value.

Returns
abscissa value

Implements JTOOLS::JAbstractCollection< JAbscissa_t >.

Definition at line 211 of file JCollection.hh.

212  {
213  return this->rbegin()->getX();
214  }

◆ getY() [1/2]

const ordinate_type& JTOOLS::JCollection< JElement2D_t , JDistance<typename JElement2D_t ::abscissa_type> >::getY ( int  index) const
inlineinherited

Get ordinate value.

Parameters
indexindex
Returns
ordinate value

Definition at line 224 of file JCollection.hh.

225  {
226  return this->at(index).getY();
227  }

◆ getY() [2/2]

ordinate_type& JTOOLS::JCollection< JElement2D_t , JDistance<typename JElement2D_t ::abscissa_type> >::getY ( int  index)
inlineinherited

Get ordinate value.

Parameters
indexindex
Returns
ordinate value

Definition at line 236 of file JCollection.hh.

237  {
238  return this->at(index).getY();
239  }

◆ transform()

void JTOOLS::JCollection< JElement2D_t , JDistance<typename JElement2D_t ::abscissa_type> >::transform ( const transformer_type transformer)
inlineinherited

Transform collection.

Parameters
transformerelement transformer

Definition at line 247 of file JCollection.hh.

248  {
249  collection_type buffer;
250 
251  this->swap(buffer);
252 
253  for (const_iterator i = buffer.begin(); i != buffer.end(); ++i) {
254  this->insert(transformer(*i));
255  }
256  }

◆ sort()

void JTOOLS::JCollection< JElement2D_t , JDistance<typename JElement2D_t ::abscissa_type> >::sort ( )
inlineinherited

Sort elements.

Definition at line 262 of file JCollection.hh.

263  {
264  std::sort(this->begin(), this->end(), compare);
265  }

◆ lower_bound() [1/2]

const_iterator JTOOLS::JCollection< JElement2D_t , JDistance<typename JElement2D_t ::abscissa_type> >::lower_bound ( typename JClass< abscissa_type >::argument_type  x) const
inlineinherited

Get first position of element i, where x >= i->getX().

Parameters
xabscissa value
Returns
position of corresponding element

Definition at line 274 of file JCollection.hh.

275  {
276  return std::lower_bound(this->begin(), this->end(), x, compare);
277  }

◆ lower_bound() [2/2]

iterator JTOOLS::JCollection< JElement2D_t , JDistance<typename JElement2D_t ::abscissa_type> >::lower_bound ( typename JClass< abscissa_type >::argument_type  x)
inlineinherited

Get first position of element i, where x >= i->getX().

Parameters
xabscissa value
Returns
position of corresponding element

Definition at line 286 of file JCollection.hh.

287  {
288  return std::lower_bound(this->begin(), this->end(), x, compare);
289  }

◆ insert()

pair_type JTOOLS::JCollection< JElement2D_t , JDistance<typename JElement2D_t ::abscissa_type> >::insert ( const value_type element)
inlineinherited

Insert element.

Parameters
elementelement
Returns
(iterator, status), where status is true if inserted; else false

Definition at line 298 of file JCollection.hh.

299  {
300  iterator i = this->lower_bound(element.getX());
301 
302  if (i == this->end() || this->getDistance(element.getX(), i->getX()) > 0.0)
303  return pair_type(container_type::insert(i, element), true);
304  else
305  return pair_type(this->end(), false);
306  }

◆ configure() [1/3]

void JTOOLS::JCollection< JElement2D_t , JDistance<typename JElement2D_t ::abscissa_type> >::configure ( const JAbstractCollection< abscissa_type > &  bounds)
inlineinherited

Configure collection.

Parameters
boundsabscissa values

Definition at line 314 of file JCollection.hh.

315  {
316  configure(bounds, JMATH::getZero<ordinate_type>());
317  }

◆ configure() [2/3]

void JTOOLS::JCollection< JElement2D_t , JDistance<typename JElement2D_t ::abscissa_type> >::configure ( const JAbstractCollection< abscissa_type > &  bounds,
typename JClass< ordinate_type >::argument_type  value 
)
inlineinherited

Configure collection.

Parameters
boundsabscissa values
valueordinate value

Definition at line 326 of file JCollection.hh.

328  {
329  this->resize(bounds.getSize());
330 
331  for (iterator i = this->begin(); i != this->end(); ++i) {
332 
333  const abscissa_type x = bounds.getX(std::distance(this->begin(),i));
334 
335  *i = value_type(x,value);
336  }
337  }

◆ configure() [3/3]

void JTOOLS::JCollection< JElement2D_t , JDistance<typename JElement2D_t ::abscissa_type> >::configure ( const JAbstractCollection< abscissa_type > &  bounds,
const JFunction1D_t &  function 
)
inlineinherited

Configure collection.

Parameters
boundsabscissa values
functionfunction

Definition at line 347 of file JCollection.hh.

349  {
350  using namespace JLANG;
351 
352  collection_type* out = (is_identical(*this, function) ? new collection_type() : this);
353 
354  for (int i = 0; i != bounds.getSize(); ++i) {
355 
356  const abscissa_type x = bounds.getX(i);
357 
358  out->put(x, function(x));
359  }
360 
361  if (is_identical(*this, function)) {
362 
363  this->swap(*out);
364 
365  delete out;
366  }
367  }

◆ is_compatible()

bool JTOOLS::JCollection< JElement2D_t , JDistance<typename JElement2D_t ::abscissa_type> >::is_compatible ( const JCollection< JElement2D_t > &  collection) const
inlineinherited

Test whether collections are compatible.

Parameters
collectioncollection
Returns
true if collections are compatible; else false

Definition at line 376 of file JCollection.hh.

377  {
378  if (this->empty() || collection.empty()) {
379 
380  return true;
381 
382  } else {
383 
384  const double precision = JDistance<abscissa_type>::precision;
385 
386  const_iterator p = this->begin();
387  const_iterator q = collection.begin();
388 
389  if (getDistance(p->getX(), q->getX()) > precision) {
390 
391  do {
392  ++p;
393  } while (p != this->end() && getDistance(p->getX(), q->getX()) > precision);
394 
395  } else if (getDistance(q->getX(), p->getX()) > precision) {
396 
397  do {
398  ++q;
399  } while (q != collection.end() && getDistance(q->getX(), p->getX()) > precision);
400  }
401 
402  for ( ; p != this->end() && q != collection.end(); ++p, ++q) {
403  if (fabs(getDistance(p->getX(), q->getX())) > precision) {
404  return false;
405  }
406  }
407 
408  return true;
409  }
410  }

◆ negate()

JCollection& JTOOLS::JCollection< JElement2D_t , JDistance<typename JElement2D_t ::abscissa_type> >::negate ( )
inlineinherited

Negate collection.

Returns
this collection

Definition at line 418 of file JCollection.hh.

419  {
420  for (iterator i = this->begin(); i != this->end(); ++i) {
421  i->getY() = -i->getY();
422  }
423 
424  return *this;
425  }

◆ add() [1/3]

JCollection& JTOOLS::JCollection< JElement2D_t , JDistance<typename JElement2D_t ::abscissa_type> >::add ( const JCollection< JElement2D_t > &  collection)
inlineinherited

Add collection.

Parameters
collectioncollection
Returns
this collection

Definition at line 434 of file JCollection.hh.

435  {
436  if (!collection.empty()) {
437 
438  if (this->empty()) {
439 
440  for (const_iterator i = collection.begin(); i != collection.end(); ++i) {
441  this->put(i->getX(), +i->getY());
442  }
443 
444  } else if (this->is_compatible(collection)) {
445 
446  const double precision = JDistance<abscissa_type>::precision;
447 
448  iterator p = this->begin();
449  const_iterator q = collection.begin();
450 
451  if (getDistance(p->getX(), q->getX()) > precision) {
452 
453  do {
454  ++p;
455  } while (p != this->end() && getDistance(p->getX(), q->getX()) > precision);
456 
457  } else if (getDistance(q->getX(), p->getX()) > precision) {
458 
459  do {
460  ++q;
461  } while (q != collection.end() && getDistance(q->getX(), p->getX()) > precision);
462  }
463 
464  const_iterator i = q;
465 
466  for ( ; p != this->end() && i != collection.end(); ++p, ++i) {
467  p->getY() += i->getY();
468  }
469 
470  for ( ; i != collection.end(); ++i) {
471  this->put(i->getX(), +i->getY());
472  }
473 
474  for (i = collection.begin(); i != q; ++i) {
475  this->put(i->getX(), +i->getY());
476  }
477  }
478  }
479 
480  return *this;
481  }

◆ add() [2/3]

JCollection& JTOOLS::JCollection< JElement2D_t , JDistance<typename JElement2D_t ::abscissa_type> >::add ( typename JClass< ordinate_type >::argument_type  value)
inlineinherited

Add offset.

Parameters
valueoffset
Returns
this collection

Definition at line 582 of file JCollection.hh.

583  {
584  for (iterator i = this->begin(); i != this->end(); ++i) {
585  i->getY() += value;
586  }
587 
588  return *this;
589  }

◆ add() [3/3]

JCollection& JTOOLS::JCollection< JElement2D_t , JDistance<typename JElement2D_t ::abscissa_type> >::add ( const JFunction1D_t &  function)
inlineinherited

Add function.

Parameters
functionfunction
Returns
this collection

Definition at line 615 of file JCollection.hh.

616  {
617  for (iterator i = this->begin(); i != this->end(); ++i) {
618  i->getY() += function(i->getX());
619  }
620 
621  return *this;
622  }

◆ sub() [1/3]

JCollection& JTOOLS::JCollection< JElement2D_t , JDistance<typename JElement2D_t ::abscissa_type> >::sub ( const JCollection< JElement2D_t > &  collection)
inlineinherited

Subtract collection.

Parameters
collectioncollection
Returns
this collection

Definition at line 490 of file JCollection.hh.

491  {
492  if (!collection.empty()) {
493 
494  if (this->empty()) {
495 
496  for (const_iterator i = collection.begin(); i != collection.end(); ++i) {
497  this->put(i->getX(), -i->getY());
498  }
499 
500  } else if (this->is_compatible(collection)) {
501 
502  const double precision = JDistance<abscissa_type>::precision;
503 
504  iterator p = this->begin();
505  const_iterator q = collection.begin();
506 
507  if (getDistance(p->getX(), q->getX()) > precision) {
508 
509  do {
510  ++p;
511  } while (p != this->end() && getDistance(p->getX(), q->getX()) > precision);
512 
513  } else if (getDistance(q->getX(), p->getX()) > precision) {
514 
515  do {
516  ++q;
517  } while (q != collection.end() && getDistance(q->getX(), p->getX()) > precision);
518  }
519 
520  const_iterator i = q;
521 
522  for ( ; p != this->end() && i != collection.end(); ++p, ++i) {
523  p->getY() -= i->getY();
524  }
525 
526  for ( ; i != collection.end(); ++i) {
527  this->put(i->getX(), -i->getY());
528  }
529 
530  for (i = collection.begin(); i != q; ++i) {
531  this->put(i->getX(), -i->getY());
532  }
533 
534  } else {
535 
536  throw JException("JCollection::add() collections incompatible.");
537  }
538  }
539 
540  return *this;
541  }

◆ sub() [2/3]

JCollection& JTOOLS::JCollection< JElement2D_t , JDistance<typename JElement2D_t ::abscissa_type> >::sub ( typename JClass< ordinate_type >::argument_type  value)
inlineinherited

Subtract offset.

Parameters
valueoffset
Returns
this collection

Definition at line 598 of file JCollection.hh.

599  {
600  for (iterator i = this->begin(); i != this->end(); ++i) {
601  i->getY() -= value;
602  }
603 
604  return *this;
605  }

◆ sub() [3/3]

JCollection& JTOOLS::JCollection< JElement2D_t , JDistance<typename JElement2D_t ::abscissa_type> >::sub ( const JFunction1D_t &  function)
inlineinherited

Subtract function.

Parameters
functionfunction
Returns
this collection

Definition at line 632 of file JCollection.hh.

633  {
634  for (iterator i = this->begin(); i != this->end(); ++i) {
635  i->getY() -= function(i->getX());
636  }
637 
638  return *this;
639  }

◆ mul() [1/2]

JCollection& JTOOLS::JCollection< JElement2D_t , JDistance<typename JElement2D_t ::abscissa_type> >::mul ( const double  value)
inlineinherited

Scale contents.

Parameters
valuemultiplication factor
Returns
this collection

Definition at line 550 of file JCollection.hh.

551  {
552  for (iterator i = this->begin(); i != this->end(); ++i) {
553  i->getY() *= value;
554  }
555 
556  return *this;
557  }

◆ mul() [2/2]

template<class JFirst_t, class JSecond_t>
JFirst_t& JMATH::JMath< JFirst_t, JSecond_t >::mul ( const JSecond_t &  object)
inlineinherited

Multiply with object.

Parameters
objectobject
Returns
result object

Definition at line 273 of file JMath.hh.

274  {
275  return static_cast<JFirst_t&>(*this) = JCalculator<JFirst_t>::calculator.mul(static_cast<const JFirst_t&>(*this), object);
276  }

◆ div()

JCollection& JTOOLS::JCollection< JElement2D_t , JDistance<typename JElement2D_t ::abscissa_type> >::div ( const double  value)
inlineinherited

Scale contents.

Parameters
valuedivision factor
Returns
this collection

Definition at line 566 of file JCollection.hh.

567  {
568  for (iterator i = this->begin(); i != this->end(); ++i) {
569  i->getY() /= value;
570  }
571 
572  return *this;
573  }

◆ getComparator()

const JComparator& JTOOLS::JCollection< JElement2D_t , JDistance<typename JElement2D_t ::abscissa_type> >::getComparator ( ) const
inlineinherited

Get comparator.

Returns
comparator

Definition at line 745 of file JCollection.hh.

746  {
747  return compare;
748  }

◆ resize()

void JTOOLS::JCollection< JElement2D_t , JDistance<typename JElement2D_t ::abscissa_type> >::resize ( typename container_type::size_type  size)
inlineprotectedinherited

Resize collection.

Parameters
sizesize

Definition at line 769 of file JCollection.hh.

770  {
771  container_type::resize(size);
772  }

◆ erase()

void JTOOLS::JCollection< JElement2D_t , JDistance<typename JElement2D_t ::abscissa_type> >::erase ( )
privateinherited

◆ push_back()

void JTOOLS::JCollection< JElement2D_t , JDistance<typename JElement2D_t ::abscissa_type> >::push_back ( )
privateinherited

◆ pop_back()

void JTOOLS::JCollection< JElement2D_t , JDistance<typename JElement2D_t ::abscissa_type> >::pop_back ( )
privateinherited

◆ operator[]()

template<class JKey_t, class JValue_t>
mapped_type& JTOOLS::JMappableCollection< JKey_t, JValue_t >::operator[] ( typename JClass< key_type >::argument_type  key)
inlineinherited

Get mapped value.

Parameters
keykey
Returns
value

Definition at line 64 of file JMappableCollection.hh.

65  {
66  return get(key);
67  }

◆ put()

template<class JKey_t, class JValue_t>
void JTOOLS::JMappableCollection< JKey_t, JValue_t >::put ( typename JClass< key_type > ::argument_type  key,
typename JClass< mapped_type >::argument_type  value 
)
inlineinherited

Put pair-wise element (key,value) into collection.

Parameters
keykey
valuevalue

Definition at line 76 of file JMappableCollection.hh.

78  {
79  get(key) = value;
80  }

◆ is_equal()

template<class JAbscissa_t>
bool JTOOLS::JAbstractCollection< JAbscissa_t >::is_equal ( const JAbstractCollection< JAbscissa_t > &  collection) const
inlineinherited

Test whether abstract collections are equal.

Parameters
collectionabstract collection
Returns
true if collections are equals; else false

Definition at line 69 of file JAbstractCollection.hh.

70  {
71  if (this->getSize() == collection.getSize()) {
72 
73  for (int i = 0; i != this->getSize(); ++i) {
74 
75  if (this->getX(i) != collection.getX(i)) {
76  return false;
77  }
78  }
79 
80  return true;
81  }
82 
83  return false;
84  }

Member Data Documentation

◆ getDistance

Function object for distance evaluation.

Definition at line 754 of file JCollection.hh.

◆ compare

JComparator JTOOLS::JCollection< JElement2D_t , JDistance<typename JElement2D_t ::abscissa_type> >::compare
protectedinherited

Function object for comparison.

Definition at line 761 of file JCollection.hh.


The documentation for this class was generated from the following file:
JTOOLS::JCollection< JElement2D_t >::compare
JComparator compare
Function object for comparison.
Definition: JCollection.hh:761
JTOOLS::JCollection< JElement2D_t >::value_type
JElement2D_t value_type
Definition: JCollection.hh:82
JTOOLS::JElement2D_t
JElement2D< double, double > JElement2D_t
Type definition of basic element for quadratures.
Definition: JQuadrature.hh:27
JTOOLS::n
const int n
Definition: JPolint.hh:628
JTOOLS::JCollection< JElement2D_t >::iterator
container_type::iterator iterator
Definition: JCollection.hh:91
JTOOLS::JCollection< JElement2D_t >::lower_bound
const_iterator lower_bound(typename JClass< abscissa_type >::argument_type x) const
Get first position of element i, where x >= i->getX().
Definition: JCollection.hh:274
JTOOLS::j
int j
Definition: JPolint.hh:634
JTOOLS::JCollection< JElement2D_t >::getDistance
JDistance< typename JElement2D_t ::abscissa_type > getDistance
Function object for distance evaluation.
Definition: JCollection.hh:754
distance
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
Definition: PhysicsEvent.hh:434
JTOOLS::JMappableCollection::put
void put(typename JClass< key_type > ::argument_type key, typename JClass< mapped_type >::argument_type value)
Put pair-wise element (key,value) into collection.
Definition: JMappableCollection.hh:76
JTOOLS::JMappableCollection::get
virtual mapped_type & get(typename JClass< key_type >::argument_type key)=0
Get mapped value.
JTOOLS::JAbstractCollection::getX
virtual abscissa_type getX(int index) const =0
Get abscissa value.
JTOOLS::JQuadrature::JQuadrature
JQuadrature()
Default constructor.
Definition: JQuadrature.hh:46
JTOOLS::JCollection< JElement2D_t >::resize
void resize(typename container_type::size_type size)
Resize collection.
Definition: JCollection.hh:769
JTOOLS::JCollection< JElement2D_t >::insert
pair_type insert(const value_type &element)
Insert element.
Definition: JCollection.hh:298
JTOOLS::JCollection< JElement2D_t >::ordinate_type
JElement2D_t ::ordinate_type ordinate_type
Definition: JCollection.hh:81
JTOOLS::JAbstractCollection::getSize
virtual int getSize() const =0
Get number of elements.
JTOOLS::JCollection< JElement2D_t >::abscissa_type
JElement2D_t ::abscissa_type abscissa_type
Definition: JCollection.hh:80
JTOOLS::PI
static const double PI
Constants.
Definition: JConstants.hh:20
JTOOLS::JDistance
Template class for distance evaluation.
Definition: JDistance.hh:24
JTOOLS::JCollection< JElement2D_t >::is_compatible
bool is_compatible(const JCollection &collection) const
Test whether collections are compatible.
Definition: JCollection.hh:376
JMATH::JCalculator
Auxiliary class for arithmetic operations on objects.
Definition: JCalculator.hh:18
p1
TPaveText * p1
Definition: JDrawModule3D.cc:35
JLANG
Auxiliary classes and methods for language specific functionality.
Definition: JAbstractClass.hh:10
JTOOLS::JCollection< JElement2D_t >::const_iterator
container_type::const_iterator const_iterator
Definition: JCollection.hh:89
JTOOLS::JCollection< JElement2D_t >::pair_type
std::pair< const_iterator, bool > pair_type
Definition: JCollection.hh:95
JTOOLS::JCollection< JElement2D_t >::configure
void configure(const JAbstractCollection< abscissa_type > &bounds)
Configure collection.
Definition: JCollection.hh:314
JTOOLS::JCollection< JElement2D_t >::collection_type
JCollection< JElement2D_t, JDistance< typename JElement2D_t ::abscissa_type > > collection_type
Definition: JCollection.hh:85
JLANG::JException
General exception.
Definition: JException.hh:40
JLANG::is_identical
bool is_identical(JFirst_t &first, JSecond_t &second)
Check if two objects are indentical.
Definition: JLangToolkit.hh:46