Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
JTOOLS::JSplineFunctionalGridMap< JKey_t, JValue_t, JDistance_t > Struct Template Referenceabstract

Type definition of a spline interpolation based on a JGridMap implementation. More...

#include <JFunctionalMap_t.hh>

Inheritance diagram for JTOOLS::JSplineFunctionalGridMap< JKey_t, JValue_t, JDistance_t >:
JTOOLS::JSplineMap< JKey_t, JValue_t, JGridMap, JResultType< JValue_t >::result_type, JDistance_t > JTOOLS::JGridMap< JKey_t, JValue_t, JDistance_t > JTOOLS::JFunction< JKey_t, JResultType< JValue_t >::result_type > JTOOLS::JGridCollection< JElement2D< JKey_t, JValue_t >, JDistance_t > JTOOLS::JFunctional< JKey_t, JResultType< JValue_t >::result_type > JTOOLS::JCollection< JElement2D< JKey_t, JValue_t >, JDistance_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 JGridMap< JKey_t,
JValue_t, JDistance_t > 
collection_type
 
typedef JFunction< JKey_t,
JResultType< JValue_t >
::result_type
function_type
 
typedef
collection_type::abscissa_type 
abscissa_type
 
typedef
collection_type::ordinate_type 
ordinate_type
 
typedef collection_type::value_type value_type
 
typedef
collection_type::distance_type 
distance_type
 
typedef
collection_type::const_iterator 
const_iterator
 
typedef
collection_type::const_reverse_iterator 
const_reverse_iterator
 
typedef collection_type::iterator iterator
 
typedef
collection_type::reverse_iterator 
reverse_iterator
 
typedef
function_type::argument_type 
argument_type
 
typedef function_type::result_type result_type
 
typedef
function_type::JExceptionHandler 
exceptionhandler_type
 
typedef JResultType
< ordinate_type >::result_type 
data_type
 
typedef JSplineFunction1D
< JSplineElement2D
< argument_type, data_type >
, JMapCollection< JGridMap >
::template collection_type,
result_type
JSplineFunction1D_t
 
typedef JKey_t key_type
 
typedef JValue_t mapped_type
 
typedef collection_type::pair_type pair_type
 
typedef std::vector< value_typecontainer_type
 
typedef
JCollectionElementTransformer
< value_type
transformer_type
 
typedef JFunctional< JKey_t,
JResultType< JValue_t >
::result_type
functional_type
 
typedef JSupervisor supervisor_type
 

Public Member Functions

virtual result_type evaluate (const argument_type *pX) const
 Recursive interpolation method implementation. More...
 
int getIndex (typename JClass< abscissa_type >::argument_type x) const
 Get index of given abscissa value. 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...
 
virtual void clear ()
 Clear. More...
 
virtual const ordinate_typeget (typename JClass< abscissa_type >::argument_type x) const
 Get ordinate value. More...
 
virtual ordinate_typeget (typename JClass< abscissa_type >::argument_type x)
 Get ordinate value. More...
 
virtual const mapped_typeget (typename JClass< key_type >::argument_type key) const =0
 Get mapped 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...
 
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...
 
const mapped_typeoperator[] (typename JClass< key_type >::argument_type key) const
 Get mapped value. 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...
 
JSupervisor getSupervisor () const
 Get supervisor. More...
 
const JExceptionHandler & getExceptionHandler () const
 Get exception handler. More...
 
void setExceptionHandler (const JSupervisor &supervisor)
 Set the supervisor for handling of exceptions. More...
 

Static Public Member Functions

static result_type getValue (const JFunctional &function, const argument_type *pX)
 Recursive function value evaluation. More...
 
static JClass< result_type >
::argument_type 
getValue (typename JClass< result_type >::argument_type value, const argument_type *pX)
 Termination of recursive function value evaluation. More...
 

Public Attributes

JDistance_t getDistance
 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...
 
JSupervisor supervisor
 

Detailed Description

template<class JKey_t, class JValue_t, class JDistance_t = JDistance<JKey_t>>
struct JTOOLS::JSplineFunctionalGridMap< JKey_t, JValue_t, JDistance_t >

Type definition of a spline interpolation based on a JGridMap implementation.

Definition at line 37 of file JFunctionalMap_t.hh.

Member Typedef Documentation

typedef JGridMap <JKey_t, JValue_t, JDistance_t> JTOOLS::JSplineMap< JKey_t, JValue_t, JGridMap , JResultType< JValue_t >::result_type , JDistance_t >::collection_type
inherited

Definition at line 704 of file JSpline.hh.

typedef JFunction<JKey_t, JResultType< JValue_t >::result_type > JTOOLS::JSplineMap< JKey_t, JValue_t, JGridMap , JResultType< JValue_t >::result_type , JDistance_t >::function_type
inherited

Definition at line 705 of file JSpline.hh.

typedef collection_type::abscissa_type JTOOLS::JSplineMap< JKey_t, JValue_t, JGridMap , JResultType< JValue_t >::result_type , JDistance_t >::abscissa_type
inherited

Definition at line 707 of file JSpline.hh.

typedef collection_type::ordinate_type JTOOLS::JSplineMap< JKey_t, JValue_t, JGridMap , JResultType< JValue_t >::result_type , JDistance_t >::ordinate_type
inherited

Definition at line 708 of file JSpline.hh.

typedef collection_type::value_type JTOOLS::JSplineMap< JKey_t, JValue_t, JGridMap , JResultType< JValue_t >::result_type , JDistance_t >::value_type
inherited

Definition at line 709 of file JSpline.hh.

typedef collection_type::distance_type JTOOLS::JSplineMap< JKey_t, JValue_t, JGridMap , JResultType< JValue_t >::result_type , JDistance_t >::distance_type
inherited

Definition at line 710 of file JSpline.hh.

typedef collection_type::const_iterator JTOOLS::JSplineMap< JKey_t, JValue_t, JGridMap , JResultType< JValue_t >::result_type , JDistance_t >::const_iterator
inherited

Definition at line 712 of file JSpline.hh.

typedef collection_type::const_reverse_iterator JTOOLS::JSplineMap< JKey_t, JValue_t, JGridMap , JResultType< JValue_t >::result_type , JDistance_t >::const_reverse_iterator
inherited

Definition at line 713 of file JSpline.hh.

typedef collection_type::iterator JTOOLS::JSplineMap< JKey_t, JValue_t, JGridMap , JResultType< JValue_t >::result_type , JDistance_t >::iterator
inherited

Definition at line 714 of file JSpline.hh.

typedef collection_type::reverse_iterator JTOOLS::JSplineMap< JKey_t, JValue_t, JGridMap , JResultType< JValue_t >::result_type , JDistance_t >::reverse_iterator
inherited

Definition at line 715 of file JSpline.hh.

typedef function_type::argument_type JTOOLS::JSplineMap< JKey_t, JValue_t, JGridMap , JResultType< JValue_t >::result_type , JDistance_t >::argument_type
inherited

Definition at line 717 of file JSpline.hh.

typedef function_type::result_type JTOOLS::JSplineMap< JKey_t, JValue_t, JGridMap , JResultType< JValue_t >::result_type , JDistance_t >::result_type
inherited

Definition at line 718 of file JSpline.hh.

typedef function_type::JExceptionHandler JTOOLS::JSplineMap< JKey_t, JValue_t, JGridMap , JResultType< JValue_t >::result_type , JDistance_t >::exceptionhandler_type
inherited

Definition at line 719 of file JSpline.hh.

typedef JResultType<ordinate_type>::result_type JTOOLS::JSplineMap< JKey_t, JValue_t, JGridMap , JResultType< JValue_t >::result_type , JDistance_t >::data_type
inherited

Definition at line 721 of file JSpline.hh.

Definition at line 724 of file JSpline.hh.

template<class JKey_t, class JValue_t, class JDistance_t = JDistance<JKey_t>>
typedef JKey_t JTOOLS::JGridMap< JKey_t, JValue_t, JDistance_t >::key_type
inherited

Definition at line 31 of file JGridMap.hh.

template<class JKey_t, class JValue_t, class JDistance_t = JDistance<JKey_t>>
typedef JValue_t JTOOLS::JGridMap< JKey_t, JValue_t, JDistance_t >::mapped_type
inherited

Definition at line 32 of file JGridMap.hh.

typedef collection_type::pair_type JTOOLS::JGridCollection< JElement2D< JKey_t, JValue_t > , JDistance_t >::pair_type
inherited

