diff options
author | Vivian McPhail <haskell.vivian.mcphail@gmail.com> | 2010-09-20 03:48:46 +0000 |
---|---|---|
committer | Vivian McPhail <haskell.vivian.mcphail@gmail.com> | 2010-09-20 03:48:46 +0000 |
commit | 482b533c3fbfcd75d6c5c1d3ce32585bf9fc2ad7 (patch) | |
tree | 82f284eeb1cf03fd4514960b848d38e5af94e709 /lib/Data | |
parent | 503f598801b67886028d9ffdfdef38813954e46f (diff) |
remove Fractional from Element
Diffstat (limited to 'lib/Data')
-rw-r--r-- | lib/Data/Packed/Internal/Matrix.hs | 3 | ||||
-rw-r--r-- | lib/Data/Packed/Matrix.hs | 4 |
2 files changed, 4 insertions, 3 deletions
diff --git a/lib/Data/Packed/Internal/Matrix.hs b/lib/Data/Packed/Internal/Matrix.hs index 090826d..c0824a3 100644 --- a/lib/Data/Packed/Internal/Matrix.hs +++ b/lib/Data/Packed/Internal/Matrix.hs | |||
@@ -246,7 +246,8 @@ compat m1 m2 = rows m1 == rows m2 && cols m1 == cols m2 | |||
246 | ------------------------------------------------------------------ | 246 | ------------------------------------------------------------------ |
247 | 247 | ||
248 | -- | Supported element types for basic matrix operations. | 248 | -- | Supported element types for basic matrix operations. |
249 | class (Storable a, Floating a) => Element a where | 249 | --class (Storable a, Floating a) => Element a where |
250 | class (Storable a) => Element a where | ||
250 | subMatrixD :: (Int,Int) -- ^ (r0,c0) starting position | 251 | subMatrixD :: (Int,Int) -- ^ (r0,c0) starting position |
251 | -> (Int,Int) -- ^ (rt,ct) dimensions of submatrix | 252 | -> (Int,Int) -- ^ (rt,ct) dimensions of submatrix |
252 | -> Matrix a -> Matrix a | 253 | -> Matrix a -> Matrix a |
diff --git a/lib/Data/Packed/Matrix.hs b/lib/Data/Packed/Matrix.hs index 0fc7876..b8c309c 100644 --- a/lib/Data/Packed/Matrix.hs +++ b/lib/Data/Packed/Matrix.hs | |||
@@ -170,7 +170,7 @@ fliprl m = fromColumns . reverse . toColumns $ m | |||
170 | ------------------------------------------------------------ | 170 | ------------------------------------------------------------ |
171 | 171 | ||
172 | -- | Creates a square matrix with a given diagonal. | 172 | -- | Creates a square matrix with a given diagonal. |
173 | diag :: Element a => Vector a -> Matrix a | 173 | diag :: (Num a, Element a) => Vector a -> Matrix a |
174 | diag v = ST.runSTMatrix $ do | 174 | diag v = ST.runSTMatrix $ do |
175 | let d = dim v | 175 | let d = dim v |
176 | m <- ST.newMatrix 0 d d | 176 | m <- ST.newMatrix 0 d d |
@@ -199,7 +199,7 @@ takeDiag :: (Element t) => Matrix t -> Vector t | |||
199 | takeDiag m = fromList [flatten m `at` (k*cols m+k) | k <- [0 .. min (rows m) (cols m) -1]] | 199 | takeDiag m = fromList [flatten m `at` (k*cols m+k) | k <- [0 .. min (rows m) (cols m) -1]] |
200 | 200 | ||
201 | -- | creates the identity matrix of given dimension | 201 | -- | creates the identity matrix of given dimension |
202 | ident :: Element a => Int -> Matrix a | 202 | ident :: (Num a, Element a) => Int -> Matrix a |
203 | ident n = diag (constantD 1 n) | 203 | ident n = diag (constantD 1 n) |
204 | 204 | ||
205 | ------------------------------------------------------------ | 205 | ------------------------------------------------------------ |