diff --git a/Modules/ThirdParty/VNL/UpdateFromUpstream.sh b/Modules/ThirdParty/VNL/UpdateFromUpstream.sh
index 299352586a6..781bf9df4fe 100755
--- a/Modules/ThirdParty/VNL/UpdateFromUpstream.sh
+++ b/Modules/ThirdParty/VNL/UpdateFromUpstream.sh
@@ -8,7 +8,7 @@ readonly name='VXL'
readonly ownership='Insight Software Consortium Maintainers '
readonly subtree="Modules/ThirdParty/VNL/src/vxl"
readonly repo="https://github.com/InsightSoftwareConsortium/vxl.git"
-readonly tag="for/itk-vxl-master-272c3f1" # 2026-06-09 (272c3f1: linkage fixes + config-option removals)
+readonly tag="for/itk-vxl-master-7829892" # 2026-06-10 (7829892: vnl_math:: deprecation campaign + sqrteps 0x1p-26)
readonly shortlog=false
readonly exact_tree_match=false
readonly paths="
diff --git a/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/tests/test_integral.cxx b/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/tests/test_integral.cxx
index 33febf117a2..1eec4eaf05a 100644
--- a/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/tests/test_integral.cxx
+++ b/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/tests/test_integral.cxx
@@ -27,7 +27,7 @@ class gaussian_integrant : public vnl_analytic_integrant
, p0_(p0)
, oneoversr2_(1.0 / sr_ / sr_)
, oneoversz2_(1.0 / sz_ / sz_)
- , normalizer_(-sr_ * sr_ / (sz_ * 2 * vnl_math::sqrt2pi))
+ , normalizer_(-sr_ * sr_ / (sz_ * 2 * vnl_math::detail::sqrt2pi))
{}
void
diff --git a/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/tests/test_qsvd.cxx b/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/tests/test_qsvd.cxx
index d70b5ed00d7..3a015c65cdf 100644
--- a/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/tests/test_qsvd.cxx
+++ b/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/tests/test_qsvd.cxx
@@ -1,5 +1,5 @@
#include
-#include "vnl/vnl_math.h" // vnl_math::abs()
+#include "vnl/vnl_math.h" // vnl_math::detail::abs()
#include "testlib/testlib_test.h"
#undef printf // to work around a bug in libintl.h
@@ -76,13 +76,13 @@ test_qsvd()
AA[8]);
TEST("D1 must be (0.6,0.8,0.6)",
- vnl_math::abs(Alpha[0] - 0.6) < 1e-6 && vnl_math::abs(Alpha[1] - 0.8) < 1e-6 &&
- vnl_math::abs(Alpha[2] - 0.6) < 1e-6,
+ vnl_math::detail::abs(Alpha[0] - 0.6) < 1e-6 && vnl_math::detail::abs(Alpha[1] - 0.8) < 1e-6 &&
+ vnl_math::detail::abs(Alpha[2] - 0.6) < 1e-6,
true);
TEST("D2 must be (0.8,0.6,0.8)",
- vnl_math::abs(Beta[0] - 0.8) < 1e-6 && vnl_math::abs(Beta[1] - 0.6) < 1e-6 &&
- vnl_math::abs(Beta[2] - 0.8) < 1e-6,
+ vnl_math::detail::abs(Beta[0] - 0.8) < 1e-6 && vnl_math::detail::abs(Beta[1] - 0.6) < 1e-6 &&
+ vnl_math::detail::abs(Beta[2] - 0.8) < 1e-6,
true);
}
diff --git a/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_amoeba.cxx b/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_amoeba.cxx
index 6610883ddd9..28dddfcd0a3 100644
--- a/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_amoeba.cxx
+++ b/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_amoeba.cxx
@@ -90,7 +90,7 @@ struct vnl_amoebaFit : public vnl_amoeba
int
vnl_amoeba_SimplexCorner::compare(const vnl_amoeba_SimplexCorner & s1, const vnl_amoeba_SimplexCorner & s2)
{
- return vnl_math::sgn(s1.fv - s2.fv);
+ return vnl_math::detail::sgn(s1.fv - s2.fv);
}
static int
@@ -112,7 +112,7 @@ maxabsdiff(const vnl_vector & a, const vnl_vector & b)
double v = 0;
for (unsigned i = 0; i < a.size(); ++i)
{
- const double ad = vnl_math::abs(a[i] - b[i]);
+ const double ad = vnl_math::detail::abs(a[i] - b[i]);
if (ad > v)
v = ad;
}
@@ -180,7 +180,7 @@ vnl_amoebaFit::set_up_simplex_relative(std::vector & s
s->v = x;
// perturb s->v(j)
- if (vnl_math::abs(s->v[j]) > zero_term_delta)
+ if (vnl_math::detail::abs(s->v[j]) > zero_term_delta)
s->v[j] = (1 + usual_delta) * s->v[j];
else
s->v[j] = zero_term_delta;
diff --git a/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_powell.cxx b/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_powell.cxx
index bd0fa91adb6..237f944a1c2 100644
--- a/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_powell.cxx
+++ b/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_powell.cxx
@@ -169,7 +169,7 @@ vnl_powell::minimize(vnl_vector & p)
report_eval(fret);
if (fptt < fp)
{
- const double t = 2.0 * (fp - 2.0 * fret + fptt) * vnl_math::sqr(fp - fret - del) - del * vnl_math::sqr(fp - fptt);
+ const double t = 2.0 * (fp - 2.0 * fret + fptt) * vnl_math::detail::sqr(fp - fret - del) - del * vnl_math::detail::sqr(fp - fptt);
if (t < 0.0)
{
f1d.init(p, xit);
diff --git a/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_qr.hxx b/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_qr.hxx
index 805f560f38b..6eed74cedae 100644
--- a/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_qr.hxx
+++ b/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_qr.hxx
@@ -14,7 +14,7 @@
# include
#endif
#include
-#include // vnl_math::squared_magnitude()
+#include // vnl_math::detail::squared_magnitude()
#include
#include
#include // dqrdc_(), dqrsl_()
@@ -124,11 +124,11 @@ vnl_qr::Q() const
continue;
// Make housevec v, and accumulate norm at the same time.
v[k] = qraux_[k];
- abs_t sq = vnl_math::squared_magnitude(v[k]);
+ abs_t sq = vnl_math::detail::squared_magnitude(v[k]);
for (int j = k + 1; j < m; ++j)
{
v[j] = qrdc_out_(k, j);
- sq += vnl_math::squared_magnitude(v[j]);
+ sq += vnl_math::detail::squared_magnitude(v[j]);
}
if (verbose)
vnl_matlab_print(std::cerr, v, "v");
diff --git a/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_svd.hxx b/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_svd.hxx
index 3faf7c50f4e..e958cb56ec8 100644
--- a/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_svd.hxx
+++ b/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_svd.hxx
@@ -146,7 +146,7 @@ vnl_svd::vnl_svd(vnl_matrix const & M, double zero_out_tol)
using abs_t = typename vnl_numeric_traits::abs_t;
const abs_t recomposition_residual = std::abs((recompose() - M).fro_norm());
const abs_t n = std::abs(M.fro_norm());
- const abs_t thresh = abs_t(m_) * abs_t(vnl_math::eps) * n;
+ const abs_t thresh = abs_t(m_) * abs_t(vnl_math::detail::eps) * n;
if (recomposition_residual > thresh)
{
std::cerr << "vnl_svd::vnl_svd() -- Warning, recomposition_residual = " << recomposition_residual
diff --git a/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_svd_fixed.hxx b/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_svd_fixed.hxx
index b4c6f9d706e..432c816f02d 100644
--- a/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_svd_fixed.hxx
+++ b/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_svd_fixed.hxx
@@ -136,7 +136,7 @@ vnl_svd_fixed::vnl_svd_fixed(vnl_matrix_fixed const & M, doubl
using abs_t = typename vnl_numeric_traits::abs_t;
const abs_t recomposition_residual = std::abs((recompose() - M).fro_norm());
const abs_t n = std::abs(M.fro_norm());
- const abs_t thresh = abs_t(R) * abs_t(vnl_math::eps) * n;
+ const abs_t thresh = abs_t(R) * abs_t(vnl_math::detail::eps) * n;
if (recomposition_residual > thresh)
{
std::cerr << "vnl_svd_fixed::vnl_svd_fixed() -- Warning, recomposition_residual = "
diff --git a/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_symmetric_eigensystem.hxx b/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_symmetric_eigensystem.hxx
index aac662002ca..ecc564738a9 100644
--- a/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_symmetric_eigensystem.hxx
+++ b/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_symmetric_eigensystem.hxx
@@ -56,7 +56,7 @@ vnl_symmetric_eigensystem_compute_eigenvals(T M11, T M12, T M13, T M22, T M23, T
// complex conjugate roots as numerically inaccurate repeated roots.
// first check we are not too numerically inaccurate
- assert((g2 - f3) / vnl_math::sqr(vnl_math::cube(b)) < 1e-8);
+ assert((g2 - f3) / vnl_math::detail::sqr(vnl_math::detail::cube(b)) < 1e-8);
if (g2 >= f3)
{
@@ -78,8 +78,8 @@ vnl_symmetric_eigensystem_compute_eigenvals(T M11, T M12, T M13, T M22, T M23, T
const T k = std::acos(g / sqrt_f3) / 3;
const T j = 2 * sqrt_f;
l1 = j * std::cos(k) - b_3;
- l2 = j * std::cos(k + T(vnl_math::twopi / 3.0)) - b_3;
- l3 = j * std::cos(k - T(vnl_math::twopi / 3.0)) - b_3;
+ l2 = j * std::cos(k + T(vnl_math::detail::twopi / 3.0)) - b_3;
+ l3 = j * std::cos(k - T(vnl_math::detail::twopi / 3.0)) - b_3;
if (l2 < l1)
std::swap(l2, l1);
diff --git a/Modules/ThirdParty/VNL/src/vxl/core/vnl/tests/test_alignment.cxx b/Modules/ThirdParty/VNL/src/vxl/core/vnl/tests/test_alignment.cxx
index 65fc6165f5c..4836476e1bd 100644
--- a/Modules/ThirdParty/VNL/src/vxl/core/vnl/tests/test_alignment.cxx
+++ b/Modules/ThirdParty/VNL/src/vxl/core/vnl/tests/test_alignment.cxx
@@ -59,7 +59,7 @@ test_euclid_dist_sq(const vnl_vector & vec, const vnl_vector & vec
const unsigned n = vec.size();
float correct(0);
for (unsigned i = 0; i < n; ++i)
- correct += vnl_math::sqr(vec(i) - vec2(i));
+ correct += vnl_math::detail::sqr(vec(i) - vec2(i));
const float err = std::abs(correct - val);
const float neps = float(n) * std::sqrt(std::numeric_limits::epsilon());
diff --git a/Modules/ThirdParty/VNL/src/vxl/core/vnl/tests/test_complex.cxx b/Modules/ThirdParty/VNL/src/vxl/core/vnl/tests/test_complex.cxx
index e3afb5b9a83..0c3b5384728 100644
--- a/Modules/ThirdParty/VNL/src/vxl/core/vnl/tests/test_complex.cxx
+++ b/Modules/ThirdParty/VNL/src/vxl/core/vnl/tests/test_complex.cxx
@@ -89,7 +89,7 @@ test_cosine()
vnl_random rng(1234567);
for (int i = 0; i < 20; ++i)
{
- const double u = rng.drand32(vnl_math::pi_over_2);
+ const double u = rng.drand32(vnl_math::detail::pi_over_2);
const double v = rng.drand32(2.0);
const std::complex c(u, v);
const std::complex d = std::cos(c);
diff --git a/Modules/ThirdParty/VNL/src/vxl/core/vnl/tests/test_gamma.cxx b/Modules/ThirdParty/VNL/src/vxl/core/vnl/tests/test_gamma.cxx
index 7b80efe30e9..bf6e4e1f5c4 100644
--- a/Modules/ThirdParty/VNL/src/vxl/core/vnl/tests/test_gamma.cxx
+++ b/Modules/ThirdParty/VNL/src/vxl/core/vnl/tests/test_gamma.cxx
@@ -39,7 +39,7 @@ test_gamma()
TEST_NEAR("vnl_scaled_erfc(6)", vnl_scaled_erfc(6.), std::exp(36.) * vnl_erfc(6.), 0.01);
TEST_NEAR("vnl_scaled_erfc(100)", vnl_scaled_erfc(100.), 0.0056, 0.01);
TEST_NEAR("vnl_scaled_erfc(-inf)", vnl_scaled_erfc(-1e9), 0.0, 1e-8);
- TEST_NEAR("vnl_digamma(1)", vnl_digamma(1), -vnl_math::euler, 1e-10);
+ TEST_NEAR("vnl_digamma(1)", vnl_digamma(1), -vnl_math::detail::euler, 1e-10);
TEST_NEAR("vnl_digamma(20)", vnl_digamma(20), 2.970523992242149, 1e-10);
}
diff --git a/Modules/ThirdParty/VNL/src/vxl/core/vnl/tests/test_math.cxx b/Modules/ThirdParty/VNL/src/vxl/core/vnl/tests/test_math.cxx
index f1f91c7a40d..12f8f1e0a4e 100644
--- a/Modules/ThirdParty/VNL/src/vxl/core/vnl/tests/test_math.cxx
+++ b/Modules/ThirdParty/VNL/src/vxl/core/vnl/tests/test_math.cxx
@@ -3,7 +3,7 @@
#include
#include
#include "vnl/vnl_math.h"
-#include "vnl/vnl_complex.h" // for vnl_math::abs(std::complex)
+#include "vnl/vnl_complex.h" // for vnl_math::detail::abs(std::complex)
#include "testlib/testlib_test.h"
static constexpr double vnl_math_test_20_epsilon = 2 * 10 * std::numeric_limits::epsilon();
@@ -37,70 +37,70 @@ check_pointer(const void *)
static void
test_static_const_definition()
{
- check_pointer(&vnl_math::e);
- check_pointer(&vnl_math::euler);
- check_pointer(&vnl_math::log2e);
- check_pointer(&vnl_math::log10e);
- check_pointer(&vnl_math::ln2);
- check_pointer(&vnl_math::ln10);
- check_pointer(&vnl_math::pi);
- check_pointer(&vnl_math::twopi);
- check_pointer(&vnl_math::pi_over_2);
- check_pointer(&vnl_math::pi_over_4);
- check_pointer(&vnl_math::pi_over_180);
- check_pointer(&vnl_math::one_over_pi);
- check_pointer(&vnl_math::two_over_pi);
- check_pointer(&vnl_math::sqrt2pi);
- check_pointer(&vnl_math::one_over_sqrt2pi);
- check_pointer(&vnl_math::two_over_sqrtpi);
- check_pointer(&vnl_math::deg_per_rad);
- check_pointer(&vnl_math::sqrt2);
- check_pointer(&vnl_math::sqrt1_2);
- check_pointer(&vnl_math::sqrt1_3);
- check_pointer(&vnl_math::eps);
- check_pointer(&vnl_math::sqrteps);
+ check_pointer(&vnl_math::detail::e);
+ check_pointer(&vnl_math::detail::euler);
+ check_pointer(&vnl_math::detail::log2e);
+ check_pointer(&vnl_math::detail::log10e);
+ check_pointer(&vnl_math::detail::ln2);
+ check_pointer(&vnl_math::detail::ln10);
+ check_pointer(&vnl_math::detail::pi);
+ check_pointer(&vnl_math::detail::twopi);
+ check_pointer(&vnl_math::detail::pi_over_2);
+ check_pointer(&vnl_math::detail::pi_over_4);
+ check_pointer(&vnl_math::detail::pi_over_180);
+ check_pointer(&vnl_math::detail::one_over_pi);
+ check_pointer(&vnl_math::detail::two_over_pi);
+ check_pointer(&vnl_math::detail::sqrt2pi);
+ check_pointer(&vnl_math::detail::one_over_sqrt2pi);
+ check_pointer(&vnl_math::detail::two_over_sqrtpi);
+ check_pointer(&vnl_math::detail::deg_per_rad);
+ check_pointer(&vnl_math::detail::sqrt2);
+ check_pointer(&vnl_math::detail::sqrt1_2);
+ check_pointer(&vnl_math::detail::sqrt1_3);
+ check_pointer(&vnl_math::detail::eps);
+ check_pointer(&vnl_math::detail::sqrteps);
}
// Test that the vnl_math constants don't have weird values
static void
test_math_constants()
{
-#define TEST_CONSTANT(a, v) TEST_NEAR("value: ", vnl_math::a, v, 0);
- TEST_NEAR("log of e is 1", log(vnl_math::e), 1.0, 1e-15);
+#define TEST_CONSTANT(a, v) TEST_NEAR("value: ", vnl_math::detail::a, v, 0);
+ TEST_NEAR("log of e is 1", log(vnl_math::detail::e), 1.0, 1e-15);
TEST_CONSTANT(e, 2.7182818284590452353602874713526624977572470936999);
- TEST_NEAR("log2e * ln2 = 1", vnl_math::log2e * vnl_math::ln2, 1.0, 1e-15);
+ TEST_NEAR("log2e * ln2 = 1", vnl_math::detail::log2e * vnl_math::detail::ln2, 1.0, 1e-15);
TEST_CONSTANT(log2e, 1.4426950408889634073599246810018921374266459541529);
TEST_CONSTANT(ln2, 0.69314718055994530941723212145817656807550013436025);
- TEST_NEAR("log10e * ln10 = 1", vnl_math::log10e * vnl_math::ln10, 1.0, 1e-15);
+ TEST_NEAR("log10e * ln10 = 1", vnl_math::detail::log10e * vnl_math::detail::ln10, 1.0, 1e-15);
TEST_CONSTANT(log10e, 0.43429448190325182765112891891660508229439700580366);
TEST_CONSTANT(ln10, 2.3025850929940456840179914546843642076011014886287);
- TEST_NEAR("cos(pi) = -1", cos(vnl_math::pi), -1.0, 1e-15);
+ TEST_NEAR("cos(pi) = -1", cos(vnl_math::detail::pi), -1.0, 1e-15);
TEST_CONSTANT(pi, 3.1415926535897932384626433832795028841971693993751);
- TEST_NEAR("twopi = 2*pi", vnl_math::twopi, 2.0 * vnl_math::pi, 1e-15);
+ TEST_NEAR("twopi = 2*pi", vnl_math::detail::twopi, 2.0 * vnl_math::detail::pi, 1e-15);
TEST_CONSTANT(twopi, 6.2831853071795864769252867665590057683943387987502);
- TEST_NEAR("pi_over_2 = pi/2", vnl_math::pi_over_2, 0.5 * vnl_math::pi, 1e-15);
+ TEST_NEAR("pi_over_2 = pi/2", vnl_math::detail::pi_over_2, 0.5 * vnl_math::detail::pi, 1e-15);
TEST_CONSTANT(pi_over_2, 1.5707963267948966192313216916397514420985846996875);
- TEST_NEAR("pi_over_4 = pi/4", vnl_math::pi_over_4, 0.25 * vnl_math::pi, 1e-15);
+ TEST_NEAR("pi_over_4 = pi/4", vnl_math::detail::pi_over_4, 0.25 * vnl_math::detail::pi, 1e-15);
TEST_CONSTANT(pi_over_4, 0.78539816339744830961566084581987572104929234984377);
- TEST_NEAR("pi_over_180=pi/180", vnl_math::pi_over_180, vnl_math::pi / 180.0, 1e-15);
+ TEST_NEAR("pi_over_180=pi/180", vnl_math::detail::pi_over_180, vnl_math::detail::pi / 180.0, 1e-15);
TEST_CONSTANT(pi_over_180, 0.017453292519943295769236907684886127134428718885417);
- TEST_NEAR("pi*one_over_pi=1", vnl_math::pi * vnl_math::one_over_pi, 1.0, 1e-15);
+ TEST_NEAR("pi*one_over_pi=1", vnl_math::detail::pi * vnl_math::detail::one_over_pi, 1.0, 1e-15);
TEST_CONSTANT(one_over_pi, 0.31830988618379067153776752674502872406891929148091);
- TEST_NEAR("pi*two_over_pi=2", vnl_math::pi * vnl_math::two_over_pi, 2.0, 1e-15);
+ TEST_NEAR("pi*two_over_pi=2", vnl_math::detail::pi * vnl_math::detail::two_over_pi, 2.0, 1e-15);
TEST_CONSTANT(two_over_pi, 0.63661977236758134307553505349005744813783858296182);
- TEST_NEAR("deg_per_rad=180/pi", vnl_math::deg_per_rad, 180.0 / vnl_math::pi, 1e-15);
+ TEST_NEAR("deg_per_rad=180/pi", vnl_math::detail::deg_per_rad, 180.0 / vnl_math::detail::pi, 1e-15);
TEST_CONSTANT(deg_per_rad, 57.295779513082320876798154814105170332405472466564);
- TEST_NEAR("sqrt2pi^2", vnl_math::sqrt2pi * vnl_math::sqrt2pi, vnl_math::twopi, 1e-15);
+ TEST_NEAR("sqrt2pi^2", vnl_math::detail::sqrt2pi * vnl_math::detail::sqrt2pi, vnl_math::detail::twopi, 1e-15);
TEST_CONSTANT(sqrt2pi, 2.5066282746310005024157652848110452530069867406099);
- TEST_NEAR("two_over_sqrtpi", vnl_math::two_over_sqrtpi, 2.0 / sqrt(vnl_math::pi), 1e-15);
+ TEST_NEAR("two_over_sqrtpi", vnl_math::detail::two_over_sqrtpi, 2.0 / sqrt(vnl_math::detail::pi), 1e-15);
TEST_CONSTANT(two_over_sqrtpi, 1.1283791670955125738961589031215451716881012586579);
- TEST_NEAR("one_over_sqrt2pi", vnl_math::one_over_sqrt2pi, 1.0 / sqrt(vnl_math::twopi), 1e-15);
+ TEST_NEAR("one_over_sqrt2pi", vnl_math::detail::one_over_sqrt2pi, 1.0 / sqrt(vnl_math::detail::twopi), 1e-15);
TEST_CONSTANT(one_over_sqrt2pi, 0.39894228040143267793994605993438186847585863116493);
- TEST_NEAR("sqrt2*sqrt2=2", vnl_math::sqrt2 * vnl_math::sqrt2, 2.0, 1e-15);
+ TEST_NEAR("sqrt2*sqrt2=2", vnl_math::detail::sqrt2 * vnl_math::detail::sqrt2, 2.0, 1e-15);
TEST_CONSTANT(sqrt2, 1.4142135623730950488016887242096980785696718753769);
- TEST_NEAR("sqrt1_2*sqrt2=1", vnl_math::sqrt1_2 * vnl_math::sqrt2, 1.0, 1e-15);
+ TEST_NEAR("sqrt1_2*sqrt2=1", vnl_math::detail::sqrt1_2 * vnl_math::detail::sqrt2, 1.0, 1e-15);
TEST_CONSTANT(sqrt1_2, 0.70710678118654752440084436210484903928483593768847);
- TEST_NEAR("sqrt1_3^2=1/3", vnl_math::sqrt1_3 * vnl_math::sqrt1_3, 1.0 / 3.0, 1e-15);
+ TEST_NEAR("sqrt1_3^2=1/3", vnl_math::detail::sqrt1_3 * vnl_math::detail::sqrt1_3, 1.0 / 3.0, 1e-15);
TEST_CONSTANT(sqrt1_3, 0.57735026918962576450914878050195745564760175127012);
TEST_CONSTANT(euler, 0.57721566490153286060651209008240243104215933593992);
#undef TEST_CONSTANT
@@ -115,7 +115,7 @@ test_math()
constexpr int n = -11;
constexpr float f = -7.5f;
- constexpr double d = -vnl_math::pi;
+ constexpr double d = -vnl_math::detail::pi;
const std::complex i(0, 1);
const std::complex z(-1, 2);
const std::complex e_ipi = std::exp(d * i);
@@ -128,157 +128,157 @@ test_math()
<< "exp(d*i) = " << e_ipi << '\n'
<< '\n'
- << "abs(n) = " << vnl_math::abs(n) << '\n'
- << "abs(f) = " << vnl_math::abs(f) << '\n'
- << "abs(d) = " << vnl_math::abs(d) << '\n'
- << "abs(i) = " << vnl_math::abs(i) << '\n'
- << "abs(z) = " << vnl_math::abs(z) << '\n'
- << "norm(z) = " << vnl_math::squared_magnitude(z) << '\n'
+ << "abs(n) = " << vnl_math::detail::abs(n) << '\n'
+ << "abs(f) = " << vnl_math::detail::abs(f) << '\n'
+ << "abs(d) = " << vnl_math::detail::abs(d) << '\n'
+ << "abs(i) = " << vnl_math::detail::abs(i) << '\n'
+ << "abs(z) = " << vnl_math::detail::abs(z) << '\n'
+ << "norm(z) = " << vnl_math::detail::squared_magnitude(z) << '\n'
<< std::endl;
- TEST("abs(n) == 11", vnl_math::abs(n), 11);
- TEST("abs(f) == 7.5f", vnl_math::abs(f), 7.5f);
- TEST("abs(d) == pi", vnl_math::abs(d), vnl_math::pi);
- TEST("abs(i) == 1", vnl_math::abs(i), 1.0);
- TEST_NEAR("abs(-1+2i)~=sqrt(5)", vnl_math::abs(z), std::sqrt(5.0), 1e-12);
- TEST_NEAR("norm(-1+2i) ~= 5", vnl_math::squared_magnitude(z), 5, 1e-12);
- TEST_NEAR("exp(d*i) ~= -1", vnl_math::abs(e_ipi + 1.0), 0, 1e-12);
+ TEST("abs(n) == 11", vnl_math::detail::abs(n), 11);
+ TEST("abs(f) == 7.5f", vnl_math::detail::abs(f), 7.5f);
+ TEST("abs(d) == pi", vnl_math::detail::abs(d), vnl_math::detail::pi);
+ TEST("abs(i) == 1", vnl_math::detail::abs(i), 1.0);
+ TEST_NEAR("abs(-1+2i)~=sqrt(5)", vnl_math::detail::abs(z), std::sqrt(5.0), 1e-12);
+ TEST_NEAR("norm(-1+2i) ~= 5", vnl_math::detail::squared_magnitude(z), 5, 1e-12);
+ TEST_NEAR("exp(d*i) ~= -1", vnl_math::detail::abs(e_ipi + 1.0), 0, 1e-12);
std::cout << std::endl;
- TEST("rnd(-8.4999) == -8 ", vnl_math::rnd(-8.4999), -8);
- TEST("rnd(-8.4999f) == -8 ", vnl_math::rnd(-8.4999f), -8);
- TEST("rnd(-8.50) == -8/9", vnl_math::rnd(-8.50) / 2, -4);
- TEST("rnd(-8.50f) == -8/9", vnl_math::rnd(-8.50f) / 2, -4);
- TEST("rnd(-8.5001) == -9 ", vnl_math::rnd(-8.5001), -9);
- TEST("rnd(-8.5001f) == -9 ", vnl_math::rnd(-8.5001f), -9);
- TEST("rnd(8.4999) == 8 ", vnl_math::rnd(8.4999), 8);
- TEST("rnd(8.4999f) == 8 ", vnl_math::rnd(8.4999f), 8);
- TEST("rnd(8.50) == 8/9", vnl_math::rnd(8.50) / 2, 4);
- TEST("rnd(8.50f) == 8/9", vnl_math::rnd(8.50f) / 2, 4);
- TEST("rnd(8.5001) == 9 ", vnl_math::rnd(8.5001), 9);
- TEST("rnd(8.5001f) == 9 ", vnl_math::rnd(8.5001f), 9);
-
- TEST("rnd(-9.4999) == -9 ", vnl_math::rnd(-9.4999), -9);
- TEST("rnd(-9.4999f) == -9 ", vnl_math::rnd(-9.4999f), -9);
- TEST("rnd(-9.50) == -9/10", (vnl_math::rnd(-9.50) + 1) / 2, -4);
- TEST("rnd(-9.50f) == -9/10", (vnl_math::rnd(-9.50f) + 1) / 2, -4);
- TEST("rnd(-9.5001) == -10 ", vnl_math::rnd(-9.5001), -10);
- TEST("rnd(-9.5001f) == -10 ", vnl_math::rnd(-9.5001f), -10);
- TEST("rnd(9.4999) == 9 ", vnl_math::rnd(9.4999), 9);
- TEST("rnd(9.4999f) == 9 ", vnl_math::rnd(9.4999f), 9);
- TEST("rnd(9.50) == 9/10", (vnl_math::rnd(9.50) - 1) / 2, 4);
- TEST("rnd(9.50f) == 9/10", (vnl_math::rnd(9.50f) - 1) / 2, 4);
- TEST("rnd(9.5001) == 10 ", vnl_math::rnd(9.5001), 10);
- TEST("rnd(9.5001f) == 10 ", vnl_math::rnd(9.5001f), 10);
-
- TEST("rnd_halfinttoeven(-8.4999) == -8", vnl_math::rnd_halfinttoeven(-8.4999), -8);
- TEST("rnd_halfinttoeven(-8.4999f) == -8", vnl_math::rnd_halfinttoeven(-8.4999f), -8);
- TEST("rnd_halfinttoeven(-8.50) == -8", vnl_math::rnd_halfinttoeven(-8.50), -8);
- TEST("rnd_halfinttoeven(-8.50f) == -8", vnl_math::rnd_halfinttoeven(-8.50f), -8);
- TEST("rnd_halfinttoeven(-8.5001) == -9", vnl_math::rnd_halfinttoeven(-8.5001), -9);
- TEST("rnd_halfinttoeven(-8.5001f) == -9", vnl_math::rnd_halfinttoeven(-8.5001f), -9);
- TEST("rnd_halfinttoeven(8.4999) == 8", vnl_math::rnd_halfinttoeven(8.4999), 8);
- TEST("rnd_halfinttoeven(8.4999f) == 8", vnl_math::rnd_halfinttoeven(8.4999f), 8);
- TEST("rnd_halfinttoeven(8.50) == 8", vnl_math::rnd_halfinttoeven(8.50), 8);
- TEST("rnd_halfinttoeven(8.50f) == 8", vnl_math::rnd_halfinttoeven(8.50f), 8);
- TEST("rnd_halfinttoeven(8.5001) == 9", vnl_math::rnd_halfinttoeven(8.5001), 9);
- TEST("rnd_halfinttoeven(8.5001f) == 9", vnl_math::rnd_halfinttoeven(8.5001f), 9);
-
- TEST("rnd_halfinttoeven(-9.4999) == -9 ", vnl_math::rnd_halfinttoeven(-9.4999), -9);
- TEST("rnd_halfinttoeven(-9.4999f) == -9 ", vnl_math::rnd_halfinttoeven(-9.4999f), -9);
- TEST("rnd_halfinttoeven(-9.50) == -10", vnl_math::rnd_halfinttoeven(-9.50), -10);
- TEST("rnd_halfinttoeven(-9.50f) == -10", vnl_math::rnd_halfinttoeven(-9.50f), -10);
- TEST("rnd_halfinttoeven(-9.5001) == -10", vnl_math::rnd_halfinttoeven(-9.5001), -10);
- TEST("rnd_halfinttoeven(-9.5001f) == -10", vnl_math::rnd_halfinttoeven(-9.5001f), -10);
- TEST("rnd_halfinttoeven(9.4999) == 9 ", vnl_math::rnd_halfinttoeven(9.4999), 9);
- TEST("rnd_halfinttoeven(9.4999f) == 9 ", vnl_math::rnd_halfinttoeven(9.4999f), 9);
- TEST("rnd_halfinttoeven(9.50) == 10", vnl_math::rnd_halfinttoeven(9.50), 10);
- TEST("rnd_halfinttoeven(9.50f) == 10", vnl_math::rnd_halfinttoeven(9.50f), 10);
- TEST("rnd_halfinttoeven(9.5001) == 10", vnl_math::rnd_halfinttoeven(9.5001), 10);
- TEST("rnd_halfinttoeven(9.5001f) == 10", vnl_math::rnd_halfinttoeven(9.5001f), 10);
-
- TEST("rnd_halfintup(-8.4999) == -8", vnl_math::rnd_halfintup(-8.4999), -8);
- TEST("rnd_halfintup(-8.4999f) == -8", vnl_math::rnd_halfintup(-8.4999f), -8);
- TEST("rnd_halfintup(-8.50) == -8", vnl_math::rnd_halfintup(-8.50), -8);
- TEST("rnd_halfintup(-8.50f) == -8", vnl_math::rnd_halfintup(-8.50f), -8);
- TEST("rnd_halfintup(-8.5001) == -9", vnl_math::rnd_halfintup(-8.5001), -9);
- TEST("rnd_halfintup(-8.5001f) == -9", vnl_math::rnd_halfintup(-8.5001f), -9);
- TEST("rnd_halfintup(8.4999) == 8", vnl_math::rnd_halfintup(8.4999), 8);
- TEST("rnd_halfintup(8.4999f) == 8", vnl_math::rnd_halfintup(8.4999f), 8);
- TEST("rnd_halfintup(8.50) == 9", vnl_math::rnd_halfintup(8.50), 9);
- TEST("rnd_halfintup(8.50f) == 9", vnl_math::rnd_halfintup(8.50f), 9);
- TEST("rnd_halfintup(8.5001) == 9", vnl_math::rnd_halfintup(8.5001), 9);
- TEST("rnd_halfintup(8.5001f) == 9", vnl_math::rnd_halfintup(8.5001f), 9);
-
- TEST("rnd_halfintup(-9.4999) == -9 ", vnl_math::rnd_halfintup(-9.4999), -9);
- TEST("rnd_halfintup(-9.4999f) == -9 ", vnl_math::rnd_halfintup(-9.4999f), -9);
- TEST("rnd_halfintup(-9.50) == -9 ", vnl_math::rnd_halfintup(-9.50), -9);
- TEST("rnd_halfintup(-9.50f) == -9 ", vnl_math::rnd_halfintup(-9.50f), -9);
- TEST("rnd_halfintup(-9.5001) == -10", vnl_math::rnd_halfintup(-9.5001), -10);
- TEST("rnd_halfintup(-9.5001f) == -10", vnl_math::rnd_halfintup(-9.5001f), -10);
- TEST("rnd_halfintup(9.4999) == 9 ", vnl_math::rnd_halfintup(9.4999), 9);
- TEST("rnd_halfintup(9.4999f) == 9 ", vnl_math::rnd_halfintup(9.4999f), 9);
- TEST("rnd_halfintup(9.50) == 10", vnl_math::rnd_halfintup(9.50), 10);
- TEST("rnd_halfintup(9.50f) == 10", vnl_math::rnd_halfintup(9.50f), 10);
- TEST("rnd_halfintup(9.5001) == 10", vnl_math::rnd_halfintup(9.5001), 10);
- TEST("rnd_halfintup(9.5001f) == 10", vnl_math::rnd_halfintup(9.5001f), 10);
-
- TEST("floor(8.0) == 8", vnl_math::floor(8.0), 8);
- TEST("floor(8.0f) == 8", vnl_math::floor(8.0f), 8);
- TEST("floor(8.9999) == 8", vnl_math::floor(8.9999), 8);
- TEST("floor(8.9999f) == 8", vnl_math::floor(8.9999f), 8);
- TEST("floor(8.0001) == 8", vnl_math::floor(8.0001), 8);
- TEST("floor(8.0001f) == 8", vnl_math::floor(8.0001f), 8);
- TEST("floor(-8.0) == -8", vnl_math::floor(-8.0), -8);
- TEST("floor(-8.0f) == -8", vnl_math::floor(-8.0f), -8);
- TEST("floor(-8.9999) == -9", vnl_math::floor(-8.9999), -9);
- TEST("floor(-8.9999f) == -9", vnl_math::floor(-8.9999f), -9);
- TEST("floor(-8.0001) == -9", vnl_math::floor(-8.0001), -9);
- TEST("floor(-8.0001f) == -9", vnl_math::floor(-8.0001f), -9);
-
- TEST("floor(9.0) == 9 ", vnl_math::floor(9.0), 9);
- TEST("floor(9.0f) == 9 ", vnl_math::floor(9.0f), 9);
- TEST("floor(9.9999) == 9 ", vnl_math::floor(9.9999), 9);
- TEST("floor(9.9999f) == 9 ", vnl_math::floor(9.9999f), 9);
- TEST("floor(9.0001) == 9 ", vnl_math::floor(9.0001), 9);
- TEST("floor(9.0001f) == 9 ", vnl_math::floor(9.0001f), 9);
- TEST("floor(-9.0) == -9 ", vnl_math::floor(-9.0), -9);
- TEST("floor(-9.0f) == -9 ", vnl_math::floor(-9.0f), -9);
- TEST("floor(-9.9999) == -10", vnl_math::floor(-9.9999), -10);
- TEST("floor(-9.9999f) == -10", vnl_math::floor(-9.9999f), -10);
- TEST("floor(-9.0001) == -10", vnl_math::floor(-9.0001), -10);
- TEST("floor(-9.0001f) == -10", vnl_math::floor(-9.0001f), -10);
-
- TEST("ceil(8.0) == 8", vnl_math::ceil(8.0), 8);
- TEST("ceil(8.0f) == 8", vnl_math::ceil(8.0f), 8);
- TEST("ceil(8.9999) == 9", vnl_math::ceil(8.9999), 9);
- TEST("ceil(8.9999f) == 9", vnl_math::ceil(8.9999f), 9);
- TEST("ceil(8.0001) == 9", vnl_math::ceil(8.0001), 9);
- TEST("ceil(8.0001f) == 9", vnl_math::ceil(8.0001f), 9);
- TEST("ceil(-8.0) == -8", vnl_math::ceil(-8.0), -8);
- TEST("ceil(-8.0f) == -8", vnl_math::ceil(-8.0f), -8);
- TEST("ceil(-8.9999) == -8", vnl_math::ceil(-8.9999), -8);
- TEST("ceil(-8.9999f) == -8", vnl_math::ceil(-8.9999f), -8);
- TEST("ceil(-8.0001) == -8", vnl_math::ceil(-8.0001), -8);
- TEST("ceil(-8.0001f) == -8", vnl_math::ceil(-8.0001f), -8);
-
- TEST("ceil(9.0) == 9", vnl_math::ceil(9.0), 9);
- TEST("ceil(9.0f) == 9", vnl_math::ceil(9.0f), 9);
- TEST("ceil(9.9999) == 10", vnl_math::ceil(9.9999), 10);
- TEST("ceil(9.9999f) == 10", vnl_math::ceil(9.9999f), 10);
- TEST("ceil(9.0001) == 10", vnl_math::ceil(9.0001), 10);
- TEST("ceil(9.0001f) == 10", vnl_math::ceil(9.0001f), 10);
- TEST("ceil(-9.0) == -9", vnl_math::ceil(-9.0), -9);
- TEST("ceil(-9.0f) == -9", vnl_math::ceil(-9.0f), -9);
- TEST("ceil(-9.9999) == -9", vnl_math::ceil(-9.9999), -9);
- TEST("ceil(-9.9999f) == -9", vnl_math::ceil(-9.9999f), -9);
- TEST("ceil(-9.0001) == -9", vnl_math::ceil(-9.0001), -9);
- TEST("ceil(-9.0001f) == -9", vnl_math::ceil(-9.0001f), -9);
-
- TEST(" isfinite(f) ", vnl_math::isfinite(f), true);
- TEST(" isfinite(d) ", vnl_math::isfinite(d), true);
- TEST(" isfinite(i) ", vnl_math::isfinite(i), true);
- TEST(" isfinite(z) ", vnl_math::isfinite(z), true);
+ TEST("rnd(-8.4999) == -8 ", vnl_math::detail::rnd(-8.4999), -8);
+ TEST("rnd(-8.4999f) == -8 ", vnl_math::detail::rnd(-8.4999f), -8);
+ TEST("rnd(-8.50) == -8/9", vnl_math::detail::rnd(-8.50) / 2, -4);
+ TEST("rnd(-8.50f) == -8/9", vnl_math::detail::rnd(-8.50f) / 2, -4);
+ TEST("rnd(-8.5001) == -9 ", vnl_math::detail::rnd(-8.5001), -9);
+ TEST("rnd(-8.5001f) == -9 ", vnl_math::detail::rnd(-8.5001f), -9);
+ TEST("rnd(8.4999) == 8 ", vnl_math::detail::rnd(8.4999), 8);
+ TEST("rnd(8.4999f) == 8 ", vnl_math::detail::rnd(8.4999f), 8);
+ TEST("rnd(8.50) == 8/9", vnl_math::detail::rnd(8.50) / 2, 4);
+ TEST("rnd(8.50f) == 8/9", vnl_math::detail::rnd(8.50f) / 2, 4);
+ TEST("rnd(8.5001) == 9 ", vnl_math::detail::rnd(8.5001), 9);
+ TEST("rnd(8.5001f) == 9 ", vnl_math::detail::rnd(8.5001f), 9);
+
+ TEST("rnd(-9.4999) == -9 ", vnl_math::detail::rnd(-9.4999), -9);
+ TEST("rnd(-9.4999f) == -9 ", vnl_math::detail::rnd(-9.4999f), -9);
+ TEST("rnd(-9.50) == -9/10", (vnl_math::detail::rnd(-9.50) + 1) / 2, -4);
+ TEST("rnd(-9.50f) == -9/10", (vnl_math::detail::rnd(-9.50f) + 1) / 2, -4);
+ TEST("rnd(-9.5001) == -10 ", vnl_math::detail::rnd(-9.5001), -10);
+ TEST("rnd(-9.5001f) == -10 ", vnl_math::detail::rnd(-9.5001f), -10);
+ TEST("rnd(9.4999) == 9 ", vnl_math::detail::rnd(9.4999), 9);
+ TEST("rnd(9.4999f) == 9 ", vnl_math::detail::rnd(9.4999f), 9);
+ TEST("rnd(9.50) == 9/10", (vnl_math::detail::rnd(9.50) - 1) / 2, 4);
+ TEST("rnd(9.50f) == 9/10", (vnl_math::detail::rnd(9.50f) - 1) / 2, 4);
+ TEST("rnd(9.5001) == 10 ", vnl_math::detail::rnd(9.5001), 10);
+ TEST("rnd(9.5001f) == 10 ", vnl_math::detail::rnd(9.5001f), 10);
+
+ TEST("rnd_halfinttoeven(-8.4999) == -8", vnl_math::detail::rnd_halfinttoeven(-8.4999), -8);
+ TEST("rnd_halfinttoeven(-8.4999f) == -8", vnl_math::detail::rnd_halfinttoeven(-8.4999f), -8);
+ TEST("rnd_halfinttoeven(-8.50) == -8", vnl_math::detail::rnd_halfinttoeven(-8.50), -8);
+ TEST("rnd_halfinttoeven(-8.50f) == -8", vnl_math::detail::rnd_halfinttoeven(-8.50f), -8);
+ TEST("rnd_halfinttoeven(-8.5001) == -9", vnl_math::detail::rnd_halfinttoeven(-8.5001), -9);
+ TEST("rnd_halfinttoeven(-8.5001f) == -9", vnl_math::detail::rnd_halfinttoeven(-8.5001f), -9);
+ TEST("rnd_halfinttoeven(8.4999) == 8", vnl_math::detail::rnd_halfinttoeven(8.4999), 8);
+ TEST("rnd_halfinttoeven(8.4999f) == 8", vnl_math::detail::rnd_halfinttoeven(8.4999f), 8);
+ TEST("rnd_halfinttoeven(8.50) == 8", vnl_math::detail::rnd_halfinttoeven(8.50), 8);
+ TEST("rnd_halfinttoeven(8.50f) == 8", vnl_math::detail::rnd_halfinttoeven(8.50f), 8);
+ TEST("rnd_halfinttoeven(8.5001) == 9", vnl_math::detail::rnd_halfinttoeven(8.5001), 9);
+ TEST("rnd_halfinttoeven(8.5001f) == 9", vnl_math::detail::rnd_halfinttoeven(8.5001f), 9);
+
+ TEST("rnd_halfinttoeven(-9.4999) == -9 ", vnl_math::detail::rnd_halfinttoeven(-9.4999), -9);
+ TEST("rnd_halfinttoeven(-9.4999f) == -9 ", vnl_math::detail::rnd_halfinttoeven(-9.4999f), -9);
+ TEST("rnd_halfinttoeven(-9.50) == -10", vnl_math::detail::rnd_halfinttoeven(-9.50), -10);
+ TEST("rnd_halfinttoeven(-9.50f) == -10", vnl_math::detail::rnd_halfinttoeven(-9.50f), -10);
+ TEST("rnd_halfinttoeven(-9.5001) == -10", vnl_math::detail::rnd_halfinttoeven(-9.5001), -10);
+ TEST("rnd_halfinttoeven(-9.5001f) == -10", vnl_math::detail::rnd_halfinttoeven(-9.5001f), -10);
+ TEST("rnd_halfinttoeven(9.4999) == 9 ", vnl_math::detail::rnd_halfinttoeven(9.4999), 9);
+ TEST("rnd_halfinttoeven(9.4999f) == 9 ", vnl_math::detail::rnd_halfinttoeven(9.4999f), 9);
+ TEST("rnd_halfinttoeven(9.50) == 10", vnl_math::detail::rnd_halfinttoeven(9.50), 10);
+ TEST("rnd_halfinttoeven(9.50f) == 10", vnl_math::detail::rnd_halfinttoeven(9.50f), 10);
+ TEST("rnd_halfinttoeven(9.5001) == 10", vnl_math::detail::rnd_halfinttoeven(9.5001), 10);
+ TEST("rnd_halfinttoeven(9.5001f) == 10", vnl_math::detail::rnd_halfinttoeven(9.5001f), 10);
+
+ TEST("rnd_halfintup(-8.4999) == -8", vnl_math::detail::rnd_halfintup(-8.4999), -8);
+ TEST("rnd_halfintup(-8.4999f) == -8", vnl_math::detail::rnd_halfintup(-8.4999f), -8);
+ TEST("rnd_halfintup(-8.50) == -8", vnl_math::detail::rnd_halfintup(-8.50), -8);
+ TEST("rnd_halfintup(-8.50f) == -8", vnl_math::detail::rnd_halfintup(-8.50f), -8);
+ TEST("rnd_halfintup(-8.5001) == -9", vnl_math::detail::rnd_halfintup(-8.5001), -9);
+ TEST("rnd_halfintup(-8.5001f) == -9", vnl_math::detail::rnd_halfintup(-8.5001f), -9);
+ TEST("rnd_halfintup(8.4999) == 8", vnl_math::detail::rnd_halfintup(8.4999), 8);
+ TEST("rnd_halfintup(8.4999f) == 8", vnl_math::detail::rnd_halfintup(8.4999f), 8);
+ TEST("rnd_halfintup(8.50) == 9", vnl_math::detail::rnd_halfintup(8.50), 9);
+ TEST("rnd_halfintup(8.50f) == 9", vnl_math::detail::rnd_halfintup(8.50f), 9);
+ TEST("rnd_halfintup(8.5001) == 9", vnl_math::detail::rnd_halfintup(8.5001), 9);
+ TEST("rnd_halfintup(8.5001f) == 9", vnl_math::detail::rnd_halfintup(8.5001f), 9);
+
+ TEST("rnd_halfintup(-9.4999) == -9 ", vnl_math::detail::rnd_halfintup(-9.4999), -9);
+ TEST("rnd_halfintup(-9.4999f) == -9 ", vnl_math::detail::rnd_halfintup(-9.4999f), -9);
+ TEST("rnd_halfintup(-9.50) == -9 ", vnl_math::detail::rnd_halfintup(-9.50), -9);
+ TEST("rnd_halfintup(-9.50f) == -9 ", vnl_math::detail::rnd_halfintup(-9.50f), -9);
+ TEST("rnd_halfintup(-9.5001) == -10", vnl_math::detail::rnd_halfintup(-9.5001), -10);
+ TEST("rnd_halfintup(-9.5001f) == -10", vnl_math::detail::rnd_halfintup(-9.5001f), -10);
+ TEST("rnd_halfintup(9.4999) == 9 ", vnl_math::detail::rnd_halfintup(9.4999), 9);
+ TEST("rnd_halfintup(9.4999f) == 9 ", vnl_math::detail::rnd_halfintup(9.4999f), 9);
+ TEST("rnd_halfintup(9.50) == 10", vnl_math::detail::rnd_halfintup(9.50), 10);
+ TEST("rnd_halfintup(9.50f) == 10", vnl_math::detail::rnd_halfintup(9.50f), 10);
+ TEST("rnd_halfintup(9.5001) == 10", vnl_math::detail::rnd_halfintup(9.5001), 10);
+ TEST("rnd_halfintup(9.5001f) == 10", vnl_math::detail::rnd_halfintup(9.5001f), 10);
+
+ TEST("floor(8.0) == 8", vnl_math::detail::floor(8.0), 8);
+ TEST("floor(8.0f) == 8", vnl_math::detail::floor(8.0f), 8);
+ TEST("floor(8.9999) == 8", vnl_math::detail::floor(8.9999), 8);
+ TEST("floor(8.9999f) == 8", vnl_math::detail::floor(8.9999f), 8);
+ TEST("floor(8.0001) == 8", vnl_math::detail::floor(8.0001), 8);
+ TEST("floor(8.0001f) == 8", vnl_math::detail::floor(8.0001f), 8);
+ TEST("floor(-8.0) == -8", vnl_math::detail::floor(-8.0), -8);
+ TEST("floor(-8.0f) == -8", vnl_math::detail::floor(-8.0f), -8);
+ TEST("floor(-8.9999) == -9", vnl_math::detail::floor(-8.9999), -9);
+ TEST("floor(-8.9999f) == -9", vnl_math::detail::floor(-8.9999f), -9);
+ TEST("floor(-8.0001) == -9", vnl_math::detail::floor(-8.0001), -9);
+ TEST("floor(-8.0001f) == -9", vnl_math::detail::floor(-8.0001f), -9);
+
+ TEST("floor(9.0) == 9 ", vnl_math::detail::floor(9.0), 9);
+ TEST("floor(9.0f) == 9 ", vnl_math::detail::floor(9.0f), 9);
+ TEST("floor(9.9999) == 9 ", vnl_math::detail::floor(9.9999), 9);
+ TEST("floor(9.9999f) == 9 ", vnl_math::detail::floor(9.9999f), 9);
+ TEST("floor(9.0001) == 9 ", vnl_math::detail::floor(9.0001), 9);
+ TEST("floor(9.0001f) == 9 ", vnl_math::detail::floor(9.0001f), 9);
+ TEST("floor(-9.0) == -9 ", vnl_math::detail::floor(-9.0), -9);
+ TEST("floor(-9.0f) == -9 ", vnl_math::detail::floor(-9.0f), -9);
+ TEST("floor(-9.9999) == -10", vnl_math::detail::floor(-9.9999), -10);
+ TEST("floor(-9.9999f) == -10", vnl_math::detail::floor(-9.9999f), -10);
+ TEST("floor(-9.0001) == -10", vnl_math::detail::floor(-9.0001), -10);
+ TEST("floor(-9.0001f) == -10", vnl_math::detail::floor(-9.0001f), -10);
+
+ TEST("ceil(8.0) == 8", vnl_math::detail::ceil(8.0), 8);
+ TEST("ceil(8.0f) == 8", vnl_math::detail::ceil(8.0f), 8);
+ TEST("ceil(8.9999) == 9", vnl_math::detail::ceil(8.9999), 9);
+ TEST("ceil(8.9999f) == 9", vnl_math::detail::ceil(8.9999f), 9);
+ TEST("ceil(8.0001) == 9", vnl_math::detail::ceil(8.0001), 9);
+ TEST("ceil(8.0001f) == 9", vnl_math::detail::ceil(8.0001f), 9);
+ TEST("ceil(-8.0) == -8", vnl_math::detail::ceil(-8.0), -8);
+ TEST("ceil(-8.0f) == -8", vnl_math::detail::ceil(-8.0f), -8);
+ TEST("ceil(-8.9999) == -8", vnl_math::detail::ceil(-8.9999), -8);
+ TEST("ceil(-8.9999f) == -8", vnl_math::detail::ceil(-8.9999f), -8);
+ TEST("ceil(-8.0001) == -8", vnl_math::detail::ceil(-8.0001), -8);
+ TEST("ceil(-8.0001f) == -8", vnl_math::detail::ceil(-8.0001f), -8);
+
+ TEST("ceil(9.0) == 9", vnl_math::detail::ceil(9.0), 9);
+ TEST("ceil(9.0f) == 9", vnl_math::detail::ceil(9.0f), 9);
+ TEST("ceil(9.9999) == 10", vnl_math::detail::ceil(9.9999), 10);
+ TEST("ceil(9.9999f) == 10", vnl_math::detail::ceil(9.9999f), 10);
+ TEST("ceil(9.0001) == 10", vnl_math::detail::ceil(9.0001), 10);
+ TEST("ceil(9.0001f) == 10", vnl_math::detail::ceil(9.0001f), 10);
+ TEST("ceil(-9.0) == -9", vnl_math::detail::ceil(-9.0), -9);
+ TEST("ceil(-9.0f) == -9", vnl_math::detail::ceil(-9.0f), -9);
+ TEST("ceil(-9.9999) == -9", vnl_math::detail::ceil(-9.9999), -9);
+ TEST("ceil(-9.9999f) == -9", vnl_math::detail::ceil(-9.9999f), -9);
+ TEST("ceil(-9.0001) == -9", vnl_math::detail::ceil(-9.0001), -9);
+ TEST("ceil(-9.0001f) == -9", vnl_math::detail::ceil(-9.0001f), -9);
+
+ TEST(" isfinite(f) ", vnl_math::numeric_predicates::isfinite(f), true);
+ TEST(" isfinite(d) ", vnl_math::numeric_predicates::isfinite(d), true);
+ TEST(" isfinite(i) ", vnl_math::numeric_predicates::isfinite(i), true);
+ TEST(" isfinite(z) ", vnl_math::numeric_predicates::isfinite(z), true);
// There is an assumption in this code that std::numeric_limits::has_infinity==true
@@ -342,86 +342,90 @@ test_math()
#endif
<< std::endl;
- TEST("!isfinite(pinf_f)", vnl_math::isfinite(pinf_f), false);
- TEST("!isfinite(ninf_f)", vnl_math::isfinite(ninf_f), false);
- TEST(" isinf(pinf_f) ", vnl_math::isinf(pinf_f), true);
- TEST(" isinf(ninf_f) ", vnl_math::isinf(ninf_f), true);
- TEST("!isnan(pinf_f) ", vnl_math::isnan(pinf_f), false);
- TEST("!isnan(ninf_f) ", vnl_math::isnan(ninf_f), false);
- TEST("!isfinite(qnan_f)", vnl_math::isfinite(qnan_f), false);
- TEST("!isinf(qnan_f) ", vnl_math::isinf(qnan_f), false);
- TEST(" isnan(qnan_f) ", vnl_math::isnan(qnan_f), true);
-
- TEST("!isfinite(pinf_d)", vnl_math::isfinite(pinf_d), false);
- TEST("!isfinite(ninf_d)", vnl_math::isfinite(ninf_d), false);
- TEST(" isinf(pinf_d) ", vnl_math::isinf(pinf_d), true);
- TEST(" isinf(ninf_d) ", vnl_math::isinf(ninf_d), true);
- TEST("!isnan(pinf_d) ", vnl_math::isnan(pinf_d), false);
- TEST("!isnan(ninf_d) ", vnl_math::isnan(ninf_d), false);
- TEST("!isfinite(qnan_d)", vnl_math::isfinite(qnan_d), false);
- TEST("!isinf(qnan_d) ", vnl_math::isinf(qnan_d), false);
- TEST(" isnan(qnan_d) ", vnl_math::isnan(qnan_d), true);
+ TEST("!isfinite(pinf_f)", vnl_math::numeric_predicates::isfinite(pinf_f), false);
+ TEST("!isfinite(ninf_f)", vnl_math::numeric_predicates::isfinite(ninf_f), false);
+ TEST(" isinf(pinf_f) ", vnl_math::numeric_predicates::isinf(pinf_f), true);
+ TEST(" isinf(ninf_f) ", vnl_math::numeric_predicates::isinf(ninf_f), true);
+ TEST("!isnan(pinf_f) ", vnl_math::numeric_predicates::isnan(pinf_f), false);
+ TEST("!isnan(ninf_f) ", vnl_math::numeric_predicates::isnan(ninf_f), false);
+ TEST("!isfinite(qnan_f)", vnl_math::numeric_predicates::isfinite(qnan_f), false);
+ TEST("!isinf(qnan_f) ", vnl_math::numeric_predicates::isinf(qnan_f), false);
+ TEST(" isnan(qnan_f) ", vnl_math::numeric_predicates::isnan(qnan_f), true);
+
+ TEST("!isfinite(pinf_d)", vnl_math::numeric_predicates::isfinite(pinf_d), false);
+ TEST("!isfinite(ninf_d)", vnl_math::numeric_predicates::isfinite(ninf_d), false);
+ TEST(" isinf(pinf_d) ", vnl_math::numeric_predicates::isinf(pinf_d), true);
+ TEST(" isinf(ninf_d) ", vnl_math::numeric_predicates::isinf(ninf_d), true);
+ TEST("!isnan(pinf_d) ", vnl_math::numeric_predicates::isnan(pinf_d), false);
+ TEST("!isnan(ninf_d) ", vnl_math::numeric_predicates::isnan(ninf_d), false);
+ TEST("!isfinite(qnan_d)", vnl_math::numeric_predicates::isfinite(qnan_d), false);
+ TEST("!isinf(qnan_d) ", vnl_math::numeric_predicates::isinf(qnan_d), false);
+ TEST(" isnan(qnan_d) ", vnl_math::numeric_predicates::isnan(qnan_d), true);
#ifdef INCLUDE_LONG_DOUBLE_TESTS
# ifndef __ICC // "long double" has no standard internal representation on different platforms/compilers
- TEST("!isfinite(pinf_q)", vnl_math::isfinite(pinf_q), false);
- TEST("!isfinite(ninf_q)", vnl_math::isfinite(ninf_q), false);
- TEST(" isinf(pinf_q) ", vnl_math::isinf(pinf_q), true);
- TEST(" isinf(ninf_q) ", vnl_math::isinf(ninf_q), true);
- TEST("!isnan(pinf_q) ", vnl_math::isnan(pinf_q), false);
- TEST("!isnan(ninf_q) ", vnl_math::isnan(ninf_q), false);
- TEST("!isfinite(qnan_q)", vnl_math::isfinite(qnan_q), false);
- TEST("!isinf(qnan_q) ", vnl_math::isinf(qnan_q), false);
+ TEST("!isfinite(pinf_q)", vnl_math::numeric_predicates::isfinite(pinf_q), false);
+ TEST("!isfinite(ninf_q)", vnl_math::numeric_predicates::isfinite(ninf_q), false);
+ TEST(" isinf(pinf_q) ", vnl_math::numeric_predicates::isinf(pinf_q), true);
+ TEST(" isinf(ninf_q) ", vnl_math::numeric_predicates::isinf(ninf_q), true);
+ TEST("!isnan(pinf_q) ", vnl_math::numeric_predicates::isnan(pinf_q), false);
+ TEST("!isnan(ninf_q) ", vnl_math::numeric_predicates::isnan(ninf_q), false);
+ TEST("!isfinite(qnan_q)", vnl_math::numeric_predicates::isfinite(qnan_q), false);
+ TEST("!isinf(qnan_q) ", vnl_math::numeric_predicates::isinf(qnan_q), false);
# endif // __ICC
#endif
- TEST("!isfinite(huge_val(double))", vnl_math::isfinite(vnl_huge_val(double())), false);
- TEST("!isfinite(huge_val(float))", vnl_math::isfinite(vnl_huge_val(float())), false);
+ TEST("!isfinite(inf(double))",
+ vnl_math::numeric_predicates::isfinite(std::numeric_limits::infinity()),
+ false);
+ TEST("!isfinite(inf(float))",
+ vnl_math::numeric_predicates::isfinite(std::numeric_limits::infinity()),
+ false);
// Test for math_sgn
- TEST("vnl_math::sgn(+7) ", vnl_math::sgn(+7), 1);
- TEST("vnl_math::sgn(-7) ", vnl_math::sgn(-7), -1);
- TEST("vnl_math::sgn( 0) ", vnl_math::sgn(0), 0);
+ TEST("vnl_math::detail::sgn(+7) ", vnl_math::detail::sgn(+7), 1);
+ TEST("vnl_math::detail::sgn(-7) ", vnl_math::detail::sgn(-7), -1);
+ TEST("vnl_math::detail::sgn( 0) ", vnl_math::detail::sgn(0), 0);
- TEST("vnl_math::sgn(+7.0) ", vnl_math::sgn(+7.0), 1);
- TEST("vnl_math::sgn(-7.0) ", vnl_math::sgn(-7.0), -1);
- TEST("vnl_math::sgn(-0.0) ", vnl_math::sgn(-0.0), 0);
- TEST("vnl_math::sgn(+0.0) ", vnl_math::sgn(-0.0), 0);
+ TEST("vnl_math::detail::sgn(+7.0) ", vnl_math::detail::sgn(+7.0), 1);
+ TEST("vnl_math::detail::sgn(-7.0) ", vnl_math::detail::sgn(-7.0), -1);
+ TEST("vnl_math::detail::sgn(-0.0) ", vnl_math::detail::sgn(-0.0), 0);
+ TEST("vnl_math::detail::sgn(+0.0) ", vnl_math::detail::sgn(-0.0), 0);
- TEST("vnl_math::sgn(+7.0F) ", vnl_math::sgn(+7.0F), 1);
- TEST("vnl_math::sgn(-7.0F) ", vnl_math::sgn(-7.0F), -1);
- TEST("vnl_math::sgn(-0.0F) ", vnl_math::sgn(-0.0F), 0);
- TEST("vnl_math::sgn(+0.0F) ", vnl_math::sgn(-0.0F), 0);
+ TEST("vnl_math::detail::sgn(+7.0F) ", vnl_math::detail::sgn(+7.0F), 1);
+ TEST("vnl_math::detail::sgn(-7.0F) ", vnl_math::detail::sgn(-7.0F), -1);
+ TEST("vnl_math::detail::sgn(-0.0F) ", vnl_math::detail::sgn(-0.0F), 0);
+ TEST("vnl_math::detail::sgn(+0.0F) ", vnl_math::detail::sgn(-0.0F), 0);
std::cout << std::endl;
- // test vnl_math::angle_0_to_2pi() for "extreme values":
- TEST("vnl_math::angle_0_to_2pi(2pi)", vnl_math::angle_0_to_2pi(vnl_math::twopi), 0.0);
- double eps = vnl_math_test_2_epsilon; // which is smaller than the precision of vnl_math::pi
- double conv_eps = vnl_math::angle_0_to_2pi(-eps);
- std::cout << "conv_eps = " << conv_eps << " = 2pi - " << vnl_math::twopi - conv_eps << std::endl;
- TEST("vnl_math::angle_0_to_2pi(-eps)", conv_eps < vnl_math::twopi && conv_eps > 6.283, true);
- eps = vnl_math_test_20_epsilon; // which is larger than the precision of vnl_math::pi
- conv_eps = vnl_math::angle_0_to_2pi(-eps);
- std::cout << "conv_eps = " << conv_eps << " = 2pi - " << vnl_math::twopi - conv_eps << std::endl;
+ // test vnl_math::detail::angle_0_to_2pi() for "extreme values":
+ TEST("vnl_math::detail::angle_0_to_2pi(2pi)", vnl_math::detail::angle_0_to_2pi(vnl_math::detail::twopi), 0.0);
+ double eps = vnl_math_test_2_epsilon; // which is smaller than the precision of vnl_math::detail::pi
+ double conv_eps = vnl_math::detail::angle_0_to_2pi(-eps);
+ std::cout << "conv_eps = " << conv_eps << " = 2pi - " << vnl_math::detail::twopi - conv_eps << std::endl;
+ TEST("vnl_math::detail::angle_0_to_2pi(-eps)", conv_eps < vnl_math::detail::twopi && conv_eps > 6.283, true);
+ eps = vnl_math_test_20_epsilon; // which is larger than the precision of vnl_math::detail::pi
+ conv_eps = vnl_math::detail::angle_0_to_2pi(-eps);
+ std::cout << "conv_eps = " << conv_eps << " = 2pi - " << vnl_math::detail::twopi - conv_eps << std::endl;
TEST(
- "vnl_math::angle_0_to_2pi(-10eps)", conv_eps < vnl_math::twopi - vnl_math_test_2_epsilon && conv_eps > 6.283, true);
- const double ang = vnl_math::twopi - eps;
- const double conv_ang = vnl_math::angle_0_to_2pi(ang);
- std::cout << "conv_ang = " << conv_ang << " = 2pi - " << vnl_math::twopi - conv_ang << std::endl;
- TEST("vnl_math::angle_0_to_2pi(2pi-10eps)", conv_ang, ang);
- // test vnl_math::angle_minuspi_to_pi() for "extreme values":
- TEST("vnl_math::angle_minuspi_to_pi(2pi)", vnl_math::angle_minuspi_to_pi(vnl_math::twopi), 0.0);
- TEST("vnl_math::angle_minuspi_to_pi(pi)", vnl_math::angle_minuspi_to_pi(vnl_math::pi), vnl_math::pi);
- TEST("vnl_math::angle_minuspi_to_pi(-pi)", vnl_math::angle_minuspi_to_pi(-vnl_math::pi), -vnl_math::pi);
- eps = vnl_math_test_2_epsilon; // which is smaller than the precision of vnl_math::pi
- conv_eps = vnl_math::angle_minuspi_to_pi(-eps);
+ "vnl_math::detail::angle_0_to_2pi(-10eps)", conv_eps < vnl_math::detail::twopi - vnl_math_test_2_epsilon && conv_eps > 6.283, true);
+ const double ang = vnl_math::detail::twopi - eps;
+ const double conv_ang = vnl_math::detail::angle_0_to_2pi(ang);
+ std::cout << "conv_ang = " << conv_ang << " = 2pi - " << vnl_math::detail::twopi - conv_ang << std::endl;
+ TEST("vnl_math::detail::angle_0_to_2pi(2pi-10eps)", conv_ang, ang);
+ // test vnl_math::detail::angle_minuspi_to_pi() for "extreme values":
+ TEST("vnl_math::detail::angle_minuspi_to_pi(2pi)", vnl_math::detail::angle_minuspi_to_pi(vnl_math::detail::twopi), 0.0);
+ TEST("vnl_math::detail::angle_minuspi_to_pi(pi)", vnl_math::detail::angle_minuspi_to_pi(vnl_math::detail::pi), vnl_math::detail::pi);
+ TEST("vnl_math::detail::angle_minuspi_to_pi(-pi)", vnl_math::detail::angle_minuspi_to_pi(-vnl_math::detail::pi), -vnl_math::detail::pi);
+ eps = vnl_math_test_2_epsilon; // which is smaller than the precision of vnl_math::detail::pi
+ conv_eps = vnl_math::detail::angle_minuspi_to_pi(-eps);
std::cout << "conv_eps = " << conv_eps << std::endl;
- TEST("vnl_math::angle_minuspi_to_pi(-eps)", conv_eps, -eps);
- eps = vnl_math_test_20_epsilon; // which is larger than the precision of vnl_math::pi
- conv_eps = vnl_math::angle_minuspi_to_pi(-eps);
+ TEST("vnl_math::detail::angle_minuspi_to_pi(-eps)", conv_eps, -eps);
+ eps = vnl_math_test_20_epsilon; // which is larger than the precision of vnl_math::detail::pi
+ conv_eps = vnl_math::detail::angle_minuspi_to_pi(-eps);
std::cout << "conv_eps = " << conv_eps << std::endl;
- TEST("vnl_math::angle_minuspi_to_pi(-10eps)", conv_eps, -eps);
+ TEST("vnl_math::detail::angle_minuspi_to_pi(-10eps)", conv_eps, -eps);
///////////////
// TRUNCATED //
@@ -457,33 +461,33 @@ test_math()
long double y_long_double = 2;
#endif
- TEST("vnl_math::remainder_truncated(x_short_u ,y_short_u )",
- vnl_math::remainder_truncated(x_short_u, y_short_u),
+ TEST("vnl_math::detail::remainder_truncated(x_short_u ,y_short_u )",
+ vnl_math::detail::remainder_truncated(x_short_u, y_short_u),
+1);
- TEST("vnl_math::remainder_truncated(x_short_s ,y_short_s )",
- vnl_math::remainder_truncated(x_short_s, y_short_s),
+ TEST("vnl_math::detail::remainder_truncated(x_short_s ,y_short_s )",
+ vnl_math::detail::remainder_truncated(x_short_s, y_short_s),
+1);
- TEST("vnl_math::remainder_truncated(x_int_u ,y_int_u )",
- vnl_math::remainder_truncated(x_int_u, y_int_u),
+ TEST("vnl_math::detail::remainder_truncated(x_int_u ,y_int_u )",
+ vnl_math::detail::remainder_truncated(x_int_u, y_int_u),
+1);
- TEST("vnl_math::remainder_truncated(x_int_s ,y_int_s )",
- vnl_math::remainder_truncated(x_int_s, y_int_s),
+ TEST("vnl_math::detail::remainder_truncated(x_int_s ,y_int_s )",
+ vnl_math::detail::remainder_truncated(x_int_s, y_int_s),
+1);
- TEST("vnl_math::remainder_truncated(x_long_u ,y_long_u )",
- vnl_math::remainder_truncated(x_long_u, y_long_u),
+ TEST("vnl_math::detail::remainder_truncated(x_long_u ,y_long_u )",
+ vnl_math::detail::remainder_truncated(x_long_u, y_long_u),
+1);
- TEST("vnl_math::remainder_truncated(x_long_s ,y_long_s )",
- vnl_math::remainder_truncated(x_long_s, y_long_s),
+ TEST("vnl_math::detail::remainder_truncated(x_long_s ,y_long_s )",
+ vnl_math::detail::remainder_truncated(x_long_s, y_long_s),
+1);
- TEST("vnl_math::remainder_truncated(x_float ,y_float )",
- vnl_math::remainder_truncated(x_float, y_float),
+ TEST("vnl_math::detail::remainder_truncated(x_float ,y_float )",
+ vnl_math::detail::remainder_truncated(x_float, y_float),
+1);
- TEST("vnl_math::remainder_truncated(x_double ,y_double )",
- vnl_math::remainder_truncated(x_double, y_double),
+ TEST("vnl_math::detail::remainder_truncated(x_double ,y_double )",
+ vnl_math::detail::remainder_truncated(x_double, y_double),
+1);
#ifdef INCLUDE_LONG_DOUBLE_TESTS
- TEST("vnl_math::remainder_truncated(x_long_double,y_long_double)",
- vnl_math::remainder_truncated(x_long_double, y_long_double),
+ TEST("vnl_math::detail::remainder_truncated(x_long_double,y_long_double)",
+ vnl_math::detail::remainder_truncated(x_long_double, y_long_double),
+1);
#endif
@@ -498,24 +502,24 @@ test_math()
y_long_double *= -1;
#endif
- TEST("vnl_math::remainder_truncated(x_short_s ,y_short_s )",
- vnl_math::remainder_truncated(x_short_s, y_short_s),
+ TEST("vnl_math::detail::remainder_truncated(x_short_s ,y_short_s )",
+ vnl_math::detail::remainder_truncated(x_short_s, y_short_s),
+1);
- TEST("vnl_math::remainder_truncated(x_int_s ,y_int_s )",
- vnl_math::remainder_truncated(x_int_s, y_int_s),
+ TEST("vnl_math::detail::remainder_truncated(x_int_s ,y_int_s )",
+ vnl_math::detail::remainder_truncated(x_int_s, y_int_s),
+1);
- TEST("vnl_math::remainder_truncated(x_long_s ,y_long_s )",
- vnl_math::remainder_truncated(x_long_s, y_long_s),
+ TEST("vnl_math::detail::remainder_truncated(x_long_s ,y_long_s )",
+ vnl_math::detail::remainder_truncated(x_long_s, y_long_s),
+1);
- TEST("vnl_math::remainder_truncated(x_float ,y_float )",
- vnl_math::remainder_truncated(x_float, y_float),
+ TEST("vnl_math::detail::remainder_truncated(x_float ,y_float )",
+ vnl_math::detail::remainder_truncated(x_float, y_float),
+1);
- TEST("vnl_math::remainder_truncated(x_double ,y_double )",
- vnl_math::remainder_truncated(x_double, y_double),
+ TEST("vnl_math::detail::remainder_truncated(x_double ,y_double )",
+ vnl_math::detail::remainder_truncated(x_double, y_double),
+1);
#ifdef INCLUDE_LONG_DOUBLE_TESTS
- TEST("vnl_math::remainder_truncated(x_long_double,y_long_double)",
- vnl_math::remainder_truncated(x_long_double, y_long_double),
+ TEST("vnl_math::detail::remainder_truncated(x_long_double,y_long_double)",
+ vnl_math::detail::remainder_truncated(x_long_double, y_long_double),
+1);
#endif
@@ -530,24 +534,24 @@ test_math()
x_long_double *= -1;
#endif
- TEST("vnl_math::remainder_truncated(x_short_s ,y_short_s )",
- vnl_math::remainder_truncated(x_short_s, y_short_s),
+ TEST("vnl_math::detail::remainder_truncated(x_short_s ,y_short_s )",
+ vnl_math::detail::remainder_truncated(x_short_s, y_short_s),
-1);
- TEST("vnl_math::remainder_truncated(x_int_s ,y_int_s )",
- vnl_math::remainder_truncated(x_int_s, y_int_s),
+ TEST("vnl_math::detail::remainder_truncated(x_int_s ,y_int_s )",
+ vnl_math::detail::remainder_truncated(x_int_s, y_int_s),
-1);
- TEST("vnl_math::remainder_truncated(x_long_s ,y_long_s )",
- vnl_math::remainder_truncated(x_long_s, y_long_s),
+ TEST("vnl_math::detail::remainder_truncated(x_long_s ,y_long_s )",
+ vnl_math::detail::remainder_truncated(x_long_s, y_long_s),
-1);
- TEST("vnl_math::remainder_truncated(x_float ,y_float )",
- vnl_math::remainder_truncated(x_float, y_float),
+ TEST("vnl_math::detail::remainder_truncated(x_float ,y_float )",
+ vnl_math::detail::remainder_truncated(x_float, y_float),
-1);
- TEST("vnl_math::remainder_truncated(x_double ,y_double )",
- vnl_math::remainder_truncated(x_double, y_double),
+ TEST("vnl_math::detail::remainder_truncated(x_double ,y_double )",
+ vnl_math::detail::remainder_truncated(x_double, y_double),
-1);
#ifdef INCLUDE_LONG_DOUBLE_TESTS
- TEST("vnl_math::remainder_truncated(x_long_double,y_long_double)",
- vnl_math::remainder_truncated(x_long_double, y_long_double),
+ TEST("vnl_math::detail::remainder_truncated(x_long_double,y_long_double)",
+ vnl_math::detail::remainder_truncated(x_long_double, y_long_double),
-1);
#endif
@@ -562,24 +566,24 @@ test_math()
y_long_double *= -1;
#endif
- TEST("vnl_math::remainder_truncated(x_short_s ,y_short_s )",
- vnl_math::remainder_truncated(x_short_s, y_short_s),
+ TEST("vnl_math::detail::remainder_truncated(x_short_s ,y_short_s )",
+ vnl_math::detail::remainder_truncated(x_short_s, y_short_s),
-1);
- TEST("vnl_math::remainder_truncated(x_int_s ,y_int_s )",
- vnl_math::remainder_truncated(x_int_s, y_int_s),
+ TEST("vnl_math::detail::remainder_truncated(x_int_s ,y_int_s )",
+ vnl_math::detail::remainder_truncated(x_int_s, y_int_s),
-1);
- TEST("vnl_math::remainder_truncated(x_long_s ,y_long_s )",
- vnl_math::remainder_truncated(x_long_s, y_long_s),
+ TEST("vnl_math::detail::remainder_truncated(x_long_s ,y_long_s )",
+ vnl_math::detail::remainder_truncated(x_long_s, y_long_s),
-1);
- TEST("vnl_math::remainder_truncated(x_float ,y_float )",
- vnl_math::remainder_truncated(x_float, y_float),
+ TEST("vnl_math::detail::remainder_truncated(x_float ,y_float )",
+ vnl_math::detail::remainder_truncated(x_float, y_float),
-1);
- TEST("vnl_math::remainder_truncated(x_double ,y_double )",
- vnl_math::remainder_truncated(x_double, y_double),
+ TEST("vnl_math::detail::remainder_truncated(x_double ,y_double )",
+ vnl_math::detail::remainder_truncated(x_double, y_double),
-1);
#ifdef INCLUDE_LONG_DOUBLE_TESTS
- TEST("vnl_math::remainder_truncated(x_long_double,y_long_double)",
- vnl_math::remainder_truncated(x_long_double, y_long_double),
+ TEST("vnl_math::detail::remainder_truncated(x_long_double,y_long_double)",
+ vnl_math::detail::remainder_truncated(x_long_double, y_long_double),
-1);
#endif
}
@@ -617,24 +621,24 @@ test_math()
long double y_long_double = 2;
#endif
- TEST("vnl_math::remainder_floored(x_short_u ,y_short_u )",
- vnl_math::remainder_floored(x_short_u, y_short_u),
+ TEST("vnl_math::detail::remainder_floored(x_short_u ,y_short_u )",
+ vnl_math::detail::remainder_floored(x_short_u, y_short_u),
+1);
- TEST("vnl_math::remainder_floored(x_short_s ,y_short_s )",
- vnl_math::remainder_floored(x_short_s, y_short_s),
+ TEST("vnl_math::detail::remainder_floored(x_short_s ,y_short_s )",
+ vnl_math::detail::remainder_floored(x_short_s, y_short_s),
+1);
- TEST("vnl_math::remainder_floored(x_int_u ,y_int_u )", vnl_math::remainder_floored(x_int_u, y_int_u), +1);
- TEST("vnl_math::remainder_floored(x_int_s ,y_int_s )", vnl_math::remainder_floored(x_int_s, y_int_s), +1);
+ TEST("vnl_math::detail::remainder_floored(x_int_u ,y_int_u )", vnl_math::detail::remainder_floored(x_int_u, y_int_u), +1);
+ TEST("vnl_math::detail::remainder_floored(x_int_s ,y_int_s )", vnl_math::detail::remainder_floored(x_int_s, y_int_s), +1);
TEST(
- "vnl_math::remainder_floored(x_long_u ,y_long_u )", vnl_math::remainder_floored(x_long_u, y_long_u), +1);
+ "vnl_math::detail::remainder_floored(x_long_u ,y_long_u )", vnl_math::detail::remainder_floored(x_long_u, y_long_u), +1);
TEST(
- "vnl_math::remainder_floored(x_long_s ,y_long_s )", vnl_math::remainder_floored(x_long_s, y_long_s), +1);
- TEST("vnl_math::remainder_floored(x_float ,y_float )", vnl_math::remainder_floored(x_float, y_float), +1);
+ "vnl_math::detail::remainder_floored(x_long_s ,y_long_s )", vnl_math::detail::remainder_floored(x_long_s, y_long_s), +1);
+ TEST("vnl_math::detail::remainder_floored(x_float ,y_float )", vnl_math::detail::remainder_floored(x_float, y_float), +1);
TEST(
- "vnl_math::remainder_floored(x_double ,y_double )", vnl_math::remainder_floored(x_double, y_double), +1);
+ "vnl_math::detail::remainder_floored(x_double ,y_double )", vnl_math::detail::remainder_floored(x_double, y_double), +1);
#ifdef INCLUDE_LONG_DOUBLE_TESTS
- TEST("vnl_math::remainder_floored(x_long_double,y_long_double)",
- vnl_math::remainder_floored(x_long_double, y_long_double),
+ TEST("vnl_math::detail::remainder_floored(x_long_double,y_long_double)",
+ vnl_math::detail::remainder_floored(x_long_double, y_long_double),
+1);
#endif
@@ -649,18 +653,18 @@ test_math()
y_long_double *= -1;
#endif
- TEST("vnl_math::remainder_floored(x_short_s ,y_short_s )",
- vnl_math::remainder_floored(x_short_s, y_short_s),
+ TEST("vnl_math::detail::remainder_floored(x_short_s ,y_short_s )",
+ vnl_math::detail::remainder_floored(x_short_s, y_short_s),
-1);
- TEST("vnl_math::remainder_floored(x_int_s ,y_int_s )", vnl_math::remainder_floored(x_int_s, y_int_s), -1);
+ TEST("vnl_math::detail::remainder_floored(x_int_s ,y_int_s )", vnl_math::detail::remainder_floored(x_int_s, y_int_s), -1);
TEST(
- "vnl_math::remainder_floored(x_long_s ,y_long_s )", vnl_math::remainder_floored(x_long_s, y_long_s), -1);
- TEST("vnl_math::remainder_floored(x_float ,y_float )", vnl_math::remainder_floored(x_float, y_float), -1);
+ "vnl_math::detail::remainder_floored(x_long_s ,y_long_s )", vnl_math::detail::remainder_floored(x_long_s, y_long_s), -1);
+ TEST("vnl_math::detail::remainder_floored(x_float ,y_float )", vnl_math::detail::remainder_floored(x_float, y_float), -1);
TEST(
- "vnl_math::remainder_floored(x_double ,y_double )", vnl_math::remainder_floored(x_double, y_double), -1);
+ "vnl_math::detail::remainder_floored(x_double ,y_double )", vnl_math::detail::remainder_floored(x_double, y_double), -1);
#ifdef INCLUDE_LONG_DOUBLE_TESTS
- TEST("vnl_math::remainder_floored(x_long_double,y_long_double)",
- vnl_math::remainder_floored(x_long_double, y_long_double),
+ TEST("vnl_math::detail::remainder_floored(x_long_double,y_long_double)",
+ vnl_math::detail::remainder_floored(x_long_double, y_long_double),
-1);
#endif
@@ -675,18 +679,18 @@ test_math()
x_long_double *= -1;
#endif
- TEST("vnl_math::remainder_floored(x_short_s ,y_short_s )",
- vnl_math::remainder_floored(x_short_s, y_short_s),
+ TEST("vnl_math::detail::remainder_floored(x_short_s ,y_short_s )",
+ vnl_math::detail::remainder_floored(x_short_s, y_short_s),
-1);
- TEST("vnl_math::remainder_floored(x_int_s ,y_int_s )", vnl_math::remainder_floored(x_int_s, y_int_s), -1);
+ TEST("vnl_math::detail::remainder_floored(x_int_s ,y_int_s )", vnl_math::detail::remainder_floored(x_int_s, y_int_s), -1);
TEST(
- "vnl_math::remainder_floored(x_long_s ,y_long_s )", vnl_math::remainder_floored(x_long_s, y_long_s), -1);
- TEST("vnl_math::remainder_floored(x_float ,y_float )", vnl_math::remainder_floored(x_float, y_float), -1);
+ "vnl_math::detail::remainder_floored(x_long_s ,y_long_s )", vnl_math::detail::remainder_floored(x_long_s, y_long_s), -1);
+ TEST("vnl_math::detail::remainder_floored(x_float ,y_float )", vnl_math::detail::remainder_floored(x_float, y_float), -1);
TEST(
- "vnl_math::remainder_floored(x_double ,y_double )", vnl_math::remainder_floored(x_double, y_double), -1);
+ "vnl_math::detail::remainder_floored(x_double ,y_double )", vnl_math::detail::remainder_floored(x_double, y_double), -1);
#ifdef INCLUDE_LONG_DOUBLE_TESTS
- TEST("vnl_math::remainder_floored(x_long_double,y_long_double)",
- vnl_math::remainder_floored(x_long_double, y_long_double),
+ TEST("vnl_math::detail::remainder_floored(x_long_double,y_long_double)",
+ vnl_math::detail::remainder_floored(x_long_double, y_long_double),
-1);
#endif
@@ -701,27 +705,28 @@ test_math()
y_long_double *= -1;
#endif
- TEST("vnl_math::remainder_floored(x_short_s ,y_short_s )",
- vnl_math::remainder_floored(x_short_s, y_short_s),
+ TEST("vnl_math::detail::remainder_floored(x_short_s ,y_short_s )",
+ vnl_math::detail::remainder_floored(x_short_s, y_short_s),
+1);
- TEST("vnl_math::remainder_floored(x_int_s ,y_int_s )", vnl_math::remainder_floored(x_int_s, y_int_s), +1);
+ TEST("vnl_math::detail::remainder_floored(x_int_s ,y_int_s )", vnl_math::detail::remainder_floored(x_int_s, y_int_s), +1);
TEST(
- "vnl_math::remainder_floored(x_long_s ,y_long_s )", vnl_math::remainder_floored(x_long_s, y_long_s), +1);
- TEST("vnl_math::remainder_floored(x_float ,y_float )", vnl_math::remainder_floored(x_float, y_float), +1);
+ "vnl_math::detail::remainder_floored(x_long_s ,y_long_s )", vnl_math::detail::remainder_floored(x_long_s, y_long_s), +1);
+ TEST("vnl_math::detail::remainder_floored(x_float ,y_float )", vnl_math::detail::remainder_floored(x_float, y_float), +1);
TEST(
- "vnl_math::remainder_floored(x_double ,y_double )", vnl_math::remainder_floored(x_double, y_double), +1);
+ "vnl_math::detail::remainder_floored(x_double ,y_double )", vnl_math::detail::remainder_floored(x_double, y_double), +1);
#ifdef INCLUDE_LONG_DOUBLE_TESTS
- TEST("vnl_math::remainder_floored(x_long_double,y_long_double)",
- vnl_math::remainder_floored(x_long_double, y_long_double),
+ TEST("vnl_math::detail::remainder_floored(x_long_double,y_long_double)",
+ vnl_math::detail::remainder_floored(x_long_double, y_long_double),
+1);
#endif
}
#define RETURN_TYPE_TEST(funcname, argtypename, returntypename) \
{ \
- const bool test_return_type = \
- std::is_same(123.4))), returntypename>(); \
- TEST("vnl_math::" #funcname "<" #argtypename "> returns " #returntypename " type", test_return_type, true); \
+ const bool test_return_type = \
+ std::is_same(123.4))), \
+ returntypename>(); \
+ TEST("vnl_math::" #funcname "<" #argtypename "> returns " #returntypename " type", test_return_type, true); \
} \
void()
diff --git a/Modules/ThirdParty/VNL/src/vxl/core/vnl/tests/test_na.cxx b/Modules/ThirdParty/VNL/src/vxl/core/vnl/tests/test_na.cxx
index 72a30267b8a..a78701fad71 100644
--- a/Modules/ThirdParty/VNL/src/vxl/core/vnl/tests/test_na.cxx
+++ b/Modules/ThirdParty/VNL/src/vxl/core/vnl/tests/test_na.cxx
@@ -19,15 +19,15 @@ template
void
test_na_type(T na_v, T qnan_v)
{
- TEST("isnan(NaN)", vnl_math::isnan(qnan_v), true);
- TEST("isnan(NA)", vnl_math::isnan(vnl_na(T())), true);
- TEST("isnan(NA2)", vnl_math::isnan(na_v), true);
- TEST("isnan(1/NA2)", vnl_math::isnan(1.0f / na_v), true);
+ TEST("isnan(NaN)", vnl_math::numeric_predicates::isnan(qnan_v), true);
+ TEST("isnan(NA)", vnl_math::numeric_predicates::isnan(vnl_na(T())), true);
+ TEST("isnan(NA2)", vnl_math::numeric_predicates::isnan(na_v), true);
+ TEST("isnan(1/NA2)", vnl_math::numeric_predicates::isnan(1.0f / na_v), true);
TEST("isna(NA)", vnl_na_isna(vnl_na(T())), true);
TEST("isna(NA2)", vnl_na_isna(na_v), true);
TEST("isna(1/NA2)", vnl_na_isna(1.0f / na_v), true);
- TEST("!isfinite(NA)", !vnl_math::isfinite(na_v), true);
- TEST("!isinf(NA)", !vnl_math::isinf(na_v), true);
+ TEST("!isfinite(NA)", !vnl_math::numeric_predicates::isfinite(na_v), true);
+ TEST("!isinf(NA)", !vnl_math::numeric_predicates::isinf(na_v), true);
TEST("!isna(0)", !vnl_na_isna(0.0), true);
TEST("!isna(-0)", !vnl_na_isna(-0.0), true);
diff --git a/Modules/ThirdParty/VNL/src/vxl/core/vnl/tests/test_quaternion.cxx b/Modules/ThirdParty/VNL/src/vxl/core/vnl/tests/test_quaternion.cxx
index b747fda0ffd..4ff63f13a39 100644
--- a/Modules/ThirdParty/VNL/src/vxl/core/vnl/tests/test_quaternion.cxx
+++ b/Modules/ThirdParty/VNL/src/vxl/core/vnl/tests/test_quaternion.cxx
@@ -41,7 +41,7 @@ test_random_round_trip()
{
// Need to be careful abount wrap around - don't test with angles that are too big
vnl_vector_fixed euler(
- rng.normal() * vnl_math::pi / 18.0, rng.normal() * vnl_math::pi / 18.0, rng.normal() * vnl_math::pi / 18.0);
+ rng.normal() * vnl_math::detail::pi / 18.0, rng.normal() * vnl_math::detail::pi / 18.0, rng.normal() * vnl_math::detail::pi / 18.0);
const vnl_quaternion quat(euler(0), euler(1), euler(2));
const vnl_vector_fixed out = quat.rotation_euler_angles();
const double err = vnl_vector_ssd(euler, out);
@@ -66,9 +66,9 @@ test_random_euler_near_zero()
{
// Need to be careful abount wrap around - don't test with angles that are too big
vnl_vector_fixed euler(
- rng.normal() * vnl_math::pi_over_180, rng.normal() * vnl_math::pi_over_180, rng.normal() * vnl_math::pi_over_180);
+ rng.normal() * vnl_math::detail::pi_over_180, rng.normal() * vnl_math::detail::pi_over_180, rng.normal() * vnl_math::detail::pi_over_180);
vnl_quaternion quat(euler(0), euler(1), euler(2));
- if (quat.angle() > vnl_math::pi / 36.0)
+ if (quat.angle() > vnl_math::detail::pi / 36.0)
{
errcount++;
std::cout << "ERROR: should be small: " << euler << ": " << quat << std::endl;
@@ -97,7 +97,7 @@ test_random_quat_near_zero()
vnl_quaternion quat(rng.normal() / 1000.0,
rng.normal() / 1000.0,
rng.normal() / 1000.0,
- vnl_math::sgn0(rng.normal()) * (1.0 + rng.normal() / 1000.0));
+ vnl_math::detail::sgn0(rng.normal()) * (1.0 + rng.normal() / 1000.0));
quat.normalize();
const vnl_vector_fixed euler = quat.rotation_euler_angles();
@@ -128,7 +128,7 @@ test_rotation_matrix_and_euler_angles()
const double z = rng.drand32(-1.0, 1.0);
vnl_vector_fixed axis(x, y, z);
axis.normalize();
- const double ang = rng.drand32(-4 * vnl_math::pi, 4 * vnl_math::pi);
+ const double ang = rng.drand32(-4 * vnl_math::detail::pi, 4 * vnl_math::detail::pi);
// Construct the quaternion from this axis and angle,
// and extract both euler_angles and rotation matrix.
@@ -212,8 +212,8 @@ test_rotations()
TEST_NEAR("rotate p2 using q0_d", vnl_vector_ssd(q0_d.rotate(p2), p2), 0.0, 1e-8);
// The axis replacing rotation - i.e. 120 degrees about (1,1,1)
- vnl_vector_fixed e1(vnl_math::pi / 2, 0, vnl_math::pi / 2);
- const vnl_quaternion q1(p1 / p1.magnitude(), vnl_math::twopi / 3.0);
+ vnl_vector_fixed e1(vnl_math::detail::pi / 2, 0, vnl_math::detail::pi / 2);
+ const vnl_quaternion q1(p1 / p1.magnitude(), vnl_math::detail::twopi / 3.0);
TEST_NEAR("rotate p1 using q1", vnl_vector_ssd(q1.rotate(p1), p1), 0.0, 1e-8);
TEST_NEAR("rotate p2 using q1", vnl_vector_ssd(q1.rotate(p2), p3), 0.0, 1e-8);
const vnl_vector_fixed e1_b = q1.rotation_euler_angles();
diff --git a/Modules/ThirdParty/VNL/src/vxl/core/vnl/tests/test_rotation_matrix.cxx b/Modules/ThirdParty/VNL/src/vxl/core/vnl/tests/test_rotation_matrix.cxx
index ce36ff02cd7..8c6cb1ca29e 100644
--- a/Modules/ThirdParty/VNL/src/vxl/core/vnl/tests/test_rotation_matrix.cxx
+++ b/Modules/ThirdParty/VNL/src/vxl/core/vnl/tests/test_rotation_matrix.cxx
@@ -118,7 +118,7 @@ test_euler_rotations()
for (unsigned i = 0; i < ntrials; ++i)
{
bool this_trial_ok = true;
- const double ang = randgen.drand32(-4 * vnl_math::pi, 4 * vnl_math::pi);
+ const double ang = randgen.drand32(-4 * vnl_math::detail::pi, 4 * vnl_math::detail::pi);
vnl_vector axis(3); // The magnitude of this vector indicates the angle of rotation
vnl_matrix_fixed M; // True answer
diff --git a/Modules/ThirdParty/VNL/src/vxl/core/vnl/tests/test_vector.cxx b/Modules/ThirdParty/VNL/src/vxl/core/vnl/tests/test_vector.cxx
index 6070a0ccce6..486a1d0e87e 100644
--- a/Modules/ThirdParty/VNL/src/vxl/core/vnl/tests/test_vector.cxx
+++ b/Modules/ThirdParty/VNL/src/vxl/core/vnl/tests/test_vector.cxx
@@ -505,7 +505,7 @@ vnl_vector_test_float()
std::cout << "v3 = " << v3 << std::endl << "v1 - v2 = " << v1 - v2 << std::endl;
double ang = angle(v1, v2);
std::cout << "angle(v1,v2) = " << ang << std::endl;
- ang *= vnl_math::deg_per_rad; // == 180/pi
+ ang *= vnl_math::detail::deg_per_rad; // == 180/pi
std::cout << "angle(v1,v2) in degrees = " << ang << std::endl
<< "v1.size()=" << v1.size() << std::endl
<< "v2.size()=" << v2.size() << std::endl
@@ -514,7 +514,7 @@ vnl_vector_test_float()
TEST_NEAR("angle(v1,v2)", ang, 90.0, 1e-15);
double ang2 = angle(v1, v3);
std::cout << "angle(v1,v3) = " << ang << std::endl;
- ang2 *= vnl_math::deg_per_rad; // == 180/pi
+ ang2 *= vnl_math::detail::deg_per_rad; // == 180/pi
std::cout << "angle(v1,v3) in degrees = " << ang2 << std::endl;
TEST_NEAR("angle(v1,v3)", ang2, 135.0, 1e-6);
TEST_NEAR("mean", vnl_c_vector::mean(v.begin(), v.size()), 2.0, 1e-6);
diff --git a/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_c_na_vector.hxx b/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_c_na_vector.hxx
index 0a8259b2a31..7607c71a312 100644
--- a/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_c_na_vector.hxx
+++ b/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_c_na_vector.hxx
@@ -65,7 +65,7 @@ vnl_c_na_vector_two_norm_squared(const T * p, unsigned n, S * out)
{
if (!vnl_na_isna(*p))
{
- val += S(vnl_math::squared_magnitude(*p));
+ val += S(vnl_math::detail::squared_magnitude(*p));
any_valid = true;
}
}
@@ -82,7 +82,7 @@ vnl_c_na_vector_rms_norm(const T * p, unsigned n, S * out)
{
if (!vnl_na_isna(*p))
{
- val += S(vnl_math::squared_magnitude(*p));
+ val += S(vnl_math::detail::squared_magnitude(*p));
n_finite++;
}
}
@@ -100,7 +100,7 @@ vnl_c_na_vector_one_norm(const T * p, unsigned n, S * out)
{
if (!vnl_na_isna(*p))
{
- val += vnl_math::abs(*p++);
+ val += vnl_math::detail::abs(*p++);
any_valid = true;
}
}
@@ -125,7 +125,7 @@ vnl_c_na_vector_inf_norm(const T * p, unsigned n, S * out)
bool any_valid(false);
for (const T * end = p + n; p != end; p++)
{
- S v = vnl_math::abs(*p);
+ S v = vnl_math::detail::abs(*p);
if (v > val) // don't need to test for NA, because NA > x is always false.
{
v = val;
diff --git a/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_c_vector.hxx b/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_c_vector.hxx
index 2ecdc3c7593..4f55204ed9c 100644
--- a/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_c_vector.hxx
+++ b/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_c_vector.hxx
@@ -34,7 +34,7 @@ vnl_c_vector::normalize(T * v, unsigned n)
{
using real_abs_t = typename vnl_numeric_traits::real_t;
abs_t tmp =
- std::accumulate(v, v + n, abs_t(0), [](abs_t s, const T & x) { return s + vnl_math::squared_magnitude(x); });
+ std::accumulate(v, v + n, abs_t(0), [](abs_t s, const T & x) { return s + vnl_math::detail::squared_magnitude(x); });
if (tmp != 0)
{
tmp = abs_t(real_abs_t(1) / std::sqrt(real_abs_t(tmp)));
@@ -327,7 +327,7 @@ vnl_c_vector_two_norm_squared(const T * p, unsigned n, S * out)
S val = S(0);
const T * end = p + n;
while (p != end)
- val += S(vnl_math::squared_magnitude(*p++));
+ val += S(vnl_math::detail::squared_magnitude(*p++));
*out = val;
}
@@ -348,7 +348,7 @@ vnl_c_vector_one_norm(const T * p, unsigned n, S * out)
*out = 0;
const T * end = p + n;
while (p != end)
- *out += vnl_math::abs(*p++);
+ *out += vnl_math::detail::abs(*p++);
}
template
@@ -368,7 +368,7 @@ vnl_c_vector_inf_norm(const T * p, unsigned n, S * out)
const T * end = p + n;
while (p != end)
{
- S v = vnl_math::abs(*p++);
+ S v = vnl_math::detail::abs(*p++);
if (v > *out)
*out = v;
}
diff --git a/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_complex.h b/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_complex.h
index 91834761209..a8bb92e3c84 100644
--- a/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_complex.h
+++ b/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_complex.h
@@ -27,15 +27,58 @@
namespace vnl_math
{
-// should consider making these function templated,
-#define type_macro(T) \
- inline bool isnan(std::complex const & z) { return isnan(std::real(z)) || isnan(std::imag(z)); } \
- inline bool isfinite(std::complex const & z) { return isfinite(std::real(z)) && isfinite(std::imag(z)); } \
- inline T abs(std::complex const & z) { return std::abs(z); } \
- inline std::complex sqr(std::complex const & z) { return z * z; } \
+namespace numeric_predicates
+{
+#define type_macro(T) \
+ inline bool isnan(std::complex const & z) { return isnan(std::real(z)) || isnan(std::imag(z)); } \
+ inline bool isfinite(std::complex const & z) { return isfinite(std::real(z)) && isfinite(std::imag(z)); }
+type_macro(float) type_macro(double) type_macro(long double)
+#undef type_macro
+} // namespace numeric_predicates
+
+// Deprecated public spellings; the non-template overloads divert complex calls
+// away from the deprecated vnl_math:: forwarder templates in vnl_math.h.
+#if VNL_MATH_DEPRECATE_PREDICATES
+# define VNL_MATH_CPLX_PREDICATE_DEPRECATED \
+ [[deprecated("vnl_math:: classification functions are deprecated; use std::isnan/isinf/isfinite/isnormal or itk::Math")]]
+#else
+# define VNL_MATH_CPLX_PREDICATE_DEPRECATED
+#endif
+#define type_macro(T) \
+ VNL_MATH_CPLX_PREDICATE_DEPRECATED inline bool isnan(std::complex const & z) { return numeric_predicates::isnan(z); } \
+ VNL_MATH_CPLX_PREDICATE_DEPRECATED inline bool isfinite(std::complex const & z) { return numeric_predicates::isfinite(z); }
+type_macro(float) type_macro(double) type_macro(long double)
+#undef type_macro
+#undef VNL_MATH_CPLX_PREDICATE_DEPRECATED
+
+namespace detail // unstable; not part of the public API
+{
+#define type_macro(T) \
+ inline std::complex sqr(std::complex const & z) { return z * z; } \
inline T squared_magnitude(std::complex const & z) { return std::norm(z); }
type_macro(float) type_macro(double) type_macro(long double)
#undef type_macro
+} // namespace detail
+// vnl_math::abs(std::complex) resolves through detail's `using std::abs`
+// (std::abs(std::complex) from ); no separate overload is needed.
+
+// Deprecated public spellings; the non-template overloads divert complex calls
+// away from the deprecated vnl_math:: forwarder templates in vnl_math.h.
+#if VNL_MATH_DEPRECATE_FUNCTIONS
+# define VNL_MATH_CPLX_FUNCTION_DEPRECATED \
+ [[deprecated("this vnl_math:: function is deprecated; use the std:: equivalent or itk::Math")]]
+#else
+# define VNL_MATH_CPLX_FUNCTION_DEPRECATED
+#endif
+#define type_macro(T) \
+ VNL_MATH_CPLX_FUNCTION_DEPRECATED inline std::complex sqr(std::complex const & z) { return detail::sqr(z); } \
+ VNL_MATH_CPLX_FUNCTION_DEPRECATED inline T squared_magnitude(std::complex const & z) \
+ { \
+ return detail::squared_magnitude(z); \
+ }
+type_macro(float) type_macro(double) type_macro(long double)
+#undef type_macro
+#undef VNL_MATH_CPLX_FUNCTION_DEPRECATED
} // end namespace vnl_math
diff --git a/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_erf.h b/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_erf.h
index 20e05abe181..b950a472996 100644
--- a/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_erf.h
+++ b/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_erf.h
@@ -34,7 +34,7 @@ vnl_erfc(double x);
inline double
vnl_scaled_erfc(double x)
{
- return (vnl_math::two_over_sqrtpi / 2.) * (1. / x);
+ return (vnl_math::detail::two_over_sqrtpi / 2.) * (1. / x);
}
#endif // vnl_erf_h_
diff --git a/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_error.h b/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_error.h
index ee3e8aa1c02..3d47c762c07 100644
--- a/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_error.h
+++ b/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_error.h
@@ -46,7 +46,7 @@ vnl_error_matrix_va_arg(int n);
template
inline void
-vnl_error_assert_int_range(T v)
+vnl_error_assert_int_range([[maybe_unused]] T v)
{
static_assert(std::is_integral_v);
if constexpr (sizeof(T) > sizeof(int) || (std::is_unsigned_v && sizeof(T) == sizeof(int)))
diff --git a/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_math.cxx b/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_math.cxx
index a6336834102..f001bb8e4fb 100644
--- a/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_math.cxx
+++ b/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_math.cxx
@@ -53,14 +53,16 @@ vnl_huge_val(char)
//----------------------------------------------------------------------
namespace vnl_math
{
+namespace detail
+{
double
angle_0_to_2pi(double angle)
{
- angle = std::fmod(angle, vnl_math::twopi);
+ angle = std::fmod(angle, vnl_math::detail::twopi);
if (angle >= 0)
return angle;
- const double a = angle + vnl_math::twopi;
- if (a > 0 && a < vnl_math::twopi)
+ const double a = angle + vnl_math::detail::twopi;
+ if (a > 0 && a < vnl_math::detail::twopi)
return a;
// added by Nhon: this fixes a bug when angle >= -1.1721201390607859e-016 :
// then after the above computation we get 6.2831853071795864769 == twopi
@@ -74,12 +76,13 @@ angle_0_to_2pi(double angle)
double
angle_minuspi_to_pi(double angle)
{
- angle = std::fmod(angle, vnl_math::twopi);
- if (angle > vnl_math::pi)
- angle -= vnl_math::twopi;
- if (angle < -vnl_math::pi)
- angle += vnl_math::twopi;
+ angle = std::fmod(angle, vnl_math::detail::twopi);
+ if (angle > vnl_math::detail::pi)
+ angle -= vnl_math::detail::twopi;
+ if (angle < -vnl_math::detail::pi)
+ angle += vnl_math::detail::twopi;
return angle;
}
+} // namespace detail
}; // end namespace vnl_math
diff --git a/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_math.h b/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_math.h
index fb55a1be66b..4c9d87b1bdd 100644
--- a/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_math.h
+++ b/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_math.h
@@ -38,6 +38,7 @@
#include
#include
#include
+#include
#ifdef _MSC_VER
# include
#endif
@@ -46,22 +47,35 @@
#include
//: Type-accessible infinities for use in templates.
+// Define VNL_MATH_DEPRECATE_HUGE_VAL=0 to silence during migration.
+#ifndef VNL_MATH_DEPRECATE_HUGE_VAL
+# define VNL_MATH_DEPRECATE_HUGE_VAL 1
+#endif
+#if VNL_MATH_DEPRECATE_HUGE_VAL
+# define VNL_HUGE_VAL_DEPRECATED \
+ [[deprecated("vnl_huge_val is deprecated; use std::numeric_limits::infinity() for " \
+ "floating-point T, or std::numeric_limits::max() for integral T")]]
+#else
+# define VNL_HUGE_VAL_DEPRECATED
+#endif
template
-VNL_EXPORT T vnl_huge_val(T);
-extern VNL_EXPORT long double
+VNL_HUGE_VAL_DEPRECATED VNL_EXPORT T
+vnl_huge_val(T);
+VNL_HUGE_VAL_DEPRECATED extern VNL_EXPORT long double
vnl_huge_val(long double);
-extern VNL_EXPORT double
+VNL_HUGE_VAL_DEPRECATED extern VNL_EXPORT double
vnl_huge_val(double);
-extern VNL_EXPORT float
+VNL_HUGE_VAL_DEPRECATED extern VNL_EXPORT float
vnl_huge_val(float);
-extern VNL_EXPORT long int
+VNL_HUGE_VAL_DEPRECATED extern VNL_EXPORT long int
vnl_huge_val(long int);
-extern VNL_EXPORT int
+VNL_HUGE_VAL_DEPRECATED extern VNL_EXPORT int
vnl_huge_val(int);
-extern VNL_EXPORT short
+VNL_HUGE_VAL_DEPRECATED extern VNL_EXPORT short
vnl_huge_val(short);
-extern VNL_EXPORT char
+VNL_HUGE_VAL_DEPRECATED extern VNL_EXPORT char
vnl_huge_val(char);
+#undef VNL_HUGE_VAL_DEPRECATED
//: real numerical constants
// Declared 'inline constexpr' so every translation unit that includes this
@@ -69,6 +83,17 @@ vnl_huge_val(char);
// internal-linkage copies produced by 'static constexpr'.
namespace vnl_math
{
+//: Undeprecated numeric constants for vnl's own internal use.
+// vnl source and headers reference these (e.g. vnl_math::detail::pi)
+// so they are unaffected by the deprecation of the public vnl_math:: aliases
+// below, even when vnl headers are instantiated in downstream translation units.
+//
+// NOT part of the public API: this namespace and its members are an
+// implementation detail, carry no stability guarantee, and may be renamed or
+// removed at any time. Downstream code must use std::numbers (C++20) or its
+// toolkit's constants (e.g. itk::Math), never these.
+namespace detail // unstable; not part of the public API
+{
//: pi, e and all that. Constants are rounded to the shown precision.
inline constexpr double e = 2.71828182845904523536; // http://oeis.org/A001113
inline constexpr double log2e = 1.44269504088896340736; // http://oeis.org/A007525
@@ -90,124 +115,158 @@ inline constexpr double sqrt2 = 1.41421356237309504880; // http://oei
inline constexpr double sqrt1_2 = 0.70710678118654752440; // http://oeis.org/A010503
inline constexpr double sqrt1_3 = 0.57735026918962576451; // http://oeis.org/A020760
inline constexpr double euler = 0.57721566490153286061; // http://oeis.org/A001620
-
//: IEEE double machine precision
inline constexpr double eps = std::numeric_limits::epsilon();
-inline constexpr double sqrteps = 1.490116119384766e-08;
+inline constexpr double sqrteps = 0x1p-26; // sqrt(eps) = sqrt(2^-52) = 2^-26, exactly representable
//: IEEE single machine precision
inline constexpr float float_eps = std::numeric_limits::epsilon();
inline constexpr float float_sqrteps = 3.4526698300e-4f;
-
+} // namespace detail
+
+// Deprecated public aliases. Downstream consumers that reference vnl_math::pi
+// (etc.) get a compile-time deprecation warning and should migrate to
+// std::numbers (C++20) or their toolkit's constants (e.g. itk::Math in ITK).
+// Define VNL_MATH_DEPRECATE_CONSTANTS=0 to silence during migration.
+#ifndef VNL_MATH_DEPRECATE_CONSTANTS
+# define VNL_MATH_DEPRECATE_CONSTANTS 1
+#endif
+#if VNL_MATH_DEPRECATE_CONSTANTS
+# define VNL_MATH_CONSTANT_DEPRECATED \
+ [[deprecated("vnl_math:: numeric constants are deprecated; use std::numbers (C++20) or itk::Math (ITK)")]]
+#else
+# define VNL_MATH_CONSTANT_DEPRECATED
+#endif
+VNL_MATH_CONSTANT_DEPRECATED inline constexpr double e = detail::e;
+VNL_MATH_CONSTANT_DEPRECATED inline constexpr double log2e = detail::log2e;
+VNL_MATH_CONSTANT_DEPRECATED inline constexpr double log10e = detail::log10e;
+VNL_MATH_CONSTANT_DEPRECATED inline constexpr double ln2 = detail::ln2;
+VNL_MATH_CONSTANT_DEPRECATED inline constexpr double ln10 = detail::ln10;
+VNL_MATH_CONSTANT_DEPRECATED inline constexpr double pi = detail::pi;
+VNL_MATH_CONSTANT_DEPRECATED inline constexpr double twopi = detail::twopi;
+VNL_MATH_CONSTANT_DEPRECATED inline constexpr double pi_over_2 = detail::pi_over_2;
+VNL_MATH_CONSTANT_DEPRECATED inline constexpr double pi_over_4 = detail::pi_over_4;
+VNL_MATH_CONSTANT_DEPRECATED inline constexpr double pi_over_180 = detail::pi_over_180;
+VNL_MATH_CONSTANT_DEPRECATED inline constexpr double one_over_pi = detail::one_over_pi;
+VNL_MATH_CONSTANT_DEPRECATED inline constexpr double two_over_pi = detail::two_over_pi;
+VNL_MATH_CONSTANT_DEPRECATED inline constexpr double deg_per_rad = detail::deg_per_rad;
+VNL_MATH_CONSTANT_DEPRECATED inline constexpr double sqrt2pi = detail::sqrt2pi;
+VNL_MATH_CONSTANT_DEPRECATED inline constexpr double two_over_sqrtpi = detail::two_over_sqrtpi;
+VNL_MATH_CONSTANT_DEPRECATED inline constexpr double one_over_sqrt2pi = detail::one_over_sqrt2pi;
+VNL_MATH_CONSTANT_DEPRECATED inline constexpr double sqrt2 = detail::sqrt2;
+VNL_MATH_CONSTANT_DEPRECATED inline constexpr double sqrt1_2 = detail::sqrt1_2;
+VNL_MATH_CONSTANT_DEPRECATED inline constexpr double sqrt1_3 = detail::sqrt1_3;
+VNL_MATH_CONSTANT_DEPRECATED inline constexpr double euler = detail::euler;
+VNL_MATH_CONSTANT_DEPRECATED inline constexpr double eps = detail::eps;
+VNL_MATH_CONSTANT_DEPRECATED inline constexpr double sqrteps = detail::sqrteps;
+VNL_MATH_CONSTANT_DEPRECATED inline constexpr float float_eps = detail::float_eps;
+VNL_MATH_CONSTANT_DEPRECATED inline constexpr float float_sqrteps = detail::float_sqrteps;
+#undef VNL_MATH_CONSTANT_DEPRECATED
+
+namespace detail // unstable; not part of the public API
+{
//: Convert an angle to [0, 2Pi) range
VNL_EXPORT double
angle_0_to_2pi(double angle);
//: Convert an angle to [-Pi, Pi) range
VNL_EXPORT double
angle_minuspi_to_pi(double angle);
+} // namespace detail
} // namespace vnl_math
-// Note that the three template functions below should not be declared "inline"
-// since that would override the non-inline specialisations. - PVr.
-//
-
namespace vnl_math
{
-#if defined(_MSC_VER)
-// MSVC does not properly implement isfinite, isinf, isnan for C++11 conformance for integral types
-// For integral types only:
-template
-_Check_return_ typename std::enable_if::value, bool>::type
-isnan(_In_ T t) throw()
-{
- return std::isnan(static_cast(t));
-}
-template
-_Check_return_ typename std::enable_if::value, bool>::type
-isinf(_In_ T t) throw()
+namespace numeric_predicates
{
- return std::isinf(static_cast(t));
-}
-template
-_Check_return_ typename std::enable_if::value, bool>::type
-isfinite(_In_ T t) throw()
-{
- return std::isfinite(static_cast(t));
-}
-template
-_Check_return_ typename std::enable_if::value, bool>::type
-isnormal(_In_ T t) throw()
-{
- return std::isnormal(static_cast(t));
-}
-
-// Floating point types can alias C++ standard that is implemented
-template
-_Check_return_ typename std::enable_if::value, bool>::type
-isnan(_In_ T t) throw()
+// Wrap the classification functions to guarantee a bool return type;
+// some standard libraries returned a signed integer from these.
+template
+inline bool
+isinf(TArg arg)
{
- return std::isnan(t);
+ return bool(std::isinf(arg));
}
-template
-_Check_return_ typename std::enable_if::value, bool>::type
-isinf(_In_ T t) throw()
+template
+inline bool
+isnan(TArg arg)
{
- return std::isinf(t);
+ return bool(std::isnan(arg));
}
-template
-_Check_return_ typename std::enable_if::value, bool>::type
-isfinite(_In_ T t) throw()
+template
+inline bool
+isfinite(TArg arg)
{
- return std::isfinite(t);
+ return bool(std::isfinite(arg));
}
-template
-_Check_return_ typename std::enable_if::value, bool>::type
-isnormal(_In_ T t) throw()
+template
+inline bool
+isnormal(TArg arg)
{
- return std::isnormal(t);
+ return bool(std::isnormal(arg));
}
-#else
-// https://en.cppreference.com/w/cpp/numeric/math/isinf indicates that isinf should return bool
-// However, several compiler environments do not properly conform to the C++11 standard for
-// returning bool from these functions. Wrap them to ensure conformance, and
-// rely on the compiler to optimize the overhead away.
-
-// Return a signed integer type has been seen with the following
-// compilers/libstdc++:
-// RHEL7-devtool-6-gcc6.3
-// RHEL7-devtool-6-gcc6.3-m32
-// RHEL7-devtool-7-gcc7.2
-// RHEL7-devtool-7-gcc7.2-m32
+} // namespace numeric_predicates
+// Deprecated public spellings; vnl-internal code uses numeric_predicates::.
+// Define VNL_MATH_DEPRECATE_PREDICATES=0 to silence during migration.
+#ifndef VNL_MATH_DEPRECATE_PREDICATES
+# define VNL_MATH_DEPRECATE_PREDICATES 1
+#endif
+#if VNL_MATH_DEPRECATE_PREDICATES
+# define VNL_MATH_PREDICATE_DEPRECATED \
+ [[deprecated("vnl_math:: classification functions are deprecated; use std::isnan/isinf/isfinite/isnormal or itk::Math")]]
+#else
+# define VNL_MATH_PREDICATE_DEPRECATED
+#endif
template
-inline bool
+VNL_MATH_PREDICATE_DEPRECATED inline bool
isinf(TArg arg)
{
- return bool(std::isinf(arg));
+ return numeric_predicates::isinf(arg);
}
template
-inline bool
+VNL_MATH_PREDICATE_DEPRECATED inline bool
isnan(TArg arg)
{
- return bool(std::isnan(arg));
+ return numeric_predicates::isnan(arg);
}
template
-inline bool
+VNL_MATH_PREDICATE_DEPRECATED inline bool
isfinite(TArg arg)
{
- return bool(std::isfinite(arg));
+ return numeric_predicates::isfinite(arg);
}
template
-inline bool
+VNL_MATH_PREDICATE_DEPRECATED inline bool
isnormal(TArg arg)
{
- return bool(std::isnormal(arg));
+ return numeric_predicates::isnormal(arg);
}
+#undef VNL_MATH_PREDICATE_DEPRECATED
+// Deprecated re-exports of the std:: equivalents; use std:: directly.
+// Define VNL_MATH_DEPRECATE_STD_REEXPORTS=0 to silence during migration.
+#ifndef VNL_MATH_DEPRECATE_STD_REEXPORTS
+# define VNL_MATH_DEPRECATE_STD_REEXPORTS 1
#endif
-using std::max;
-using std::min;
-using std::cbrt;
-using std::hypot;
-
+#if VNL_MATH_DEPRECATE_STD_REEXPORTS
+# define VNL_MATH_STD_REEXPORT_DEPRECATED(fn) [[deprecated("vnl_math::" #fn " is deprecated; use std::" #fn)]]
+#else
+# define VNL_MATH_STD_REEXPORT_DEPRECATED(fn)
+#endif
+#define VNL_MATH_DEPRECATED_STD_FORWARD(fn) \
+ template \
+ VNL_MATH_STD_REEXPORT_DEPRECATED(fn) inline auto fn(Args &&... args) \
+ ->decltype(std::fn(std::forward(args)...)) \
+ { \
+ return std::fn(std::forward(args)...); \
+ }
+VNL_MATH_DEPRECATED_STD_FORWARD(max)
+VNL_MATH_DEPRECATED_STD_FORWARD(min)
+VNL_MATH_DEPRECATED_STD_FORWARD(cbrt)
+VNL_MATH_DEPRECATED_STD_FORWARD(hypot)
+#undef VNL_MATH_DEPRECATED_STD_FORWARD
+#undef VNL_MATH_STD_REEXPORT_DEPRECATED
+
+namespace detail // unstable; not part of the public API
+{
// rnd_halfinttoeven -- round towards nearest integer
// halfway cases are rounded towards the nearest even integer, e.g.
// rnd_halfinttoeven( 1.5) == 2
@@ -660,6 +719,60 @@ remainder_floored(long double x, long double y)
{
return fmodl(fmodl(x, y) + y, y);
}
+} // namespace detail
+
+// Deprecated public spellings; vnl-internal code uses vnl_math::detail::.
+// Each forwarder perfectly forwards to detail::, preserving the overload set
+// (scalar, integral and complex) and return type of the original.
+// Define VNL_MATH_DEPRECATE_FUNCTIONS=0 to silence during migration.
+#ifndef VNL_MATH_DEPRECATE_FUNCTIONS
+# define VNL_MATH_DEPRECATE_FUNCTIONS 1
+#endif
+#if VNL_MATH_DEPRECATE_FUNCTIONS
+# define VNL_MATH_FUNCTION_DEPRECATED \
+ [[deprecated("this vnl_math:: function is deprecated; use the std:: equivalent or itk::Math")]]
+#else
+# define VNL_MATH_FUNCTION_DEPRECATED
+#endif
+#define VNL_MATH_DEPRECATED_FORWARD(fn) \
+ template \
+ VNL_MATH_FUNCTION_DEPRECATED inline auto fn(Args &&... args) \
+ ->decltype(detail::fn(std::forward(args)...)) \
+ { \
+ return detail::fn(std::forward(args)...); \
+ }
+VNL_MATH_DEPRECATED_FORWARD(angle_0_to_2pi)
+VNL_MATH_DEPRECATED_FORWARD(angle_minuspi_to_pi)
+VNL_MATH_DEPRECATED_FORWARD(rnd_halfinttoeven)
+VNL_MATH_DEPRECATED_FORWARD(rnd_halfintup)
+VNL_MATH_DEPRECATED_FORWARD(rnd)
+VNL_MATH_DEPRECATED_FORWARD(floor)
+VNL_MATH_DEPRECATED_FORWARD(ceil)
+VNL_MATH_DEPRECATED_FORWARD(sgn)
+VNL_MATH_DEPRECATED_FORWARD(sgn0)
+VNL_MATH_DEPRECATED_FORWARD(remainder_truncated)
+VNL_MATH_DEPRECATED_FORWARD(remainder_floored)
+VNL_MATH_DEPRECATED_FORWARD(sqr)
+VNL_MATH_DEPRECATED_FORWARD(cube)
+VNL_MATH_DEPRECATED_FORWARD(squared_magnitude)
+#undef VNL_MATH_DEPRECATED_FORWARD
+#undef VNL_MATH_FUNCTION_DEPRECATED
+
+// abs migrates to itk::Math::Absolute(), which (unlike std::abs) preserves the
+// unsigned-returning integral semantics and supports INT_MIN and bool.
+#if VNL_MATH_DEPRECATE_FUNCTIONS
+# define VNL_MATH_ABS_DEPRECATED \
+ [[deprecated("vnl_math::abs is deprecated; use itk::Math::Absolute() (ITK) or std::abs")]]
+#else
+# define VNL_MATH_ABS_DEPRECATED
+#endif
+template
+VNL_MATH_ABS_DEPRECATED inline auto
+abs(Args &&... args) -> decltype(detail::abs(std::forward(args)...))
+{
+ return detail::abs(std::forward(args)...);
+}
+#undef VNL_MATH_ABS_DEPRECATED
} // end of namespace vnl_math
#endif // vnl_math_h_
diff --git a/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_matrix.hxx b/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_matrix.hxx
index 48cb7c0fe2a..1644ec3ff9e 100644
--- a/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_matrix.hxx
+++ b/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_matrix.hxx
@@ -741,7 +741,7 @@ cos_angle(const vnl_matrix & a, const vnl_matrix & b)
using abs_r = typename vnl_numeric_traits::real_t;
T ab = inner_product(a, b);
- const Abs_t a_b = (Abs_t)std::sqrt((abs_r)vnl_math::abs(inner_product(a, a) * inner_product(b, b)));
+ const Abs_t a_b = (Abs_t)std::sqrt((abs_r)vnl_math::detail::abs(inner_product(a, a) * inner_product(b, b)));
return T(ab / a_b);
}
@@ -833,7 +833,7 @@ vnl_matrix::normalize_rows()
{ // For each row in the Matrix
Abs_t norm(0); // double will not do for all types.
for (unsigned int j = 0; j < this->num_cols; ++j) // For each element in row
- norm += vnl_math::squared_magnitude(this->data[i][j]);
+ norm += vnl_math::detail::squared_magnitude(this->data[i][j]);
if (norm != 0)
{
@@ -858,7 +858,7 @@ vnl_matrix::normalize_columns()
{ // For each column in the Matrix
Abs_t norm(0); // double will not do for all types.
for (unsigned int i = 0; i < this->num_rows; i++)
- norm += vnl_math::squared_magnitude(this->data[i][j]);
+ norm += vnl_math::detail::squared_magnitude(this->data[i][j]);
if (norm != 0)
{
@@ -1141,7 +1141,7 @@ vnl_matrix::is_equal(const vnl_matrix & rhs, double tol) const
for (unsigned int i = 0; i < this->rows(); ++i)
for (unsigned int j = 0; j < this->columns(); ++j)
- if (!(vnl_math::abs(this->data[i][j] - rhs.data[i][j]) <= tol))
+ if (!(vnl_math::detail::abs(this->data[i][j] - rhs.data[i][j]) <= tol))
return false; // difference greater than tol
return true;
@@ -1174,7 +1174,7 @@ vnl_matrix::is_identity(double tol) const
for (unsigned int j = 0; j < this->columns(); ++j)
{
T xm = (*this)(i, j);
- const abs_t absdev = (i == j) ? vnl_math::abs(xm - one) : vnl_math::abs(xm);
+ const abs_t absdev = (i == j) ? vnl_math::detail::abs(xm - one) : vnl_math::detail::abs(xm);
if (absdev > tol)
return false;
}
@@ -1201,7 +1201,7 @@ vnl_matrix::is_zero(double tol) const
{
for (unsigned int i = 0; i < this->rows(); ++i)
for (unsigned int j = 0; j < this->columns(); ++j)
- if (vnl_math::abs((*this)(i, j)) > tol)
+ if (vnl_math::detail::abs((*this)(i, j)) > tol)
return false;
return true;
@@ -1214,7 +1214,7 @@ vnl_matrix::has_nans() const
{
for (unsigned int i = 0; i < this->rows(); ++i)
for (unsigned int j = 0; j < this->columns(); ++j)
- if (vnl_math::isnan((*this)(i, j)))
+ if (vnl_math::numeric_predicates::isnan((*this)(i, j)))
return true;
return false;
@@ -1227,7 +1227,7 @@ vnl_matrix::is_finite() const
{
for (unsigned int i = 0; i < this->rows(); ++i)
for (unsigned int j = 0; j < this->columns(); ++j)
- if (!vnl_math::isfinite((*this)(i, j)))
+ if (!vnl_math::numeric_predicates::isfinite((*this)(i, j)))
return false;
return true;
@@ -1255,7 +1255,7 @@ vnl_matrix::assert_finite_internal() const
for (unsigned int i = 0; i < rows(); ++i)
{
for (unsigned int j = 0; j < cols(); ++j)
- std::cerr << char(vnl_math::isfinite((*this)(i, j)) ? '-' : '*');
+ std::cerr << char(vnl_math::numeric_predicates::isfinite((*this)(i, j)) ? '-' : '*');
std::cerr << '\n';
}
}
@@ -1489,7 +1489,7 @@ vnl_matrix::operator_one_norm() const
{
abs_t tmp = 0;
for (unsigned int i = 0; i < this->num_rows; ++i)
- tmp += vnl_math::abs(this->data[i][j]);
+ tmp += vnl_math::detail::abs(this->data[i][j]);
if (tmp > max)
max = tmp;
}
@@ -1507,7 +1507,7 @@ vnl_matrix::operator_inf_norm() const
{
abs_t tmp = 0;
for (unsigned int j = 0; j < this->num_cols; ++j)
- tmp += vnl_math::abs(this->data[i][j]);
+ tmp += vnl_math::detail::abs(this->data[i][j]);
if (tmp > max)
max = tmp;
}
diff --git a/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_matrix_fixed.hxx b/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_matrix_fixed.hxx
index f07a2456653..926d49ba562 100644
--- a/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_matrix_fixed.hxx
+++ b/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_matrix_fixed.hxx
@@ -348,7 +348,7 @@ vnl_matrix_fixed::normalize_rows()
{
abs_t norm(0); // double will not do for all types.
for (unsigned int j = 0; j < ncols; ++j)
- norm += vnl_math::squared_magnitude(this->data_[i][j]);
+ norm += vnl_math::detail::squared_magnitude(this->data_[i][j]);
if (norm != 0)
{
@@ -373,7 +373,7 @@ vnl_matrix_fixed::normalize_columns()
{ // For each column in the Matrix
abs_t norm(0); // double will not do for all types.
for (unsigned int i = 0; i < nrows; ++i)
- norm += vnl_math::squared_magnitude(this->data_[i][j]);
+ norm += vnl_math::detail::squared_magnitude(this->data_[i][j]);
if (norm != 0)
{
@@ -665,7 +665,7 @@ vnl_matrix_fixed::is_identity(double tol) const
for (unsigned int j = 0; j < ncols; ++j)
{
T xm = this->data_[i][j];
- const abs_t absdev = (i == j) ? vnl_math::abs(xm - one) : vnl_math::abs(xm);
+ const abs_t absdev = (i == j) ? vnl_math::detail::abs(xm - one) : vnl_math::detail::abs(xm);
if (absdev > tol)
return false;
}
@@ -694,7 +694,7 @@ vnl_matrix_fixed::is_equal(const vnl_matrix_fixeddata_[i][j] - rhs.data_[i][j]) <= tol))
+ if (!(vnl_math::detail::abs(this->data_[i][j] - rhs.data_[i][j]) <= tol))
return false; // difference greater than tol
return true;
@@ -706,7 +706,7 @@ vnl_matrix_fixed::is_zero(double tol) const
{
for (unsigned int i = 0; i < nrows; ++i)
for (unsigned int j = 0; j < ncols; ++j)
- if (vnl_math::abs(this->data_[i][j]) > tol)
+ if (vnl_math::detail::abs(this->data_[i][j]) > tol)
return false;
return true;
@@ -718,7 +718,7 @@ vnl_matrix_fixed::has_nans() const
{
for (unsigned int i = 0; i < nrows; ++i)
for (unsigned int j = 0; j < ncols; ++j)
- if (vnl_math::isnan(this->data_[i][j]))
+ if (vnl_math::numeric_predicates::isnan(this->data_[i][j]))
return true;
return false;
@@ -730,7 +730,7 @@ vnl_matrix_fixed::is_finite() const
{
for (unsigned int i = 0; i < nrows; ++i)
for (unsigned int j = 0; j < ncols; ++j)
- if (!vnl_math::isfinite(this->data_[i][j]))
+ if (!vnl_math::numeric_predicates::isfinite(this->data_[i][j]))
return false;
return true;
@@ -756,7 +756,7 @@ vnl_matrix_fixed::assert_finite_internal() const
for (unsigned int i = 0; i < rows(); ++i)
{
for (unsigned int j = 0; j < cols(); ++j)
- std::cerr << char(vnl_math::isfinite(this->data_[i][j]) ? '-' : '*');
+ std::cerr << char(vnl_math::numeric_predicates::isfinite(this->data_[i][j]) ? '-' : '*');
std::cerr << '\n';
}
}
@@ -834,7 +834,7 @@ vnl_matrix_fixed::operator_one_norm() const
{
abs_t t(0);
for (unsigned int i = 0; i < nrows; ++i)
- t += vnl_math::abs(this->data_[i][j]);
+ t += vnl_math::detail::abs(this->data_[i][j]);
if (t > m)
m = t;
}
@@ -850,7 +850,7 @@ vnl_matrix_fixed::operator_inf_norm() const
{
abs_t t(0);
for (unsigned int j = 0; j < ncols; ++j)
- t += vnl_math::abs(this->data_[i][j]);
+ t += vnl_math::detail::abs(this->data_[i][j]);
if (t > m)
m = t;
}
diff --git a/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_matrix_fixed_ref.hxx b/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_matrix_fixed_ref.hxx
index e74a3df335b..ebed13150ee 100644
--- a/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_matrix_fixed_ref.hxx
+++ b/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_matrix_fixed_ref.hxx
@@ -192,7 +192,7 @@ vnl_matrix_fixed_ref::normalize_rows() const
{
Abs_t norm(0); // double will not do for all types.
for (unsigned int j = 0; j < ncols; j++)
- norm += vnl_math::squared_magnitude((*this)(i, j));
+ norm += vnl_math::detail::squared_magnitude((*this)(i, j));
if (norm != 0)
{
@@ -218,7 +218,7 @@ vnl_matrix_fixed_ref::normalize_columns() const
{ // For each column in the Matrix
Abs_t norm(0); // double will not do for all types.
for (unsigned int i = 0; i < nrows; i++)
- norm += vnl_math::squared_magnitude((*this)(i, j));
+ norm += vnl_math::detail::squared_magnitude((*this)(i, j));
if (norm != 0)
{
@@ -417,7 +417,7 @@ vnl_matrix_fixed_ref_const::is_identity(double tol) const
for (unsigned int j = 0; j < ncols; ++j)
{
T xm = (*this)(i, j);
- const abs_t absdev = (i == j) ? vnl_math::abs(xm - one) : vnl_math::abs(xm);
+ const abs_t absdev = (i == j) ? vnl_math::detail::abs(xm - one) : vnl_math::detail::abs(xm);
if (absdev > tol)
return false;
}
@@ -443,7 +443,7 @@ vnl_matrix_fixed_ref_const::is_zero(double tol) const
{
for (unsigned int i = 0; i < nrows; ++i)
for (unsigned int j = 0; j < ncols; ++j)
- if (vnl_math::abs((*this)(i, j)) > tol)
+ if (vnl_math::detail::abs((*this)(i, j)) > tol)
return false;
return true;
@@ -455,7 +455,7 @@ vnl_matrix_fixed_ref_const::has_nans() const
{
for (unsigned int i = 0; i < nrows; ++i)
for (unsigned int j = 0; j < ncols; ++j)
- if (vnl_math::isnan((*this)(i, j)))
+ if (vnl_math::numeric_predicates::isnan((*this)(i, j)))
return true;
return false;
@@ -467,7 +467,7 @@ vnl_matrix_fixed_ref_const::is_finite() const
{
for (unsigned int i = 0; i < nrows; ++i)
for (unsigned int j = 0; j < ncols; ++j)
- if (!vnl_math::isfinite((*this)(i, j)))
+ if (!vnl_math::numeric_predicates::isfinite((*this)(i, j)))
return false;
return true;
@@ -493,7 +493,7 @@ vnl_matrix_fixed_ref_const::assert_finite_internal() const
for (unsigned int i = 0; i < rows(); ++i)
{
for (unsigned int j = 0; j < cols(); ++j)
- std::cerr << char(vnl_math::isfinite((*this)(i, j)) ? '-' : '*');
+ std::cerr << char(vnl_math::numeric_predicates::isfinite((*this)(i, j)) ? '-' : '*');
std::cerr << '\n';
}
}
@@ -575,7 +575,7 @@ vnl_matrix_fixed_ref_const::operator_one_norm() const
{
abs_t t(0);
for (unsigned int i = 0; i < nrows; ++i)
- t += vnl_math::abs((*this)(i, j));
+ t += vnl_math::detail::abs((*this)(i, j));
if (t > m)
m = t;
}
@@ -591,7 +591,7 @@ vnl_matrix_fixed_ref_const::operator_inf_norm() const
{
abs_t t(0);
for (unsigned int j = 0; j < ncols; ++j)
- t += vnl_math::abs((*this)(i, j));
+ t += vnl_math::detail::abs((*this)(i, j));
if (t > m)
m = t;
}
diff --git a/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_na.cxx b/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_na.cxx
index 0308fd7bc7e..80b013a0822 100644
--- a/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_na.cxx
+++ b/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_na.cxx
@@ -2,6 +2,7 @@
//:
// \file
+#include
#include
#include
#include
@@ -94,14 +95,14 @@ vnl_na_isna(float x)
double
vnl_na_nan_to_na(double v)
{
- return vnl_math::isnan(v) ? vnl_na(double()) : v;
+ return std::isnan(v) ? vnl_na(double()) : v;
}
//: Replace NaNs with NA, leave other values alone.
float
vnl_na_nan_to_na(float v)
{
- return vnl_math::isnan(v) ? vnl_na(float()) : v;
+ return std::isnan(v) ? vnl_na(float()) : v;
}
//: Read a floating point number or "NA" from a stream.
diff --git a/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_quaternion.hxx b/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_quaternion.hxx
index 0a2163b8a55..5ca5d492bd7 100644
--- a/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_quaternion.hxx
+++ b/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_quaternion.hxx
@@ -183,7 +183,7 @@ vnl_quaternion::rotation_euler_angles() const
vnl_vector_fixed angles;
vnl_matrix_fixed rotM = rotation_matrix_transpose_4();
- T xy = T(std::sqrt(double(vnl_math::sqr(rotM(0, 0)) + vnl_math::sqr(rotM(0, 1)))));
+ T xy = T(std::sqrt(double(vnl_math::detail::sqr(rotM(0, 0)) + vnl_math::detail::sqr(rotM(0, 1)))));
if (xy > std::numeric_limits::epsilon() * T(8))
{
angles(0) = T(std::atan2(double(rotM(1, 2)), double(rotM(2, 2))));
diff --git a/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_sample.cxx b/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_sample.cxx
index 94a52ae3738..a41356be5d7 100644
--- a/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_sample.cxx
+++ b/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_sample.cxx
@@ -37,7 +37,7 @@ void
vnl_sample_normal_2(double * x, double * y)
{
const double u = vnl_sample_uniform(1, 0); // not (0,1): should not return 0
- const double theta = vnl_sample_uniform(0, vnl_math::twopi);
+ const double theta = vnl_sample_uniform(0, vnl_math::detail::twopi);
const double r = std::sqrt(-2 * std::log(u));
diff --git a/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_sparse_matrix.hxx b/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_sparse_matrix.hxx
index 902dfd5ec38..82ed858d3fa 100644
--- a/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_sparse_matrix.hxx
+++ b/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_sparse_matrix.hxx
@@ -941,7 +941,7 @@ vnl_sparse_matrix::normalize_rows()
for (typename row::iterator col_iter = this_row.begin(); col_iter != this_row.end(); ++col_iter)
{
const vnl_sparse_matrix_pair & entry = *col_iter;
- norm += vnl_math::squared_magnitude(entry.second);
+ norm += vnl_math::detail::squared_magnitude(entry.second);
}
if (norm != 0)
{
diff --git a/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_vector.hxx b/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_vector.hxx
index f7a780132a8..5ccd245a937 100644
--- a/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_vector.hxx
+++ b/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_vector.hxx
@@ -739,7 +739,7 @@ angle(const vnl_vector & a, const vnl_vector & b)
if (c >= 1.0)
return 0;
if (c <= -1.0)
- return vnl_math::pi;
+ return vnl_math::detail::pi;
return std::acos(c);
}
@@ -748,7 +748,7 @@ bool
vnl_vector::is_finite() const
{
for (size_t i = 0; i < this->size(); ++i)
- if (!vnl_math::isfinite((*this)[i]))
+ if (!vnl_math::numeric_predicates::isfinite((*this)[i]))
return false;
return true;
@@ -798,7 +798,7 @@ vnl_vector::is_equal(const vnl_vector & rhs, double tol) const
if (this->size() != rhs.size()) // Size different ?
return false;
for (size_t i = 0; i < size(); i++)
- if (!(vnl_math::abs(this->data[i] - rhs.data[i]) <= tol)) // Element different ?
+ if (!(vnl_math::detail::abs(this->data[i] - rhs.data[i]) <= tol)) // Element different ?
return false;
return true;
diff --git a/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_vector_fixed.hxx b/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_vector_fixed.hxx
index d87a457f86d..ef2a76286df 100644
--- a/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_vector_fixed.hxx
+++ b/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_vector_fixed.hxx
@@ -13,7 +13,7 @@
#ifdef _MSC_VER
# include
#endif
-#include "vnl_math.h" // for vnl_math::isfinite
+#include "vnl_math.h" // for vnl_math::numeric_predicates::isfinite
template
T &
@@ -105,7 +105,7 @@ bool
vnl_vector_fixed::is_finite() const
{
for (size_type i = 0; i < this->size(); ++i)
- if (!vnl_math::isfinite((*this)[i]))
+ if (!vnl_math::numeric_predicates::isfinite((*this)[i]))
return false;
return true;
@@ -154,7 +154,7 @@ vnl_vector_fixed::is_equal(const vnl_vector_fixed & rhs, double tol)
return true;
for (size_t i = 0; i < n; ++i)
- if (!(vnl_math::abs(this->data_[i] - rhs.data_[i]) <= tol)) // Element different ?
+ if (!(vnl_math::detail::abs(this->data_[i] - rhs.data_[i]) <= tol)) // Element different ?
return false;
return true;
diff --git a/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_vector_fixed_ref.hxx b/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_vector_fixed_ref.hxx
index 0ba7a794d70..67e4524a5e8 100644
--- a/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_vector_fixed_ref.hxx
+++ b/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_vector_fixed_ref.hxx
@@ -12,7 +12,7 @@
#ifdef _MSC_VER
# include
#endif
-#include "vnl_math.h" // for vnl_math::isfinite
+#include "vnl_math.h" // for vnl_math::numeric_predicates::isfinite
//------------------------------------------------------------
@@ -71,7 +71,7 @@ bool
vnl_vector_fixed_ref_const::is_finite() const
{
for (size_type i = 0; i < this->size(); ++i)
- if (!vnl_math::isfinite((*this)[i]))
+ if (!vnl_math::numeric_predicates::isfinite((*this)[i]))
return false;
return true;