MVE - Multi-View Environment mve-devel
Loading...
Searching...
No Matches
Classes | Functions
math::algo Namespace Reference

Algorithms, functors, value interpolation, etc. More...

Classes

struct  foreach_addition_with_const
 for-each functor: adds a constant value to operand. More...
 
struct  foreach_constant_power
 for-each functor: raises each operand to the power of constant value. More...
 
struct  foreach_divide_by_const
 for-each functor: divides operand by constant divisor. More...
 
struct  foreach_matrix_mult
 for-each functor: matrix-vector multiplication. More...
 
struct  foreach_multiply_with_const
 for-each functor: multiplies operand with constant factor. More...
 
struct  foreach_substraction_with_const
 for-each functor: substracts a constant value to operand. More...
 
struct  IncrementGenerator
 
struct  InterleavedIter
 Iterator that advances 'S' elements of type T. More...
 
struct  predicate_epsilon_equal
 Epsilon comparator predicate. More...
 

Functions

template<typename T >
accum_absolute_sum (T const &init, T const &next)
 Absolute sum accumulator.
 
template<typename T >
accum_squared_sum (T const &init, T const &next)
 Squared sum accumulator.
 
template<typename Key , typename Value >
Value const * binary_search (std::vector< std::pair< Key, Value > > const &vec, Key const &key)
 Algorithm that finds the value corresponding to a key in sorted vector of key-value pairs.
 
template<typename T >
void foreach_absolute_value (T &val)
 for-each functor: applies absolute value to operand.
 
template<typename T >
void foreach_ceil (T &val)
 for-each functor: applies ceil operation to the operand.
 
template<typename T >
void foreach_floor (T &val)
 for-each functor: applies floor operation to the operand.
 
template<typename T >
void foreach_invert_value (T &val)
 for-each functor: inverts floating point values with 1/value.
 
template<typename T >
void foreach_negate_value (T &val)
 for-each functor: negates the operand.
 
template<typename T >
void foreach_round (T &val)
 for-each functor: applies rounding to the operand.
 
template<typename T >
void kernel_region (T const &cx, T const &cy, T const &ks, T const &width, T const &height, T *x1, T *x2, T *y1, T *y2)
 Returns the kernel region (x1,y1) to (x2,y2) for a kernel of size ks for image of size (width, height) and for center pixel (cx,cy).
 
