summaryrefslogtreecommitdiff
path: root/lib/Numeric/GSL/Internal.hs
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2010-03-01 11:15:22 +0000
committerAlberto Ruiz <aruiz@um.es>2010-03-01 11:15:22 +0000
commit283f3033f86fabde2290bb28a59e7d87fd0754f5 (patch)
treeac9000c976a805636b557b916af9e139922df70c /lib/Numeric/GSL/Internal.hs
parent54bcc1fc1e0f9676cb10f627f412eeeea34b5d2c (diff)
compatible with vector
Diffstat (limited to 'lib/Numeric/GSL/Internal.hs')
-rw-r--r--lib/Numeric/GSL/Internal.hs8
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
36aux_vTov :: (Vector Double -> Vector Double) -> TVV 36aux_vTov :: (Vector Double -> Vector Double) -> TVV
37aux_vTov f n p nr r = g where 37aux_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
46foreign import ccall "wrapper" 46foreign import ccall "wrapper"
@@ -51,12 +51,12 @@ foreign import ccall "wrapper"
51 51
52aux_vTom :: (Vector Double -> Matrix Double) -> TVM 52aux_vTom :: (Vector Double -> Matrix Double) -> TVM
53aux_vTom f n p rr cr r = g where 53aux_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
62createV n fun msg = unsafePerformIO $ do 62createV n fun msg = unsafePerformIO $ do