summaryrefslogtreecommitdiff
path: root/lib/Data/Packed/Internal/Matrix.hs
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2012-01-07 18:51:20 +0100
committerAlberto Ruiz <aruiz@um.es>2012-01-07 18:51:20 +0100
commit776f4b9fbda8eeec006b24ed5f1548be752eae3c (patch)
treecfafa35ecc9bcb5562b3cd648e98c20d4fceaa58 /lib/Data/Packed/Internal/Matrix.hs
parent97e7156b59811bd51d0a9d6060e868eafedfcc75 (diff)
remove warnings
Diffstat (limited to 'lib/Data/Packed/Internal/Matrix.hs')
-rw-r--r--lib/Data/Packed/Internal/Matrix.hs10
1 files changed, 3 insertions, 7 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
182infixl 9 @@> 182infixl 9 @@>
183--m@M {rows = r, cols = c} @@> (i,j) 183m@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
187m@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
207createMatrix :: (Storable a) => MatrixOrder -> Int -> Int -> IO (Matrix a) 203createMatrix :: (Storable a) => MatrixOrder -> Int -> Int -> IO (Matrix a)
208createMatrix order r c = do 204createMatrix 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@
213where r is the desired number of rows.) 209where r is the desired number of rows.)