Package cern.colt.list

Examples of cern.colt.list.DoubleArrayList


/**
* Returns a string representation of the receiver, containing
* the String representation of each key-value pair, sorted ascending by value.
*/
public String toStringByValue() {
  DoubleArrayList theKeys = new DoubleArrayList();
  keysSortedByValue(theKeys);

  StringBuffer buf = new StringBuffer();
  buf.append("[");
  int maxIndex = theKeys.size() - 1;
  for (int i = 0; i <= maxIndex; i++) {
    double key = theKeys.get(i);
      buf.append(String.valueOf(key));
    buf.append("->");
      buf.append(String.valueOf(get(key)));
    if (i < maxIndex) buf.append(", ");
  }
View Full Code Here


* Each percentage must be in the interval <tt>[0.0,1.0]</tt>.
* @return the quantiles.
*/
public static DoubleArrayList quantiles(DoubleArrayList sortedData, DoubleArrayList percentages) {
  int s = percentages.size();
  DoubleArrayList quantiles = new DoubleArrayList(s);
 
  for (int i=0; i < s; i++) {
    quantiles.add(quantile(sortedData, percentages.get(i)));
  }
 
  return quantiles;
}
View Full Code Here

  // assertion: data is sorted ascending.
  // assertion: splitValues is sorted ascending.
  int noOfBins = splitters.size() + 1;
 
  DoubleArrayList[] bins = new DoubleArrayList[noOfBins];
  for (int i=noOfBins; --i >= 0;) bins[i] = new DoubleArrayList();
 
  int listSize = sortedList.size();
  int nextStart = 0;
  int i=0;
  while (nextStart < listSize && i < noOfBins-1) {
View Full Code Here

public DoubleBuffer2D(DoubleBuffer2DConsumer target, int capacity) {
  this.target = target;
  this.capacity = capacity;
  this.xElements = new double[capacity];
  this.yElements = new double[capacity];
  this.xList = new DoubleArrayList(xElements);
  this.yList = new DoubleArrayList(yElements);
  this.size = 0;
}
View Full Code Here

*/
public DoubleBuffer(DoubleBufferConsumer target, int capacity) {
  this.target = target;
  this.capacity = capacity;
  this.elements = new double[capacity];
  this.list = new DoubleArrayList(elements);
  this.size = 0;
}
View Full Code Here

* This method was created in VisualAge.
* @param k int
*/
public DoubleBuffer(int k) {
  super(k);
  this.values = new DoubleArrayList(0);
  this.isSorted = false;
}
View Full Code Here

  protected boolean isSorted;
/**
* Constructs an empty exact quantile finder.
*/
public ExactDoubleQuantileFinder() {
  this.buffer = new DoubleArrayList(0);
  this.clear();
}
View Full Code Here

}
/**
* Observed epsilon
*/
public static double epsilon(DoubleArrayList sortedList, DoubleQuantileFinder finder, double phi) {
  double element = finder.quantileElements(new DoubleArrayList(new double[] {phi})).get(0);
  return epsilon(sortedList, phi, element);
}
View Full Code Here

public static double observedEpsilonAtPhi(double phi, ExactDoubleQuantileFinder exactFinder, DoubleQuantileFinder approxFinder) {
  int N = (int) exactFinder.size();
 
  int exactRank = (int) Utils.epsilonCeiling(phi * N) - 1;
  //System.out.println("exactRank="+exactRank);
  exactFinder.quantileElements(new DoubleArrayList(new double[] {phi})).get(0); // just to ensure exactFinder is sorted
  double approxElement = approxFinder.quantileElements(new DoubleArrayList(new double[] {phi})).get(0);
  //System.out.println("approxElem="+approxElement);
  IntArrayList approxRanks = binaryMultiSearch(exactFinder.buffer, approxElement);
  int from = approxRanks.get(0);
  int to = approxRanks.get(1);

View Full Code Here

* @return double[]
* @param values cern.it.hepodbms.primitivearray.DoubleArrayList
* @param phis double[]
*/
public static DoubleArrayList observedEpsilonsAtPhis(DoubleArrayList phis, ExactDoubleQuantileFinder exactFinder, DoubleQuantileFinder approxFinder, double desiredEpsilon) {
  DoubleArrayList epsilons = new DoubleArrayList(phis.size());
 
  for (int i=phis.size(); --i >=0;) {
    double epsilon = observedEpsilonAtPhi(phis.get(i), exactFinder, approxFinder);
    epsilons.add(epsilon);
    if (epsilon>desiredEpsilon) System.out.println("Real epsilon = "+epsilon+" is larger than desired by "+(epsilon-desiredEpsilon));
  }
  return epsilons;
}
View Full Code Here

TOP

Related Classes of cern.colt.list.DoubleArrayList

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.