diff options
author | Vivian McPhail <haskell.vivian.mcphail@gmail.com> | 2010-06-29 09:03:19 +0000 |
---|---|---|
committer | Vivian McPhail <haskell.vivian.mcphail@gmail.com> | 2010-06-29 09:03:19 +0000 |
commit | 4957cff8af91cbb23c12382e25f5373fe96acb95 (patch) | |
tree | 2f2968d5ca88f7d76e208982b8938c4dfc46ce8a /lib/Data/Packed/Internal/Vector.hs | |
parent | d18a86d37d55a39d4ec9b16397dd59f35aa13688 (diff) |
add-vector-float
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 |