diff options
Diffstat (limited to 'src/vZ')
-rw-r--r-- | src/vZ/EquationSystem.hpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/vZ/EquationSystem.hpp b/src/vZ/EquationSystem.hpp index 0963baf..6409f18 100644 --- a/src/vZ/EquationSystem.hpp +++ b/src/vZ/EquationSystem.hpp @@ -21,6 +21,8 @@ #ifndef VZ_EQUATIONSYSTEM_HPP #define VZ_EQUATIONSYSTEM_HPP +#include <algorithm> +#include <cmath> #include <cstddef> namespace vZ @@ -149,6 +151,18 @@ namespace vZ } return *this; } + + template <std::size_t N, typename T> + typename EquationSystem<N, T>::Scalar + abs(const EquationSystem<N, T>& es) + { + typename EquationSystem<N, T>::Scalar ret(0); + for (std::size_t i = 0; i < N; ++i) { + using std::abs; + ret = std::max(ret, abs(es[i])); + } + return ret; + } } #endif // VZ_EQUATIONSYSTEM_HPP |