Package com.nr.ran

Examples of com.nr.ran.Ranq1


  public double tt;
 
  public Amebsa(final double[] point, final double del, final RealValueFun funkk, final double ftoll) {
    funk = funkk;
    ftol = ftoll;
    ran = new Ranq1(1234);
    yb = Double.MAX_VALUE;
    ndim = point.length;
    pb = new double[ndim];
    mpts = ndim+1;
    y = new double[mpts];
View Full Code Here


  }
 
  public Amebsa(final double[] point, final double[] dels, final RealValueFun funkk, final double ftoll) {
    funk =funkk;
    ftol = ftoll;
    ran = new Ranq1(1234);
    yb = Double.MAX_VALUE;
    ndim = point.length;
    pb = new double[ndim];
    mpts = ndim+1;
    y = new double[mpts];
View Full Code Here

  }
 
  public Amebsa(final double[][] pp, final RealValueFun funkk, final double ftoll){
    funk =funkk;
    ftol = ftoll;
    ran = new Ranq1(1234);
    yb = Double.MAX_VALUE;
    ndim = pp[0].length;
    pb = new double[ndim];
    mpts = pp.length;
    y = new double[mpts];
View Full Code Here

    System.out.println("Testing Ranq1");
    average=N/(double)(M);
    double[] ebins = buildVector(M,average);

    // Check fingerprint of int32()
    Ranq1 myran1 = new Ranq1(17);
    localflag=false;
    for (i=0;i<10;i++)
      localflag=localflag || (myran1.int32() != fingerprint1[i]);
    globalflag = globalflag || localflag;
    if (localflag) {
      fail("*** Ranq1: int32() does not match fingerprint");
     
    }

    // Check statistics
    for (i=0;i<N;i++) bins[myran1.int32p()%M] += 1;
    chsone(bins,ebins,dfW,chisqW,probW);df = dfW.val; chisq = chisqW.val; prob = probW.val;
    System.out.printf("     chisq,int32(): %f  prob: %f\n",chisq, prob);
    localflag = (prob < 0.05);
    globalflag = globalflag || localflag;
    if (localflag) {
      fail("*** Ranq1: int32() does not give distribution with correct variance");
     
    }

    // Check fingerprint of int64()
    Ranq1 myran2 = new Ranq1(17);
    localflag=false;
    for (i=0;i<10;i++)
      localflag=localflag || (myran2.int64() != fingerprint2[i]);
    globalflag = globalflag || localflag;
    if (localflag) {
      fail("*** Ranq1: int64() does not match fingerprint");
     
    }

    // Check statistics
    for (i=0;i<M;i++) bins[i]=0;
    for (i=0;i<N;i++) bins[(int)(myran2.int64p()%M)] += 1;
    chsone(bins,ebins,dfW,chisqW,probW);df = dfW.val; chisq = chisqW.val; prob = probW.val;
    System.out.printf("     chisq,int64(): %f  prob: %f\n",chisq, prob);
    localflag = (prob < 0.05);
    globalflag = globalflag || localflag;
    if (localflag) {
      fail("*** Ranq1: int64() does not give distribution with correct variance");
     
    }

    // Check fingerprint of doub()
    Ranq1 myran3 = new Ranq1(17);
    localflag=false;
    for (i=0;i<10;i++)
      localflag=localflag || abs(myran3.doub()-fingerprint3[i])>sbeps;
    globalflag = globalflag || localflag;
    if (localflag) {
      fail("*** Ranq1: doub() does not match fingerprint");
     
    }

    // Check statistics
    for (i=0;i<M;i++) bins[i]=0;
    for (i=0;i<N;i++) bins[(int)(floor(M*myran3.doub()))] += 1;
    chsone(bins,ebins,dfW,chisqW,probW);df = dfW.val; chisq = chisqW.val; prob = probW.val;
    System.out.printf("     chisq,doub(): %f  prob: %f\n",chisq, prob);
    localflag = (prob < 0.05);
    globalflag = globalflag || localflag;
    if (localflag) {
View Full Code Here

TOP

Related Classes of com.nr.ran.Ranq1

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.