Skip to content

Commit

Permalink
Improve optimization unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
mattiaisgro committed Dec 4, 2024
1 parent 65bc051 commit f4df62f
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions test/prec/test_optimization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,31 +52,30 @@ int main(int argc, char const *argv[]) {
const real f1_root = 0.690389757422;

prec::equals(
"root_bisect",
"root_bisect (1)",
root_bisect(f_1D<real>, 0.5, 0.8, 1E-12),
f1_root
);

prec::equals("root_newton", root_newton(f_1D, 0.5), f1_root);
prec::equals("root_halley", root_halley(f_1D<dual2>, 0.5), f1_root);
prec::equals("root_steffensen", root_steffensen(f_1D, 0.5), f1_root);
prec::equals("root_chebyshev", root_chebyshev(f_1D, 0.5), f1_root);
prec::equals("root_newton (1)", root_newton(f_1D, 0.5), f1_root);
prec::equals("root_halley (1)", root_halley(f_1D<dual2>, 0.5), f1_root);
prec::equals("root_chebyshev (1)", root_chebyshev(f_1D, 0.5), f1_root);
}


{
const real g1_root = 1.772453850906;

prec::equals(
"root_bisect",
"root_bisect (2)",
root_bisect(g_1D<real>, 1.5, 2, 1E-12),
g1_root
);

prec::equals("root_newton", root_newton(g_1D, 1.5), g1_root);
prec::equals("root_halley", root_halley(g_1D<dual2>, 1.5), g1_root);
prec::equals("root_steffensen", root_steffensen(g_1D<real>, 1), g1_root);
prec::equals("root_chebyshev", root_chebyshev(g_1D, 1.5), g1_root);
prec::equals("root_newton (2)", root_newton(g_1D, 1.5), g1_root);
prec::equals("root_halley (2)", root_halley(g_1D<dual2>, 1.5), g1_root);
prec::equals("root_steffensen (2)", root_steffensen(g_1D<real>, 1), g1_root);
prec::equals("root_chebyshev (2)", root_chebyshev(g_1D, 1.5), g1_root);
}


Expand Down

0 comments on commit f4df62f

Please sign in to comment.