Definition at line 46 of file JGridCollection.hh.

typedef std::vector<value_type> JTOOLS::JCollection< JElement2D< JKey_t, JValue_t > , JDistance_t >::container_type
inherited

Definition at line 88 of file JCollection.hh.

typedef JCollectionElementTransformer<value_type> JTOOLS::JCollection< JElement2D< JKey_t, JValue_t > , JDistance_t >::transformer_type
inherited

Definition at line 95 of file JCollection.hh.

typedef JFunctional<JKey_t , JResultType< JValue_t >::result_type > JTOOLS::JFunction< JKey_t , JResultType< JValue_t >::result_type >::functional_type
inherited

Definition at line 306 of file JFunctional.hh.

typedef JSupervisor JTOOLS::JFunctional< JKey_t , JResultType< JValue_t >::result_type >::supervisor_type
inherited

Definition at line 89 of file JFunctional.hh.

Member Function Documentation

virtual result_type JTOOLS::JSplineMap< JKey_t, JValue_t, JGridMap , JResultType< JValue_t >::result_type , JDistance_t >::evaluate ( const argument_type pX) const
inlinevirtualinherited

Recursive interpolation method implementation.

Parameters
pXpointer to abscissa values
Returns
function value

Implements JTOOLS::JFunctional< JKey_t, JResultType< JValue_t >::result_type >.

Definition at line 740 of file JSpline.hh.

741  {
742  const argument_type x = *pX;
743 
744  ++pX; // next argument value
745 
746  const_iterator p = this->begin();
747 
748  for (typename JSplineFunction1D_t::iterator q = buffer.begin(); q != buffer.end(); ++q, ++p) {
749  q->getY() = JFunction<argument_type, data_type>::getValue(p->getY(), pX);
750  }
751 
752  buffer.compile();
753 
754  return buffer(x);
755  }
double getValue(const JScale_t scale)
Get numerical value corresponding to scale.
Definition: JScale.hh:47
int JTOOLS::JGridCollection< JElement2D< JKey_t, JValue_t > , JDistance_t >::getIndex ( typename JClass< abscissa_type >::argument_type  x) const
inlineinherited

Get index of given abscissa value.

For values within the range of this collection, the index starts at zero and ends at number of elements minus one. Note that the index could be less than zero or larger than (or equal to) the number of elements, if the given abscissa value is outside the range of this collection.

Parameters
xabscissa value
Returns
index

Definition at line 66 of file JGridCollection.hh.

67  {
68  return (int) ((this->size() - 1) * (x - this->begin()->getX()) / (this->rbegin()->getX() - this->begin()->getX()));
69  }
const_iterator JTOOLS::JGridCollection< JElement2D< JKey_t, JValue_t > , JDistance_t >::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 78 of file JGridCollection.hh.

79  {
80  const int index = getIndex(x) + 1;
81 
82  if (index <= 0)
83  return this->begin();
84  else if (index >= (int) this->size())
85  return this->end();
86  else
87  return this->begin() + index;
88  }
int getIndex(typename JClass< abscissa_type >::argument_type x) const
Get index of given abscissa value.
iterator JTOOLS::JGridCollection< JElement2D< JKey_t, JValue_t > , JDistance_t >::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 97 of file JGridCollection.hh.

98  {
99  const int index = getIndex(x) + 1;
100 
101  if (index <= 0)
102  return this->begin();
103  else if (index >= (int) this->size())
104  return this->end();
105  else
106  return this->begin() + index;
107  }
int getIndex(typename JClass< abscissa_type >::argument_type x) const
Get index of given abscissa value.
virtual void JTOOLS::JCollection< JElement2D< JKey_t, JValue_t > , JDistance_t >::clear ( )
inlinevirtualinherited

Clear.

Implements JTOOLS::JMappableCollection< JKey_t, JValue_t >.

Definition at line 149 of file JCollection.hh.

150  {
151  container_type::clear();
152  }
virtual const ordinate_type& JTOOLS::JCollection< JElement2D< JKey_t, JValue_t > , JDistance_t >::get ( typename JClass< abscissa_type >::argument_type  x) const
inlinevirtualinherited

Get ordinate value.

Parameters
xabscissa value
Returns
ordinate value

Definition at line 161 of file JCollection.hh.