template<typename FwdIter >
std::size_t max_element_id (FwdIter first, FwdIter last)
 Algorithm that returns the ID (starting from zero at element 'first') of the largest element in range [first, last[.
 
template<typename FwdIter >
std::size_t min_element_id (FwdIter first, FwdIter last)
 Algorithm that returns the ID (starting from zero at element 'first') of the smallest element in range [first, last[.
 
template<class V , class P >
void permute_math (std::vector< V > &v, std::vector< P > const &p)
 This function permutes a vector of elements v using a permutation given by vector p, calculating v' = p(v).
 
template<class V , class P >
void permute_reloc (std::vector< V > &v, std::vector< P > const &p)
 This function permutes a vector of elements v using a permutation given by vector p, calculating v' = p(v).
 
template<typename T >
void sort_values (T *a, T *b, T *c)
 
template<typename T >
void vector_clean (std::vector< bool > const &delete_list, std::vector< T > *vector)
 Erases all elements from 'vector' that are marked with 'true' in 'delete_list'.
 

Detailed Description

Algorithms, functors, value interpolation, etc.

Function Documentation

◆ accum_absolute_sum()

template<typename T >
T math::algo::accum_absolute_sum ( T const &  init,
T const &  next 
)
inline

Absolute sum accumulator.

Definition at line 128 of file algo.h.

◆ accum_squared_sum()

template<typename T >
T math::algo::accum_squared_sum ( T const &  init,
T const &  next 
)
inline

Squared sum accumulator.

Definition at line 120 of file algo.h.

◆ binary_search()

template<typename Key , typename Value >
Value const * math::algo::binary_search ( std::vector< std::pair< Key, Value > > const &  vec,
Key const &  key 
)

Algorithm that finds the value corresponding to a key in sorted vector of key-value pairs.

If the key does not exist, null is returned.

Definition at line 83 of file algo.h.

◆ foreach_absolute_value()

template<typename T >
void math::algo::foreach_absolute_value ( T &  val)
inline

for-each functor: applies absolute value to operand.

Definition at line 277 of file algo.h.

◆ foreach_ceil()

template<typename T >
void math::algo::foreach_ceil ( T &  val)
inline

for-each functor: applies ceil operation to the operand.

Definition at line 309 of file algo.h.

◆ foreach_floor()

template<typename T >
void math::algo::foreach_floor ( T &  val)
inline

for-each functor: applies floor operation to the operand.

Definition at line 301 of file algo.h.

◆ foreach_invert_value()

template<typename T >
void math::algo::foreach_invert_value ( T &  val)
inline

for-each functor: inverts floating point values with 1/value.

Definition at line 293 of file algo.h.

◆ foreach_negate_value()

template<typename T >
void math::algo::foreach_negate_value ( T &  val)
inline

for-each functor: negates the operand.

Definition at line 285 of file algo.h.

◆ foreach_round()

template<typename T >
void math::algo::foreach_round ( T &  val)
inline

for-each functor: applies rounding to the operand.

Definition at line 317 of file algo.h.

◆ kernel_region()

template<typename T >
void math::algo::kernel_region ( T const &  cx,
T const &  cy,
T const &  ks,
T const &  width,
T const &  height,
T *  x1,
T *  x2,
T *  y1,
T *  y2 
)
inline

Returns the kernel region (x1,y1) to (x2,y2) for a kernel of size ks for image of size (width, height) and for center pixel (cx,cy).

The kernel size ks is the half-size, i.e. 2*ks+1 is full kernel size. Values x2 and y2 are inclusive, i.e. belong to the kernel.

Definition at line 197 of file algo.h.

◆ max_element_id()

template<typename FwdIter >
std::size_t math::algo::max_element_id ( FwdIter  first,
FwdIter  last 
)

Algorithm that returns the ID (starting from zero at element 'first') of the largest element in range [first, last[.

Definition at line 57 of file algo.h.

◆ min_element_id()

template<typename FwdIter >
std::size_t math::algo::min_element_id ( FwdIter  first,
FwdIter  last 
)

Algorithm that returns the ID (starting from zero at element 'first') of the smallest element in range [first, last[.

Definition at line 31 of file algo.h.

◆ permute_math()

template<class V , class P >
void math::algo::permute_math ( std::vector< V > &  v,
std::vector< P > const &  p 
)

This function permutes a vector of elements v using a permutation given by vector p, calculating v' = p(v).

In this algorithm, p is more mathematically defined and computationally is more efficient:

v'_i = v_p[i] e.g. v = [a, b, c], p = [1, 2, 0], v' = [b, c, a]

Each element is copied only once inside the vector, and elements at the beginning of a cycle are copied twice.

"permute_reloc" and "permute_math" are inverse to each other.

Definition at line 102 of file permute.h.

◆ permute_reloc()

template<class V , class P >
void math::algo::permute_reloc ( std::vector< V > &  v,
std::vector< P > const &  p 
)

This function permutes a vector of elements v using a permutation given by vector p, calculating v' = p(v).

Vector p can be seen as a mapping from old indices to new indices,

v'_p[i] = v_i e.g. v = [a, b, c], p = [1, 2, 0], v' = [c, a, b].

which is better called a index-based relocation of the elements. Each element is copied two times, from the original vector to a temporary variable, and back to the vector using cycles in the permutation.

"permute_reloc" and "permute_math" are inverse to each other.

Definition at line 59 of file permute.h.

◆ sort_values()

template<typename T >
void math::algo::sort_values ( T *  a,
T *  b,
T *  c 
)
inline

Definition at line 208 of file algo.h.

◆ vector_clean()

template<typename T >
void math::algo::vector_clean ( std::vector< bool > const &  delete_list,
std::vector< T > *  vector 
)

Erases all elements from 'vector' that are marked with 'true' in 'delete_list'.

The remaining elements are kept in order but relocated to another position in the vector.

Definition at line 166 of file algo.h.