Skip to content
Snippets Groups Projects
Commit 13a9feb6 authored by stepan's avatar stepan
Browse files

Fix typo in RPois + Wilcox catches OutOfMemoryError

parent e1b41bc8
Branches
No related tags found
No related merge requests found
......@@ -160,7 +160,7 @@ public final class RPois {
/* Only if mu >= 10 : ----------------------- */
/* Step N. normal sample */
g = mu + s * rand.unifRand(); /* norm_rand() ~ N(0,1), standard normal */
g = mu + s * rand.normRand(); /* norm_rand() ~ N(0,1), standard normal */
if (g >= 0.) {
pois = Math.floor(g);
......
......@@ -53,7 +53,13 @@ public final class Wilcox {
r = 0.0;
k = (int) (m + n);
int[] x = new int[k];
int[] x;
try {
x = new int[k];
} catch (OutOfMemoryError ex) {
// GnuR seems to be reporting the same number regardless of 'k'
throw RError.error(RError.SHOW_CALLER, CALLOC_COULD_NOT_ALLOCATE_INF);
}
for (i = 0; i < k; i++) {
x[i] = i;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment