summaryrefslogtreecommitdiff
path: root/lib/Numeric/LinearAlgebra/Tests.hs
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2009-06-07 13:01:03 +0000
committerAlberto Ruiz <aruiz@um.es>2009-06-07 13:01:03 +0000
commit7697c6dc27fd0d9601728af576e8d7b9d1c800ee (patch)
treec4b2c0f52f3884fbbd93bd6c0739e0fc73b921a2 /lib/Numeric/LinearAlgebra/Tests.hs
parent49a3d719221cd9484a64688ffcdbeb13cb8e55a0 (diff)
root finding with jacobian
Diffstat (limited to 'lib/Numeric/LinearAlgebra/Tests.hs')
-rw-r--r--lib/Numeric/LinearAlgebra/Tests.hs9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/Numeric/LinearAlgebra/Tests.hs b/lib/Numeric/LinearAlgebra/Tests.hs
index 174e418..83f581f 100644
--- a/lib/Numeric/LinearAlgebra/Tests.hs
+++ b/lib/Numeric/LinearAlgebra/Tests.hs
@@ -119,9 +119,14 @@ minimizationTest = TestList [ utest "minimization conj grad" (minim1 f df [5,7]
119 119
120--------------------------------------------------------------------- 120---------------------------------------------------------------------
121 121
122rootFindingTest = utest "root Hybrids" (sol ~~ [1,1]) 122rootFindingTest = TestList [ utest "root Hybrids" (fst sol1 ~~ [1,1])
123 where sol = fst $ root Hybrids 1E-7 30 (rosenbrock 1 10) [-10,-5] 123 , utest "root Newton" (rows (snd sol2) == 2)
124 ]
125 where sol1 = root Hybrids 1E-7 30 (rosenbrock 1 10) [-10,-5]
126 sol2 = rootJ Newton 1E-7 30 (rosenbrock 1 10) (jacobian 1 10) [-10,-5]
124 rosenbrock a b [x,y] = [ a*(1-x), b*(y-x^2) ] 127 rosenbrock a b [x,y] = [ a*(1-x), b*(y-x^2) ]
128 jacobian a b [x,_y] = [ [-a , 0]
129 , [-2*b*x, b] ]
125 130
126--------------------------------------------------------------------- 131---------------------------------------------------------------------
127 132