[Haskell-cafe] uvector and the stream interface

stefan kersten sk at k-hornz.de
Mon Jul 14 12:17:04 EDT 2008

currently i'm working on stuff that looks something like this:

1 read soundfile from disk in blocks of N samples (IOCArray, hsndfile  
2 convert to CArray with unsafeFreeze (simple O(1) cast, carray package)
3 perform FFT (CArray, fftw package)
4 convert to UArr (uvector package)
5 do some stuff with vectors

i'd like to minimize copying, and since the FFT returns a new array  
anyway, the only copying conversion is the one between CArray and  
UArr in step 4. the approach i've been following is defining a  
`stream' conversion for CArray, hoping that subsequent carray  
accesses will be fused with uvector operations without the need for  
allocating a vector in between. does that make sense? could this be a  
general strategy for avoiding copying at the boundary between the  
various array libraries?


More information about the Haskell-Cafe mailing list