Forum Numerical Method Bug Reports
maximum number of iterations 2147483647 exceeded
-
Anonymous 2011-11-14 at 5:23 pm
Hi, First of all many thanks for this great library ! You rock guys !
Well, I started testing your trial version and got this thing:
<br /> @Test<br /> public void testSuanshuStat() throws Exception {<br /> double aLevel = 0.05;<br /> int N = 500;<br /> <br /> // normal distr with m=100, sigma=1<br /> NormalRng ng = new NormalRng(100, 1);<br /> <br /> // generate N numbers<br /> double[] vNorm = new double[N];<br /> for (int i = 0; i < N; i++)<br /> vNorm<i> = ng.nextDouble();<br /> <br /> for (int i = 0; i < 200; i++) {<br /> T t = new T(vNorm, 100);<br /> double[] rr = t.confidenceInterval(0.975);<br /> System.out.println(i + "> T = " + t.pValue() + " l = " + rr[0] + " r = " + rr[1]);<br /> }<br /> }<br /> </i>After I ran this code I got next output:
<br /> 0> T = 0.7016288954439946 l = 99.90095700580275 r = 100.0667037706929<br /> 1> T = 0.7016288954439946 l = 99.90095700580275 r = 100.0667037706929<br /> 2> T = 0.7016288954439946 l = 99.90095700580275 r = 100.0667037706929<br /> 3> T = 0.7016288954439946 l = 99.90095700580275 r = 100.0667037706929<br /> 4> T = 0.7016288954439946 l = 99.90095700580275 r = 100.0667037706929<br /> 5> T = 0.7016288954439946 l = 99.90095700580275 r = 100.0667037706929<br /> 6> T = 0.7016288954439946 l = 99.90095700580275 r = 100.0667037706929<br /> 7> T = 0.7016288954439946 l = 99.90095700580275 r = 100.0667037706929<br /> 8> T = 0.7016288954439946 l = 99.90095700580275 r = 100.0667037706929<br /> 9> T = 0.7016288954439946 l = 99.90095700580275 r = 100.0667037706929<br /> 10> T = 0.7016288954439946 l = 99.90095700580275 r = 100.0667037706929<br /> 11> T = 0.7016288954439946 l = 99.90095700580275 r = 100.0667037706929<br /> 12> T = 0.7016288954439946 l = 99.90095700580275 r = 100.0667037706929<br /> 13> T = 0.7016288954439946 l = 99.90095700580275 r = 100.0667037706929<br /> 14> T = 0.7016288954439946 l = 99.90095700580275 r = 100.0667037706929<br /> 15> T = 0.7016288954439946 l = 99.90095700580275 r = 100.0667037706929<br /> 16> T = 0.7016288954439946 l = 99.90095700580275 r = 100.0667037706929<br /> 17> T = 0.7016288954439946 l = 99.90095700580275 r = 100.0667037706929<br /> <br /> com.numericalmethod.suanshu.analysis.function.rn2r1.ContinuedFraction$MaxIterationsExceededException: maximum number of iterations 2147483647 exceeded<br /> at com.numericalmethod.suanshu.analysis.function.rn2r1.ContinuedFraction.evaluate(do:156)<br /> at com.numericalmethod.suanshu.analysis.function.rn2r1.ContinuedFraction.evaluate(do:257)<br /> at com.numericalmethod.suanshu.analysis.function.special.BetaRegularized.evaluate(uq:130)<br /> at com.numericalmethod.suanshu.analysis.function.special.BetaRegularized.evaluate(uq:82)<br /> at com.numericalmethod.suanshu.analysis.function.special.BetaRegularizedInverse$1.evaluate(dv:259)<br /> at com.numericalmethod.suanshu.analysis.uniroot.Halley.solve(qr:231)<br /> at com.numericalmethod.suanshu.analysis.uniroot.Uniroot.solve(np:116)<br /> at com.numericalmethod.suanshu.analysis.function.special.BetaRegularizedInverse.evaluate(dv:15)<br /> at com.numericalmethod.suanshu.stats.distribution.univariate.TDistribution.quantile(mi:45)<br /> at com.numericalmethod.suanshu.stats.test.mean.T.confidenceInterval(cl:12)<br /> <br />Number (i) when I can get this exception depends on number of data in series. For N=1000 I get that at i==5 etc. Seems it uses some interior static buffers and doesn’t free it. Could you advise me how to refresh this buffer or how to avoid this situation ?
-
RyuParticipant 2011-11-15 at 2:40 am
Hello o16t,
Thank you very much for evaluating SuanShu.
I suspect that it has to do with the jvm that you are using. Could you let us know which jvm you are using please? I tried to reproduce your problem using jdk1.6.0_24 (32 bit) but could not reproduce the exception. Maybe you would like to try this most updated 32 bit jvm?
There is no ‘internal’ buffer in this particular code snippet. The T distribution is a complicated function to evaluate, which depends on calling BetaRegularized, BetaRegularizedInverse, LogBeta, LogGamma, and Digamma. They are in turned computed using their continued fraction forms. By default, we do not put a limit on the number of iterations when evaluating a continued fraction and just let it run until convergence (or failure).
-
Ken YiuParticipant 2011-11-15 at 7:35 am
Thank you o16t for reporting this!
The problem will be fixed in the next version which will be released soon.
-
Anonymous 2011-11-15 at 10:36 am
Oh, sorry guys, I really forgot to say that I was using Sun jvm version “1.6.0_26” (64 bit) on 64-bit Linux (2.6.32-34-generic #77-Ubuntu SMP x86_64 GNU/Linux). Also I tried 32-bit (1.6.0_26) Sun jvm on same platform and got same result – it fails on some iteration.
I also attached test case.
-
RyuParticipant 2011-11-15 at 10:44 am
Hi o16t,
Thank you for the test case. We have fixed a bug in our code that solve your problem. We will make a new release on Dec 1.
If you need a fixed version urgently, please email support AT numericalmethod DOT com to request an ‘unofficial’ version.
-
Anonymous 2011-11-15 at 10:48 am
Great ! Thank you guys for very quick support !
-
Ken YiuParticipant 2011-11-17 at 11:11 am
Hi o16t,
If you are still using the 64-bit JVM for running your program (and if there is no way for you to change the vm due to admin right limitations), I suggest you to turn off the adaptive compiler by using the jvm option (-XInt) (ref: http://download.oracle.com/javase/6/docs/technotes/tools/windows/java.html). i.e., simply run your program by typing something like this:
java -XInt com.your.program.MainPlease let us know if the problem still persists.
-
Anonymous 2011-11-21 at 6:49 pm
Hi kenyiu, Thanks for advice, yes it works perfect with interpret only mode. But I’m afraid I can’t use interpret mode for our application because of performance issues. Thanks for tip anyway.
Are you planning to fix this issue in next releases ?
–dmitry
-
RyuParticipant 2011-11-22 at 4:04 am
Yup. We have already fixed the bug, and it will go to the next release in the week of Dec 5th.
Please stay tuned.
-
RyuParticipant 2011-12-02 at 12:58 pm
Hello o16t,
Could you let us know if release 1.8.0 solves your problem please? http://numericalmethod.com/forum/index.php/topic,98.0.html
Thanks! Ryu
-
Anonymous 2011-12-05 at 11:11 am
Hi, Ryu ! yes, it solved the problem. Thanks !