diff options
Diffstat (limited to 'packages/base/src/Data/Packed/Internal/Vector.hs')
-rw-r--r-- | packages/base/src/Data/Packed/Internal/Vector.hs | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/packages/base/src/Data/Packed/Internal/Vector.hs b/packages/base/src/Data/Packed/Internal/Vector.hs index 2a6ed2c..7b0df64 100644 --- a/packages/base/src/Data/Packed/Internal/Vector.hs +++ b/packages/base/src/Data/Packed/Internal/Vector.hs | |||
@@ -19,13 +19,13 @@ module Data.Packed.Internal.Vector ( | |||
19 | foldVector, foldVectorG, foldLoop, foldVectorWithIndex, | 19 | foldVector, foldVectorG, foldLoop, foldVectorWithIndex, |
20 | createVector, vec, | 20 | createVector, vec, |
21 | asComplex, asReal, float2DoubleV, double2FloatV, | 21 | asComplex, asReal, float2DoubleV, double2FloatV, |
22 | stepF, stepD, condF, condD, | 22 | stepF, stepD, stepI, condF, condD, condI, |
23 | conjugateQ, conjugateC, | 23 | conjugateQ, conjugateC, |
24 | cloneVector, | 24 | cloneVector, |
25 | unsafeToForeignPtr, | 25 | unsafeToForeignPtr, |
26 | unsafeFromForeignPtr, | 26 | unsafeFromForeignPtr, |
27 | unsafeWith, | 27 | unsafeWith, |
28 | Idxs | 28 | CInt,Idxs |
29 | ) where | 29 | ) where |
30 | 30 | ||
31 | import Data.Packed.Internal.Common | 31 | import Data.Packed.Internal.Common |
@@ -249,37 +249,45 @@ foreign import ccall unsafe "double2float" c_double2float:: TVF | |||
249 | 249 | ||
250 | --------------------------------------------------------------- | 250 | --------------------------------------------------------------- |
251 | 251 | ||
252 | stepF :: Vector Float -> Vector Float | 252 | step f v = unsafePerformIO $ do |
253 | stepF v = unsafePerformIO $ do | ||
254 | r <- createVector (dim v) | 253 | r <- createVector (dim v) |
255 | app2 c_stepF vec v vec r "stepF" | 254 | app2 f vec v vec r "step" |
256 | return r | 255 | return r |
257 | 256 | ||
258 | stepD :: Vector Double -> Vector Double | 257 | stepD :: Vector Double -> Vector Double |
259 | stepD v = unsafePerformIO $ do | 258 | stepD = step c_stepD |
260 | r <- createVector (dim v) | 259 | |
261 | app2 c_stepD vec v vec r "stepD" | 260 | stepF :: Vector Float -> Vector Float |
262 | return r | 261 | stepF = step c_stepF |
262 | |||
263 | stepI :: Vector CInt -> Vector CInt | ||
264 | stepI = step c_stepI | ||
263 | 265 | ||
264 | foreign import ccall unsafe "stepF" c_stepF :: TFF | 266 | foreign import ccall unsafe "stepF" c_stepF :: TFF |
265 | foreign import ccall unsafe "stepD" c_stepD :: TVV | 267 | foreign import ccall unsafe "stepD" c_stepD :: TVV |
268 | foreign import ccall unsafe "stepI" c_stepI :: CV CInt (CV CInt (IO CInt)) | ||
266 | 269 | ||
267 | --------------------------------------------------------------- | 270 | --------------------------------------------------------------- |
268 | 271 | ||
269 | condF :: Vector Float -> Vector Float -> Vector Float -> Vector Float -> Vector Float -> Vector Float | 272 | condF :: Vector Float -> Vector Float -> Vector Float -> Vector Float -> Vector Float -> Vector Float |
270 | condF x y l e g = unsafePerformIO $ do | 273 | condF = condg c_condF |
271 | r <- createVector (dim x) | ||
272 | app6 c_condF vec x vec y vec l vec e vec g vec r "condF" | ||
273 | return r | ||
274 | 274 | ||
275 | condD :: Vector Double -> Vector Double -> Vector Double -> Vector Double -> Vector Double -> Vector Double | 275 | condD :: Vector Double -> Vector Double -> Vector Double -> Vector Double -> Vector Double -> Vector Double |
276 | condD x y l e g = unsafePerformIO $ do | 276 | condD = condg c_condD |
277 | |||
278 | condI :: Vector CInt -> Vector CInt -> Vector CInt -> Vector CInt -> Vector CInt -> Vector CInt | ||
279 | condI = condg c_condI | ||
280 | |||
281 | |||
282 | condg f x y l e g = unsafePerformIO $ do | ||
277 | r <- createVector (dim x) | 283 | r <- createVector (dim x) |
278 | app6 c_condD vec x vec y vec l vec e vec g vec r "condD" | 284 | app6 f vec x vec y vec l vec e vec g vec r "cond" |
279 | return r | 285 | return r |
280 | 286 | ||
287 | |||
281 | foreign import ccall unsafe "condF" c_condF :: CInt -> PF -> CInt -> PF -> CInt -> PF -> TFFF | 288 | foreign import ccall unsafe "condF" c_condF :: CInt -> PF -> CInt -> PF -> CInt -> PF -> TFFF |
282 | foreign import ccall unsafe "condD" c_condD :: CInt -> PD -> CInt -> PD -> CInt -> PD -> TVVV | 289 | foreign import ccall unsafe "condD" c_condD :: CInt -> PD -> CInt -> PD -> CInt -> PD -> TVVV |
290 | foreign import ccall unsafe "condI" c_condI :: CV CInt (CV CInt (CV CInt (CV CInt (CV CInt (CV CInt (IO CInt)))))) | ||
283 | 291 | ||
284 | -------------------------------------------------------------------------------- | 292 | -------------------------------------------------------------------------------- |
285 | 293 | ||