diff options
author | Alberto Ruiz <aruiz@um.es> | 2010-02-03 15:25:44 +0000 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2010-02-03 15:25:44 +0000 |
commit | ab5a2c1c8b4ecd7f8d9d9823d9976410aa94bb18 (patch) | |
tree | 566df5edcf5c1f431bc5d5ce1c1e0a46767c7361 /lib/Numeric/LinearAlgebra/Util.hs | |
parent | 25592aea904c4f29ea1c06210adb52dae99ba95c (diff) |
dispcf, latexFormat
Diffstat (limited to 'lib/Numeric/LinearAlgebra/Util.hs')
-rw-r--r-- | lib/Numeric/LinearAlgebra/Util.hs | 12 |
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 | ||
32 | import Numeric.LinearAlgebra hiding ((<>), (<|>), (<->), (<\>), (.*), (*/)) | 31 | import Numeric.LinearAlgebra hiding ((<>), (<|>), (<->), (<\>), (.*), (*/)) |
33 | import Data.Packed.Internal.Common(table,splitEvery) | 32 | import Data.Packed.Internal.Common(table,splitEvery) |
34 | import System.Random(randomIO) | 33 | import System.Random(randomIO) |
35 | 34 | ||
36 | |||
37 | infixl 7 <> | 35 | infixl 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 | |||
121 | col :: [Double] -> Matrix Double | 119 | col :: [Double] -> Matrix Double |
122 | col = asColumn . vector | 120 | col = asColumn . vector |
123 | 121 | ||
124 | -- | Tool to display matrices with latex syntax. | ||
125 | latexFormat :: 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 | ||
130 | latexFormat 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 | ||