commit ghc-matrices for openSUSE:Factory
![](https://seccdn.libravatar.org/avatar/e2145bc5cf53dda95c308a3c75e8fef3.jpg?s=120&d=mm&r=g)
Hello community, here is the log from the commit of package ghc-matrices for openSUSE:Factory checked in at 2017-08-31 20:57:20 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-matrices (Old) and /work/SRC/openSUSE:Factory/.ghc-matrices.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "ghc-matrices" Thu Aug 31 20:57:20 2017 rev:3 rq:513429 version:0.4.5 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-matrices/ghc-matrices.changes 2017-01-12 15:50:06.172089561 +0100 +++ /work/SRC/openSUSE:Factory/.ghc-matrices.new/ghc-matrices.changes 2017-08-31 20:57:22.315758260 +0200 @@ -1,0 +2,5 @@ +Thu Jul 27 14:05:08 UTC 2017 - psimons@suse.com + +- Update to version 0.4.5. + +------------------------------------------------------------------- Old: ---- matrices-0.4.4.tar.gz New: ---- matrices-0.4.5.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-matrices.spec ++++++ --- /var/tmp/diff_new_pack.N5Abgu/_old 2017-08-31 20:57:23.435600919 +0200 +++ /var/tmp/diff_new_pack.N5Abgu/_new 2017-08-31 20:57:23.439600357 +0200 @@ -1,7 +1,7 @@ # # spec file for package ghc-matrices # -# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,7 +19,7 @@ %global pkg_name matrices %bcond_with tests Name: ghc-%{pkg_name} -Version: 0.4.4 +Version: 0.4.5 Release: 0 Summary: Native matrix based on vector License: BSD-3-Clause @@ -39,9 +39,8 @@ %endif %description -This library provide the APIs for creating, indexing, modifying matrices (2d -arrays), including dense and sparse representations. The underling data -structure is vector. +Pure Haskell matrix library, supporting creating, indexing, and modifying +dense/sparse matrices. %package devel Summary: Haskell %{pkg_name} library development files ++++++ matrices-0.4.4.tar.gz -> matrices-0.4.5.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/matrices-0.4.4/matrices.cabal new/matrices-0.4.5/matrices.cabal --- old/matrices-0.4.4/matrices.cabal 2016-12-04 05:10:18.000000000 +0100 +++ new/matrices-0.4.5/matrices.cabal 2017-07-23 02:38:09.000000000 +0200 @@ -2,20 +2,17 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: matrices -version: 0.4.4 +version: 0.4.5 synopsis: native matrix based on vector -description: This library provide the APIs for creating, indexing, - modifying matrices (2d arrays), including dense and - sparse representations. The underling data - structure is vector. +description: Pure Haskell matrix library, supporting creating, indexing, + and modifying dense/sparse matrices. license: BSD3 license-file: LICENSE author: Kai Zhang maintainer: kai@kzhang.org -copyright: (c) 2015,2016 Kai Zhang +copyright: (c) 2015-2017 Kai Zhang category: Data build-type: Simple --- extra-source-files: cabal-version: >=1.10 library @@ -36,12 +33,10 @@ ghc-options: -Wall -funbox-strict-fields - -- other-modules: - build-depends: base >=4.8 && <5 , deepseq - , vector >=0.9 + , vector >=0.11 , primitive hs-source-dirs: src diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/matrices-0.4.4/src/Data/Matrix/Dense/Generic.hs new/matrices-0.4.5/src/Data/Matrix/Dense/Generic.hs --- old/matrices-0.4.4/src/Data/Matrix/Dense/Generic.hs 2016-12-04 05:08:20.000000000 +0100 +++ new/matrices-0.4.5/src/Data/Matrix/Dense/Generic.hs 2017-07-23 02:31:10.000000000 +0200 @@ -53,11 +53,14 @@ , Data.Matrix.Dense.Generic.foldl -- * Mapping - , imap , Data.Matrix.Dense.Generic.map + , imap + -- * Monadic mapping , mapM + , imapM , mapM_ + , imapM_ , forM , forM_ @@ -117,7 +120,7 @@ type instance MG.Mutable Matrix = MMatrix --- | row-major matrix supporting efficient slice +-- | Row-major matrix supporting efficient slice data Matrix v a = Matrix !Int -- number of rows !Int -- number of cols !Int -- physical row dimension @@ -268,29 +271,50 @@ force m@(Matrix r c _ _ _) = MG.fromVector (r,c) . G.force . MG.flatten $ m {-# INLINE force #-} +map :: (G.Vector v a, G.Vector v b) => (a -> b) -> Matrix v a -> Matrix v b +map f m@(Matrix r c _ _ _) = MG.fromVector (r,c) $ G.map f . MG.flatten $ m +{-# INLINE map #-} + imap :: (G.Vector v a, G.Vector v b) => ((Int, Int) -> a -> b) -> Matrix v a -> Matrix v b imap f m@(Matrix r c _ _ _) = MG.fromVector (r,c) $ G.imap f' . MG.flatten $ m where f' i = f (i `div` c, i `mod` c) {-# INLINE imap #-} -map :: (G.Vector v a, G.Vector v b) => (a -> b) -> Matrix v a -> Matrix v b -map f m@(Matrix r c _ _ _) = MG.fromVector (r,c) $ G.map f . MG.flatten $ m -{-# INLINE map #-} - foldl :: G.Vector v b => (a -> b -> a) -> a -> Matrix v b -> a foldl f acc m = G.foldl f acc . MG.flatten $ m {-# INLINE foldl #-} -mapM :: (G.Vector v a, G.Vector v b, Monad m) => (a -> m b) -> Matrix v a -> m (Matrix v b) -mapM f m@(Matrix r c _ _ _) = liftM (MG.fromVector (r,c)) . G.mapM f . MG.flatten $ m +mapM :: (G.Vector v a, G.Vector v b, Monad m) + => (a -> m b) -> Matrix v a -> m (Matrix v b) +mapM f m@(Matrix r c _ _ _) = liftM (MG.fromVector (r,c)) $ G.mapM f $ MG.flatten m {-# INLINE mapM #-} +-- | O(m*n) Apply the monadic action to every element and its index, +-- yielding a matrix of results. +imapM :: (G.Vector v a, G.Vector v b, Monad m) + => ((Int, Int) -> a -> m b) -> Matrix v a -> m (Matrix v b) +imapM f m@(Matrix r c _ _ _) = fmap (MG.fromVector (r,c)) $ G.imapM f' $ + MG.flatten m + where + f' i = f (i `div` c, i `mod` c) +{-# INLINE imapM #-} + mapM_ :: (G.Vector v a, Monad m) => (a -> m b) -> Matrix v a -> m () mapM_ f = G.mapM_ f . MG.flatten {-# INLINE mapM_ #-} -forM :: (G.Vector v a, G.Vector v b, Monad m) => Matrix v a -> (a -> m b) -> m (Matrix v b) +-- | O(m*n) Apply the monadic action to every element and its index, +-- ignoring the results. +imapM_ :: (G.Vector v a, Monad m) + => ((Int, Int) -> a -> m b) -> Matrix v a -> m () +imapM_ f m@(Matrix _ c _ _ _) = G.imapM_ f' $ MG.flatten m + where + f' i = f (i `div` c, i `mod` c) +{-# INLINE imapM_ #-} + +forM :: (G.Vector v a, G.Vector v b, Monad m) + => Matrix v a -> (a -> m b) -> m (Matrix v b) forM = flip mapM {-# INLINE forM #-}
participants (1)
-
root@hilbert.suse.de