diff options
author | Alberto Ruiz <aruiz@um.es> | 2007-10-24 09:42:36 +0000 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2007-10-24 09:42:36 +0000 |
commit | 2e441c3f4d08da050540256164456e18519d22ef (patch) | |
tree | faae9372692ac8b618337b3e97f8ff9d44df2d08 /lib/Data/Packed/Matrix.hs | |
parent | 9c65a03f4e2b3b09f6f2ac606c5b22f6df9cea14 (diff) |
documentation
Diffstat (limited to 'lib/Data/Packed/Matrix.hs')
-rw-r--r-- | lib/Data/Packed/Matrix.hs | 8 |
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 | ||
197 | this 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 | -} | ||
196 | format :: (Field t) => String -> (t -> String) -> Matrix t -> String | 204 | format :: (Field t) => String -> (t -> String) -> Matrix t -> String |
197 | format sep f m = dsp' sep . map (map f) . toLists $ m | 205 | format sep f m = dsp' sep . map (map f) . toLists $ m |
198 | 206 | ||