From ef93c93547287de7bbc25d552705914b7a850029 Mon Sep 17 00:00:00 2001 From: Alberto Ruiz Date: Thu, 8 Dec 2011 19:43:17 +0100 Subject: fix haddock markup errors --- THANKS | 2 ++ examples/fitting.hs | 24 ++++++++++++++++++++++++ hmatrix.cabal | 7 +++---- lib/Data/Packed/Matrix.hs | 6 +++--- 4 files changed, 32 insertions(+), 7 deletions(-) create mode 100644 examples/fitting.hs diff --git a/THANKS b/THANKS index 0132938..f3fb949 100644 --- a/THANKS +++ b/THANKS @@ -103,3 +103,5 @@ module reorganization, monadic mapVectorM, and many other improvements. - Tom Nielsen discovered a problem in Config.hs, exposed by link problems in Ubuntu 11.10 beta. +- Daniel Fischer reported some Haddock markup errors. + diff --git a/examples/fitting.hs b/examples/fitting.hs new file mode 100644 index 0000000..a8f6b1c --- /dev/null +++ b/examples/fitting.hs @@ -0,0 +1,24 @@ +-- nonlinear least-squares fitting + +import Numeric.GSL.Fitting +import Numeric.LinearAlgebra + +xs = map return [0 .. 39] +sigma = 0.1 +ys = map return $ toList $ fromList (map (head . expModel [5,0.1,1]) xs) + + scalar sigma * (randomVector 0 Gaussian 40) + +dat :: [([Double],([Double],Double))] + +dat = zip xs (zip ys (repeat sigma)) + +expModel [a,lambda,b] [t] = [a * exp (-lambda * t) + b] + +expModelDer [a,lambda,b] [t] = [[exp (-lambda * t), -t * a * exp(-lambda*t) , 1]] + +(sol,path) = fitModelScaled 1E-4 1E-4 20 (expModel, expModelDer) dat [1,0,0] + +main = do + print dat + print path + print sol diff --git a/hmatrix.cabal b/hmatrix.cabal index 51ed4dd..576a6df 100644 --- a/hmatrix.cabal +++ b/hmatrix.cabal @@ -1,5 +1,5 @@ Name: hmatrix -Version: 0.12.0.1 +Version: 0.12.0.2 License: GPL License-file: LICENSE Author: Alberto Ruiz @@ -216,9 +216,8 @@ library extra-lib-dirs: source-repository head - type: darcs - location: http://patch-tag.com/r/aruiz/hmatrix --- location: http://code.haskell.org/hmatrix + type: git + location: https://github.com/AlbertoRuiz/hmatrix -- Test-Suite tests -- type: exitcode-stdio-1.0 diff --git a/lib/Data/Packed/Matrix.hs b/lib/Data/Packed/Matrix.hs index 27fa36c..ca96c50 100644 --- a/lib/Data/Packed/Matrix.hs +++ b/lib/Data/Packed/Matrix.hs @@ -205,7 +205,7 @@ safely be used with lists that are too long (like infinite lists). Example: -@\> (2>|<3)[1..] +@\> (2><3)[1..] (2><3) [ 1.0, 2.0, 3.0 , 4.0, 5.0, 6.0 ]@ @@ -259,7 +259,7 @@ asColumn v = reshape 1 v {- | creates a Matrix of the specified size using the supplied function to to map the row\/column position to the value at that row\/column position. -@> buildMatrix 3 4 (\ (r,c) -> fromIntegral r * fromIntegral c) +@> buildMatrix 3 4 (\\(r,c) -> fromIntegral r * fromIntegral c) (3><4) [ 0.0, 0.0, 0.0, 0.0, 0.0 , 0.0, 1.0, 2.0, 3.0, 4.0 @@ -267,7 +267,7 @@ asColumn v = reshape 1 v Hilbert matrix of order N: -@hilb n = buildMatrix n n (\(i,j)->1/(fromIntegral i + fromIntegral j +1))@ +@hilb n = buildMatrix n n (\\(i,j)->1/(fromIntegral i + fromIntegral j +1))@ -} buildMatrix :: Element a => Int -> Int -> ((Int, Int) -> a) -> Matrix a -- cgit v1.2.3