Skip to content
Snippets Groups Projects
Commit 61ca818b authored by Dr. Felix Tobias Schindler's avatar Dr. Felix Tobias Schindler Committed by Tobias Leibner
Browse files

[vector] add sup_norm(vec)

parent 43604ae0
No related branches found
No related tags found
No related merge requests found
...@@ -290,6 +290,29 @@ typename std::enable_if<is_vector<VectorType>::value, VectorType>::type zeros_li ...@@ -290,6 +290,29 @@ typename std::enable_if<is_vector<VectorType>::value, VectorType>::type zeros_li
} }
template <class VectorType>
std::enable_if_t<is_vector<VectorType>::value, typename VectorAbstraction<VectorType>::R>
sup_norm(const VectorType& vector)
{
typename VectorAbstraction<VectorType>::R result(0);
for (size_t ii = 0; ii < vector.size(); ++ii)
result = std::max(result, std::abs(vector[ii]));
return result;
}
template <class F>
typename FieldTraits<F>::real_type sup_norm(const DynamicVector<F>& vector)
{
return vector.infinity_norm();
}
template <class F, int SIZE>
typename FieldTraits<F>::real_type sup_norm(const FieldVector<F, SIZE>& vector)
{
return vector.infinity_norm();
}
template <class VectorType> template <class VectorType>
typename std::enable_if<is_vector<VectorType>::value, typename VectorAbstraction<VectorType>::ScalarType*>::type typename std::enable_if<is_vector<VectorType>::value, typename VectorAbstraction<VectorType>::ScalarType*>::type
data(VectorType& source) data(VectorType& source)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment