public int getDocumentLength(int document) { if (_documentLenghts.containsKey(document)) return _documentLenghts.get(document); else { if (document < _documentsFrequencies.size()) { TIntArrayList frequencies = _documentsFrequencies.get(document); int length = 0; for (int i = 0; i < frequencies.size(); ++i) length += frequencies.getQuick(i); _documentLenghts.put(document, length); return length; } else return 0; } }
public void ours() { TIntIntHashMap ours = new TIntIntHashMap(SET_SIZE); for (int i = dataset.size(); i-- > 0;) { ours.put(i,i); } }
assert(currentTypeTopicCounts.get(oldTopic) >= 0); if (currentTypeTopicCounts.get(oldTopic) == 1) { currentTypeTopicCounts.remove(oldTopic); currentTypeTopicCounts.adjustValue(oldTopic, -1); tw = ((currentTypeTopicCounts.get(ti) + beta) / (tokensPerTopic[ti] + betaSum)) currentTypeTopicCounts.adjustOrPutValue(newTopic, 1, 1); tokensPerTopic[newTopic]++;
public void columnPlusEquals (int index, double value) { if (index2location == null) setIndex2Location (); int location = index2location.get(index); if (index2location.contains (index)) values[location] += value; else throw new IllegalArgumentException ("Trying to set value that isn't present in HashedSparseVector"); }
TIntIntHashMap htypes= new TIntIntHashMap(); // Table des types d'lments TIntIntHashMap hngpes= new TIntIntHashMap(); // Table des numros de groupe List vgpes= new ArrayList(); // Table des groupes for (int j=0; j<nbEl; j++) { int num=((RefondeElementData)mailElt.element(j).data()).numero; htypes.put(num, type); for (int j=0; j<nbEl; j++) { int num=((RefondeElementData)mailElt.element(j).data()).numero; hngpes.put(num, ngpe); for (int j=0; j<eltNb; j++) { int num=((RefondeElementData)grElt.element(j).data()).numero; htypes.put( num, type); hngpes.put(num, ngpe); else type=1; htypes.ensureCapacity(nbElt); for (int j= 0; j < nbElt; j++) { int num= ((RefondeElementData)grElt.element(j).data()).numero; htypes.put(num, type); hngpes.ensureCapacity(nbElt); for (int j= 0; j < nbElt; j++) { int num= ((RefondeElementData)grElt.element(j).data()).numero; hngpes.put(num, ngpe);
/** {@inheritDoc} */ @Override public DocumentIndexEntry getDocumentEntry(int docid) { //BasicDocumentIndexEntry die = new BasicDocumentIndexEntry(); // refactored by Dyaa NonIncrementalDocumentIndexEntry die = new NonIncrementalDocumentIndexEntry(); int diedocid= -1; if(docids2lengths.containsKey(docid)) diedocid = docid; die.setDocid(diedocid); die.setDocumentLength(docids2lengths.get(docid)); return die; }
private void setIndex2Location () { //System.out.println ("HashedSparseVector setIndex2Location indices.length="+indices.length+" maxindex="+indices[indices.length-1]); assert (index2location == null); assert (indices.length > 0); this.maxIndex = indices[indices.length - 1]; this.index2location = new TIntIntHashMap (numLocations ()); index2location.setDefaultValue (-1); for (int i = 0; i < indices.length; i++) index2location.put (indices[i], i); }
private void initializeTypeTopicCounts () { TIntIntHashMap[] newTypeTopicCounts = new TIntIntHashMap[numTypes]; for (int i = 0; i < typeTopicCounts.length; i++) newTypeTopicCounts[i] = typeTopicCounts[i]; for (int i = typeTopicCounts.length; i < numTypes; i++) newTypeTopicCounts[i] = new TIntIntHashMap(); this.typeTopicCounts = newTypeTopicCounts; }
@Override public void addConstraint(int fi, double[][] target, double weight) { constraintsList.add(new TwoLabelL2GEConstraint(target,weight)); constraintsMap.put(fi, constraintsList.size()-1); }
private void state() { logger.debug("***REALTIME*** Geometric merge state"); logger.debug("Number of columns: " + parts.size()); TIntIntIterator it = parts.iterator(); while (it.hasNext()) { it.advance(); logger.debug("Column: " + it.key()); logger.debug("Column prefixID: " + it.value()); logger.debug("Column merges: " + sizes.get(it.key())); logger.debug("Column merges (max): " + Math.pow(g, it.key())); } } }
private void setCachesCapacity (int n) { factorsByVar = new List [n]; for (int i = 0; i < n; i++) { factorsByVar[i] = new ArrayList (); } vertexPots = new List [n]; my2global = new int [n]; if (projectionMap == null) { projectionMap = new TIntIntHashMap (n); // projectionMap.setDefaultValue (-1); } else { projectionMap.ensureCapacity (n); } // no need to recreate edgePots if it exists, since it's a HashMap. if (pairwiseFactors == null) pairwiseFactors = new CSIntInt2ObjectMultiMap (); }
public IDSorter[] getSortedTopicWords(int topic) { IDSorter[] sortedTypes = new IDSorter[ numTypes ]; for (int type = 0; type < numTypes; type++) sortedTypes[type] = new IDSorter(type, typeTopicCounts[type].get(topic)); Arrays.sort(sortedTypes); return sortedTypes; }
/** * Empties the map. */ public void clear() { this._map.clear(); }
final TIntIntHashMap vxVy = resHolder.vxVy_; final TIntIntHashMap vyVx = resHolder.vyVx_; vxVy.ensureCapacity(size); vyVx.ensureCapacity(size); newVar.add(vy); vxVy.put(idxInit, idxY); vyVx.put(idxY, idxInit); newVar.add(vx); vxVy.put(idxX, idxInit); vyVx.put(idxInit, idxX);
public void removeDocuments(IIntIterator removedDocuments) { int shift = 0; while (removedDocuments.hasNext()) { int document = removedDocuments.next() - shift; _documentsFeatures.remove(document); _documentsFrequencies.remove(document); _documentLenghts.remove(document); ++shift; } _featureDocumentsCount.clear(); }
/** * Returns the number of entries in the map. * @return the map's size. */ public int size() { return this._map.size(); }