summaryrefslogtreecommitdiff
path: root/lib/Data
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2008-10-22 12:59:18 +0000
committerAlberto Ruiz <aruiz@um.es>2008-10-22 12:59:18 +0000
commitfaeaf6d261b760e628c1e63551d822d16876c0cc (patch)
tree45e3e2d1460d72e1fd037e19d4470963b75cc00e /lib/Data
parent9d9b1274a522e1bf0c5dea210765a0368ebb74a5 (diff)
-Wall
Diffstat (limited to 'lib/Data')
-rw-r--r--lib/Data/Packed/Convert.hs3
-rw-r--r--lib/Data/Packed/Internal/Common.hs2
-rw-r--r--lib/Data/Packed/Internal/Matrix.hs2
-rw-r--r--lib/Data/Packed/ST.hs10
4 files changed, 6 insertions, 11 deletions
diff --git a/lib/Data/Packed/Convert.hs b/lib/Data/Packed/Convert.hs
index 206fa06..8f0eef6 100644
--- a/lib/Data/Packed/Convert.hs
+++ b/lib/Data/Packed/Convert.hs
@@ -29,7 +29,6 @@ import Data.Array.Storable
29import Foreign 29import Foreign
30import Control.Monad.ST 30import Control.Monad.ST
31import Data.Array.ST 31import Data.Array.ST
32import Data.Array.IArray
33import Data.Array.Unboxed 32import Data.Array.Unboxed
34 33
35-- | Creates a StorableArray indexed from 0 to dim -1. 34-- | Creates a StorableArray indexed from 0 to dim -1.
@@ -88,7 +87,7 @@ vectorFromMArray x = fmap vectorFromArray (unsafeFreeze' x)
88matrixFromArray :: UArray (Int, Int) Double -> Matrix Double 87matrixFromArray :: UArray (Int, Int) Double -> Matrix Double
89matrixFromArray m = reshape c . fromList . elems $ m 88matrixFromArray m = reshape c . fromList . elems $ m
90 where ((r1,c1),(r2,c2)) = bounds m 89 where ((r1,c1),(r2,c2)) = bounds m
91 r = r2-r1+1 90 _r = r2-r1+1
92 c = c2-c1+1 91 c = c2-c1+1
93 92
94arrayFromMatrix :: Matrix Double -> UArray (Int, Int) Double 93arrayFromMatrix :: Matrix Double -> UArray (Int, Int) Double
diff --git a/lib/Data/Packed/Internal/Common.hs b/lib/Data/Packed/Internal/Common.hs
index baeb5bc..3609bc2 100644
--- a/lib/Data/Packed/Internal/Common.hs
+++ b/lib/Data/Packed/Internal/Common.hs
@@ -22,7 +22,7 @@ import Control.Monad(when)
22import Debug.Trace 22import Debug.Trace
23import Foreign.C.String(peekCString) 23import Foreign.C.String(peekCString)
24import Foreign.C.Types 24import Foreign.C.Types
25import Foreign.Storable.Complex 25import Foreign.Storable.Complex()
26 26
27 27
28-- | @debug x = trace (show x) x@ 28-- | @debug x = trace (show x) x@
diff --git a/lib/Data/Packed/Internal/Matrix.hs b/lib/Data/Packed/Internal/Matrix.hs
index 45a3955..63f0a8d 100644
--- a/lib/Data/Packed/Internal/Matrix.hs
+++ b/lib/Data/Packed/Internal/Matrix.hs
@@ -22,10 +22,8 @@ import Data.Packed.Internal.Vector
22 22
23import Foreign hiding (xor) 23import Foreign hiding (xor)
24import Complex 24import Complex
25import Control.Monad(when)
26import Foreign.C.String 25import Foreign.C.String
27import Foreign.C.Types 26import Foreign.C.Types
28import Data.List(transpose)
29 27
30----------------------------------------------------------------- 28-----------------------------------------------------------------
31 29
diff --git a/lib/Data/Packed/ST.hs b/lib/Data/Packed/ST.hs
index ed0a05e..91b7968 100644
--- a/lib/Data/Packed/ST.hs
+++ b/lib/Data/Packed/ST.hs
@@ -30,9 +30,7 @@ module Data.Packed.ST (
30) where 30) where
31 31
32import Data.Packed.Internal 32import Data.Packed.Internal
33import Data.Array.Storable
34import Control.Monad.ST 33import Control.Monad.ST
35import Data.Array.ST
36import Foreign 34import Foreign
37 35
38{-# INLINE ioReadV #-} 36{-# INLINE ioReadV #-}
@@ -97,13 +95,13 @@ newVector v = unsafeThawVector . constant v
97 95
98{-# INLINE ioReadM #-} 96{-# INLINE ioReadM #-}
99ioReadM :: Storable t => Matrix t -> Int -> Int -> IO t 97ioReadM :: Storable t => Matrix t -> Int -> Int -> IO t
100ioReadM (MC nr nc cv) r c = ioReadV cv (r*nc+c) 98ioReadM (MC _ nc cv) r c = ioReadV cv (r*nc+c)
101ioReadM (MF nr nc fv) r c = ioReadV fv (c*nr+r) 99ioReadM (MF nr _ fv) r c = ioReadV fv (c*nr+r)
102 100
103{-# INLINE ioWriteM #-} 101{-# INLINE ioWriteM #-}
104ioWriteM :: Storable t => Matrix t -> Int -> Int -> t -> IO () 102ioWriteM :: Storable t => Matrix t -> Int -> Int -> t -> IO ()
105ioWriteM (MC nr nc cv) r c val = ioWriteV cv (r*nc+c) val 103ioWriteM (MC _ nc cv) r c val = ioWriteV cv (r*nc+c) val
106ioWriteM (MF nr nc fv) r c val = ioWriteV fv (c*nr+r) val 104ioWriteM (MF nr _ fv) r c val = ioWriteV fv (c*nr+r) val
107 105
108newtype STMatrix s t = STMatrix (Matrix t) 106newtype STMatrix s t = STMatrix (Matrix t)
109 107