Wojtek Skulski wrote:
> Robert:
>
> thank you for a quick answer ... forget the theory ...
>
> The answer is LibVectors.Conv (x, h) and I am happy with that...
Sorry Wojtek, I am a mathematician, how can I forget the theory ?
For x and h real, and h symmetric, the functions LibVectors.Conv &
LibVectors.Corr both return the same result. So using Corr might be regarded as
ok ("If it ain't broke, don't fix it").
But I would argue it is not ok, and not just for aesthetic reasons. Suppose you,
or someone else, comes back a month or six later with a different filter and
decides it would be efficient to use the existing, and known to be 'working',
code. You have forgotten the detailed thinking. The new filter is non-symmetric.
The code now fails, and in a way that might not be immediately obvious.
But your mate says it is ok if you reverse one of the participants. So you try
z := Vec.Corr (x, Vec.Reverse (h));
instead of
z := Vec.Conv (x, h);
This works with both symmetric and non-symmetric h. So thats ok, right?
Wrong!
Because six months later you have another new filter which is complex , and the
code above now fails, because your mate's advice was only conditionally correct.
There is a simple fix that will work with Lib, but the story now gets a little
bit more interesting.
I said before that my defintions of these functions agree with Wikipedia. That
seems to be wrong. They do for real vectors, and for complex auto-correlation
and convolution, but not for complex cross-correlation.
Wikipedia agrees with Mathworld, so it begins to look like my function is in
error. I traced my use of it to some 1987 notes, but can't now trace the source.
I like to think that I did not make an error, but that there really are
different definitions in use in different sources.
My definition DOES agree with Matlab, which is almost a de-facto standard for
these things.
So if there are different conventions in use, as appears to be the case, it is
(*impossible*) to have a reliable way of relating Corr to Conv.
Anyway this have given me an excuse to update the Lib Docu file on these
functions - see the attached bitmap - with 'typeset' LaTeX equations. Far
better, I think, than the previous 'ascii only' version.
(If anyone missed it, my LaTeX project has now been published on CPC as
SubSystem Casket.)
Cheers
Robert
----
To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy
Received on Fri Mar 27 2009 - 18:19:30 UTC