hmatrix 0.7.1.0 → 0.7.2.1
raw patch · 11 files changed
+47/−48 lines, 11 files
Files
- CHANGES +9/−2
- INSTALL +2/−2
- README +1/−16
- hmatrix.cabal +2/−2
- lib/Data/Packed/Internal/Vector.hs +2/−0
- lib/Graphics/Plot.hs +12/−11
- lib/Numeric/GSL.hs +0/−1
- lib/Numeric/LinearAlgebra/Algorithms.hs +13/−11
- lib/Numeric/LinearAlgebra/LAPACK.hs +0/−1
- lib/Numeric/LinearAlgebra/Linear.hs +0/−1
- lib/Numeric/LinearAlgebra/Tests.hs +6/−1
CHANGES view
@@ -1,7 +1,14 @@-0.7.0.0+0.7.2.0 ======= -- NFData instances for deepseq/parallel-2+- ranksv++0.7.1.0+=======++- buildVector/buildMatrix++- removed NFData instances 0.6.0.0 =======
INSTALL view
@@ -4,8 +4,8 @@ INSTALLATION -Recommended method:- $ sudo apt-get install libgsl0-dev refblas3-dev lapack3-dev atlas3-[your arch]-dev+Recommended method (ok in Ubuntu/Debian systems):+ $ sudo apt-get install libgsl0-dev liblapack-dev $ cabal install hmatrix Detailed installation instructions:
README view
@@ -4,25 +4,13 @@ INSTALLATION -Recommended method (ok in Ubuntu/Debian systems):- $ sudo apt-get install libgsl0-dev refblas3-dev lapack3-dev atlas3-[your_arch]-dev- $ cabal install hmatrix--Detailed installation instructions:- http://www.hmatrix.googlepages.com/installation--For installation in Windows see the companion INSTALL file.+See the INSTALL file. TESTS --------------------------------------------- $ ghci-GHCi, version 6.8.2: http://www.haskell.org/ghc/ :? for help Prelude> Numeric.LinearAlgebra.Tests.runTests 20 -Additional tests with big matrices (taking a few minutes):--$ runhaskell examples/experiments/bigtests- EXAMPLES ------------------------------------------------------ $ ghci@@ -59,9 +47,6 @@ - On Ubuntu 6.06 LTS (Dapper) atlas3-sse2-dev (3.6.0-20) produced segmentation faults when working with big matrices on compiled programs.--- On distributions with old GSL versions you should comment out a couple of functions- in the export lists of Ellint.hs and Debye.hs ACKNOWLEDGEMENTS -----------------------------------------------------
hmatrix.cabal view
@@ -1,5 +1,5 @@ Name: hmatrix-Version: 0.7.1.0+Version: 0.7.2.1 License: GPL License-file: LICENSE Author: Alberto Ruiz@@ -11,7 +11,7 @@ and other numerical computations, internally implemented using GSL, BLAS and LAPACK. Category: Math-tested-with: GHC ==6.10.4+tested-with: GHC ==6.12.1 cabal-version: >=1.2 build-type: Custom
lib/Data/Packed/Internal/Vector.hs view
@@ -41,7 +41,9 @@ #endif import GHC.Base+#if __GLASGOW_HASKELL__ < 612 import GHC.IOBase+#endif -- | A one-dimensional array of objects stored in a contiguous memory block. data Vector t =
lib/Graphics/Plot.hs view
@@ -51,7 +51,7 @@ meshdom r1 r2 = (outer r1 (constant 1 (size r2)), outer (constant 1 (size r1)) r2) gnuplotX :: String -> IO ()-gnuplotX command = do {system cmdstr; return()} where+gnuplotX command = do { _ <- system cmdstr; return()} where cmdstr = "echo \""++command++"\" | gnuplot -persist" datafollows = "\\\"-\\\""@@ -76,8 +76,8 @@ writeFile "splot-gnu-command" "splot \"splot-tmp.txt\" matrix with lines; pause -1"; toFile' "splot-tmp.txt" m putStr "Press [Return] to close the graphic and continue... "- system "gnuplot -persist splot-gnu-command"- system "rm splot-tmp.txt splot-gnu-command"+ _ <- system "gnuplot -persist splot-gnu-command"+ _ <- system "rm splot-tmp.txt splot-gnu-command" return () {- | Draws the surface represented by the function f in the desired ranges and number of points, internally using 'mesh'.@@ -161,7 +161,7 @@ -- | imshow shows a representation of a matrix as a gray level image using ImageMagick's display. imshow :: Matrix Double -> IO () imshow m = do- system $ "echo \""++ matrixToPGM m ++"\"| display -antialias -resize 300 - &"+ _ <- system $ "echo \""++ matrixToPGM m ++"\"| display -antialias -resize 300 - &" return () ----------------------------------------------------@@ -173,12 +173,12 @@ draw = concat (intersperse ", " (map ("\"-\" "++) defs)) ++ "\n" ++ concatMap pr dats postproc = do- system $ "epstopdf "++title++".eps"+ _ <- system $ "epstopdf "++title++".eps" mklatex- system $ "pdflatex "++title++"aux.tex > /dev/null"- system $ "pdfcrop "++title++"aux.pdf > /dev/null"- system $ "mv "++title++"aux-crop.pdf "++title++".pdf"- system $ "rm "++title++"aux.* "++title++".eps "++title++".tex"+ _ <- system $ "pdflatex "++title++"aux.tex > /dev/null"+ _ <- system $ "pdfcrop "++title++"aux.pdf > /dev/null"+ _ <- system $ "mv "++title++"aux-crop.pdf "++title++".pdf"+ _ <- system $ "rm "++title++"aux.* "++title++".eps "++title++".tex" return () mklatex = writeFile (title++"aux.tex") $@@ -201,5 +201,6 @@ gnuplot cmd = do writeFile "gnuplotcommand" cmd- system "gnuplot gnuplotcommand"- system "rm gnuplotcommand"+ _ <- system "gnuplot gnuplotcommand"+ _ <- system "rm gnuplotcommand"+ return ()
lib/Numeric/GSL.hs view
@@ -32,7 +32,6 @@ import Numeric.GSL.Minimization import Numeric.GSL.Root import Complex-import Numeric.GSL.Special -- | This action removes the GSL default error handler (which aborts the program), so that
lib/Numeric/LinearAlgebra/Algorithms.hs view
@@ -63,7 +63,7 @@ haussholder, unpackQR, unpackHess, pinvTol,- rankSVD,+ rankSVD, ranksv, nullspaceSVD ) where @@ -72,7 +72,6 @@ import Data.Packed import Numeric.GSL.Vector import Numeric.LinearAlgebra.LAPACK as LAPACK-import Complex import Numeric.LinearAlgebra.Linear import Data.List(foldl1') import Data.Array@@ -262,15 +261,18 @@ -> Matrix t -- ^ input matrix m -> (Matrix t, Vector Double, Matrix t) -- ^ 'svd' of m -> Int -- ^ rank of m-rankSVD teps m (_,s,_) = k where- sl@(g:_) = toList s- r = rows m- c = cols m- tol = fromIntegral (max r c) * g * teps- s' = fromList . filter (>tol) $ sl- k = if g > teps- then dim s'- else 0+rankSVD teps m (_,s,_) = ranksv teps (max (rows m) (cols m)) (toList s)++-- | Numeric rank of a matrix from its singular values.+ranksv :: Double -- ^ numeric zero (e.g. 1*'eps')+ -> Int -- ^ maximum dimension of the matrix+ -> [Double] -- ^ singular values+ -> Int -- ^ rank of m+ranksv teps maxdim s = k where+ g = maximum s+ tol = fromIntegral maxdim * g * teps+ s' = filter (>tol) s+ k = if g > teps then length s' else 0 -- | The machine precision of a Double: @eps = 2.22044604925031e-16@ (the value used by GNU-Octave). eps :: Double
lib/Numeric/LinearAlgebra/LAPACK.hs view
@@ -30,7 +30,6 @@ import Data.Packed.Internal hiding (toComplex) import Data.Packed import Numeric.GSL.Vector(vectorMapValR, FunCodeSV(Scale))-import Complex import Foreign import Foreign.C.Types (CInt) import Control.Monad(when)
lib/Numeric/LinearAlgebra/Linear.hs view
@@ -20,7 +20,6 @@ import Data.Packed import Numeric.GSL.Vector-import Complex -- | A generic interface for vectors and matrices to a few element-by-element functions in Numeric.GSL.Vector. class (Container c e) => Linear c e where
lib/Numeric/LinearAlgebra/Tests.hs view
@@ -225,7 +225,7 @@ test (\m -> toRows (m::RM) == read (show (toRows m))) test (\m -> toRows (m::CM) == read (show (toRows m))) putStrLn "------ some unit tests"- runTestTT $ TestList+ _ <- runTestTT $ TestList [ utest "1E5 rots" rotTest , utest "det1" detTest1 , utest "expm1" (expmTest1)@@ -243,6 +243,11 @@ , rootFindingTest , utest "randomGaussian" randomTestGaussian , utest "randomUniform" randomTestUniform+ , utest "buildVector/Matrix" $+ comp (10 |> [0::Double ..]) == buildVector 10 fromIntegral+ && ident 5 == buildMatrix 5 5 (\(r,c) -> if r==c then 1::Double else 0)+ , utest "rank" $ rank ((2><3)[1,0,0,1,6*eps,0]) == 1+ && rank ((2><3)[1,0,0,1,7*eps,0]) == 2 ] return ()