use of it.unimi.dsi.fastutil.ints.Int2DoubleRBTreeMap in project ignite by apache.
the class SparseDistributedMatrixStorage method matrixSet.
/**
* Distributed matrix set.
*
* @param a Row or column index.
* @param b Row or column index.
* @param v New value to set.
*/
private void matrixSet(int a, int b, double v) {
// Remote set on the primary node (where given row or column is stored locally).
ignite().compute(getClusterGroupForGivenKey(CACHE_NAME, a)).run(() -> {
IgniteCache<RowColMatrixKey, Map<Integer, Double>> cache = Ignition.localIgnite().getOrCreateCache(CACHE_NAME);
// Local get.
Map<Integer, Double> map = cache.localPeek(getCacheKey(a), CachePeekMode.PRIMARY);
if (map == null) {
// Remote entry get.
map = cache.get(getCacheKey(a));
if (map == null)
map = acsMode == SEQUENTIAL_ACCESS_MODE ? new Int2DoubleRBTreeMap() : new Int2DoubleOpenHashMap();
}
if (v != 0.0)
map.put(b, v);
else if (map.containsKey(b))
map.remove(b);
// Local put.
cache.put(getCacheKey(a), map);
});
}
Aggregations