# Changeset 825 for trunk/yat/utility

Ignore:
Timestamp:
Mar 19, 2007, 1:46:10 PM (16 years ago)
Message:

removed minmax functions and moved shuffle into vector.*

Location:
trunk/yat/utility
Files:
4 edited

Unmodified
Removed
• ## trunk/yat/utility/utility.cc

 r737 std::pair minmax_index(const vector& vec, const std::vector& subset) { size_t min_index = subset[0]; size_t max_index = subset[0]; for (unsigned int i=1; i vec[max_index]) max_index = subset[i]; return std::pair(min_index, max_index); } void shuffle(vector& invec) { vector vec(invec); random::DiscreteUniform rnd; for (size_t i=0; i
• ## trunk/yat/utility/utility.h

 r737 bool is_nan(const std::string& s); /** This function returns the indices of the minimum and maximum values in the sub-vector (defined by \a subset), storing them in imin and imax. When there are several equal minimum or maximum elements then the lowest indices are returned. The returned index is the index from the complete vector (not the sub-vector) @return Index corresponding to the smallest and largest value. @note If \a subset is emtpy, the result is undefined. */ std::pair minmax_index(const vector& vec, const std::vector& subset); /** Randomly shuffles the elements in vector \a invec */ void shuffle(vector& invec);
• ## trunk/yat/utility/vector.cc

 r810 #include "matrix.h" #include "utility.h" #include "yat/random/random.h" #include std::pair minmax(const vector& v) { std::pair minmax; gsl_vector_minmax(v.gsl_vector_p(), &minmax.first, &minmax.second); return minmax; } std::pair minmax_index(const vector& v) { std::pair minmax; gsl_vector_minmax_index(v.gsl_vector_p(), &minmax.first, &minmax.second); return minmax; } bool nan(const vector& templat, vector& flag) { void shuffle(vector& invec) { vector vec(invec); random::DiscreteUniform rnd; for (size_t i=0; i
• ## trunk/yat/utility/vector.h

 r811 /** \brief Get the minimum and maximim values of the vector. \return The minimum and maximum values of the vector, respectively. */ std::pair minmax(const vector&); /** \brief Locate the maximum and minumum element in the vector. \return The indecies to the element with the minimum and maximum values of the vector, respectively. \note Lower index has precedence. */ std::pair minmax_index(const vector&); /** \brief Create a vector \a flag indicating NaN's in another vector \a templat. \return True if the \a templat vector contains at least one NaN. */ bool nan(const matrix& templat, matrix& flag); bool nan(const vector& templat, vector& flag); /** /** Randomly shuffles the elements in vector \a invec */ void shuffle(vector& invec); /** Sort the elements in the vector.
Note: See TracChangeset for help on using the changeset viewer.