packages feed

hmatrix 0.6.0.0 → 0.7.1.0

raw patch · 9 files changed

+51/−16 lines, 9 filesdep −parallelPVP ok

version bump matches the API change (PVP)

Dependencies removed: parallel

API changes (from Hackage documentation)

- Numeric.LinearAlgebra.Instances: instance (NFData a, Element a) => NFData (Matrix a)
- Numeric.LinearAlgebra.Instances: instance (NFData a, Storable a) => NFData (Vector a)
+ Data.Packed.Matrix: buildMatrix :: (Element a) => Int -> Int -> ((Int, Int) -> a) -> Matrix a
+ Data.Packed.Vector: buildVector :: (Element a) => Int -> (Int -> a) -> Vector a

Files

CHANGES view
@@ -1,4 +1,9 @@-6.0.0.0+0.7.0.0+=======++- NFData instances for deepseq/parallel-2++0.6.0.0 =======  - added randomVector, gaussianSample, uniformSample, meanCov
README view
@@ -117,3 +117,7 @@   safely used on lists that are too long (or infinite).  - Chris Waterson improved the configure.hs program for OS/X.++- Erik de Castro Lopo added buildVector and buildMatrix, which take a+  size parameter(s) and a function that maps vector/matrix indices+  to the values at that position.
configure.hs view
@@ -31,6 +31,7 @@        , "cblas"        , "gslcblas"        , "blas gslcblas"+       , "f77blas"        , "f77blas cblas atlas gcc_s"     -- Arch Linux (older version of atlas-lapack)        , "blas gslcblas gfortran"        -- Arch Linux with normal blas and lapack        ]
examples/parallel.hs view
@@ -5,8 +5,8 @@ import Control.Parallel.Strategies import System.Time -inParallel = parMap rnf id--- rwhnf also works in this case+inParallel = parMap rwhnf id+--  rdeepseq (or older rnf) not needed in this case  -- matrix product decomposed into p parallel subtasks parMul p x y = fromBlocks [ inParallel ( map (x <>) ys ) ]
examples/plot.hs view
@@ -16,5 +16,5 @@ main = do     let x = linspace 1000 (-4,4)     mplot [f x]-    mplot [x, liftVector cumdist x,  liftVector gaussianPDF x]+    mplot [x, mapVector cumdist x, mapVector gaussianPDF x]     mesh (sombrero 40)
hmatrix.cabal view
@@ -1,5 +1,5 @@ Name:               hmatrix-Version:            0.6.0.0+Version:            0.7.1.0 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.3+tested-with:        GHC ==6.10.4  cabal-version:      >=1.2 build-type:         Custom@@ -71,8 +71,7 @@     Build-Depends:      haskell98,                         QuickCheck, HUnit,                         storable-complex,-                        process,-                        parallel+                        process      Extensions:         ForeignFunctionInterface,                         CPP
lib/Data/Packed/Matrix.hs view
@@ -19,7 +19,7 @@     (><),     trans,     reshape, flatten,-    fromLists, toLists,+    fromLists, toLists, buildMatrix,     (@@>),     asRow, asColumn,     fromRows, toRows, fromColumns, toColumns,@@ -175,6 +175,21 @@ -- | creates a 1-column matrix from a vector asColumn :: Element a => Vector a -> Matrix a 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)+(3><4)+ [ 0.0, 0.0, 0.0, 0.0, 0.0+ , 0.0, 1.0, 2.0, 3.0, 4.0+ , 0.0, 2.0, 4.0, 6.0, 8.0]@+-}+buildMatrix :: Element a => Int -> Int -> ((Int, Int) -> a) -> Matrix a+buildMatrix rc cc f =+    fromLists $ map (\x -> map f x)+    	$ map (\ ri -> map (\ ci -> (ri, ci)) [0 .. (cc - 1)]) [0 .. (rc - 1)]  ----------------------------------------------------- 
lib/Data/Packed/Vector.hs view
@@ -14,7 +14,7 @@  module Data.Packed.Vector (     Vector,-    fromList, (|>), toList,+    fromList, (|>), toList, buildVector,     dim, (@>),     subVector, join,     constant, linspace,@@ -59,3 +59,14 @@ constant :: Element a => a -> Int -> Vector a -- constant x n = runSTVector (newVector x n) constant = constantD -- about 2x faster++{- | creates a Vector of the specified length using the supplied function to+     to map the index to the value at that index.++@> buildVector 4 fromIntegral+4 |> [0.0,1.0,2.0,3.0]@++-}+buildVector :: Element a => Int -> (Int -> a) -> Vector a+buildVector len f =+    fromList $ map f [0 .. (len - 1)]
lib/Numeric/LinearAlgebra/Instances.hs view
@@ -27,7 +27,7 @@ import Foreign(Storable) import Data.Monoid import Data.Packed.Internal.Vector-import Control.Parallel.Strategies+-- import Control.Parallel.Strategies  ------------------------------------------------------------------ @@ -199,8 +199,8 @@  --------------------------------------------------------------- -instance (NFData a, Storable a) => NFData (Vector a) where-    rnf = rnf . (@>0)--instance (NFData a, Element a) => NFData (Matrix a) where-    rnf = rnf . flatten+-- instance (NFData a, Storable a) => NFData (Vector a) where+--     rnf = rnf . (@>0)+--+-- instance (NFData a, Element a) => NFData (Matrix a) where+--     rnf = rnf . flatten