All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cern.jet.stat.quantile.QuantileFinderTest Maven / Gradle / Ivy

/*
Copyright (c) 1999 CERN - European Organization for Nuclear Research.
Permission to use, copy, modify, distribute and sell this software and its documentation for any purpose 
is hereby granted without fee, provided that the above copyright notice appear in all copies and 
that both that copyright notice and this permission notice appear in supporting documentation. 
CERN makes no representations about the suitability of this software for any purpose. 
It is provided "as is" without expressed or implied warranty.
*/
package cern.jet.stat.quantile;

import cern.colt.Timer;
import cern.colt.list.DoubleArrayList;
import cern.colt.list.IntArrayList;
/**
 * A class holding test cases for exact and approximate quantile finders.
 */
class QuantileFinderTest { 
/**
 * Finds the first and last indexes of a specific element within a sorted list.
 * @return int[]
 * @param list cern.colt.list.DoubleArrayList
 * @param element the element to search for
 */
protected static IntArrayList binaryMultiSearch(DoubleArrayList list, double element) {
	int index = list.binarySearch(element);
	if (index<0) return null; //not found

	int from = index-1;
	while (from>=0 && list.get(from)==element) from--;
	from++;
	
	int to = index+1;
	while (to=0) mem = N;
						//System.out.print("         (e,d,N,p)=("+epsilon+","+delta+","+N+","+p+") --> ");
						System.out.print("         (known, d)=("+knownStr+", "+delta+") --> ");
						//System.out.print("(mem,b,k,memF");
						System.out.print("(MB,mem");
						//if (known_N) System.out.print(",sampling");
						//System.out.print(")=("+(Math.round(b*k/1000.0))+","+b+","+k+", "+Math.round(b*k*8/1024.0/1024.0));
						//System.out.print(")=("+b*k/1000.0+","+b+","+k+", "+b*k*8/1024.0/1024.0+", "+Math.round(b*k*8/1024.0/1024.0));
						System.out.print(")=("+mem*8.0/1024.0/1024.0+",  "+mem/1000.0+",  "+Math.round(mem*8.0/1024.0/1024.0));
						//if (known_N) System.out.print(","+returnSamplingRate[0]);
						System.out.println(")");
					}
				}
			}
		}
	}

	timer.stop().display();
}
/**
 * This method was created in VisualAge.
 */
public static void testLocalVarDeclarationSpeed(int size) {
	System.out.println("free="+Runtime.getRuntime().freeMemory());
	System.out.println("total="+Runtime.getRuntime().totalMemory());

	/*Timer timer = new Timer().start();
	for (int i=0; i-->
            
    
            


© 2015 - 2024 Weber Informatics LLC | Privacy Policy