Package cern.colt.list

Examples of cern.colt.list.IntArrayList


@param  condition The condition to be matched.
@return the new view.
*/
public ObjectMatrix3D viewSelection(ObjectMatrix2DProcedure 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 ObjectMatrix2D viewSelection(ObjectMatrix1DProcedure 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

@param  condition The condition to be matched.
@return the new view.
*/
public ObjectMatrix1D viewSelection(cern.colt.function.ObjectProcedure condition) {
  IntArrayList matches = new IntArrayList();
  for (int i=0; i < size; i++) {
    if (condition.apply(getQuick(i))) matches.add(i);
  }
  matches.trimToSize();
  return viewSelection(matches.elements());
}
View Full Code Here

@param  condition The condition to be matched.
@return the new view.
*/
public DoubleMatrix1D viewSelection(cern.colt.function.DoubleProcedure condition) {
  IntArrayList matches = new IntArrayList();
  for (int i=0; i < size; i++) {
    if (condition.apply(getQuick(i))) matches.add(i);
  }
  matches.trimToSize();
  return viewSelection(matches.elements());
}
View Full Code Here

public void setQuick(int row, int column, double value) {
  int i=row;
  int j=column;
 
  int k=-1;
  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

    setUp(rows, columns);
  }
  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

/**
*/
public static void doubleTest30(int size) {

int[] values = { 0, 2, 3, 5, 7};
IntArrayList list = new IntArrayList(values);
int val = 3;
int sum=0;
cern.colt.Timer timer = new cern.colt.Timer().start();
for (int i=size; --i>=0; ) {
  int k = list.binarySearchFromTo(val,0,values.length-1);
  System.out.println(list+", "+val+" --> "+k);
  sum+=k;
}
timer.stop().display();
//System.out.println("sum = "+sum);
View Full Code Here

*/
public static void doubleTest30(int size, int val) {

//int[] values = { 0, 2};
int[] values = {2};
IntArrayList list = new IntArrayList(values);
int l = values.length-1;
int sum=0;
cern.colt.Timer timer = new cern.colt.Timer().start();
for (int i=size; --i>=0; ) {
  int k = cern.colt.Sorting.binarySearchFromTo(values,val,0,l);
View Full Code Here

public IntBuffer2D(IntBuffer2DConsumer target, int capacity) {
  this.target = target;
  this.capacity = capacity;
  this.xElements = new int[capacity];
  this.yElements = new int[capacity];
  this.xList = new IntArrayList(xElements);
  this.yList = new IntArrayList(yElements);
  this.size = 0;
}
View Full Code Here

  this.target = target;
  this.capacity = capacity;
  this.xElements = new int[capacity];
  this.yElements = new int[capacity];
  this.zElements = new int[capacity];
  this.xList = new IntArrayList(xElements);
  this.yList = new IntArrayList(yElements);
  this.zList = new IntArrayList(zElements);
  this.size = 0;
}
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.