You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Alex Herbert (Jira)" <ji...@apache.org> on 2021/06/30 08:51:00 UTC
[jira] [Commented] (RNG-148) UnitSphereSampler does not check for
infinite length dimension
[ https://issues.apache.org/jira/browse/RNG-148?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17371904#comment-17371904 ]
Alex Herbert commented on RNG-148:
----------------------------------
Fixed in commit
f4023d55bc9336036e5faf10e69ba391257a64d4
> UnitSphereSampler does not check for infinite length dimension
> --------------------------------------------------------------
>
> Key: RNG-148
> URL: https://issues.apache.org/jira/browse/RNG-148
> Project: Commons RNG
> Issue Type: Bug
> Components: sampling
> Affects Versions: 1.3
> Reporter: Alex Herbert
> Priority: Trivial
>
> The UnitSphereSampler does not check the vector to be normalised has infinite length.
> A check is already made for zero length (see RNG-55) since the underlying Gaussian sampler can return zero values. A check should also be made for infinite length. The normalisation is only valid if the sum is a finite positive value.
> The code can be fixed by changing:
> {code:java}
> if (sum == 0) {
> // Zero-norm vector is discarded.
> return sample();
> }
> {code}
> to:
> {code:java}
> if (sum == 0 || sum == Double.POSITIVE_INFINITY) {
> // Invalid vector is discarded.
> return sample();
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)