diff options
author | Alberto Ruiz <aruiz@um.es> | 2012-01-07 18:51:20 +0100 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2012-01-07 18:51:20 +0100 |
commit | 776f4b9fbda8eeec006b24ed5f1548be752eae3c (patch) | |
tree | cfafa35ecc9bcb5562b3cd648e98c20d4fceaa58 /lib | |
parent | 97e7156b59811bd51d0a9d6060e868eafedfcc75 (diff) |
remove warnings
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Data/Packed/Internal/Matrix.hs | 10 | ||||
-rw-r--r-- | lib/Data/Packed/ST.hs | 2 |
2 files changed, 4 insertions, 8 deletions
diff --git a/lib/Data/Packed/Internal/Matrix.hs b/lib/Data/Packed/Internal/Matrix.hs index 28bebbc..257e4fc 100644 --- a/lib/Data/Packed/Internal/Matrix.hs +++ b/lib/Data/Packed/Internal/Matrix.hs | |||
@@ -180,11 +180,7 @@ toColumns m = toRows . trans $ m | |||
180 | -- | Reads a matrix position. | 180 | -- | Reads a matrix position. |
181 | (@@>) :: Storable t => Matrix t -> (Int,Int) -> t | 181 | (@@>) :: Storable t => Matrix t -> (Int,Int) -> t |
182 | infixl 9 @@> | 182 | infixl 9 @@> |
183 | --m@M {rows = r, cols = c} @@> (i,j) | 183 | m@Matrix {irows = r, icols = c} @@> (i,j) |
184 | -- | i<0 || i>=r || j<0 || j>=c = error "matrix indexing out of range" | ||
185 | -- | otherwise = cdat m `at` (i*c+j) | ||
186 | |||
187 | m@Matrix {irows = r, icols = c, xdat = v, order = o} @@> (i,j) | ||
188 | | safe = if i<0 || i>=r || j<0 || j>=c | 184 | | safe = if i<0 || i>=r || j<0 || j>=c |
189 | then error "matrix indexing out of range" | 185 | then error "matrix indexing out of range" |
190 | else atM' m i j | 186 | else atM' m i j |
@@ -205,9 +201,9 @@ matrixFromVector o c v = Matrix { irows = r, icols = c, xdat = v, order = o } | |||
205 | 201 | ||
206 | -- allocates memory for a new matrix | 202 | -- allocates memory for a new matrix |
207 | createMatrix :: (Storable a) => MatrixOrder -> Int -> Int -> IO (Matrix a) | 203 | createMatrix :: (Storable a) => MatrixOrder -> Int -> Int -> IO (Matrix a) |
208 | createMatrix order r c = do | 204 | createMatrix ord r c = do |
209 | p <- createVector (r*c) | 205 | p <- createVector (r*c) |
210 | return (matrixFromVector order c p) | 206 | return (matrixFromVector ord c p) |
211 | 207 | ||
212 | {- | Creates a matrix from a vector by grouping the elements in rows with the desired number of columns. (GNU-Octave groups by columns. To do it you can define @reshapeF r = trans . reshape r@ | 208 | {- | Creates a matrix from a vector by grouping the elements in rows with the desired number of columns. (GNU-Octave groups by columns. To do it you can define @reshapeF r = trans . reshape r@ |
213 | where r is the desired number of rows.) | 209 | where r is the desired number of rows.) |
diff --git a/lib/Data/Packed/ST.hs b/lib/Data/Packed/ST.hs index c96a209..c1e7aef 100644 --- a/lib/Data/Packed/ST.hs +++ b/lib/Data/Packed/ST.hs | |||
@@ -171,7 +171,7 @@ writeMatrix :: Storable t => STMatrix s t -> Int -> Int -> t -> ST s () | |||
171 | writeMatrix = safeIndexM unsafeWriteMatrix | 171 | writeMatrix = safeIndexM unsafeWriteMatrix |
172 | 172 | ||
173 | newUndefinedMatrix :: Storable t => MatrixOrder -> Int -> Int -> ST s (STMatrix s t) | 173 | newUndefinedMatrix :: Storable t => MatrixOrder -> Int -> Int -> ST s (STMatrix s t) |
174 | newUndefinedMatrix order r c = unsafeIOToST $ fmap STMatrix $ createMatrix order r c | 174 | newUndefinedMatrix ord r c = unsafeIOToST $ fmap STMatrix $ createMatrix ord r c |
175 | 175 | ||
176 | {-# NOINLINE newMatrix #-} | 176 | {-# NOINLINE newMatrix #-} |
177 | newMatrix :: Storable t => t -> Int -> Int -> ST s (STMatrix s t) | 177 | newMatrix :: Storable t => t -> Int -> Int -> ST s (STMatrix s t) |