Package com.nr.sort

Examples of com.nr.sort.Indexx.sort()


    System.out.println("Testing Indexx");
    Ran myran = new Ran(17);
    for (i=0;i<N;i++) x[i]=myran.doub()
    Indexx idx =new Indexx(x);      // Create the index
    double[] xx=buildVector(x);     // Copy of x
    idx.sort(xx);     // Test sort on x itself
    for (i=0;i<N-1;i++) localflag = localflag || (xx[i] > xx[i+1]);
    globalflag = globalflag || localflag;
    if (localflag) {
      fail("*** Indexx: Array sorted according to index is incorrectly ordered");
     
View Full Code Here


     
    }

    // Test member function sort() on another array
    for (i=0;i<N;i++) yy[i] = 1.0-x[i]; // Invert the sorting order
    idx.sort(yy);   // yy sorted according to the sizes of x
    for (i=0;i<N-1;i++) localflag = localflag || (yy[i+1] > yy[i]);
    globalflag = globalflag || localflag;
    if (localflag) {
      fail("*** Indexx: Independent array sorted according to index is incorrectly ordered");
     
View Full Code Here

     
    }

    // Test member function rank()
    idx.rank(zi);
    idx.sort(zi);
    for (i=0;i<N;i++) localflag = localflag || (zi[i] != i);
    globalflag = globalflag || localflag;
    if (localflag) {
      fail("*** Indexx: Sorting the rank table into element-size order does not give increasing integers");
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.