Conversation
… area is added outside the domain
…1 and xmax to bin nbin
…d kind instead of default single precision
…bin by using linear interpolation on the CDF axis and adding boundary guards
…ared mean from each value
… the full array size
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This fixes a few bugs:
integral_general_subsetadds spurious area outside the tabulated range. When the integration limits extend beyond the tabulatedx, the routine adds a triangular ramp of area past the domain instead of clamping. Fix: clamp the effective limits to[x(1), x(n)]so out-of-range extremities contribute zero.iposmishandles both boundaries for descending ranges (xmax < xmin).x == xminandx == xmaxreturn off-by-one bins. Fix: correct the boundary handling soxminmaps to bin 1 andxmaxto binnbin.xvalcomputes bin centres in single precision. The bin-centre fraction(i - 0.5) / nbinis evaluated in default (single) precision before being used, so the double-precision instantiation loses precision. Fix: compute the fraction in the instantiated kind.sample_pdf_logreturns NaN for draws in the first CDF bin. A random value landing in the first bin feedscdf(1) = 0into log-log interpolation (log(0)), producing NaN. Fix: use linear interpolation on the CDF axis with boundary guards.