Newer
Older
T max = (T)constant::MIN_double;
for (auto &i : input)
if (i > max)
max = i;
return max;
}
template int calcul::vtr_max(vtr<int> const &input);
template double calcul::vtr_max<double>(vtr<double> const &input);
///Finds maximal value contained in the 2d input vector.
///@tparam data type of searched vector
///@param[in] input vector
///@return maximal value
template <typename T>
T calcul::vtr_max(vtr2<T> const &input)
{
double max = constant::MIN_double;
for (auto &&i : input)
for (auto &&j : i)
if (j > max)
max = j;
return max;
}
template double calcul::vtr_max<double>(vtr2<double> const &input);
///Finds maximal value contained in the 3d input vector.
///@param[in] input vector
///@return maximal value
template <typename T>
T calcul::vtr_max(vtr3<T> const &input)
{
double max = constant::MIN_double;
for (auto const &i : input) {
auto tmp = vtr_findMax(i);
if (tmp > max)
max = tmp;
}
return max;
}
///Finds minimal value contained in the input vector.
///@param[in] input vector
///@return minimal value
template <typename T>
T calcul::vtr_min(vtr<T> const &input)
{
T min = (T)constant::MAX_double;
for (auto &i : input)
if (i < min)
min = i;
return min;
}
template double calcul::vtr_min<double>(vtr<double> const &input);
///Finds minimal value contained in the input vector.
///@param[in] input vector
///@return minimal value
template <typename T>
T calcul::vtr_min(vtr2<T> const &input)
{
double min = constant::MAX_double;
for (auto const &i : input)
for (auto const &j : i)
if (j < min)
min = j;
return min;
}
template double calcul::vtr_min<double>(vtr2<double> const &input);