162  {
163  const_iterator i = this->lower_bound(x);
164 
165  if (i == this->end() || this->getDistance(x, i->getX()) > distance_type::precision) {
166  THROW(JValueOutOfRange, "Invalid abscissa value " << x);
167  }
168 
169  return i->getY();
170  }
JDistance_t getDistance
Function object for distance evaluation.
Definition: JCollection.hh:773
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:670
const_iterator lower_bound(typename JClass< abscissa_type >::argument_type x) const
Get first position of element i, where x &gt;= i-&gt;getX().
Definition: JCollection.hh:293
Exception for accessing a value in a collection that is outside of its range.
Definition: JException.hh:162
virtual ordinate_type& JTOOLS::JCollection< JElement2D< JKey_t, JValue_t > , JDistance_t >::get ( typename JClass< abscissa_type >::argument_type  x)
inlinevirtualinherited

Get ordinate value.

Parameters
xabscissa value
Returns
ordinate value

Definition at line 179 of file JCollection.hh.

180  {
181  iterator i = this->lower_bound(x);
182 
183  if (i == this->end() || this->getDistance(x, i->getX()) > distance_type::precision) {
184  i = container_type::insert(i, value_type(x, ordinate_type()));
185  }
186 
187  return i->getY();
188  }
JDistance_t getDistance
Function object for distance evaluation.
Definition: JCollection.hh:773
const_iterator lower_bound(typename JClass< abscissa_type >::argument_type x) const
Get first position of element i, where x &gt;= i-&gt;getX().
Definition: JCollection.hh:293
JElement2D< JKey_t, JValue_t >::ordinate_type ordinate_type
Definition: JCollection.hh:82
template<class JKey_t, class JValue_t>
virtual const mapped_type& JTOOLS::JMappableCollection< JKey_t, JValue_t >::get ( typename JClass< key_type >::argument_type  key) const
pure virtualinherited
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
virtual int JTOOLS::JCollection< JElement2D< JKey_t, JValue_t > , JDistance_t >::getSize ( ) const
inlinevirtualinherited

Get number of elements.

Returns
number of elements

Implements JTOOLS::JAbstractCollection< JAbscissa_t >.

Definition at line 196 of file JCollection.hh.

197  {
198  return (int) this->size();
199  }
virtual abscissa_type JTOOLS::JCollection< JElement2D< JKey_t, JValue_t > , JDistance_t >::getX ( int  index) const
inlinevirtualinherited

Get abscissa value.

Parameters
indexindex
Returns
abscissa value

Implements JTOOLS::JAbstractCollection< JAbscissa_t >.

Definition at line 208 of file JCollection.hh.

209  {
210  return this->at(index).getX();
211  }
virtual abscissa_type JTOOLS::JCollection< JElement2D< JKey_t, JValue_t > , JDistance_t >::getXmin ( ) const
inlinevirtualinherited

Get minimal abscissa value.

Returns
abscissa value

Implements JTOOLS::JAbstractCollection< JAbscissa_t >.

Definition at line 219 of file JCollection.hh.

220  {
221  return this->begin()->getX();
222  }
virtual abscissa_type JTOOLS::JCollection< JElement2D< JKey_t, JValue_t > , JDistance_t >::getXmax ( ) const
inlinevirtualinherited

Get maximal abscissa value.

Returns
abscissa value

Implements JTOOLS::JAbstractCollection< JAbscissa_t >.

Definition at line 230 of file JCollection.hh.

231  {
232  return this->rbegin()->getX();
233  }
const ordinate_type& JTOOLS::JCollection< JElement2D< JKey_t, JValue_t > , JDistance_t >::getY ( int  index) const
inlineinherited

Get ordinate value.

Parameters
indexindex
Returns
ordinate value

Definition at line 243 of file JCollection.hh.

244  {
245  return this->at(index).getY();
246  }
ordinate_type& JTOOLS::JCollection< JElement2D< JKey_t, JValue_t > , JDistance_t >::getY ( int  index)
inlineinherited

Get ordinate value.

Parameters
indexindex
Returns
ordinate value

Definition at line 255 of file JCollection.hh.

256  {
257  return this->at(index).getY();
258  }
void JTOOLS::JCollection< JElement2D< JKey_t, JValue_t > , JDistance_t >::transform ( const transformer_type transformer)
inlineinherited

