diff options
Diffstat (limited to 'lib/Graphics')
-rw-r--r-- | lib/Graphics/Plot.hs | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/Graphics/Plot.hs b/lib/Graphics/Plot.hs index bcb1fb3..9b64a1d 100644 --- a/lib/Graphics/Plot.hs +++ b/lib/Graphics/Plot.hs | |||
@@ -1,7 +1,7 @@ | |||
1 | ----------------------------------------------------------------------------- | 1 | ----------------------------------------------------------------------------- |
2 | -- | | 2 | -- | |
3 | -- Module : Graphics.Plot | 3 | -- Module : Graphics.Plot |
4 | -- Copyright : (c) Alberto Ruiz 2005 | 4 | -- Copyright : (c) Alberto Ruiz 2005-8 |
5 | -- License : GPL-style | 5 | -- License : GPL-style |
6 | -- | 6 | -- |
7 | -- Maintainer : Alberto Ruiz (aruiz at um dot es) | 7 | -- Maintainer : Alberto Ruiz (aruiz at um dot es) |
@@ -28,14 +28,10 @@ module Graphics.Plot( | |||
28 | 28 | ||
29 | ) where | 29 | ) where |
30 | 30 | ||
31 | import Data.Packed.Vector | 31 | import Data.Packed |
32 | import Data.Packed.Matrix | ||
33 | import Numeric.LinearAlgebra(outer) | 32 | import Numeric.LinearAlgebra(outer) |
34 | import Numeric.GSL.Vector(FunCodeS(Max,Min),toScalarR) | ||
35 | import Data.List(intersperse) | 33 | import Data.List(intersperse) |
36 | import System | 34 | import System |
37 | import Foreign hiding (rotate) | ||
38 | |||
39 | 35 | ||
40 | size = dim | 36 | size = dim |
41 | 37 | ||
@@ -154,8 +150,8 @@ matrixToPGM m = header ++ unlines (map unwords ll) where | |||
154 | r = rows m | 150 | r = rows m |
155 | header = "P2 "++show c++" "++show r++" "++show (round maxgray :: Int)++"\n" | 151 | header = "P2 "++show c++" "++show r++" "++show (round maxgray :: Int)++"\n" |
156 | maxgray = 255.0 | 152 | maxgray = 255.0 |
157 | maxval = toScalarR Max $ flatten $ m | 153 | maxval = vectorMax $ flatten $ m |
158 | minval = toScalarR Min $ flatten $ m | 154 | minval = vectorMin $ flatten $ m |
159 | scale = if (maxval == minval) | 155 | scale = if (maxval == minval) |
160 | then 0.0 | 156 | then 0.0 |
161 | else maxgray / (maxval - minval) | 157 | else maxgray / (maxval - minval) |