ar1st0crat / NWaves

.NET DSP library with a lot of audio processing functions
MIT License
453 stars 71 forks source link

Buggy RLS filter implementation #77

Open richardpl opened 1 year ago

richardpl commented 1 year ago

This line looks wrong:

https://github.com/ar1st0crat/NWaves/blob/c1a6a4a8fdb70ce7cfd6b31ad59595e8461ff2e5/NWaves/Filters/Adaptive/RlsFilter.cs#L112

Are there any tests to make sure that this implementation behave correctly?

ar1st0crat commented 1 year ago

Looks like an ordinary matrix multiplication (straightforward implementation, not the most efficient, though). I didn't write tests for adaptive filters, but there are demo forms that allow us checking the results. In particular, this form:

image

richardpl commented 1 year ago

Even if implementation idea is correct, the matrix multiplication I linked above is flawed. One needs +=. Otherwise older values are overwritten.

ar1st0crat commented 1 year ago

You're right - it's a bug; it should be +=. Thanks for noticing. I'll double-check this and fix it when I have the time