/** * Creates a new <code>TIntDoubleHashMap</code> instance containing * all of the entries in the map passed in. * * @param keys a <tt>int</tt> array containing the keys for the matching values. * @param values a <tt>double</tt> array containing the values. */ public TIntDoubleHashMap( int[] keys, double[] values ) { super( Math.max( keys.length, values.length ) ); int size = Math.min( keys.length, values.length ); for ( int i = 0; i < size; i++ ) { this.put( keys[i], values[i] ); } }
/** {@inheritDoc} */ public void putAll( Map<? extends Integer, ? extends Double> map ) { ensureCapacity( map.size() ); // could optimize this for cases when map instanceof THashMap for ( Map.Entry<? extends Integer, ? extends Double> entry : map.entrySet() ) { this.put( entry.getKey().intValue(), entry.getValue().doubleValue() ); } }
/** {@inheritDoc} */ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { // VERSION in.readByte(); // SUPER super.readExternal( in ); // NUMBER OF ENTRIES int size = in.readInt(); setUp( size ); // ENTRIES while (size-- > 0) { int key = in.readInt(); double val = in.readDouble(); put(key, val); } } } // TIntDoubleHashMap
/** {@inheritDoc} */ public void putAll( TIntDoubleMap map ) { ensureCapacity( map.size() ); TIntDoubleIterator iter = map.iterator(); while ( iter.hasNext() ) { iter.advance(); this.put( iter.key(), iter.value() ); } }
@Override public void setactivity(int value, double activity) { Av.put(value - os, activity); }
/** * Creates a new <code>TIntDoubleHashMap</code> instance containing * all of the entries in the map passed in. * * @param keys a <tt>int</tt> array containing the keys for the matching values. * @param values a <tt>double</tt> array containing the values. */ public TIntDoubleHashMap( int[] keys, double[] values ) { super( Math.max( keys.length, values.length ) ); int size = Math.min( keys.length, values.length ); for ( int i = 0; i < size; i++ ) { this.put( keys[i], values[i] ); } }
/** {@inheritDoc} */ public void putAll( Map<? extends Integer, ? extends Double> map ) { ensureCapacity( map.size() ); // could optimize this for cases when map instanceof THashMap for ( Map.Entry<? extends Integer, ? extends Double> entry : map.entrySet() ) { this.put( entry.getKey().intValue(), entry.getValue().doubleValue() ); } }
/** {@inheritDoc} */ public void putAll( Map<? extends Integer, ? extends Double> map ) { ensureCapacity( map.size() ); // could optimize this for cases when map instanceof THashMap for ( Map.Entry<? extends Integer, ? extends Double> entry : map.entrySet() ) { this.put( entry.getKey().intValue(), entry.getValue().doubleValue() ); } }
/** * {@inheritDoc} */ public void set(int index, double value) { if (value == 0d) vector.remove(index); else vector.put(index, value); magnitude = -1; nonZeroIndices = null; }
/** {@inheritDoc} */ @Override public void putAll( Map<? extends Integer, ? extends Double> map ) { ensureCapacity( map.size() ); // could optimize this for cases when map instanceof THashMap for ( Map.Entry<? extends Integer, ? extends Double> entry : map.entrySet() ) { this.put( entry.getKey().intValue(), entry.getValue().doubleValue() ); } }
/** {@inheritDoc} */ public void putAll( Map<? extends Integer, ? extends Double> map ) { ensureCapacity( map.size() ); // could optimize this for cases when map instanceof THashMap for ( Map.Entry<? extends Integer, ? extends Double> entry : map.entrySet() ) { this.put( entry.getKey().intValue(), entry.getValue().doubleValue() ); } }
/** * {@inheritDoc} */ public void set(int index, double value) { double old = vector.get(index); if (value == 0) vector.remove(index); else vector.put(index, value); magnitude = -1; }
@Override public SparseDoubleArray reverse() { //TODO: this could be more efficient and avoid the copy TIntDoubleHashMap tmp = new TIntDoubleHashMap(data.size()); for (Entry e : entries()) tmp.put(length - e.index, e.value); this.data = tmp; return this; } }
@Override public boolean execute(int a, TDoubleArrayList b) { final double noise = b.size() >= minNumberOfNoisePeaks ? b.getQuick(__quickselect(b, 0, b.size(), b.size()/2)) : 0d; noiseThresholds.put(a, noise); return true; } });
/** {@inheritDoc} */ public void putAll( TIntDoubleMap map ) { ensureCapacity( map.size() ); TIntDoubleIterator iter = map.iterator(); while ( iter.hasNext() ) { iter.advance(); this.put( iter.key(), iter.value() ); } }
/** {@inheritDoc} */ public void putAll( TIntDoubleMap map ) { ensureCapacity( map.size() ); TIntDoubleIterator iter = map.iterator(); while ( iter.hasNext() ) { iter.advance(); this.put( iter.key(), iter.value() ); } }
/** {@inheritDoc} */ @Override public void putAll( TIntDoubleMap map ) { ensureCapacity( map.size() ); TIntDoubleIterator iter = map.iterator(); while ( iter.hasNext() ) { iter.advance(); this.put( iter.key(), iter.value() ); } }
/** {@inheritDoc} */ public void putAll( TIntDoubleMap map ) { ensureCapacity( map.size() ); TIntDoubleIterator iter = map.iterator(); while ( iter.hasNext() ) { iter.advance(); this.put( iter.key(), iter.value() ); } }
@Override protected V filterSingleObject(V featureVector) { TIntDoubleHashMap vals = new TIntDoubleHashMap(); for(int it = featureVector.iter(); featureVector.iterValid(it); it = featureVector.iterAdvance(it)) { final int dim = featureVector.iterDim(it); vals.put(dim, featureVector.iterDoubleValue(it) * idf.get(dim)); } return ((SparseNumberVector.Factory<V>) factory).newNumberVector(vals, featureVector.getDimensionality()); }
@Override public V restore(V featureVector) { TIntDoubleHashMap vals = new TIntDoubleHashMap(); for(int it = featureVector.iter(); featureVector.iterValid(it); it = featureVector.iterAdvance(it)) { final int dim = featureVector.iterDim(it); vals.put(dim, featureVector.iterDoubleValue(it) / idf.get(dim)); } return ((SparseNumberVector.Factory<V>) factory).newNumberVector(vals, featureVector.getDimensionality()); }