Transform collection.

Parameters
transformerelement transformer

Definition at line 266 of file JCollection.hh.

267  {
268  collection_type buffer;
269 
270  this->swap(buffer);
271 
272  for (const_iterator i = buffer.begin(); i != buffer.end(); ++i) {
273  this->insert(transformer(*i));
274  }
275  }
JCollection< JElement2D< JKey_t, JValue_t >, JDistance_t > collection_type
Definition: JCollection.hh:86
pair_type insert(const value_type &element)
Insert element.
Definition: JCollection.hh:317
void JTOOLS::JCollection< JElement2D< JKey_t, JValue_t > , JDistance_t >::sort ( )
inlineinherited

Sort elements.

Definition at line 281 of file JCollection.hh.

282  {
283  std::sort(this->begin(), this->end(), compare);
284  }
JComparator compare
Function object for comparison.
Definition: JCollection.hh:780
pair_type JTOOLS::JCollection< JElement2D< JKey_t, JValue_t > , JDistance_t >::insert ( const value_type element)
inlineinherited

Insert element.

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

Definition at line 317 of file JCollection.hh.

318  {
319  iterator i = this->lower_bound(element.getX());
320 
321  if (i == this->end() || this->getDistance(element.getX(), i->getX()) > 0.0)
322  return pair_type(container_type::insert(i, element), true);
323  else
324  return pair_type(this->end(), false);
325  }
JDistance_t getDistance
Function object for distance evaluation.
Definition: JCollection.hh:773
const_iterator lower_bound(typename JClass< abscissa_type >::argument_type x) const
Get first position of element i, where x &gt;= i-&gt;getX().
Definition: JCollection.hh:293
void JTOOLS::JCollection< JElement2D< JKey_t, JValue_t > , JDistance_t >::configure ( const JAbstractCollection< abscissa_type > &  bounds)
inlineinherited

Configure collection.

Parameters
boundsabscissa values

Definition at line 333 of file JCollection.hh.

334  {
335  configure(bounds, JMATH::getZero<ordinate_type>());
336  }
void configure(const JAbstractCollection< abscissa_type > &bounds)
Configure collection.
Definition: JCollection.hh:333
void JTOOLS::JCollection< JElement2D< JKey_t, JValue_t > , JDistance_t >::configure ( const JAbstractCollection< abscissa_type > &  bounds,
typename JClass< ordinate_type >::argument_type  value 
)
inlineinherited

Configure collection.

Parameters
boundsabscissa values
valueordinate value

Definition at line 345 of file JCollection.hh.

347  {
348  this->resize(bounds.getSize());
349 
350  for (iterator i = this->begin(); i != this->end(); ++i) {
351 
352  const abscissa_type x = bounds.getX(std::distance(this->begin(),i));
353 
354  *i = value_type(x,value);
355  }
356  }
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
void resize(typename container_type::size_type size)
Resize collection.
Definition: JCollection.hh:788
JElement2D< JKey_t, JValue_t >::abscissa_type abscissa_type
Definition: JCollection.hh:81
virtual abscissa_type getX(int index) const =0
Get abscissa value.
virtual int getSize() const =0
Get number of elements.
void JTOOLS::JCollection< JElement2D< JKey_t, JValue_t > , JDistance_t >::configure ( const JAbstractCollection< abscissa_type > &  bounds,
const JFunction1D_t &  function 
)
inlineinherited

Configure collection.

Parameters
boundsabscissa values
functionfunction

Definition at line 366 of file JCollection.hh.

368  {
369  using namespace JLANG;
370 
371  collection_type* out = (is_identical(*this, function) ? new collection_type() : this);
372 
373  for (int i = 0; i != bounds.getSize(); ++i) {
374 
375  const abscissa_type x = bounds.getX(i);
376 
377  out->put(x, function(x));
378  }
379 
380  if (is_identical(*this, function)) {
381 
382  this->swap(*out);
383 
384  delete out;
385  }
386  }
JCollection< JElement2D< JKey_t, JValue_t >, JDistance_t > collection_type
Definition: JCollection.hh:86
JElement2D< JKey_t, JValue_t >::abscissa_type abscissa_type
Definition: JCollection.hh:81
bool is_identical(JFirst_t &first, JSecond_t &second)
Check if two objects are indentical.
Definition: JLangToolkit.hh:46
virtual abscissa_type getX(int index) const =0
Get abscissa value.
virtual int getSize() const =0
Get number of elements.
bool JTOOLS::JCollection< JElement2D< JKey_t, JValue_t > , JDistance_t >::is_compatible ( const JCollection< JElement2D< JKey_t, JValue_t >, JDistance_t > &  collection) const
inlineinherited

Test whether collections are compatible.

Parameters
collectioncollection
Returns
true if collections are compatible; else false

Definition at line 395 of file JCollection.hh.

396  {
397  if (this->empty() || collection.empty()) {
398 
399  return true;
400 
401  } else {
402 
403  const double precision = JDistance<abscissa_type>::precision;
404 
405  const_iterator p = this->begin();
406  const_iterator q = collection.begin();
407 
408  if (getDistance(p->getX(), q->getX()) > precision) {
409 
410  do {
411  ++p;
412  } while (p != this->end() && getDistance(p->getX(), q->getX()) > precision);
413 
414  } else if (getDistance(q->getX(), p->getX()) > precision) {
415 
416  do {
417  ++q;
418  } while (q != collection.end() && getDistance(q->getX(), p->getX()) > precision);
419  }
420 
421  for ( ; p != this->end() && q != collection.end(); ++p, ++q) {
422  if (fabs(getDistance(p->getX(), q->getX())) > precision) {
423  return false;
424  }
425  }
426 
427  return true;
428  }
429  }
Template class for distance evaluation.
Definition: JDistance.hh:24
JDistance_t getDistance
Function object for distance evaluation.
Definition: JCollection.hh:773
JCollection& JTOOLS::JCollection< JElement2D< JKey_t, JValue_t > , JDistance_t >::negate ( )
inlineinherited

Negate collection.

Returns
this collection

Definition at line 437 of file JCollection.hh.

438  {
439  for (iterator i = this->begin(); i != this->end(); ++i) {
440  i->getY() = -i->getY();
441  }
442 
443  return *this;
444  }
JCollection& JTOOLS::JCollection< JElement2D< JKey_t, JValue_t > , JDistance_t >::add ( const JCollection< JElement2D< JKey_t, JValue_t >, JDistance_t > &  collection)
inlineinherited

Add collection.

Parameters
collectioncollection
Returns
this collection

Definition at line 453 of file JCollection.hh.

454  {
455  if (!collection.empty()) {
456 
457  if (this->empty()) {
458 
459  for (const_iterator i = collection.begin(); i != collection.end(); ++i) {
460  this->put(i->getX(), +i->getY());
461  }
462 
463  } else if (this->is_compatible(collection)) {
464 
465  const double precision = JDistance<abscissa_type>::precision;
466 
467  iterator p = this->begin();
468  const_iterator q = collection.begin();
469 
470  if (getDistance(p->getX(), q->getX()) > precision) {
471 
472  do {
473  ++p;
474  } while (p != this->end() && getDistance(p->getX(), q->getX()) > precision);
475 
476  } else if (getDistance(q->getX(), p->getX()) > precision) {
477 
478  do {
479  ++q;
480  } while (q != collection.end() && getDistance(q->getX(), p->getX()) > precision);
481  }
482 
483  const_iterator i = q;
484 
485  for ( ; p != this->end() && i != collection.end(); ++p, ++i) {
486  p->getY() += i->getY();
487  }
488 
489  for ( ; i != collection.end(); ++i) {
490  this->put(i->getX(), +i->getY());
491  }
492 
493  for (i = collection.begin(); i != q; ++i) {
494  this->put(i->getX(), +i->getY());
495  }
496  }
497  }
498 
499  return *this;
500  }
Template class for distance evaluation.
Definition: JDistance.hh:24
JDistance_t getDistance
Function object for distance evaluation.
Definition: JCollection.hh:773
bool is_compatible(const JCollection &collection) const
Test whether collections are compatible.
Definition: JCollection.hh:395
void put(typename JClass< key_type >::argument_type key, typename JClass< mapped_type >::argument_type value)
Put pair-wise element (key,value) into collection.
JCollection& JTOOLS::JCollection< JElement2D< JKey_t, JValue_t > , JDistance_t >::add ( typename JClass< ordinate_type >::argument_type  value)
inlineinherited

