Added a testcase for newton's method

This commit is contained in:
Your Name 2011-02-10 22:07:24 -05:00
parent 5b3bef64b1
commit 4c08fdc90d
2 changed files with 6 additions and 1 deletions

View File

@ -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})

View File

@ -1,6 +1,8 @@
#ifndef _COSMOTOOL_NEWTON_HPP
#define _COSMOTOOL_NEWTON_HPP
#include <cmath>
namespace CosmoTool
{
template<typename T, typename FunT>
@ -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);