11#include < iostream>
22
3+ #include < catch2/catch_test_macros.hpp>
4+ #include < catch2/generators/catch_generators_all.hpp>
5+
36#include < Eigen/Core>
4- #include < catch2/catch.hpp>
57
68#include < finitediff.hpp>
79#include < spdlog/spdlog.h>
@@ -18,7 +20,7 @@ TEST_CASE("Test finite difference hessian of quadratic", "[hessian]")
1820 Eigen::MatrixXd A = Eigen::MatrixXd::Random (n, n);
1921 Eigen::VectorXd b = Eigen::VectorXd::Random (n);
2022
21- const auto f = [&](const Eigen::VectorXd x) -> double {
23+ const auto f = [&](const Eigen::VectorXd& x) -> double {
2224 return (x.transpose () * A * x + b.transpose () * x)(0 );
2325 };
2426
@@ -36,7 +38,7 @@ TEST_CASE("Test finite difference hessian of quadratic", "[hessian]")
3638TEST_CASE (" Test finite difference hessian of Rosenbrock" , " [hessian]" )
3739{
3840 AccuracyOrder accuracy = GENERATE (SECOND, FOURTH, SIXTH, EIGHTH);
39- const auto f = [](const Eigen::VectorXd x) {
41+ const auto f = [](const Eigen::VectorXd& x) {
4042 double t1 = 1 - x[0 ];
4143 double t2 = (x[1 ] - x[0 ] * x[0 ]);
4244 return t1 * t1 + 100 * t2 * t2;
@@ -61,7 +63,7 @@ TEST_CASE("Test finite difference hessian of trig", "[hessian]")
6163 AccuracyOrder accuracy = GENERATE (SECOND, FOURTH, SIXTH, EIGHTH);
6264 int n = GENERATE (1 , 2 , 4 , 10 , 25 );
6365
64- const auto f = [&](const Eigen::VectorXd x) -> double {
66+ const auto f = [&](const Eigen::VectorXd& x) -> double {
6567 return x.array ().sin ().matrix ().squaredNorm ();
6668 };
6769
0 commit comments