.. _program_listing_file__tmp_ws_src_ecl_core_ecl_math_include_ecl_math_norms.hpp: Program Listing for File norms.hpp ================================== |exhale_lsh| :ref:`Return to documentation for file ` (``/tmp/ws/src/ecl_core/ecl_math/include/ecl/math/norms.hpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp /***************************************************************************** ** Ifdefs *****************************************************************************/ #ifndef ECL_MATH_NORMS_HPP_ #define ECL_MATH_NORMS_HPP_ /***************************************************************************** ** Includes *****************************************************************************/ #include /***************************************************************************** ** Namespaces *****************************************************************************/ namespace ecl { /***************************************************************************** ** Functors *****************************************************************************/ class EuclideanNorm { public: template T operator()(const T& x1, const T& x2) { return std::sqrt(x1*x1 + x2*x2); } template T operator()(const T& x1, const T& x2, const T& x3) { return std::sqrt(x1*x1 + x2*x2 + x3*x3); } // n dimensional cases using vectors, valarrays and eigen vectors here. // maybe also a norm(vectorx, vectory) which is sqrt((x0-y0)^2+(x1-y1)^2.....) }; /***************************************************************************** ** Functions *****************************************************************************/ template T euclidean_norm(const T& x1, const T& x2) { return std::sqrt(x1*x1 + x2*x2); } template T euclidean_norm(const T& x1, const T& x2, const T& x3) { return std::sqrt(x1*x1 + x2*x2 + x3*x3); } } // namespace ecl #endif /* ECL_MATH_NORMS_HPP_ */