Add offset.

Parameters
valueoffset
Returns
this collection

Definition at line 601 of file JCollection.hh.

602  {
603  for (iterator i = this->begin(); i != this->end(); ++i) {
604  i->getY() += value;
605  }
606 
607  return *this;
608  }
JCollection& JTOOLS::JCollection< JElement2D< JKey_t, JValue_t > , JDistance_t >::add ( const JFunction1D_t &  function)
inlineinherited

Add function.

Parameters
functionfunction
Returns
this collection

Definition at line 634 of file JCollection.hh.

635  {
636  for (iterator i = this->begin(); i != this->end(); ++i) {
637  i->getY() += function(i->getX());
638  }
639 
640  return *this;
641  }
JCollection& JTOOLS::JCollection< JElement2D< JKey_t, JValue_t > , JDistance_t >::sub ( const JCollection< JElement2D< JKey_t, JValue_t >, JDistance_t > &  collection)
inlineinherited

Subtract collection.

Parameters
collectioncollection
Returns
this collection

Definition at line 509 of file JCollection.hh.

510  {
511  if (!collection.empty()) {
512 
513  if (this->empty()) {
514 
515  for (const_iterator i = collection.begin(); i != collection.end(); ++i) {
516  this->put(i->getX(), -i->getY());
517  }
518 
519  } else if (this->is_compatible(collection)) {
520 
521  const double precision = JDistance<abscissa_type>::precision;
522 
523  iterator p = this->begin();
524  const_iterator q = collection.begin();
525 
526  if (getDistance(p->getX(), q->getX()) > precision) {
527 
528  do {
529  ++p;
530  } while (p != this->end() && getDistance(p->getX(), q->getX()) > precision);
531 
532  } else if (getDistance(q->getX(), p->getX()) > precision) {
533 
534  do {
535  ++q;
536  } while (q != collection.end() && getDistance(q->getX(), p->getX()) > precision);
537  }
538 
539  const_iterator i = q;
540 
541  for ( ; p != this->end() && i != collection.end(); ++p, ++i) {
542  p->getY() -= i->getY();
543  }
544 
545  for ( ; i != collection.end(); ++i) {
546  this->put(i->getX(), -i->getY());
547  }
548 
549  for (i = collection.begin(); i != q; ++i) {
550  this->put(i->getX(), -i->getY());
551  }
552 
553  } else {
554 
555  throw JException("JCollection::add() collections incompatible.");
556  }
557  }
558 
559  return *this;
560  }
General exception.
Definition: JException.hh:23
Template class for distance evaluation.
Definition: JDistance.hh:24
JDistance_t getDistance
Function object for distance evaluation.
Definition: JCollection.hh:773
bool is_compatible(const JCollection &collection) const
Test whether collections are compatible.
Definition: JCollection.hh:395
void put(typename JClass< key_type >::argument_type key, typename JClass< mapped_type >::argument_type value)
Put pair-wise element (key,value) into collection.
JCollection& JTOOLS::JCollection< JElement2D< JKey_t, JValue_t > , JDistance_t >::sub ( typename JClass< ordinate_type >::argument_type  value)
inlineinherited

Subtract offset.

Parameters
valueoffset
Returns
this collection

Definition at line 617 of file JCollection.hh.

618  {
619  for (iterator i = this->begin(); i != this->end(); ++i) {
620  i->getY() -= value;
621  }
622 
623  return *this;
624  }
JCollection& JTOOLS::JCollection< JElement2D< JKey_t, JValue_t > , JDistance_t >::sub ( const JFunction1D_t &  function)
inlineinherited

Subtract function.

Parameters
functionfunction
Returns
this collection

Definition at line 651 of file JCollection.hh.

652  {
653  for (iterator i = this->begin(); i != this->end(); ++i) {
654  i->getY() -= function(i->getX());
655  }
656 
657  return *this;
658  }
JCollection& JTOOLS::JCollection< JElement2D< JKey_t, JValue_t > , JDistance_t >::mul ( const double  value)
inlineinherited

Scale contents.

Parameters
valuemultiplication factor
Returns
this collection

Definition at line 569 of file JCollection.hh.

