-// Copyright (C) 2007-2016 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2022 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 epsilonEqual(dot(cros, cros), 0.0, eps);
}
+ /**
+ * Caracteristic vector size (its biggest component, in absolute)
+ */
+ inline double caracteristicDimVector(const double *v)
+ {
+ double ret = 0;
+ for (int i = 0; i < 3; i++)
+ ret = std::max(ret, std::fabs(v[i]));
+ return ret;
+ }
/**
* Compares doubles using a relative tolerance
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