Main MRPT website > C++ reference for MRPT 1.9.9
CBinaryRelation.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2018, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 #ifndef CBINARYRELATION_H_
10 #define CBINARYRELATION_H_
11 
14 
15 #include <set>
16 #include <iterator>
17 #include <algorithm>
18 #include <utility>
19 
20 namespace mrpt
21 {
22 namespace math
23 {
24 using std::vector;
25 
26 /**
27  * This class models a binary relation through the elements of any given set.
28  * I.e. for each pair of elements (A,B) it assigns two values, f(A,B) and
29  * f(B,A).
30  * This class is useful when calling the base function is costly, since it acts
31  * like a proxy. It's also useful if the relationship values do not correspond
32  * with the return value of a function. Although it theoretically supports
33  * objects with non-trivial constructors or destructors (indicated by specifying
34  * "true" as the thrid parameter of the template instantiation), certain
35  * operations will cause memory leaks and may even cause undefined behaviour, so
36  * it's
37  * reccomended to use only basic types for the parameter U. The parameter T may
38  * be any complex object, however, like a smart pointer.
39  * \ingroup mrpt_math_grp
40  */
41 template <typename T, typename U, bool UIsObject = false>
43 {
44  private:
45  // TODO: VIRTUALIZE INSERTROWSANDCOLS!!! AND REIMPLEMENT IN
46  // CMATRIXTEMPLATEOBJECTS.
47 
48  /**Matrix type used to store the actual relation. */
50 
51  public:
52  /** Simple function type, used to initialize chunks of the matrix. */
53  using SimpleFunctionByReturnValue = U (*)(T, T);
54  /**Function type which obtains the relation value by a return value. */
55  using FunctionByReturnValue = U (*)(const T&, const T&);
56  /**Function type which obtains the relation value by reference pass. */
57  using FunctionByReferencePass = void (*)(const T&, const T&, U&);
58  /**Constant iterator through the set elements. */
60  /**Constant reverse iterator through the set elements. */
61  using const_reverse_iterator = typename std::set<T>::const_reverse_iterator;
62  /**Accessor type to every value related to any element A, i.e., f(A,x). */
64  /**Accessor type to every value related to any element B, i.e., f(x,B). */
66  /**Const accessor type to every value related to any element A, i.e.,
67  * f(A,x). */
69  /**Const accessor type to every value related to any element B, i.e.,
70  * f(x,B). */
72 
73  private:
74  /**Actual set of elements. */
75  std::set<T> elements;
76  /**Matrix storing the relation. */
78 
79  /**
80  * Template used to make the function interface independent from the
81  * function type.
82  * (wrapper for the global method - needed to make this compile under
83  * GCC).
84  */
85  template <typename FunctionType>
86  inline void applyFunction(
87  FunctionType fun, size_t e1, size_t e2, const T& T1, const T& T2)
88  {
89  detail::applyFunction<T, U, UIsObject, FunctionType>(
90  *this, fun, e1, e2, T1, T2);
91  }
92 
93  public:
94  /**
95  * Default constructor, doesn't initialize the relation.
96  */
97  explicit inline CBinaryRelation(const std::set<T>& els)
98  : elements(els), relation(els.size(), els.size())
99  {
100  }
101  /**
102  * Constructor which initializes the relation using a given function.
103  */
104  template <typename FunctionType>
105  inline CBinaryRelation(const std::set<T>& els, FunctionType fun)
106  : elements(els), relation(els.size(), els.size())
107  {
108  initializeWith(fun);
109  }
110  /**
111  * Initialize the whole relation with a given function.
112  */
113  template <typename FunctionType>
114  void initializeWith(FunctionType fun)
115  {
116  typename std::set<T>::const_iterator it = elements.begin();
117  for (size_t i = 0; i < elements.size(); ++i, ++it)
118  {
119  typename std::set<T>::const_iterator jt = elements.begin();
120  for (size_t j = 0; j < elements.size(); ++j, ++jt)
121  applyFunction(fun, i, j, *it, *jt);
122  }
123  }
124  /**
125  * Initialize the whole relation with a given function, assuming that the
126  * relation is symmetrical.
127  */
128  template <typename FunctionType>
129  void initializeSymmetricallyWith(FunctionType fun)
130  {
131  typename std::set<T>::const_iterator it = elements.begin();
132  for (size_t i = 0; i < elements.size(); ++i, ++it)
133  {
134  applyFunction(fun, i, i, *it, *it);
135  typename std::set<T>::const_iterator jt = it;
136  jt++;
137  for (size_t j = i + 1; j < elements.size(); ++j, ++jt)
138  {
139  applyFunction(fun, i, j, *it, *jt);
140  relation(j, i) = relation(i, j);
141  }
142  }
143  }
144  /**
145  * Manually set a relationship value, given the indices.
146  */
147  inline void setRelationValue(size_t e1, size_t e2, const U& newVal)
148  {
149  relation.get_unsafe(e1, e2) = newVal;
150  }
151  /**
152  * Get a relation value, given the indices.
153  */
154  inline const U& getRelationValue(size_t e1, size_t e2) const
155  {
156  return relation.get_unsafe(e1, e2);
157  }
158  inline const U& operator()(size_t e1, size_t e2) const
159  {
160  return getRelationValue(e1, e2);
161  }
162  /**
163  * Get a reference to a relation value given its indices, which allows both
164  * querying and setting the value.
165  */
166  inline U& getRelationValue(size_t e1, size_t e2)
167  {
168  return relation.get_unsafe(e1, e2);
169  }
170  inline U& operator()(size_t e1, size_t e2)
171  {
172  return getRelationValue(e1, e2);
173  }
174  /**
175  * Manually set a relationship value, given the elements. Returns false if
176  * any of the elements is not present.
177  */
178  inline bool setRelationValue(const T& t1, const T& t2, const U& newVal)
179  {
180  typename std::set<T>::const_iterator b = elements.begin(),
181  e = elements.end();
182  typename std::set<T>::const_iterator it1 = std::find(b, e, t1),
183  it2 = std::find(b, e, t2);
184  if (it1 == e || it2 == e) return false;
186  static_cast<size_t>(std::distance(b, it1)),
187  static_cast<size_t>(std::distance(b, it2)), newVal);
188  return true;
189  }
190  /**
191  * Get a relation value, given the elements. Throws domain_error if any of
192  * the elements is not present.
193  */
194  inline U getRelationValue(const T& t1, const T& t2) const
195  {
196  typename std::set<T>::const_iterator b = elements.begin(),
197  e = elements.end();
198  typename std::set<T>::const_iterator it1 = std::find(b, e, t1),
199  it2 = std::find(b, e, t2);
200  if (it1 == e || it2 == e) throw std::domain_error("Element not found");
201  return getRelationValue(
202  static_cast<size_t>(std::distance(b, it1)),
203  static_cast<size_t>(std::distance(b, it2)));
204  }
205  /**
206  * Get a reference to a relation value given the elements, which allows
207  * both querying and setting. Throws domain_error if any of the elements is
208  * not
209  * present.
210  */
211  inline U& getRelationValue(const T& t1, const T& t2)
212  {
213  typename std::set<T>::const_iterator b = elements.begin(),
214  e = elements.end();
215  typename std::set<T>::const_iterator it1 = std::find(b, e, t1),
216  it2 = std::find(b, e, t2);
217  if (it1 == e || it2 == e) throw std::domain_error("Element not found");
218  return getRelationValue(
219  static_cast<size_t>(std::distance(b, it1)),
220  static_cast<size_t>(distance(b, it2)));
221  }
222  /**
223  * Gets an iterator to the starting point of the elements set.
224  */
225  inline const_iterator begin() const { return elements.begin(); }
226  /**
227  * Gets an iterator to the ending point of the elements set.
228  */
229  inline const_iterator end() const { return elements.end(); }
230  /**
231  * Gets a reverse iterator to the ending point of the elements set.
232  */
233  inline const_reverse_iterator rbegin() const { return elements.rbegin(); }
234  /**
235  * Gets a reverse iterator to the starting point of the elements set.
236  */
237  inline const_reverse_iterator rend() const { return elements.rend(); }
238  /**
239  * Operator for direct access to a element given its index.
240  */
241  T operator[](size_t i) const
242  {
243  ASSERT_BELOW_(i, elements.size();
244  typename std::set<T>::const_iterator it = elements.begin();
245  std::advance(it, i);
246  return *it;
247  }
248  /**
249  * Gets an accessor for every value related to an element A given its
250  * index, i.e., every f(A,x). This accessor is iterable.
251  */
253  {
255  }
256  /**
257  * Gets a constant accessor for every value related to an element A given
258  * its index, i.e., every f(A,x). This accessor is iterable.
259  */
261  {
263  }
264  /**
265  * Gets an accessor for every value related to an element B given its
266  * index, i.e., every f(x,B). This accessor is iterable.
267  */
269  {
271  }
272  /**
273  * Gets a constant accessor for every value related to an element B given
274  * its index, i.e., every f(x,B). This accessor is fully iterable.
275  */
277  {
279  }
280  /**
281  * Gets an iterable accessor for every value related to an element A, i.e.,
282  * every f(A,x). A domain_error will be thrown if the element is not
283  * present.
284  */
286  {
287  typename std::set<T>::const_iterator b = elements.begin(),
288  e = elements.end();
289  typename std::set<T>::const_iterator it = std::find(b, e, t);
290  if (it == e) throw std::domain_error("Element not found");
291  return getRelationFrom(static_cast<size_t>(std::distance(b, it)));
292  }
293  /**
294  * Gets an iterable constant accessor for every value related to an element
295  * A, i.e., every f(A,x). A domain_error will be thrown if the element is
296  * not
297  * present.
298  */
300  {
301  typename std::set<T>::const_iterator b = elements.begin(),
302  e = elements.end();
303  typename std::set<T>::const_iterator it = std::find(b, e, t);
304  if (it == e) throw std::domain_error("Element not found");
305  return getRelationFrom(static_cast<size_t>(std::distance(b, it)));
306  }
307  inline void getRelationFrom(size_t i, vector<U>& vec)
308  {
309  size_t N = elements.size();
310  ASSERT_(i < N);
311  vec.resize(N);
313  std::copy(access.begin(), access.end(), vec.begin());
314  }
315  inline void getRelationFrom(const T& t, vector<U>& vec)
316  {
317  typename std::set<T>::const_iterator b = elements.begin(),
318  e = elements.end();
319  typename std::set<T>::const_iterator it = std::find(b, e, t);
320  if (it == e) throw std::domain_error("Element not found");
321  getRelationFrom(static_cast<size_t>(std::distance(b, it)), vec);
322  }
323  /**
324  * Gets an iterable accessor for every value related to an element B, i.e.,
325  * every f(x,B). A domain_error will be thrown if the element is not
326  * present.
327  */
329  {
330  typename std::set<T>::const_iterator b = elements.begin(),
331  e = elements.end();
332  typename std::set<T>::const_iterator it = std::find(b, e, t);
333  if (it == e) throw std::domain_error("Element not found");
334  return getRelationTo(static_cast<size_t>(std::distance(b, it)));
335  }
336  /**
337  * Gets an iterable constant accessor for every value related to an alement
338  * B, i.e., every f(x,B). A domain_error will be thrown if the element is
339  * not
340  * present.
341  */
343  {
344  typename std::set<T>::const_iterator b = elements.begin(),
345  e = elements.end();
346  typename std::set<T>::const_iterator it = std::find(b, e, t);
347  if (it == e) throw std::domain_error("Element not found");
348  return getRelationTo(static_cast<size_t>(std::distance(b, it)));
349  }
350  inline void getRelationTo(size_t i, vector<U>& vec)
351  {
352  size_t N = elements.size();
353  ASSERT_(i < N);
354  vec.resize(N);
356  std::copy(access.begin(), access.end(), vec.begin());
357  }
358  inline void getRelationTo(const T& t, vector<U>& vec)
359  {
360  typename std::set<T>::const_iterator b = elements.begin(),
361  e = elements.end();
362  typename std::set<T>::const_iterator it = std::find(b, e, t);
363  if (it == e) throw std::domain_error("Element not found");
364  getRelationTo(static_cast<size_t>(std::distance(b, it)), vec);
365  }
366  /**
367  * Removes an element at a concrete position.
368  */
369  void removeElementAt(size_t i)
370  {
371  ASSERT_(i < elements.size());
372  typename std::set<T>::const_iterator it = elements.begin();
373  std::advance(it, i);
374  elements.erase(i);
375  std::set<size_t> ii;
376  ii.insert(i);
377  relation.removeRowsAndCols(ii, ii);
378  }
379  /**
380  * Removes an element. Returns false if the element was not present and
381  * thus could'nt be eliminated.
382  */
383  bool removeElement(const T& el)
384  {
385  typename std::set<T>::const_iterator b = elements.begin(),
386  e = elements.end();
387  typename std::set<T>::const_iterator it = std::find(e, b, el);
388  if (it == e) return false;
390  return true;
391  }
392  /**
393  * Removes a set of elements. Returns the number of elements which were
394  * actually erased.
395  */
396  size_t removeElements(const std::set<T>& vals)
397  {
398  std::set<size_t> positions;
399  for (typename std::set<T>::const_iterator it = vals.begin();
400  it != vals.end(); ++it)
401  {
402  typename std::set<T>::iterator elsIt =
403  std::find(elements.begin(), elements.end(), *it);
404  if (elsIt != elements.end())
405  positions.insert(std::distance(elements.begin(), elsIt));
406  }
407  removeElementsAt(positions);
408  return positions.size();
409  }
410  void removeElementsAt(const std::set<size_t>& poss)
411  {
412  relation.removeRowsAndCols(poss, poss);
413  for (std::set<size_t>::const_reverse_iterator it = poss.rbegin();
414  it != poss.rend(); ++it)
415  {
416  typename std::set<T>::const_iterator it2 = elements.begin();
417  std::advance(it2, *it);
418  elements.erase(it2);
419  }
420  }
421  /**
422  * Inserts an element. If the element was present, returns false and its
423  * current position. If it wasn't, returns true and the position in which it
424  * was
425  * inserted.
426  */
427  std::pair<bool, size_t> insertElement(const T& el)
428  {
430  elements.insert(el);
431  size_t dist = std::distance(elements.begin(), ins.first);
432  if (ins.second)
433  {
434  std::multiset<size_t> newEls;
435  newEls.insert(dist);
436  relation.insertRowsAndCols(newEls, newEls);
437  return std::make_pair(true, dist);
438  }
439  else
440  return std::make_pair(false, dist);
441  }
442  /**
443  * Inserts an element and initializes its relationship values, even if it
444  * was already present.
445  */
446  template <typename FunctionType>
447  std::pair<bool, size_t> insertElement(const T& el, FunctionType fun)
448  {
449  std::pair<bool, size_t> ins = insertElement(el);
450  size_t pos = ins.second;
451  for (size_t i = 0; i < elements.size(); ++i)
452  {
453  const T& newEl = operator[](i);
454  applyFunction(fun, pos, i, el, newEl);
455  applyFunction(fun, i, pos, newEl, el);
456  }
457  return ins;
458  }
459  /**
460  * Inserts a set of elements into the relation. Does not initialize the
461  * actual relation.
462  */
463  size_t insertElements(const std::set<T>& els)
464  {
465  if (els.empty()) return 0;
466  // This code is much more complex than it should! Trying, for
467  // efficiency, to avoid multiple calls to insertElement makes things a
468  // lot harder.
469  // It raises the complexity level to N^2, but alleviates it greatly by
470  // making a single memory allocation. Multiple calls to insertElement
471  // will be
472  // faster only if the number of elements in the set is really large.
473  std::vector<size_t> added;
474  // std::vector<size_t> exist;
475  added.reserve(els.size());
476  for (typename std::set<T>::const_iterator it = els.begin();
477  it != els.end(); ++it)
478  {
480  elements.insert(*it);
481  size_t dist = std::distance(elements.begin(), ins.first);
482  if (ins.second)
483  {
484  added.push_back(dist);
485  for (std::vector<size_t>::iterator it2 = added.begin();
486  it2 != added.end(); ++it2)
487  if (*it2 >= dist) ++(*it2);
488  // for (std::vector<size_t>::iterator
489  // it2=exist.begin();it2!=exist.end();++it2) if (*it2>=dist)
490  // ++(*it2);
491  } // else exist.push_back(dist);
492  }
493  std::sort(added.begin(), added.end());
494  for (size_t j = 1; j < added.size(); ++j) added[j] -= j;
495  std::multiset<size_t> poss(added.begin(), added.end());
496  relation.insertRowsAndCols(poss, poss);
497  return added.size();
498  }
499  /**
500  * Inserts a set of elements into the relation, initializing the actual
501  * relation with a given function.
502  */
503  template <typename FunctionType>
504  size_t insertElements(const std::set<T>& els, FunctionType fun)
505  {
506  if (els.empty()) return 0;
507  size_t howMany = insertElements(els);
508  std::set<size_t> poss;
509  {
510  // Little scope for "begin" and "end"...
511  typename std::set<T>::const_iterator begin = elements.begin(),
512  end = elements.end();
513  for (typename std::set<T>::const_iterator it = els.begin();
514  it != els.end(); ++it)
515  poss.insert(std::distance(begin, find(begin, end, *it)));
516  }
517  std::set<size_t> nPoss;
518  std::set<size_t>::const_iterator begin = poss.begin(), end = poss.end();
519  for (size_t i = 0; i < elements.size(); ++i)
520  if (std::find(begin, end, i) == end) nPoss.insert(i);
521  vector<const T*> proxy;
522  proxy.reserve(poss.size());
523  for (std::set<size_t>::const_iterator it = begin; it != end; ++it)
524  {
525  const T& e1 = operator[](*it);
526  proxy.push_back(&e1);
527  size_t i = 0;
528  for (typename std::set<T>::const_iterator it2 = elements.begin();
529  it2 != elements.end(); ++it2, ++i)
530  applyFunction(fun, *it, i, e1, *it2);
531  }
532  for (std::set<size_t>::const_iterator it = nPoss.begin();
533  it != nPoss.end(); ++it)
534  {
535  const T& e1 = operator[](*it);
536  typename std::vector<const T*>::const_iterator itV = proxy.begin();
537  for (std::set<size_t>::const_iterator it2 = poss.begin();
538  it2 != poss.end(); ++it2, ++itV)
539  applyFunction(fun, *it, *it2, e1, **itV);
540  }
541  return howMany;
542  }
543  /**
544  * Completely resets the relation, using a new set of elements. Does not
545  * initialize the relation.
546  */
547  void setElements(const std::set<T>& newEls)
548  {
549  relation.setSize(0, 0);
550  elements = newEls;
551  relation.setSize(newEls.size(), newEls.size());
552  }
553  /**
554  * Returns the amount of elements present in the relation.
555  */
556  inline size_t size() const { return elements.size(); }
557 };
558 
559 namespace detail
560 {
561 // generic version (specialization is after definition of CBinaryRelation):
562 template <typename T, typename U, bool UIsObject, typename FunctionType>
563 inline void applyFunction(
564  CBinaryRelation<T, U, UIsObject>& o, FunctionType fun, size_t e1, size_t e2,
565  const T& T1, const T& T2)
566 {
567  o.getRelationValue(e1, e2) = fun(T1, T2);
568 }
569 
570 /** Template specialization by reference type.
571  */
572 template <typename T, typename U, bool UIsObject>
573 inline void applyFunction(
576  size_t e1, size_t e2, const T& T1, const T& T2)
577 {
578  fun(T1, T2, o.getRelationValue(e1, e2));
579 }
580 } // namespace detail
581 } // namespace math
582 } // namespace mrpt
583 #endif
CMatrixRowAccessor< U > AccessorForFirstElement
Accessor type to every value related to any element A, i.e., f(A,x).
A vector-like wrapper for a const Matrix for accessing the elements of a given column with a [] opera...
void applyFunction(CBinaryRelation< T, U, UIsObject > &o, FunctionType fun, size_t e1, size_t e2, const T &T1, const T &T2)
Scalar * iterator
Definition: eigen_plugins.h:26
U & getRelationValue(size_t e1, size_t e2)
Get a reference to a relation value given its indices, which allows both querying and setting the val...
const_iterator end() const
Gets an iterator to the ending point of the elements set.
This template is a trick to switch the type of a variable using a boolean variable in the template...
GLdouble GLdouble t
Definition: glext.h:3689
void setRelationValue(size_t e1, size_t e2, const U &newVal)
Manually set a relationship value, given the indices.
ConstAccessorForFirstElement getRelationFrom(size_t i) const
Gets a constant accessor for every value related to an element A given its index, i...
const_iterator find(const KEY &key) const
Definition: ts_hash_map.h:219
#define ASSERT_BELOW_(__A, __B)
Definition: exceptions.h:165
void removeElementsAt(const std::set< size_t > &poss)
std::pair< bool, size_t > insertElement(const T &el, FunctionType fun)
Inserts an element and initializes its relationship values, even if it was already present...
typename std::set< T >::const_reverse_iterator const_reverse_iterator
Constant reverse iterator through the set elements.
void(*)(const T &, const T &, U &) FunctionByReferencePass
Function type which obtains the relation value by reference pass.
size_t insertElements(const std::set< T > &els)
Inserts a set of elements into the relation.
This class models a binary relation through the elements of any given set.
std::pair< bool, size_t > insertElement(const T &el)
Inserts an element.
AccessorForFirstElement getRelationFrom(size_t i)
Gets an accessor for every value related to an element A given its index, i.e., every f(A...
void applyFunction(FunctionType fun, size_t e1, size_t e2, const T &T1, const T &T2)
Template used to make the function interface independent from the function type.
const_iterator begin() const
Gets an iterator to the starting point of the elements set.
void getRelationTo(size_t i, vector< U > &vec)
void getRelationFrom(size_t i, vector< U > &vec)
#define ASSERT_(f)
Defines an assertion mechanism.
Definition: exceptions.h:113
size_t removeElements(const std::set< T > &vals)
Removes a set of elements.
A vector-like wrapper for a const Matrix for accessing the elements of a given row with a [] operator...
size_t insertElements(const std::set< T > &els, FunctionType fun)
Inserts a set of elements into the relation, initializing the actual relation with a given function...
std::set< T > elements
Actual set of elements.
ConstAccessorForSecondElement getRelationTo(size_t i) const
Gets a constant accessor for every value related to an element B given its index, i...
CConstMatrixColumnAccessor< U > ConstAccessorForSecondElement
Const accessor type to every value related to any element B, i.e., f(x,B).
U & getRelationValue(const T &t1, const T &t2)
Get a reference to a relation value given the elements, which allows both querying and setting...
MatrixType relation
Matrix storing the relation.
ConstAccessorForSecondElement getRelationTo(const T &t) const
Gets an iterable constant accessor for every value related to an alement B, i.e., every f(x...
GLuint GLuint end
Definition: glext.h:3528
void initializeWith(FunctionType fun)
Initialize the whole relation with a given function.
const_reverse_iterator rend() const
Gets a reverse iterator to the starting point of the elements set.
GLubyte GLubyte b
Definition: glext.h:6279
U(*)(T, T) SimpleFunctionByReturnValue
Simple function type, used to initialize chunks of the matrix.
A vector-like wrapper for a Matrix for accessing the elements of a given row with a [] operator...
void setElements(const std::set< T > &newEls)
Completely resets the relation, using a new set of elements.
void getRelationFrom(const T &t, vector< U > &vec)
void getRelationTo(const T &t, vector< U > &vec)
CBinaryRelation(const std::set< T > &els, FunctionType fun)
Constructor which initializes the relation using a given function.
void removeElementAt(size_t i)
Removes an element at a concrete position.
bool removeElement(const T &el)
Removes an element.
AccessorForSecondElement getRelationTo(size_t i)
Gets an accessor for every value related to an element B given its index, i.e., every f(x...
U(*)(const T &, const T &) FunctionByReturnValue
Function type which obtains the relation value by a return value.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
CBinaryRelation(const std::set< T > &els)
Default constructor, doesn&#39;t initialize the relation.
const U & getRelationValue(size_t e1, size_t e2) const
Get a relation value, given the indices.
typename std::set< T >::const_iterator const_iterator
Constant iterator through the set elements.
void initializeSymmetricallyWith(FunctionType fun)
Initialize the whole relation with a given function, assuming that the relation is symmetrical...
size_t size() const
Returns the amount of elements present in the relation.
CMatrixColumnAccessor< U > AccessorForSecondElement
Accessor type to every value related to any element B, i.e., f(x,B).
ConstAccessorForFirstElement getRelationFrom(const T &t) const
Gets an iterable constant accessor for every value related to an element A, i.e., every f(A...
typedef void(APIENTRYP PFNGLBLENDCOLORPROC)(GLclampf red
typename detail::MatrixWrapper< U, UIsObject >::MatrixType MatrixType
Matrix type used to store the actual relation.
GLsizeiptr size
Definition: glext.h:3923
bool setRelationValue(const T &t1, const T &t2, const U &newVal)
Manually set a relationship value, given the elements.
AccessorForSecondElement getRelationTo(const T &t)
Gets an iterable accessor for every value related to an element B, i.e., every f(x,B).
T operator[](size_t i) const
Operator for direct access to a element given its index.
A vector-like wrapper for a Matrix for accessing the elements of a given column with a [] operator...
U & operator()(size_t e1, size_t e2)
const U & operator()(size_t e1, size_t e2) const
const Scalar * const_iterator
Definition: eigen_plugins.h:27
const_reverse_iterator rbegin() const
Gets a reverse iterator to the ending point of the elements set.
AccessorForFirstElement getRelationFrom(const T &t)
Gets an iterable accessor for every value related to an element A, i.e., every f(A,x).
U getRelationValue(const T &t1, const T &t2) const
Get a relation value, given the elements.
double distance(const TPoint2D &p1, const TPoint2D &p2)
Gets the distance between two points in a 2D space.
Definition: geometry.cpp:1891
CConstMatrixRowAccessor< U > ConstAccessorForFirstElement
Const accessor type to every value related to any element A, i.e., f(A,x).



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at lun oct 28 00:14:14 CET 2019