Re: [Haskell-cafe] Convolution

2008-11-09 Thread Andrew Coppin
Andrew Coppin wrote: Assuming DPH ever becomes a reality, how would you implement the above with it? It seems I'm late to the party - the latest release of GHC claims to include DHP! o_O OTOH, I can't lay my hands on any documentation, so...? (The DPH wiki page was last updated in August

[Haskell-cafe] Convolution

2008-11-07 Thread Andrew Coppin
A simple and straight-forward way to define the DSP operations of correlation and convolution is as follows: correlate1 :: [Double] - [Double] - Double correlate1 ks = sum . zipWith (*) ks correlate :: [Double] - [Double] - [Double] correlate ks [] = [] correlate ks xs = correlate1 ks xs

Re: [Haskell-cafe] Convolution

2008-11-07 Thread Henning Thielemann
On Fri, 7 Nov 2008, Andrew Coppin wrote: A simple and straight-forward way to define the DSP operations of correlation and convolution is as follows: correlate1 :: [Double] - [Double] - Double correlate1 ks = sum . zipWith (*) ks correlate :: [Double] - [Double] - [Double] correlate ks [] =

Re: [Haskell-cafe] Convolution

2008-11-07 Thread Andrew Coppin
Henning Thielemann wrote: I think the verb is 'convolve'. Possibly. If ks is infinite it will not work. Indeed. If the correlate function could be altered to use Prelude list functions only, I would think the above code works quite well with stream fusion too. (Presumably you could do