diff options
author | Vivian McPhail <haskell.vivian.mcphail@gmail.com> | 2010-07-12 22:23:14 +0000 |
---|---|---|
committer | Vivian McPhail <haskell.vivian.mcphail@gmail.com> | 2010-07-12 22:23:14 +0000 |
commit | 7659d9c67f75e1f665d6b02663ee8767e97762b4 (patch) | |
tree | cddaaf3156cadef9aaf564abf9d033b72f6e2e67 /lib/Graphics | |
parent | 007960d648485d5c161cd366d16282bc29fac68b (diff) |
refactored Data.Packed.Vector to remove any numerics
Diffstat (limited to 'lib/Graphics')
-rw-r--r-- | lib/Graphics/Plot.hs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/Graphics/Plot.hs b/lib/Graphics/Plot.hs index 02b0c4c..b2acc15 100644 --- a/lib/Graphics/Plot.hs +++ b/lib/Graphics/Plot.hs | |||
@@ -30,7 +30,7 @@ module Graphics.Plot( | |||
30 | 30 | ||
31 | import Data.Packed | 31 | import Data.Packed |
32 | import Numeric.LinearAlgebra(outer) | 32 | import Numeric.LinearAlgebra(outer) |
33 | import Numeric.LinearAlgebra.Linear(Vectors(..)) | 33 | import Numeric.LinearAlgebra.Linear |
34 | import Data.List(intersperse) | 34 | import Data.List(intersperse) |
35 | import System.Process (system) | 35 | import System.Process (system) |
36 | 36 | ||
@@ -153,10 +153,10 @@ matrixToPGM m = header ++ unlines (map unwords ll) where | |||
153 | maxgray = 255.0 | 153 | maxgray = 255.0 |
154 | maxval = vectorMax $ flatten $ m | 154 | maxval = vectorMax $ flatten $ m |
155 | minval = vectorMin $ flatten $ m | 155 | minval = vectorMin $ flatten $ m |
156 | scale = if (maxval == minval) | 156 | scale' = if (maxval == minval) |
157 | then 0.0 | 157 | then 0.0 |
158 | else maxgray / (maxval - minval) | 158 | else maxgray / (maxval - minval) |
159 | f x = show ( round ( scale *(x - minval) ) :: Int ) | 159 | f x = show ( round ( scale' *(x - minval) ) :: Int ) |
160 | ll = map (map f) (toLists m) | 160 | ll = map (map f) (toLists m) |
161 | 161 | ||
162 | -- | imshow shows a representation of a matrix as a gray level image using ImageMagick's display. | 162 | -- | imshow shows a representation of a matrix as a gray level image using ImageMagick's display. |