utils/include/utils

namespace feasst

Functions

template<class T>
bool find_in_list(const T value, const std::vector<T> &list, int *index)

Return true if value is found in list, and the index of that value in list.

param list:

search for this value

param index:

list to search for value return the last index in list where value was found

template<class T>
bool find_in_list(const T value, const std::vector<T> &list)

Same as above, but do not return the index.

template<class T1, class T2>
bool find_in_list(const T1 value, const std::vector<std::pair<T1, T2>> &list, int *index)

Same as above, but use the first element of pair in list.

template<class T>
void resize(const int xs, const int ys, std::vector<std::vector<T>> *vec)

Resize two dimensional vector to size xs, ys. Note to HWH: rewrite using variadic templates for arbitrary dimensions

template<class T>
void resize(const int xs, const int ys, const int zs, std::vector<std::vector<std::vector<T>>> *vec)

Resize three dimensional vector. Note to HWH: rewrite using variadic templates for arbitrary dimensions

template<class T>
void resize(const int dim0, const int dim1, const int dim2, const int dim3, std::vector<std::vector<std::vector<std::vector<T>>>> *vec)

Resize four dimensional vector.

template<class T>
void resize(const int dim0, const int dim1, const int dim2, const int dim3, const int dim4, std::vector<std::vector<std::vector<std::vector<std::vector<T>>>>> *vec)

Resize five dimensional vector.

template<class T>
void resize(const int dim0, const int dim1, const int dim2, const int dim3, const int dim4, const int dim5, std::vector<std::vector<std::vector<std::vector<std::vector<std::vector<T>>>>>> *vec)

Resize six dimensional vector.

template<typename T>
void fill(const T value, std::vector<T> *vec)

Fill vector with a constant.

template<typename T1, typename T2>
void fill(const T1 value, std::vector<T2> *vec)

Fill multi-dimensional vector with a constant.

template<class T>
int num_elements(const std::vector<T> &vec)

Return the total number of elements in a vector.

template<class T>
int num_elements(const std::vector<std::vector<T>> &vec)

Return the total number of elements in a multidimensional vector.

template<class T>
bool has_duplicate(const std::vector<T> &vec)

Return true if the sorted vector contains a duplicate value.

template<class T>
bool is_equal(const std::vector<T> &vec1, const std::vector<T> &vec2, const double tolerance = 1e-15)
template<class T>
bool is_equal(const std::vector<std::vector<T>> &vec1, const std::vector<std::vector<T>> &vec2, const double tolerance = 1e-15)
template<class T>
bool is_equal(const std::vector<std::vector<std::vector<T>>> &vec1, const std::vector<std::vector<std::vector<T>>> &vec2, const double tolerance = 1e-15)
template<class T>
bool is_equal(const std::vector<std::vector<std::vector<std::vector<T>>>> &vec1, const std::vector<std::vector<std::vector<std::vector<T>>>> &vec2, const double tolerance = 1e-15)
template<class T>
bool is_equal(const std::vector<std::vector<std::vector<std::vector<std::vector<T>>>>> &vec1, const std::vector<std::vector<std::vector<std::vector<std::vector<T>>>>> &vec2, const double tolerance = 1e-15)