Commit 358c618f authored by Kilian Lackhove's avatar Kilian Lackhove
Browse files

added Vmath::Nnan

parent a31e519c
......@@ -865,6 +865,27 @@ namespace Vmath
template LIB_UTILITIES_EXPORT Nektar::NekDouble Vmin( int n, const Nektar::NekDouble *x, const int incx);
template LIB_UTILITIES_EXPORT int Vmin( int n, const int *x, const int incx);
/// \brief Return number of NaN elements of x
template<class T> int Nnan(int n, const T *x, const int incx)
{
int nNan = 0;
while (n--)
{
if (isnan(*x))
{
nNan++;
}
x += incx;
}
return nNan;
}
template LIB_UTILITIES_EXPORT int Nnan(int n, const Nektar::NekDouble *x, const int incx);
template LIB_UTILITIES_EXPORT int Nnan(int n, const int *x, const int incx);
/// \brief vvtvp (vector times vector times vector): z = w*x*y
template<class T> T Dot( int n,
const T *w,
......
......@@ -248,6 +248,10 @@ namespace Vmath
/// \brief Return the minimum element in x - called vmin to avoid
/// conflict with min
template<class T> LIB_UTILITIES_EXPORT T Vmin( int n, const T *x, const int incx);
/// \brief Return number of NaN elements of x
template<class T> LIB_UTILITIES_EXPORT int Nnan(int n, const T *x, const int incx);
/// \brief vvtvp (vector times vector times vector): z = w*x*y
template<class T> LIB_UTILITIES_EXPORT T Dot( int n,
......
......@@ -387,6 +387,14 @@
return Vmin(n,&x[0],incx);
}
/// \brief Return number of NaN elements of x
template<class T> int Nnan(int n, const Array<OneD, const T> &x, const int incx)
{
ASSERTL1(n * incx <= x.num_elements() + x.GetOffset(), "Array out of bounds");
return Nnan(n, &x[0], incx);
}
/// \brief
template<class T> T Dot(int n,
const Array<OneD, const T> &w,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment