From 4c08fdc90d2ef04f81e8349f981bcf0ae211e963 Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 10 Feb 2011 22:07:24 -0500 Subject: [PATCH] Added a testcase for newton's method --- sample/CMakeLists.txt | 3 +++ src/newton.hpp | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/sample/CMakeLists.txt b/sample/CMakeLists.txt index 1e6a3ac..db9ac43 100644 --- a/sample/CMakeLists.txt +++ b/sample/CMakeLists.txt @@ -18,3 +18,6 @@ target_link_libraries(testkd2 ${tolink}) add_executable(testDelaunay testDelaunay.cpp) target_link_libraries(testDelaunay ${tolink}) + +add_executable(testNewton testNewton.cpp) +target_link_libraries(testNewton ${tolink}) \ No newline at end of file diff --git a/src/newton.hpp b/src/newton.hpp index ca39804..3e861f0 100644 --- a/src/newton.hpp +++ b/src/newton.hpp @@ -1,6 +1,8 @@ #ifndef _COSMOTOOL_NEWTON_HPP #define _COSMOTOOL_NEWTON_HPP +#include + namespace CosmoTool { template @@ -12,7 +14,7 @@ namespace CosmoTool x = xold - f_x/df_x; - while (abs(xold-x) > residual) + while (std::abs(xold-x) > residual) { xold = x; f_x = function.eval(x);