insaf021 commented on PR #350:
URL: https://github.com/apache/commons-math/pull/350#issuecomment-6940177464

   Kept the copy and documented it. `getPercentile(double)` now says each call 
copies and re-selects even when the data hasn't changed, and shows getting the 
values once and passing all the probabilities to `Quantile.evaluate`. The 
example sets `EstimationMethod.HF6`, since `Quantile.withDefaults()` is HF8 and 
would otherwise give different numbers from `getPercentile`.
   
   For `StatUtils` I kept the Math3 behaviour, as the rest of `StatUtils` only 
reads its input, and documented the per-call copy on both `percentile` 
overloads with the same pointer to `Quantile`. If you'd rather leave it in 
place and document the reordering instead, that's a one-line revert of the 
`StatUtils` hunk plus dropping `testPercentileDoesNotModifyInput`.
   
   On caching a working copy: keying it on the array reference and `[begin, 
length)` isn't safe for `DescriptiveStatistics`. `replaceMostRecentValue` goes 
through `substituteMostRecentElement`, which writes into the same internal 
array at the same start and length, and `removeMostRecentValue` followed by 
`addValue` does the same, so a repeat `getPercentile` would hit the cache and 
return the old value. It would need `DescriptiveStatistics` to invalidate the 
cache on every mutation, so I've left it out of this PR. Happy to look at it 
separately if you think it's worth it.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to