Package hep.aida.bin

Examples of hep.aida.bin.DynamicBin1D


             rand,
             false,
             false,
             2);

  DynamicBin1D dbin = new DynamicBin1D();
 
  /*
   * Use a new random number generator to generate numExamples
   * random gaussians, and add them to the QuantileBin1D
   */
  Uniform dataRand = new Uniform(new DRand(7757));
  for (int i = 1; i <= numExamples; i++) {
    double gauss = dataRand.nextDouble();
      qAccum.add(gauss);
      dbin.add(gauss);
  }
 
  /*
   * print out the percentiles
   */
  DecimalFormat fmt = new DecimalFormat("0.00");
  System.out.println();
  //int step = 1;
  int step = 10;
  for (int i = 1; i < 100; ) {
      double percent = ((double)i) * 0.01;
      double quantile = qAccum.quantile(percent);
      System.out.println(fmt.format(percent) + "  " + quantile + ",  " + dbin.quantile(percent)+ ",  " + (dbin.quantile(percent)-quantile));
      i = i + step;
  }
}
View Full Code Here


* @see Formatter
* @see hep.aida.bin.BinFunction1D
* @see hep.aida.bin.BinFunctions1D
*/
public static DoubleMatrix2D aggregate(DoubleMatrix2D matrix, hep.aida.bin.BinFunction1D[] aggr, DoubleMatrix2D result) {
  DynamicBin1D bin = new DynamicBin1D();
  double[] elements = new double[matrix.rows()];
  cern.colt.list.DoubleArrayList values = new cern.colt.list.DoubleArrayList(elements);
  for (int column=matrix.columns(); --column >= 0; ) {
    matrix.viewColumn(column).toArray(elements); // copy column into values
    bin.clear();
    bin.addAllOf(values);
    for (int i=aggr.length; --i >= 0; ) {
      result.set(i, column, aggr[i].apply(bin));
    }
  }
  return result;
View Full Code Here

@param vector the vector to analyze.
@return a bin holding the statistics measures of the vector.
*/
public static DynamicBin1D bin(DoubleMatrix1D vector) {
  DynamicBin1D bin = new DynamicBin1D();
  bin.addAllOf(DoubleFactory1D.dense.toList(vector));
  return bin;
}
View Full Code Here

* @see Formatter
* @see hep.aida.bin.BinFunction1D
* @see hep.aida.bin.BinFunctions1D
*/
public static DoubleMatrix2D aggregate(DoubleMatrix2D matrix, hep.aida.bin.BinFunction1D[] aggr, DoubleMatrix2D result) {
  DynamicBin1D bin = new DynamicBin1D();
  double[] elements = new double[matrix.rows()];
  cern.colt.list.DoubleArrayList values = new cern.colt.list.DoubleArrayList(elements);
  for (int column=matrix.columns(); --column >= 0; ) {
    matrix.viewColumn(column).toArray(elements); // copy column into values
    bin.clear();
    bin.addAllOf(values);
    for (int i=aggr.length; --i >= 0; ) {
      result.set(i, column, aggr[i].apply(bin));
    }
  }
  return result;
View Full Code Here

@param vector the vector to analyze.
@return a bin holding the statistics measures of the vector.
*/
public static DynamicBin1D bin(DoubleMatrix1D vector) {
  DynamicBin1D bin = new DynamicBin1D();
  bin.addAllOf(DoubleFactory1D.dense.toList(vector));
  return bin;
}
View Full Code Here

             rand,
             false,
             false,
             2);

  DynamicBin1D dbin = new DynamicBin1D();
 
  /*
   * Use a new random number generator to generate numExamples
   * random gaussians, and add them to the QuantileBin1D
   */
  Uniform dataRand = new Uniform(new DRand(7757));
  for (int i = 1; i <= numExamples; i++) {
    double gauss = dataRand.nextDouble();
      qAccum.add(gauss);
      dbin.add(gauss);
  }
 
  /*
   * print out the percentiles
   */
  DecimalFormat fmt = new DecimalFormat("0.00");
  System.out.println();
  //int step = 1;
  int step = 10;
  for (int i = 1; i < 100; ) {
      double percent = ((double)i) * 0.01;
      double quantile = qAccum.quantile(percent);
      System.out.println(fmt.format(percent) + "  " + quantile + ",  " + dbin.quantile(percent)+ ",  " + (dbin.quantile(percent)-quantile));
      i = i + step;
  }
}
View Full Code Here

TOP

Related Classes of hep.aida.bin.DynamicBin1D

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.