570  {
571  for (iterator i = this->begin(); i != this->end(); ++i) {
572  i->getY() *= value;
573  }
574 
575  return *this;
576  }
template<class JFirst_t, class JSecond_t = JNullType>
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  }
Auxiliary class for arithmetic operations on objects.
Definition: JCalculator.hh:18
JCollection& JTOOLS::JCollection< JElement2D< JKey_t, JValue_t > , JDistance_t >::div ( const double  value)
inlineinherited

Scale contents.

Parameters
valuedivision factor
Returns
this collection

Definition at line 585 of file JCollection.hh.

586  {
587  for (iterator i = this->begin(); i != this->end(); ++i) {
588  i->getY() /= value;
589  }
590 
591  return *this;
592  }
const JComparator& JTOOLS::JCollection< JElement2D< JKey_t, JValue_t > , JDistance_t >::getComparator ( ) const
inlineinherited

Get comparator.

Returns
comparator

Definition at line 764 of file JCollection.hh.

765  {
766  return compare;
767  }
JComparator compare
Function object for comparison.
Definition: JCollection.hh:780
void JTOOLS::JCollection< JElement2D< JKey_t, JValue_t > , JDistance_t >::resize ( typename container_type::size_type  size)
inlineprotectedinherited

Resize collection.

Parameters
sizesize

Definition at line 788 of file JCollection.hh.

789  {
790  container_type::resize(size);
791  }
template<class JKey_t, class JValue_t>
const mapped_type& JTOOLS::JMappableCollection< JKey_t, JValue_t >::operator[] ( typename JClass< key_type >::argument_type  key) const
inlineinherited

Get mapped value.

Parameters
keykey
Returns
value

Definition at line 73 of file JMappableCollection.hh.

74  {
75  return get(key);
76  }
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 85 of file JMappableCollection.hh.

86  {
87  return get(key);
88  }
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 97 of file JMappableCollection.hh.

99  {
100  get(key) = value;
101  }
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  }
virtual abscissa_type getX(int index) const =0
Get abscissa value.
virtual int getSize() const =0
Get number of elements.
static result_type JTOOLS::JFunctional< JKey_t , JResultType< JValue_t >::result_type >::getValue ( const JFunctional< JKey_t, JResultType< JValue_t >::result_type > &  function,
const argument_type pX 
)
inlinestaticinherited

Recursive function value evaluation.

Parameters
functionfunction
pXpointer to abscissa values

Definition at line 107 of file JFunctional.hh.

109  {
110  return function.evaluate(pX);
111  }
static JClass<result_type>::argument_type JTOOLS::JFunctional< JKey_t , JResultType< JValue_t >::result_type >::getValue ( typename JClass< result_type >::argument_type  value,
const argument_type pX 
)
inlinestaticinherited

Termination of recursive function value evaluation.

Parameters
valueresult
pXpointer to abscissa values

Definition at line 121 of file JFunctional.hh.

123  {
124  return value;
125  }
JSupervisor JTOOLS::JFunctional< JKey_t , JResultType< JValue_t >::result_type >::getSupervisor ( ) const
inlineinherited

Get supervisor.

Returns
supervisor

Definition at line 266 of file JFunctional.hh.

const JExceptionHandler& JTOOLS::JFunctional< JKey_t , JResultType< JValue_t >::result_type >::getExceptionHandler ( ) const
inlineinherited

Get exception handler.

Returns
exception handler

Definition at line 277 of file JFunctional.hh.

void JTOOLS::JFunctional< JKey_t , JResultType< JValue_t >::result_type >::setExceptionHandler ( const JSupervisor &  supervisor)
inlineinherited

Set the supervisor for handling of exceptions.

Parameters
supervisorsupervisor

Definition at line 288 of file JFunctional.hh.

Member Data Documentation

JDistance_t JTOOLS::JCollection< JElement2D< JKey_t, JValue_t > , JDistance_t >::getDistance
inherited

Function object for distance evaluation.

Definition at line 773 of file JCollection.hh.

JComparator JTOOLS::JCollection< JElement2D< JKey_t, JValue_t > , JDistance_t >::compare
protectedinherited

Function object for comparison.

Definition at line 780 of file JCollection.hh.

JSupervisor JTOOLS::JFunctional< JKey_t , JResultType< JValue_t >::result_type >::supervisor
protectedinherited

Definition at line 295 of file JFunctional.hh.


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