diff options
author | Alberto Ruiz <aruiz@um.es> | 2007-10-01 18:52:46 +0000 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2007-10-01 18:52:46 +0000 |
commit | d925bada507562250a75587c409bdb35bbbc6ed8 (patch) | |
tree | 3c83410ce29de563f55b00923298494d9a7c64d9 /examples/latexmat.hs | |
parent | c99b8fd6e3f8a2fb365ec12baf838f864b118ece (diff) |
misc examples
Diffstat (limited to 'examples/latexmat.hs')
-rw-r--r-- | examples/latexmat.hs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/examples/latexmat.hs b/examples/latexmat.hs new file mode 100644 index 0000000..d912a28 --- /dev/null +++ b/examples/latexmat.hs | |||
@@ -0,0 +1,11 @@ | |||
1 | import Numeric.LinearAlgebra | ||
2 | import Text.Printf | ||
3 | |||
4 | disp w l fmt m = unlines $ map (++l) $ lines $ format w (printf fmt) m | ||
5 | |||
6 | latex fmt m = "\\begin{bmatrix}\n" ++ disp " & " " \\\\" fmt m ++ "\\end{bmatrix}" | ||
7 | |||
8 | main = do | ||
9 | let m = (3><4) [1..12::Double] | ||
10 | putStrLn $ disp " | " "" "%.2f" m | ||
11 | putStrLn $ latex "%.3f" m | ||