aboutsummaryrefslogtreecommitdiff
path: root/src/jtutil/norm.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/jtutil/norm.cc')
-rw-r--r--src/jtutil/norm.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/jtutil/norm.cc b/src/jtutil/norm.cc
index 1878e74..d6f0baf 100644
--- a/src/jtutil/norm.cc
+++ b/src/jtutil/norm.cc
@@ -5,8 +5,8 @@
// *** class jtutil::norm::
//
-#include <float.h>
-#include <math.h>
+#include <cmath>
+#include <algorithm>
#include <assert.h>
#include "jt/util.hh"
@@ -21,7 +21,7 @@ template <typename fp>
{
++N_;
sum2_ += x*x;
-infinity_norm_ = jtutil::max(infinity_norm_, jtutil::abs(x));
+infinity_norm_ = std::max(infinity_norm_, jtutil::abs<fp>(x));
}
} // namespace jtutil::
@@ -31,10 +31,10 @@ infinity_norm_ = jtutil::max(infinity_norm_, jtutil::abs(x));
namespace jtutil
{
template<typename fp>
- fp norm<fp>::two_norm() const { return sqrt(sum2_); }
+ fp norm<fp>::two_norm() const { return std::sqrt(sum2_); }
template<typename fp>
fp norm<fp>::rms_norm() const
- { assert(is_nonempty()); return sqrt(sum2_/fp(N_)); }
+ { assert(is_nonempty()); return std::sqrt(sum2_/fp(N_)); }
template<typename fp>
fp norm<fp>::infinity_norm() const { return infinity_norm_; }
} // namespace jtutil::