summaryrefslogtreecommitdiff
path: root/lib/Data/Packed/Matrix.hs
diff options
context:
space:
mode:
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]