summaryrefslogtreecommitdiff
path: root/lib/Numeric/LinearAlgebra/Util.hs
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2010-02-03 15:25:44 +0000
committerAlberto Ruiz <aruiz@um.es>2010-02-03 15:25:44 +0000
commitab5a2c1c8b4ecd7f8d9d9823d9976410aa94bb18 (patch)
tree566df5edcf5c1f431bc5d5ce1c1e0a46767c7361 /lib/Numeric/LinearAlgebra/Util.hs
parent25592aea904c4f29ea1c06210adb52dae99ba95c (diff)
dispcf, latexFormat
Diffstat (limited to 'lib/Numeric/LinearAlgebra/Util.hs')
-rw-r--r--lib/Numeric/LinearAlgebra/Util.hs12
1 files changed, 1 insertions, 11 deletions
diff --git a/lib/Numeric/LinearAlgebra/Util.hs b/lib/Numeric/LinearAlgebra/Util.hs
index 92b66e3..24317e3 100644
--- a/lib/Numeric/LinearAlgebra/Util.hs
+++ b/lib/Numeric/LinearAlgebra/Util.hs
@@ -25,15 +25,13 @@ module Numeric.LinearAlgebra.Util(
25 (#),(&), (//), blocks, 25 (#),(&), (//), blocks,
26 rand, 26 rand,
27 splitEvery, 27 splitEvery,
28 table, 28 table
29 latexFormat
30) where 29) where
31 30
32import Numeric.LinearAlgebra hiding ((<>), (<|>), (<->), (<\>), (.*), (*/)) 31import Numeric.LinearAlgebra hiding ((<>), (<|>), (<->), (<\>), (.*), (*/))
33import Data.Packed.Internal.Common(table,splitEvery) 32import Data.Packed.Internal.Common(table,splitEvery)
34import System.Random(randomIO) 33import System.Random(randomIO)
35 34
36
37infixl 7 <> 35infixl 7 <>
38-- | Matrix product ('multiply') 36-- | Matrix product ('multiply')
39(<>) :: Field t => Matrix t -> Matrix t -> Matrix t 37(<>) :: Field t => Matrix t -> Matrix t -> Matrix t
@@ -121,12 +119,4 @@ row = asRow . vector
121col :: [Double] -> Matrix Double 119col :: [Double] -> Matrix Double
122col = asColumn . vector 120col = asColumn . vector
123 121
124-- | Tool to display matrices with latex syntax.
125latexFormat :: Element t
126 => String -- ^ type of braces: \"matrix\", \"bmatrix\", \"pmatrix\", etc.
127 -> (t->String) -- ^ formatting function for the elements: (printf \"%.2f\"), etc.
128 -> Matrix t -- ^ input matrix
129 -> String
130latexFormat t shf m = "\\begin{"++t++"}\n" ++ dispg " & " " \\\\" shf m ++ "\\end{"++t++"}"
131 where dispg w l shfun x = unlines $ map (++l) $ lines $ format w shfun x
132 122