summaryrefslogtreecommitdiff
path: root/lib/Numeric/LinearAlgebra
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2009-04-18 18:42:14 +0000
committerAlberto Ruiz <aruiz@um.es>2009-04-18 18:42:14 +0000
commit1b5b7b8252fddcda816722b55eae1d5f1ca9a80e (patch)
tree25cf8ae1a8e8fdb1c6fc347abf999a0286e34411 /lib/Numeric/LinearAlgebra
parent33a8f087574c89d257fccefd58643bd9b8fa9f22 (diff)
added minimizeVectorBFGS2
Diffstat (limited to 'lib/Numeric/LinearAlgebra')
-rw-r--r--lib/Numeric/LinearAlgebra/Tests.hs15
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/Numeric/LinearAlgebra/Tests.hs b/lib/Numeric/LinearAlgebra/Tests.hs
index 7758268..278df78 100644
--- a/lib/Numeric/LinearAlgebra/Tests.hs
+++ b/lib/Numeric/LinearAlgebra/Tests.hs
@@ -1,9 +1,9 @@
1{-# LANGUAGE CPP #-} 1{-# LANGUAGE CPP #-}
2{-# OPTIONS_GHC -fno-warn-unused-imports #-} 2{-# OPTIONS_GHC -fno-warn-unused-imports -fno-warn-incomplete-patterns #-}
3----------------------------------------------------------------------------- 3-----------------------------------------------------------------------------
4{- | 4{- |
5Module : Numeric.LinearAlgebra.Tests 5Module : Numeric.LinearAlgebra.Tests
6Copyright : (c) Alberto Ruiz 2007 6Copyright : (c) Alberto Ruiz 2007-9
7License : GPL-style 7License : GPL-style
8 8
9Maintainer : Alberto Ruiz (aruiz at um dot es) 9Maintainer : Alberto Ruiz (aruiz at um dot es)
@@ -105,6 +105,16 @@ expmTest2 = expm nd2 :~15~: (2><2)
105 , 2.718281828459045 105 , 2.718281828459045
106 , 2.718281828459045 ] 106 , 2.718281828459045 ]
107 107
108---------------------------------------------------------------------
109
110minimizationTest = TestList [ utest "minimization conj grad" (minim1 f df [5,7] ~~ [1,2])
111 , utest "minimization bg2" (minim2 f df [5,7] ~~ [1,2])
112 ]
113 where f [x,y] = 10*(x-1)^2 + 20*(y-2)^2 + 30
114 df [x,y] = [20*(x-1), 40*(y-2)]
115 a ~~ b = fromList a |~| fromList b
116 minim1 g dg ini = fst $ minimizeConjugateGradient 1E-2 1E-4 1E-3 30 g dg ini
117 minim2 g dg ini = fst $ minimizeVectorBFGS2 1E-2 1E-2 1E-3 30 g dg ini
108 118
109--------------------------------------------------------------------- 119---------------------------------------------------------------------
110 120
@@ -206,6 +216,7 @@ runTests n = do
206 , exponentialTest 216 , exponentialTest
207 , utest "integrate" (abs (volSphere 2.5 - 4/3*pi*2.5^3) < 1E-8) 217 , utest "integrate" (abs (volSphere 2.5 - 4/3*pi*2.5^3) < 1E-8)
208 , utest "polySolve" (polySolveProp [1,2,3,4]) 218 , utest "polySolve" (polySolveProp [1,2,3,4])
219 , minimizationTest
209 ] 220 ]
210 return () 221 return ()
211 222