diff options
author | Alberto Ruiz <aruiz@um.es> | 2007-06-22 10:21:15 +0000 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2007-06-22 10:21:15 +0000 |
commit | 989bdf7e88c13500bd1986dcde36f6cc4f467efb (patch) | |
tree | b30ff0dd52e2b6c2adb1dfe8759d03234f65c684 /lib/Data/Packed/Internal/Matrix.hs | |
parent | aa14e6615533e7bd5e2b15acdc3ec76afbe1aac4 (diff) |
reverting to the old signatures for aux C functions
Diffstat (limited to 'lib/Data/Packed/Internal/Matrix.hs')
-rw-r--r-- | lib/Data/Packed/Internal/Matrix.hs | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/lib/Data/Packed/Internal/Matrix.hs b/lib/Data/Packed/Internal/Matrix.hs index fccf8bb..2925fc0 100644 --- a/lib/Data/Packed/Internal/Matrix.hs +++ b/lib/Data/Packed/Internal/Matrix.hs | |||
@@ -50,8 +50,9 @@ trans m = m { rows = cols m | |||
50 | } | 50 | } |
51 | 51 | ||
52 | type Mt t s = Int -> Int -> Ptr t -> s | 52 | type Mt t s = Int -> Int -> Ptr t -> s |
53 | infixr 6 ::> | 53 | -- not yet admitted by my haddock version |
54 | type t ::> s = Mt t s | 54 | -- infixr 6 ::> |
55 | -- type t ::> s = Mt t s | ||
55 | 56 | ||
56 | mat d m f = f (rows m) (cols m) (ptr (d m)) | 57 | mat d m f = f (rows m) (cols m) (ptr (d m)) |
57 | 58 | ||
@@ -117,9 +118,9 @@ transdataAux fun c1 d c2 = | |||
117 | noneed = r1 == 1 || c1 == 1 | 118 | noneed = r1 == 1 || c1 == 1 |
118 | 119 | ||
119 | foreign import ccall safe "aux.h transR" | 120 | foreign import ccall safe "aux.h transR" |
120 | ctransR :: Double ::> Double ::> IO Int | 121 | ctransR :: TMM -- Double ::> Double ::> IO Int |
121 | foreign import ccall safe "aux.h transC" | 122 | foreign import ccall safe "aux.h transC" |
122 | ctransC :: Complex Double ::> Complex Double ::> IO Int | 123 | ctransC :: TCMCM -- Complex Double ::> Complex Double ::> IO Int |
123 | 124 | ||
124 | transdata :: Field a => Int -> Vector a -> Int -> Vector a | 125 | transdata :: Field a => Int -> Vector a -> Int -> Vector a |
125 | transdata c1 d c2 | isReal baseOf d = scast $ transdataR c1 (scast d) c2 | 126 | transdata c1 d c2 | isReal baseOf d = scast $ transdataR c1 (scast d) c2 |
@@ -170,10 +171,16 @@ multiplyAux order fun a b = unsafePerformIO $ do | |||
170 | return r | 171 | return r |
171 | 172 | ||
172 | foreign import ccall safe "aux.h multiplyR" | 173 | foreign import ccall safe "aux.h multiplyR" |
173 | cmultiplyR :: Int -> Double ::> (Int -> Double ::> (Double ::> IO Int)) | 174 | cmultiplyR :: Int -> Int -> Int -> Ptr Double |
175 | -> Int -> Int -> Int -> Ptr Double | ||
176 | -> Int -> Int -> Ptr Double | ||
177 | -> IO Int | ||
174 | 178 | ||
175 | foreign import ccall safe "aux.h multiplyC" | 179 | foreign import ccall safe "aux.h multiplyC" |
176 | cmultiplyC :: Int -> Complex Double ::> (Int -> Complex Double ::> (Complex Double ::> IO Int)) | 180 | cmultiplyC :: Int -> Int -> Int -> Ptr (Complex Double) |
181 | -> Int -> Int -> Int -> Ptr (Complex Double) | ||
182 | -> Int -> Int -> Ptr (Complex Double) | ||
183 | -> IO Int | ||
177 | 184 | ||
178 | multiply :: (Num a, Field a) => MatrixOrder -> Matrix a -> Matrix a -> Matrix a | 185 | multiply :: (Num a, Field a) => MatrixOrder -> Matrix a -> Matrix a -> Matrix a |
179 | multiply RowMajor a b = multiplyD RowMajor a b | 186 | multiply RowMajor a b = multiplyD RowMajor a b |
@@ -206,7 +213,7 @@ subMatrixR (r0,c0) (rt,ct) x = unsafePerformIO $ do | |||
206 | c_submatrixR r0 (r0+rt-1) c0 (c0+ct-1) // mat cdat x // mat cdat r // check "subMatrixR" [dat r] | 213 | c_submatrixR r0 (r0+rt-1) c0 (c0+ct-1) // mat cdat x // mat cdat r // check "subMatrixR" [dat r] |
207 | return r | 214 | return r |
208 | foreign import ccall "aux.h submatrixR" | 215 | foreign import ccall "aux.h submatrixR" |
209 | c_submatrixR :: Int -> Int -> Int -> Int -> Double ::> Double ::> IO Int | 216 | c_submatrixR :: Int -> Int -> Int -> Int -> TMM |
210 | 217 | ||
211 | -- | extraction of a submatrix of a complex matrix | 218 | -- | extraction of a submatrix of a complex matrix |
212 | subMatrixC :: (Int,Int) -- ^ (r0,c0) starting position | 219 | subMatrixC :: (Int,Int) -- ^ (r0,c0) starting position |
@@ -239,12 +246,12 @@ diagAux fun msg (v@V {dim = n}) = unsafePerformIO $ do | |||
239 | -- | diagonal matrix from a real vector | 246 | -- | diagonal matrix from a real vector |
240 | diagR :: Vector Double -> Matrix Double | 247 | diagR :: Vector Double -> Matrix Double |
241 | diagR = diagAux c_diagR "diagR" | 248 | diagR = diagAux c_diagR "diagR" |
242 | foreign import ccall "aux.h diagR" c_diagR :: Double :> Double ::> IO Int | 249 | foreign import ccall "aux.h diagR" c_diagR :: TVM |
243 | 250 | ||
244 | -- | diagonal matrix from a real vector | 251 | -- | diagonal matrix from a real vector |
245 | diagC :: Vector (Complex Double) -> Matrix (Complex Double) | 252 | diagC :: Vector (Complex Double) -> Matrix (Complex Double) |
246 | diagC = diagAux c_diagC "diagC" | 253 | diagC = diagAux c_diagC "diagC" |
247 | foreign import ccall "aux.h diagC" c_diagC :: (Complex Double) :> (Complex Double) ::> IO Int | 254 | foreign import ccall "aux.h diagC" c_diagC :: TCVCM |
248 | 255 | ||
249 | -- | diagonal matrix from a vector | 256 | -- | diagonal matrix from a vector |
250 | diag :: (Num a, Field a) => Vector a -> Matrix a | 257 | diag :: (Num a, Field a) => Vector a -> Matrix a |