summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hmatrix.cabal2
-rw-r--r--lib/Data/Packed/Internal/Matrix.hs18
2 files changed, 9 insertions, 11 deletions
diff --git a/hmatrix.cabal b/hmatrix.cabal
index 638358b..466711a 100644
--- a/hmatrix.cabal
+++ b/hmatrix.cabal
@@ -1,5 +1,5 @@
1Name: hmatrix 1Name: hmatrix
2Version: 0.5.0.1 2Version: 0.5.1.0
3License: GPL 3License: GPL
4License-file: LICENSE 4License-file: LICENSE
5Author: Alberto Ruiz 5Author: Alberto Ruiz
diff --git a/lib/Data/Packed/Internal/Matrix.hs b/lib/Data/Packed/Internal/Matrix.hs
index a32a782..9def473 100644
--- a/lib/Data/Packed/Internal/Matrix.hs
+++ b/lib/Data/Packed/Internal/Matrix.hs
@@ -234,21 +234,19 @@ transdata' c1 v c2 =
234 then v 234 then v
235 else unsafePerformIO $ do 235 else unsafePerformIO $ do
236 w <- createVector (r2*c2) 236 w <- createVector (r2*c2)
237 let p = unsafeForeignPtrToPtr (fptr v) 237 withForeignPtr (fptr v) $ \p ->
238 q = unsafeForeignPtrToPtr (fptr w) 238 withForeignPtr (fptr w) $ \q -> do
239 go (-1) _ = return () 239 let go (-1) _ = return ()
240 go !i (-1) = go (i-1) (c1-1) 240 go !i (-1) = go (i-1) (c1-1)
241 go !i !j = do x <- peekElemOff p (i*c1+j) 241 go !i !j = do x <- peekElemOff p (i*c1+j)
242 pokeElemOff q (j*c2+i) x 242 pokeElemOff q (j*c2+i) x
243 go i (j-1) 243 go i (j-1)
244 go (r1-1) (c1-1) 244 go (r1-1) (c1-1)
245 touchForeignPtr (fptr w)
246 return w 245 return w
247 where r1 = dim v `div` c1 246 where r1 = dim v `div` c1
248 r2 = dim v `div` c2 247 r2 = dim v `div` c2
249 noneed = r1 == 1 || c1 == 1 248 noneed = r1 == 1 || c1 == 1
250 249
251
252-- {-# SPECIALIZE transdata' :: Int -> Vector Double -> Int -> Vector Double #-} 250-- {-# SPECIALIZE transdata' :: Int -> Vector Double -> Int -> Vector Double #-}
253-- {-# SPECIALIZE transdata' :: Int -> Vector (Complex Double) -> Int -> Vector (Complex Double) #-} 251-- {-# SPECIALIZE transdata' :: Int -> Vector (Complex Double) -> Int -> Vector (Complex Double) #-}
254 252