diff options
Diffstat (limited to 'lib/Data/Packed/Internal/Vector.hs')
-rw-r--r-- | lib/Data/Packed/Internal/Vector.hs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Data/Packed/Internal/Vector.hs b/lib/Data/Packed/Internal/Vector.hs index a6868d9..d97a86d 100644 --- a/lib/Data/Packed/Internal/Vector.hs +++ b/lib/Data/Packed/Internal/Vector.hs | |||
@@ -264,13 +264,13 @@ takesV ms w | sum ms > dim w = error $ "takesV " ++ show ms ++ " on dim = " ++ ( | |||
264 | --------------------------------------------------------------- | 264 | --------------------------------------------------------------- |
265 | 265 | ||
266 | -- | transforms a complex vector into a real vector with alternating real and imaginary parts | 266 | -- | transforms a complex vector into a real vector with alternating real and imaginary parts |
267 | asReal :: Vector (Complex Double) -> Vector Double | 267 | asReal :: Vector (Complex a) -> Vector a |
268 | --asReal v = V { ioff = 2*ioff v, idim = 2*dim v, fptr = castForeignPtr (fptr v) } | 268 | --asReal v = V { ioff = 2*ioff v, idim = 2*dim v, fptr = castForeignPtr (fptr v) } |
269 | asReal v = unsafeFromForeignPtr (castForeignPtr fp) (2*i) (2*n) | 269 | asReal v = unsafeFromForeignPtr (castForeignPtr fp) (2*i) (2*n) |
270 | where (fp,i,n) = unsafeToForeignPtr v | 270 | where (fp,i,n) = unsafeToForeignPtr v |
271 | 271 | ||
272 | -- | transforms a real vector into a complex vector with alternating real and imaginary parts | 272 | -- | transforms a real vector into a complex vector with alternating real and imaginary parts |
273 | asComplex :: Vector Double -> Vector (Complex Double) | 273 | asComplex :: Vector a -> Vector (Complex a) |
274 | --asComplex v = V { ioff = ioff v `div` 2, idim = dim v `div` 2, fptr = castForeignPtr (fptr v) } | 274 | --asComplex v = V { ioff = ioff v `div` 2, idim = dim v `div` 2, fptr = castForeignPtr (fptr v) } |
275 | asComplex v = unsafeFromForeignPtr (castForeignPtr fp) (i `div` 2) (n `div` 2) | 275 | asComplex v = unsafeFromForeignPtr (castForeignPtr fp) (i `div` 2) (n `div` 2) |
276 | where (fp,i,n) = unsafeToForeignPtr v | 276 | where (fp,i,n) = unsafeToForeignPtr v |