|
template<typename T > |
T | accum_absolute_sum (T const &init, T const &next) |
| Absolute sum accumulator.
|
|
template<typename T > |
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'.
|
|
Algorithms, functors, value interpolation, etc.
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.
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.
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.