commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alex Herbert (Jira)" <j...@apache.org>
Subject [jira] [Resolved] (RNG-148) UnitSphereSampler does not check for infinite length dimension
Date Mon, 02 Aug 2021 11:17:00 GMT

     [ https://issues.apache.org/jira/browse/RNG-148?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Alex Herbert resolved RNG-148.
------------------------------
    Resolution: Not A Problem

> 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)

Mime
View raw message