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 6d39c6e..dfa2e86 100644 --- a/lib/Data/Packed/Internal/Vector.hs +++ b/lib/Data/Packed/Internal/Vector.hs | |||
@@ -266,13 +266,13 @@ takesV ms w | sum ms > dim w = error $ "takesV " ++ show ms ++ " on dim = " ++ ( | |||
266 | --------------------------------------------------------------- | 266 | --------------------------------------------------------------- |
267 | 267 | ||
268 | -- | transforms a complex vector into a real vector with alternating real and imaginary parts | 268 | -- | transforms a complex vector into a real vector with alternating real and imaginary parts |
269 | asReal :: Vector (Complex a) -> Vector a | 269 | asReal :: (RealFloat a, Storable a) => Vector (Complex a) -> Vector a |
270 | --asReal v = V { ioff = 2*ioff v, idim = 2*dim v, fptr = castForeignPtr (fptr v) } | 270 | --asReal v = V { ioff = 2*ioff v, idim = 2*dim v, fptr = castForeignPtr (fptr v) } |
271 | asReal v = unsafeFromForeignPtr (castForeignPtr fp) (2*i) (2*n) | 271 | asReal v = unsafeFromForeignPtr (castForeignPtr fp) (2*i) (2*n) |
272 | where (fp,i,n) = unsafeToForeignPtr v | 272 | where (fp,i,n) = unsafeToForeignPtr v |
273 | 273 | ||
274 | -- | transforms a real vector into a complex vector with alternating real and imaginary parts | 274 | -- | transforms a real vector into a complex vector with alternating real and imaginary parts |
275 | asComplex :: Vector a -> Vector (Complex a) | 275 | asComplex :: (RealFloat a, Storable a) => Vector a -> Vector (Complex a) |
276 | --asComplex v = V { ioff = ioff v `div` 2, idim = dim v `div` 2, fptr = castForeignPtr (fptr v) } | 276 | --asComplex v = V { ioff = ioff v `div` 2, idim = dim v `div` 2, fptr = castForeignPtr (fptr v) } |
277 | asComplex v = unsafeFromForeignPtr (castForeignPtr fp) (i `div` 2) (n `div` 2) | 277 | asComplex v = unsafeFromForeignPtr (castForeignPtr fp) (i `div` 2) (n `div` 2) |
278 | where (fp,i,n) = unsafeToForeignPtr v | 278 | where (fp,i,n) = unsafeToForeignPtr v |