Package cern.colt.list

Examples of cern.colt.list.IntArrayList


  //System.out.println(binA);
  //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);
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");
  }
View Full Code Here

*/
public IntBuffer(IntBufferConsumer target, int capacity) {
  this.target = target;
  this.capacity = capacity;
  this.elements = new int[capacity];
  this.list = new IntArrayList(elements);
  this.size = 0;
}
View Full Code Here

@param  condition The condition to be matched.
@return the new view.
*/
public DoubleMatrix3D viewSelection(DoubleMatrix2DProcedure condition) {
  IntArrayList matches = new IntArrayList();
  for (int i=0; i < slices; i++) {
    if (condition.apply(viewSlice(i))) matches.add(i);
  }

  matches.trimToSize();
  return viewSelection(matches.elements(), null, null); // take all rows and columns
}
View Full Code Here

@param  condition The condition to be matched.
@return the new view.
*/
public DoubleMatrix2D viewSelection(DoubleMatrix1DProcedure condition) {
  IntArrayList matches = new IntArrayList();
  for (int i=0; i < rows; i++) {
    if (condition.apply(viewRow(i))) matches.add(i);
  }
 
  matches.trimToSize();
  return viewSelection(matches.elements(), null); // take all columns
}
View Full Code Here

* This method can be used to iterate over the keys of the receiver.
*
* @return the keys.
*/
public IntArrayList keys() {
  IntArrayList list = new IntArrayList(size());
  keys(list);
  return list;
}
View Full Code Here

/**
* Returns a string representation of the receiver, containing
* the String representation of each key-value pair, sorted ascending by key.
*/
public String toString() {
  IntArrayList theKeys = keys();
  String tmp = theKeys.toString() + "\n";
  theKeys.sort();

  StringBuffer buf = new StringBuffer(tmp);
  //StringBuffer buf = new StringBuffer();
  buf.append("[");
  int maxIndex = theKeys.size() - 1;
  for (int i = 0; i <= maxIndex; i++) {
    int 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

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

  StringBuffer buf = new StringBuffer();
  buf.append("[");
  int maxIndex = theKeys.size() - 1;
  for (int i = 0; i <= maxIndex; i++) {
    int 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

* This method can be used to iterate over the keys of the receiver.
*
* @return the keys.
*/
public IntArrayList keys() {
  IntArrayList list = new IntArrayList(size());
  keys(list);
  return list;
}
View Full Code Here

* <tt>keys = (8,7,6), values = (1,2,2) --> keyList = (8,6,7)</tt>
*
* @param keyList the list to be filled, can have any size.
*/
public void keysSortedByValue(final IntArrayList keyList) {
  pairsSortedByValue(keyList, new IntArrayList(size()));
}
View Full Code Here

TOP

Related Classes of cern.colt.list.IntArrayList

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.