Boost logo

Boost :

From: Darryl Green (darryl.green_at_[hidden])
Date: 2006-12-14 07:17:42


Eric Niebler wrote:
> Anyway, from Wikipedia, I see that convolution is "the integral of the
> product of the two functions after one is reversed and shifted." Seems
> straightforward. There already is a shift adapter. I could add a reverse
> adapter.

If you add a reversed adapter then you can implement convolution and
correlation (correlation is the same algorithm without the reversal) in
terms of the same primitives. To apply an arbitrary filter (such as the
sinc filter mentioned by Janek) you simply convolve a time series
consisting of the values of the function (truncated) with the original
series. When decimating you obviously only need to evaluate the result
at the output rate, not for every sample point at the input rate. The
sinc filter is a good choice for decimation because it is the
(truncated) time series representation of a "brick wall" filter (ie a
hard cutoff in the frequency domain). As many filters of interest are
symmetrical, you don't actually need the reverse step anyway.

> (Reversed relative to what time t? Should it be a parameter to
> the adapter?)

I don't think the origin of the reversal belongs in reverse. For the
decimation or smoothing filters you want to have 0 delay so you would
construct your filter sequence to be symmetrical about t=0. A way to
apply a time offset to an existing sequence would seem like a reasonable
thing to have (and be trivial to implement as an adapter I would think).

> Series multiplication is already implemented, as is an
> integrate() function. So maybe it's almost already there.

The multiply and integrate can/should be combined and optimized as
multiply-accumulate.

It seems you have something very close to a good set of primitives
already. A few examples of how to combine/use them (especially if those
examples actually provided needed functionality like decimation and
interpolation) would help a lot I think.

Regards
Darryl.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk