diff options
Diffstat (limited to 'lib/Data')
-rw-r--r-- | lib/Data/Packed/Internal/Vector.hs | 11 | ||||
-rw-r--r-- | lib/Data/Packed/Vector.hs | 2 |
2 files changed, 7 insertions, 6 deletions
diff --git a/lib/Data/Packed/Internal/Vector.hs b/lib/Data/Packed/Internal/Vector.hs index c73ef10..7dd1289 100644 --- a/lib/Data/Packed/Internal/Vector.hs +++ b/lib/Data/Packed/Internal/Vector.hs | |||
@@ -322,8 +322,8 @@ zipVector f u v = unsafePerformIO $ do | |||
322 | 322 | ||
323 | -- | unzipWith for Vectors | 323 | -- | unzipWith for Vectors |
324 | unzipVectorWith :: (Storable (a,b), Storable c, Storable d) | 324 | unzipVectorWith :: (Storable (a,b), Storable c, Storable d) |
325 | => (a -> c) -> (b -> d) -> Vector (a,b) -> (Vector c,Vector d) | 325 | => ((a,b) -> (c,d)) -> Vector (a,b) -> (Vector c,Vector d) |
326 | unzipVectorWith f g u = unsafePerformIO $ do | 326 | unzipVectorWith f u = unsafePerformIO $ do |
327 | let n = dim u | 327 | let n = dim u |
328 | v <- createVector n | 328 | v <- createVector n |
329 | w <- createVector n | 329 | w <- createVector n |
@@ -331,9 +331,10 @@ unzipVectorWith f g u = unsafePerformIO $ do | |||
331 | unsafeWith v $ \pv -> | 331 | unsafeWith v $ \pv -> |
332 | unsafeWith w $ \pw -> do | 332 | unsafeWith w $ \pw -> do |
333 | let go (-1) = return () | 333 | let go (-1) = return () |
334 | go !k = do (x,y) <- peekElemOff pu k | 334 | go !k = do z <- peekElemOff pu k |
335 | pokeElemOff pv k (f x) | 335 | let (x,y) = f z |
336 | pokeElemOff pw k (g y) | 336 | pokeElemOff pv k x |
337 | pokeElemOff pw k y | ||
337 | go (k-1) | 338 | go (k-1) |
338 | go (n-1) | 339 | go (n-1) |
339 | return (v,w) | 340 | return (v,w) |
diff --git a/lib/Data/Packed/Vector.hs b/lib/Data/Packed/Vector.hs index 760f724..40dd6b5 100644 --- a/lib/Data/Packed/Vector.hs +++ b/lib/Data/Packed/Vector.hs | |||
@@ -152,6 +152,6 @@ vecdisp f v | |||
152 | 152 | ||
153 | -- | unzip for Vectors | 153 | -- | unzip for Vectors |
154 | unzipVector :: (Storable a, Storable b, Storable (a,b)) => Vector (a,b) -> (Vector a,Vector b) | 154 | unzipVector :: (Storable a, Storable b, Storable (a,b)) => Vector (a,b) -> (Vector a,Vector b) |
155 | unzipVector = unzipVectorWith id id | 155 | unzipVector = unzipVectorWith id |
156 | 156 | ||
157 | 157 | ||