summaryrefslogtreecommitdiff
path: root/examples/latexmat.hs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/latexmat.hs')
-rw-r--r--examples/latexmat.hs11
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 @@
1import Numeric.LinearAlgebra
2import Text.Printf
3
4disp w l fmt m = unlines $ map (++l) $ lines $ format w (printf fmt) m
5
6latex fmt m = "\\begin{bmatrix}\n" ++ disp " & " " \\\\" fmt m ++ "\\end{bmatrix}"
7
8main = do
9 let m = (3><4) [1..12::Double]
10 putStrLn $ disp " | " "" "%.2f" m
11 putStrLn $ latex "%.3f" m