packages feed

matrix 0.1 → 0.1.1

raw patch · 2 files changed

+5/−1 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Data.Matrix: fromLists :: [[a]] -> Matrix a

Files

Data/Matrix.hs view
@@ -8,6 +8,7 @@   , zero
   , identity
   , matrix
+  , fromLists
     -- * Accessing
   , getElem , (!)
     -- * Manipulating matrices
@@ -104,6 +105,9 @@ -- | Identity matrix of the given order.
 identity :: Num a => Int -> Matrix a
 identity n = matrix n n $ \(i,j) -> if i == j then 1 else 0
+
+fromLists :: [[a]] -> Matrix a
+fromLists xss = M (length xss) (length $ head xss) $ mconcat $ fmap V.fromList xss
 
 -------------------------------------------------------
 -------------------------------------------------------
matrix.cabal view
@@ -1,5 +1,5 @@ Name: matrix
-Version: 0.1
+Version: 0.1.1
 Author: Daniel Díaz
 Category: Math
 Build-type: Simple