Commit 91568536 authored by Davis King's avatar Davis King

Changed tests so that they compile in visual studio.

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%402277
parent 8bcd5d73
...@@ -128,37 +128,37 @@ namespace ...@@ -128,37 +128,37 @@ namespace
total_count = 0; total_count = 0;
x = p; x = p;
find_min_quasi_newton(&apq<T>, &der_apq<T>, x, minf, eps); find_min_quasi_newton(wrap_function(apq<T>), wrap_function(der_apq<T>), x, minf, eps);
DLIB_CASSERT(dlib::equal(x,opt, 1e-5),opt-x); DLIB_CASSERT(dlib::equal(x,opt, 1e-5),opt-x);
dlog << LINFO << "find_min_quasi_newton got apq in " << total_count; dlog << LINFO << "find_min_quasi_newton got apq in " << total_count;
total_count = 0; total_count = 0;
x = p; x = p;
find_min_conjugate_gradient(&apq<T>, &der_apq<T>, x, minf, eps); find_min_conjugate_gradient(wrap_function(apq<T>), wrap_function(der_apq<T>), x, minf, eps);
DLIB_CASSERT(dlib::equal(x,opt, 1e-5),opt-x); DLIB_CASSERT(dlib::equal(x,opt, 1e-5),opt-x);
dlog << LINFO << "find_min_conjugate_gradient got apq in " << total_count; dlog << LINFO << "find_min_conjugate_gradient got apq in " << total_count;
total_count = 0; total_count = 0;
x = p; x = p;
find_min_quasi_newton(&apq<T>, derivative(&apq<T>), x, minf, eps); find_min_quasi_newton(wrap_function(apq<T>), derivative(wrap_function(apq<T>)), x, minf, eps);
DLIB_CASSERT(dlib::equal(x,opt, 1e-5),opt-x); DLIB_CASSERT(dlib::equal(x,opt, 1e-5),opt-x);
dlog << LINFO << "find_min_quasi_newton got apq/noder in " << total_count; dlog << LINFO << "find_min_quasi_newton got apq/noder in " << total_count;
total_count = 0; total_count = 0;
x = p; x = p;
find_min_conjugate_gradient(&apq<T>, derivative(&apq<T>), x, minf, eps); find_min_conjugate_gradient(wrap_function(apq<T>), derivative(wrap_function(apq<T>)), x, minf, eps);
DLIB_CASSERT(dlib::equal(x,opt, 1e-5),opt-x); DLIB_CASSERT(dlib::equal(x,opt, 1e-5),opt-x);
dlog << LINFO << "find_min_conjugate_gradient got apq/noder in " << total_count; dlog << LINFO << "find_min_conjugate_gradient got apq/noder in " << total_count;
total_count = 0; total_count = 0;
x = p; x = p;
find_min_quasi_newton2(&apq<T>, x, minf, eps); find_min_quasi_newton2(wrap_function(apq<T>), x, minf, eps);
DLIB_CASSERT(dlib::equal(x,opt, 1e-5),opt-x); DLIB_CASSERT(dlib::equal(x,opt, 1e-5),opt-x);
dlog << LINFO << "find_min_quasi_newton got apq/noder2 in " << total_count; dlog << LINFO << "find_min_quasi_newton got apq/noder2 in " << total_count;
total_count = 0; total_count = 0;
x = p; x = p;
find_min_conjugate_gradient2(&apq<T>, x, minf, eps); find_min_conjugate_gradient2(wrap_function(apq<T>), x, minf, eps);
DLIB_CASSERT(dlib::equal(x,opt, 1e-5),opt-x); DLIB_CASSERT(dlib::equal(x,opt, 1e-5),opt-x);
dlog << LINFO << "find_min_conjugate_gradient got apq/noder2 in " << total_count; dlog << LINFO << "find_min_conjugate_gradient got apq/noder2 in " << total_count;
} }
...@@ -258,7 +258,7 @@ namespace ...@@ -258,7 +258,7 @@ namespace
const matrix<double,2,1> p const matrix<double,2,1> p
) )
{ {
const double eps = 1e-12; const double eps = 1e-15;
const double minf = -10; const double minf = -10;
matrix<double,2,1> x, opt; matrix<double,2,1> x, opt;
opt(0) = 1; opt(0) = 1;
...@@ -269,13 +269,13 @@ namespace ...@@ -269,13 +269,13 @@ namespace
total_count = 0; total_count = 0;
x = p; x = p;
find_min_quasi_newton(&rosen, &der_rosen, x, minf, eps); find_min_quasi_newton(&rosen, &der_rosen, x, minf, eps);
DLIB_CASSERT(dlib::equal(x,opt, 1e-5),opt-x); DLIB_CASSERT(dlib::equal(x,opt, 1e-7),opt-x);
dlog << LINFO << "find_min_quasi_newton got rosen in " << total_count; dlog << LINFO << "find_min_quasi_newton got rosen in " << total_count;
total_count = 0; total_count = 0;
x = p; x = p;
find_min_conjugate_gradient(&rosen, &der_rosen, x, minf, eps); find_min_conjugate_gradient(&rosen, &der_rosen, x, minf, eps);
DLIB_CASSERT(dlib::equal(x,opt, 1e-5),opt-x); DLIB_CASSERT(dlib::equal(x,opt, 1e-7),opt-x);
dlog << LINFO << "find_min_conjugate_gradient got rosen in " << total_count; dlog << LINFO << "find_min_conjugate_gradient got rosen in " << total_count;
total_count = 0; total_count = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment