Remove redundant code.

This commit is contained in:
2018-03-13 14:28:00 +01:00
parent e21c7b33e8
commit 93d4cb4df0
6 changed files with 69 additions and 68 deletions

View File

@@ -207,4 +207,21 @@ namespace fmri
return indices;
}
/**
* Fix non-normal floating point values in a range.
*
* @tparam It
* @param first Start of range iterator
* @param last Past the end of range iterator
* @param normalValue Value to assign to non-normal values. Default 1.
*/
template<class It>
inline void normalize(It first, It last, typename std::iterator_traits<It>::value_type normalValue = 1)
{
for (; first != last; ++first) {
if (!std::isnormal(*first)) {
*first = normalValue;
}
}
}
}