summaryrefslogtreecommitdiff
path: root/lib/Data/Packed/Matrix.hs
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2007-10-24 09:42:36 +0000
committerAlberto Ruiz <aruiz@um.es>2007-10-24 09:42:36 +0000
commit2e441c3f4d08da050540256164456e18519d22ef (patch)
treefaae9372692ac8b618337b3e97f8ff9d44df2d08 /lib/Data/Packed/Matrix.hs
parent9c65a03f4e2b3b09f6f2ac606c5b22f6df9cea14 (diff)
documentation
Diffstat (limited to 'lib/Data/Packed/Matrix.hs')
-rw-r--r--lib/Data/Packed/Matrix.hs8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Data/Packed/Matrix.hs b/lib/Data/Packed/Matrix.hs
index e94d038..a705975 100644
--- a/lib/Data/Packed/Matrix.hs
+++ b/lib/Data/Packed/Matrix.hs
@@ -193,6 +193,14 @@ dsp' sep as = unlines . map unwords' $ transpose mtp where
193 pad n str = replicate (n - length str) ' ' ++ str 193 pad n str = replicate (n - length str) ' ' ++ str
194 unwords' = concat . intersperse sep 194 unwords' = concat . intersperse sep
195 195
196{- | Creates a string from a matrix given a separator and a function to show each entry. Using
197this function the user can easily define any desired display function:
198
199@import Text.Printf(printf)@
200
201@disp = putStrLn . format \" \" (printf \"%.2f\")@
202
203-}
196format :: (Field t) => String -> (t -> String) -> Matrix t -> String 204format :: (Field t) => String -> (t -> String) -> Matrix t -> String
197format sep f m = dsp' sep . map (map f) . toLists $ m 205format sep f m = dsp' sep . map (map f) . toLists $ m
198 206