/** * Constructs and returns a new buffer with the given target. * @param target the target to flush to. * @param capacity the number of points the buffer shall be capable of holding before overflowing and flushing to the target. */ 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; } /**
/** * Constructs and returns a new buffer with the given target. * @param target the target to flush to. * @param capacity the number of points the buffer shall be capable of holding before overflowing and flushing to the target. */ 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; } /**
protected void initializeStructures() { title = null; nodes = new IntArrayList(); sources = new IntArrayList(); targets = new IntArrayList(); nodeLabels = new ArrayList<String>(); edgeLabels = new ArrayList<String>(); edge_root_index_pairs = new Vector(); node_root_index_pairs = new Vector(); }
/** * Returns a deep copy of the receiver. * * @return a deep copy of the receiver. */ public Object clone() { // overridden for performance only. IntArrayList clone = new IntArrayList((int[]) elements.clone()); clone.setSizeRaw(size); return clone; } /**
/** * Returns a deep copy of the receiver. * * @return a deep copy of the receiver. */ public Object clone() { // overridden for performance only. IntArrayList clone = new IntArrayList((int[]) elements.clone()); clone.setSizeRaw(size); return clone; } /**
/** * Returns a deep copy of the receiver. * * @return a deep copy of the receiver. */ public Object clone() { // overridden for performance only. IntArrayList clone = new IntArrayList((int[]) elements.clone()); clone.setSizeRaw(size); return clone; }
public SimplePermutation() { permutation = new IntArrayList(); permutationHash = new OpenIntIntHashMap(); positionHash = new OpenIntIntHashMap(); elementsHashDirty = true; }
/** * Returns a list filled with all values contained in the receiver. * The returned list has a size that equals <tt>this.size()</tt>. * Iteration order is guaranteed to be <i>identical</i> to the order used by method {@link #forEachKey(DoubleProcedure)}. * <p> * This method can be used to iterate over the values of the receiver. * * @return the values. */ public IntArrayList values() { IntArrayList list = new IntArrayList(size()); values(list); return list; } /**
/** * Returns a list filled with all values contained in the receiver. The * returned list has a size that equals <tt>this.size()</tt>. Iteration * order is guaranteed to be <i>identical</i> to the order used by method * {@link #forEachKey(DoubleProcedure)}. * <p> * This method can be used to iterate over the values of the receiver. * * @return the values. */ public IntArrayList values() { IntArrayList list = new IntArrayList(size()); values(list); return list; }
/** * Returns a list filled with all values contained in the receiver. The * returned list has a size that equals <tt>this.size()</tt>. Iteration * order is guaranteed to be <i>identical</i> to the order used by method * {@link #forEachKey(IntProcedure)}. * <p> * This method can be used to iterate over the values of the receiver. * * @return the values. */ public IntArrayList values() { IntArrayList list = new IntArrayList(size()); values(list); return list; }
/** * Sets the receiver's elements to be the specified array. * The size and capacity of the list is the length of the array. * <b>WARNING:</b> For efficiency reasons and to keep memory usage low, this method may decide <b>not to copy the array</b>. * So if subsequently you modify the returned array directly via the [] operator, be sure you know what you're doing. * * @param elements the new elements to be stored. * @return the receiver itself. */ public AbstractIntList elements(int[] elements) { clear(); addAllOfFromTo(new IntArrayList(elements),0,elements.length-1); return this; } /**
/** * Returns a list which is a concatenation of <code>times</code> times the receiver. * @param times the number of times the receiver shall be copied. */ public AbstractIntList times(int times) { AbstractIntList newList = new IntArrayList(times*size()); for (int i=times; --i >= 0; ) { newList.addAllOfFromTo(this,0,size()-1); } return newList; } /**
public List<ConceptData> getConceptDataList(DoubleMatrix1D v1){ IntArrayList arg0 = new IntArrayList() ; DoubleArrayList arg1=new DoubleArrayList(); v1.getNonZeros(arg0, arg1); List<ConceptData> vectorTopic=new ArrayList<ConceptData>() ; for(int i=0;i<arg0.size();i++){ String concept=inverseindex.get(arg0.get(i)); ConceptData data=new ConceptData(concept,arg1.get(i)); vectorTopic.add(data); } return vectorTopic; }
/** * Returns a list which is a concatenation of <code>times</code> times the receiver. * @param times the number of times the receiver shall be copied. */ public AbstractIntList times(int times) { AbstractIntList newList = new IntArrayList(times*size()); for (int i=times; --i >= 0; ) { newList.addAllOfFromTo(this,0,size()-1); } return newList; } /**
/** * Not yet commented. */ public static void test(int weight, int size) { WeightedRandomSampler sampler = new WeightedRandomSampler(); sampler.setWeight(weight); cern.colt.list.IntArrayList sample = new cern.colt.list.IntArrayList(); for (int i=0; i<size; i++) { if (sampler.sampleNextElement()) sample.add(i); } System.out.println("Sample = "+sample); } /**
/** * Returns a list which is a concatenation of <code>times</code> times the * receiver. * * @param times * the number of times the receiver shall be copied. */ public AbstractIntList times(int times) { AbstractIntList newList = new IntArrayList(times * size()); for (int i = times; --i >= 0;) { newList.addAllOfFromTo(this, 0, size() - 1); } return newList; }
/** * Not yet commented. */ public static void test(int weight, int size) { WeightedRandomSampler sampler = new WeightedRandomSampler(); sampler.setWeight(weight); cern.colt.list.IntArrayList sample = new cern.colt.list.IntArrayList(); for (int i=0; i<size; i++) { if (sampler.sampleNextElement()) sample.add(i); } System.out.println("Sample = "+sample); } /**
@Override public double[] getAssignedValue() { double[] result = new double[data.size()]; data.pairsSortedByKey(new IntArrayList(data.size()), new DoubleArrayList(result)); return result; }
/** * DOCUMENT ME! * * @return DOCUMENT ME! */ public int[] getEdgeIndicesArray() { final IntArrayList edge_indices = new IntArrayList(edges.size()); edges.keys(edge_indices); edge_indices.trimToSize(); return edge_indices.elements(); }
protected double normQuick(SparseDoubleMatrix1D v) { IntArrayList indexList = new IntArrayList(); DoubleArrayList valueList = new DoubleArrayList(); v.getNonZeros(indexList, valueList); double norm = 0.0; for (int i = 0; i < valueList.size(); ++i) { norm += valueList.get(i) * valueList.get(i); } return norm; }