diff options
Diffstat (limited to 'lib/Numeric')
-rw-r--r-- | lib/Numeric/GSL/Matrix.hs | 2 | ||||
-rw-r--r-- | lib/Numeric/GSL/Minimization.hs | 12 | ||||
-rw-r--r-- | lib/Numeric/LinearAlgebra/Algorithms.hs | 4 |
3 files changed, 9 insertions, 9 deletions
diff --git a/lib/Numeric/GSL/Matrix.hs b/lib/Numeric/GSL/Matrix.hs index acf4e77..370356f 100644 --- a/lib/Numeric/GSL/Matrix.hs +++ b/lib/Numeric/GSL/Matrix.hs | |||
@@ -299,7 +299,7 @@ L \* U obtains a permuted version of the original matrix: | |||
299 | 2.+3.i -7. 0. | 299 | 2.+3.i -7. 0. |
300 | 1. 2. -3. | 300 | 1. 2. -3. |
301 | 1. -1.i 2.i | 301 | 1. -1.i 2.i |
302 | \ | 302 | \ -- CPP |
303 | \> l \<\> u | 303 | \> l \<\> u |
304 | 2.+3.i -7. 0. | 304 | 2.+3.i -7. 0. |
305 | 1. 2. -3. | 305 | 1. 2. -3. |
diff --git a/lib/Numeric/GSL/Minimization.hs b/lib/Numeric/GSL/Minimization.hs index 0a2d577..a1d009b 100644 --- a/lib/Numeric/GSL/Minimization.hs +++ b/lib/Numeric/GSL/Minimization.hs | |||
@@ -31,14 +31,14 @@ import Foreign.C.Types(CInt) | |||
31 | {- | The method of Nelder and Mead, implemented by /gsl_multimin_fminimizer_nmsimplex/. The gradient of the function is not required. This is the example in the GSL manual: | 31 | {- | The method of Nelder and Mead, implemented by /gsl_multimin_fminimizer_nmsimplex/. The gradient of the function is not required. This is the example in the GSL manual: |
32 | 32 | ||
33 | @minimize f xi = minimizeNMSimplex f xi (replicate (length xi) 1) 1e-2 100 | 33 | @minimize f xi = minimizeNMSimplex f xi (replicate (length xi) 1) 1e-2 100 |
34 | \ | 34 | \ -- |
35 | f [x,y] = 10*(x-1)^2 + 20*(y-2)^2 + 30 | 35 | f [x,y] = 10*(x-1)^2 + 20*(y-2)^2 + 30 |
36 | \ | 36 | \ -- |
37 | main = do | 37 | main = do |
38 | let (s,p) = minimize f [5,7] | 38 | let (s,p) = minimize f [5,7] |
39 | print s | 39 | print s |
40 | print p | 40 | print p |
41 | \ | 41 | \ -- |
42 | \> main | 42 | \> main |
43 | [0.9920430849306285,1.9969168063253164] | 43 | [0.9920430849306285,1.9969168063253164] |
44 | 0. 512.500 1.082 6.500 5. | 44 | 0. 512.500 1.082 6.500 5. |
@@ -104,14 +104,14 @@ foreign import ccall "gsl-aux.h minimize" | |||
104 | 104 | ||
105 | @minimize = minimizeConjugateGradient 1E-2 1E-4 1E-3 30 | 105 | @minimize = minimizeConjugateGradient 1E-2 1E-4 1E-3 30 |
106 | f [x,y] = 10*(x-1)^2 + 20*(y-2)^2 + 30 | 106 | f [x,y] = 10*(x-1)^2 + 20*(y-2)^2 + 30 |
107 | \ | 107 | \ -- |
108 | df [x,y] = [20*(x-1), 40*(y-2)] | 108 | df [x,y] = [20*(x-1), 40*(y-2)] |
109 | \ | 109 | \ -- |
110 | main = do | 110 | main = do |
111 | let (s,p) = minimize f df [5,7] | 111 | let (s,p) = minimize f df [5,7] |
112 | print s | 112 | print s |
113 | print p | 113 | print p |
114 | \ | 114 | \ -- |
115 | \> main | 115 | \> main |
116 | [1.0,2.0] | 116 | [1.0,2.0] |
117 | 0. 687.848 4.996 6.991 | 117 | 0. 687.848 4.996 6.991 |
diff --git a/lib/Numeric/LinearAlgebra/Algorithms.hs b/lib/Numeric/LinearAlgebra/Algorithms.hs index 1de018c..bbc5986 100644 --- a/lib/Numeric/LinearAlgebra/Algorithms.hs +++ b/lib/Numeric/LinearAlgebra/Algorithms.hs | |||
@@ -300,12 +300,12 @@ multiplicative factor of the default tolerance used by GNU-Octave (see 'pinv'). | |||
300 | @\> let m = 'fromLists' [[1,0, 0] | 300 | @\> let m = 'fromLists' [[1,0, 0] |
301 | ,[0,1, 0] | 301 | ,[0,1, 0] |
302 | ,[0,0,1e-10]] | 302 | ,[0,0,1e-10]] |
303 | \ | 303 | \ -- |
304 | \> 'pinv' m | 304 | \> 'pinv' m |
305 | 1. 0. 0. | 305 | 1. 0. 0. |
306 | 0. 1. 0. | 306 | 0. 1. 0. |
307 | 0. 0. 10000000000. | 307 | 0. 0. 10000000000. |
308 | \ | 308 | \ -- |
309 | \> pinvTol 1E8 m | 309 | \> pinvTol 1E8 m |
310 | 1. 0. 0. | 310 | 1. 0. 0. |
311 | 0. 1. 0. | 311 | 0. 1. 0. |