summaryrefslogtreecommitdiff
path: root/lib/Data/Packed/Matrix.hs
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2007-09-28 12:25:56 +0000
committerAlberto Ruiz <aruiz@um.es>2007-09-28 12:25:56 +0000
commit3815bc25f62124063e02af83fe3c907336dc86f5 (patch)
tree50fddcf4e66780272fdddf5515540e0f5d200feb /lib/Data/Packed/Matrix.hs
parent74e7d42263b196c22d1f5da3d51beec69071600d (diff)
algorithms interface reorganized
Diffstat (limited to 'lib/Data/Packed/Matrix.hs')
-rw-r--r--lib/Data/Packed/Matrix.hs8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/Data/Packed/Matrix.hs b/lib/Data/Packed/Matrix.hs
index 404fde7..2b93348 100644
--- a/lib/Data/Packed/Matrix.hs
+++ b/lib/Data/Packed/Matrix.hs
@@ -25,9 +25,10 @@ module Data.Packed.Matrix (
25 fromBlocks, 25 fromBlocks,
26 flipud, fliprl, 26 flipud, fliprl,
27 subMatrix, takeRows, dropRows, takeColumns, dropColumns, 27 subMatrix, takeRows, dropRows, takeColumns, dropColumns,
28 extractRows,
28 ident, diag, diagRect, takeDiag, 29 ident, diag, diagRect, takeDiag,
29 liftMatrix, liftMatrix2, 30 liftMatrix, liftMatrix2,
30 format, dispR, readMatrix, fromArray2D 31 format, dispR, readMatrix, fromFile, fromArray2D
31) where 32) where
32 33
33import Data.Packed.Internal 34import Data.Packed.Internal
@@ -209,3 +210,8 @@ dispC d m = disp m (shfc d)
209-- | creates a matrix from a table of numbers. 210-- | creates a matrix from a table of numbers.
210readMatrix :: String -> Matrix Double 211readMatrix :: String -> Matrix Double
211readMatrix = fromLists . map (map read). map words . filter (not.null) . lines 212readMatrix = fromLists . map (map read). map words . filter (not.null) . lines
213
214-- | rearranges the rows of a matrix according to the order given in a list of integers.
215extractRows :: Field t => [Int] -> Matrix t -> Matrix t
216extractRows l m = fromRows $ extract (toRows $ m) l
217 where extract l is = [l!!i |i<-is]