Package cern.colt.list

Examples of cern.colt.list.DoubleArrayList


  IntArrayList indexList = indexes[i];
  if (indexList != null) k = indexList.binarySearch(j);
 
  if (k>=0) { // found
    if (value==0) {
      DoubleArrayList valueList = values[i];
      indexList.remove(k);
      valueList.remove(k);
      int s = indexList.size();
      if (s>2 && s*3 < indexList.elements().length) {
        indexList.setSize(s*3/2);
        indexList.trimToSize();
        indexList.setSize(s);
       
        valueList.setSize(s*3/2);
        valueList.trimToSize();
        valueList.setSize(s);   
      }
    }
    else {
      values[i].setQuick(k,value);
    }
  }
  else { // not found
    if (value==0) return;

    k = -k-1;

    if (indexList == null) {
      indexes[i] = new IntArrayList(3);
      values[i= new DoubleArrayList(3);
    }
    indexes[i].beforeInsert(k,j);
    values[i].beforeInsert(k,value);
  }
}
View Full Code Here


  }
  catch (IllegalArgumentException exc) { // we can hold rows*columns>Integer.MAX_VALUE cells !
    if (! "matrix too large".equals(exc.getMessage())) throw exc;
  }
  indexes = new IntArrayList();
  values = new DoubleArrayList();
  starts = new int[rows+1];
}
View Full Code Here

  if (k<0) throw new IllegalArgumentException("k must be >= 0");
  //checkOrder(k);
  if (!hasSumOfPowers(k)) return Double.NaN;

  int maxOrder = Math.min(k,getMaxOrderForSumOfPowers());
  DoubleArrayList sumOfPows = new DoubleArrayList(maxOrder+1);
  sumOfPows.add(size());
  sumOfPows.add(sum());
  sumOfPows.add(sumOfSquares());
  for (int i=3; i<=maxOrder; i++) sumOfPows.add(sumOfPowers(i));
 
  return Descriptive.moment(k, c, size(), sumOfPows.elements());
}
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

  //System.out.println(binB);
  //System.out.println(binA.compareWith(binB));

  System.out.println("\n\nBenchmarking frequencies...\n");
  IntArrayList freq = new IntArrayList();
  DoubleArrayList distinct = new DoubleArrayList();
  cern.colt.Timer timer = new cern.colt.Timer();
  timer.reset();
  timer.start();
  binA.frequencies(distinct,freq);
  timer.stop().display();
View Full Code Here

* Constructs and returns an empty bin; implicitly calls {@link #setFixedOrder(boolean) setFixedOrder(false)}.
*/
public DynamicBin1D() {
  super();
  this.clear();
  this.elements = new DoubleArrayList();
  this.sortedElements = new DoubleArrayList(0);
  this.fixedOrder = false;
  this.hasSumOfLogarithms = true;
  this.hasSumOfInversions = true;
}
View Full Code Here

/**
* Returns a String representation of the receiver.
*/
public synchronized String toString() {
  StringBuffer buf = new StringBuffer(super.toString());
  DoubleArrayList distinctElements = new DoubleArrayList();
  IntArrayList frequencies = new IntArrayList();
  frequencies(distinctElements,frequencies);
  if (distinctElements.size() < 100) { // don't cause unintended floods
    buf.append("Distinct elements: "+distinctElements+"\n");
    buf.append("Frequencies: "+frequencies+"\n");
  }
  else {
    buf.append("Distinct elements & frequencies not printed (too many).");
View Full Code Here

*
* @param s the number of smallest elements to trim away (<tt>s >= 0</tt>).
* @param l the number of largest elements to trim away (<tt>l >= 0</tt>).
*/
public synchronized void trim(int s, int l) {
  DoubleArrayList elems = sortedElements();
  clear();
  addAllOfFromTo(elems, s, elems.size()-1 - l);
}
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.target = target;
  this.capacity = capacity;
  this.xElements = new double[capacity];
  this.yElements = new double[capacity];
  this.zElements = new double[capacity];
  this.xList = new DoubleArrayList(xElements);
  this.yList = new DoubleArrayList(yElements);
  this.zList = new DoubleArrayList(zElements);
  this.size = 0;
}
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.