-// Copyright (C) 2007-2016 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2021 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#ifndef __VECTORUTILS_HXX__
#define __VECTORUTILS_HXX__
+#include <algorithm>
#include <sstream>
#include <numeric>
#include <string>
#include <cmath>
#include <map>
+
namespace INTERP_KERNEL
{
/// Precision used for tests of 3D part of INTERP_KERNEL
return relError < relTol;
}
+ inline double sumOfAbsoluteValues(const double row[3])
+ {
+ double ret(0.);
+ std::for_each(row,row+3,[&ret](double v) { ret += std::abs(v); });
+ return ret;
+ }
+
+ /*!
+ * Returns the infinite norm of a 3x3 input matrix \a mat.
+ * The max of absolute value of row sum.
+ */
+ inline double normInf(const double mat[9])
+ {
+ double ret(std::max(sumOfAbsoluteValues(mat),sumOfAbsoluteValues(mat+3)));
+ return std::max(ret,sumOfAbsoluteValues(mat+6));
+ }
+
}
#endif