
On Tue, 12 May 2015 11:19:48 -0400
Leza Morais Lutonda
On 05/11/2015 11:50 PM, briand@aracnet.com wrote:
FFTWReal maps to RealFloat which i found, but i haven't found anything that will take a RealFloat and give me a Double. Double` is `RealFloat`, so it is `Fractional`. Every FFTWReal is a `Real` too, so you can use realToFrac to map from FFTWReal to Double:
fftwRealToDouble :: FFTWReal r => r -> Double fftwRealToDouble = realToFrac
Regards.
Well what I was _really_ trying to do was to get to a Vector of (Complex Double). Interestingly, the following, where ys is type Vector.Storable (Complex Double), ys_array = listArray (0, V.length ys -1) (V.toList ys) y = V.fromList $ map (\z -> realPart z :+ imagPart z) (elems (dft ys_array)) worked just fine, but it's not obvious to me that it should have. Seems like the realPart/imagPart should have failed to work because the argument is not Complex Double it's Complex FFTWReal, so I should have ended up with (Complex FFTWReal) when I really wanted (Complex Double) and fail. BTW, it seems to me that it would be awfully nice if FFT delivered results as Vectors instead of the Array thingy. It looked to me like V.Storable is something which is supposed to ease the marshalling to and from the C world. Would it be a whole lot of work to change the interface to Vector.Storable ? Among other advantages, it makes interfacing to HMatrix easier. Thanks, Brian