summaryrefslogtreecommitdiff
path: root/examples/latexmat.hs
blob: d912a28fc1bd68c824fe236555bab5962f28f8fc (plain)
1
2
3
4
5
6
7
8
9
10
11
import Numeric.LinearAlgebra
import Text.Printf

disp w l fmt m = unlines $ map (++l) $ lines $ format w (printf fmt) m

latex fmt m = "\\begin{bmatrix}\n" ++ disp " & " " \\\\" fmt m ++ "\\end{bmatrix}"

main = do
    let m = (3><4) [1..12::Double]
    putStrLn $ disp " | " "" "%.2f" m
    putStrLn $ latex "%.3f" m