You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
invpred always returned dxlo = Inf, dxup = Inf whenever the slope wasn't significant, treating every such case as an interval covering the whole real line. But in some cases the correct interval is only unbounded on one side, with a finite value on the other. Fixed by checking which case applies instead of assuming both sides are always infinite.
Thanks for this. The reasoning is right and it is worth having.
MATLAB ships an invpred of its own, and its documentation states exactly what this PR implements:
The intervals are not simultaneous and are not necessarily finite. Some intervals may extend from a finite value to -Inf or +Inf, and some may extend over the entire real line.
I checked the scalar cases against R2024a and they agree to every digit it displays, at the default alpha and at alpha = 0.5, for both predopt values. So the direction and the arithmetic are both correct.
One thing blocks it: with the interval requested, the new branch fails on a non-scalar y0. It has to be all three outputs, since invpred returns before the interval code when nargout < 2.
main answers these calls with dxlo and dxup both Inf rather than raising, so it is a regression and not just an uncovered case. The same page is explicit that this has to work: "Y0 can be an array of any size", and "Both DXLO and DXUP have the same size as Y0".
Could you add tests with a vector y0 as well? Your scalar test passes because a scalar makes the sizes agree by accident, so it never reaches the code the patch rewrites. Two values from R2024a, on your own fixture:
center and halfwidth weren't indexed by the mask while offset was, so it broke as soon as y0 had more than one element. Fixed it by indexing all three consistently.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
invpredalways returneddxlo = Inf, dxup = Infwhenever the slope wasn't significant, treating every such case as an interval covering the whole real line. But in some cases the correct interval is only unbounded on one side, with a finite value on the other. Fixed by checking which case applies instead of assuming both sides are always infinite.BEFORE:
AFTER:
MATLAB: