Skip to content
This repository has been archived by the owner on Jan 22, 2021. It is now read-only.

Possible issue in ScalarNewtonRalphson.h ? #17

Closed
ptarabbia opened this issue Mar 14, 2018 · 1 comment
Closed

Possible issue in ScalarNewtonRalphson.h ? #17

ptarabbia opened this issue Mar 14, 2018 · 1 comment

Comments

@ptarabbia
Copy link

Maybe I'm missing something, but:

optimize() does
output[0] = optimize_impl(input, output);

and optimize_impl does (in some rare cases):
return output[-1];

if that last return happens on the very first call, doesn't the entire state get initialized with bad data ? Maybe there's something in place to prevent reading before the first value of the array, but I couldn't see it.

@mbrucher
Copy link
Owner

Actually no, there is no issue with this if and only if the filter has an output delay of 1. The last output sample is thus copied to the new output buffer.
When this is set, then output[i-1] is always defined for i inside [0;n[. Also this original output[-1] is also used as the value for the NR optimization.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants