diff options
Diffstat (limited to 'lib/Numeric/GSL/Internal.hs')
-rw-r--r-- | lib/Numeric/GSL/Internal.hs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/Numeric/GSL/Internal.hs b/lib/Numeric/GSL/Internal.hs index 37bcc1b..2ccc3ef 100644 --- a/lib/Numeric/GSL/Internal.hs +++ b/lib/Numeric/GSL/Internal.hs | |||
@@ -35,12 +35,12 @@ foreign import ccall "wrapper" | |||
35 | 35 | ||
36 | aux_vTov :: (Vector Double -> Vector Double) -> TVV | 36 | aux_vTov :: (Vector Double -> Vector Double) -> TVV |
37 | aux_vTov f n p nr r = g where | 37 | aux_vTov f n p nr r = g where |
38 | V {fptr = pr} = f x | 38 | v = f x |
39 | x = createV (fromIntegral n) copy "aux_vTov" | 39 | x = createV (fromIntegral n) copy "aux_vTov" |
40 | copy n' q = do | 40 | copy n' q = do |
41 | copyArray q p (fromIntegral n') | 41 | copyArray q p (fromIntegral n') |
42 | return 0 | 42 | return 0 |
43 | g = do withForeignPtr pr $ \p' -> copyArray r p' (fromIntegral nr) | 43 | g = do unsafeWith v $ \p' -> copyArray r p' (fromIntegral nr) |
44 | return 0 | 44 | return 0 |
45 | 45 | ||
46 | foreign import ccall "wrapper" | 46 | foreign import ccall "wrapper" |
@@ -51,12 +51,12 @@ foreign import ccall "wrapper" | |||
51 | 51 | ||
52 | aux_vTom :: (Vector Double -> Matrix Double) -> TVM | 52 | aux_vTom :: (Vector Double -> Matrix Double) -> TVM |
53 | aux_vTom f n p rr cr r = g where | 53 | aux_vTom f n p rr cr r = g where |
54 | V {fptr = pr} = flatten $ f x | 54 | v = flatten $ f x |
55 | x = createV (fromIntegral n) copy "aux_vTov" | 55 | x = createV (fromIntegral n) copy "aux_vTov" |
56 | copy n' q = do | 56 | copy n' q = do |
57 | copyArray q p (fromIntegral n') | 57 | copyArray q p (fromIntegral n') |
58 | return 0 | 58 | return 0 |
59 | g = do withForeignPtr pr $ \p' -> copyArray r p' (fromIntegral $ rr*cr) | 59 | g = do unsafeWith v $ \p' -> copyArray r p' (fromIntegral $ rr*cr) |
60 | return 0 | 60 | return 0 |
61 | 61 | ||
62 | createV n fun msg = unsafePerformIO $ do | 62 | createV n fun msg = unsafePerformIO $ do |