diff --git a/libs/main/math/pimathcomplex.h b/libs/main/math/pimathcomplex.h index 2bcc7fea..46d75e6b 100644 --- a/libs/main/math/pimathcomplex.h +++ b/libs/main/math/pimathcomplex.h @@ -117,4 +117,33 @@ inline PIVector2D abs(const PIVector2D & v) { return result; } + +/** +* @brief Inline funtion of compare with zero different types +* +* @param v is input parameter of type T +* @return true if zero, false if not zero +*/ +template::value, int>::type = 0> +inline bool PIMathFloatNullCompare(const T v) { + static_assert(std::is_floating_point::value, "Type must be floating point"); + return (piAbs(v) < T(1E-200)); +} + +/** +* @brief Inline funtion of compare with zero colmplexf type +* +* @param v is input parameter of type colmplexf +* @return true if zero, false if not zero +*/ +template::value || + std::is_floating_point::value + , int>::type = 0> +inline bool PIMathFloatNullCompare(const T v) { + static_assert(std::is_floating_point::value, "Type must be floating point"); + static_assert(std::is_floating_point::value, "Type must be floating point"); + return (abs(v) < float(1E-200)); +} + #endif // PIMATHCOMPLEX_H diff --git a/libs/main/math/pimathmatrix.h b/libs/main/math/pimathmatrix.h index 3f89c4b5..1d5b71ee 100644 --- a/libs/main/math/pimathmatrix.h +++ b/libs/main/math/pimathmatrix.h @@ -28,34 +28,6 @@ #include "pimathvector.h" #include "pimathcomplex.h" -/** -* @brief Inline funtion of compare with zero different types -* -* @param v is input parameter of type T -* @return true if zero, false if not zero -*/ -template::value, int>::type = 0> -inline bool _PIMathMatrixNullCompare(const T v) { - static_assert(std::is_floating_point::value, "Type must be floating point"); - return (piAbs(v) < T(1E-200)); -} - -/** -* @brief Inline funtion of compare with zero colmplexf type -* -* @param v is input parameter of type colmplexf -* @return true if zero, false if not zero -*/ -template::value || - std::is_floating_point::value - , int>::type = 0> -inline bool _PIMathMatrixNullCompare(const T v) { - static_assert(std::is_floating_point::value, "Type must be floating point"); - static_assert(std::is_floating_point::value, "Type must be floating point"); - return (abs(v) < float(1E-200)); -} - /// Matrix templated @@ -1219,7 +1191,7 @@ public: for (uint k = i; k < _V2D::cols_; ++k) smat.element(k, j) -= mul * smat.element(k, i); } if (i < _V2D::cols_ - 1) { - if (_PIMathMatrixNullCompare(smat.element(i + 1, i + 1))) { + if (PIMathFloatNullCompare(smat.element(i + 1, i + 1))) { if (ok != 0) *ok = false; return *this; } @@ -1269,7 +1241,7 @@ public: if (sv != 0) (*sv)[j] -= mul * (*sv)[i]; } if (i < _V2D::cols_ - 1) { - if (_PIMathMatrixNullCompare(smat.element(i + 1, i + 1))) { + if (PIMathFloatNullCompare(smat.element(i + 1, i + 1))) { if (ok != 0) *ok = false; return *this; }