@Override public int getNumberOfAssignedValue() { return data.size(); }
@Override public String getInfo() { return "Double vector sparse(Colt): " + data.size() + "/" + size(); }
/** * Trims the capacity of the receiver to be the receiver's current * size. Releases any superfluous internal memory. An application can use this operation to minimize the * storage of the receiver. */ public void trimToSize() { // * 1.2 because open addressing's performance exponentially degrades beyond that point // so that even rehashing the table can take very long int newCapacity = nextPrime((int)(1 + 1.2*size())); if (table.length > newCapacity) { rehash(newCapacity); } } /**
/** * Trims the capacity of the receiver to be the receiver's current * size. Releases any superfluous internal memory. An application can use this operation to minimize the * storage of the receiver. */ public void trimToSize() { // * 1.2 because open addressing's performance exponentially degrades beyond that point // so that even rehashing the table can take very long int newCapacity = nextPrime((int)(1 + 1.2*size())); if (table.length > newCapacity) { rehash(newCapacity); } } /**
/** * Trims the capacity of the receiver to be the receiver's current size. * Releases any superfluous internal memory. An application can use this * operation to minimize the storage of the receiver. */ public void trimToSize() { // * 1.2 because open addressing's performance exponentially degrades // beyond that point // so that even rehashing the table can take very long int newCapacity = nextPrime((int) (1 + 1.2 * size())); if (table.length > newCapacity) { rehash(newCapacity); } }
@Override public void map(final MapFunction f) { // on commence toujours par modifier la valeur par defaut // car les valeurs suivante pourrait prendre cette valeur // et donc disparaitre des tableaux si besoin defaultValue = f.apply(defaultValue); IntArrayList keys = new IntArrayList(data.size()); data.keys(keys); keys.forEach(new IntProcedure() { @Override public boolean apply(int i) { double value = data.get(i); value = f.apply(value); if (value == defaultValue) { data.removeKey(i); } else { data.put(i, value); } return true; } }); }