Java 类it.unimi.dsi.fastutil.ints.Int2DoubleRBTreeMap 实例源码

项目:Higher-Cloud-Computing-Project    文件:SparseDistributedMatrixStorage.java   
/**
 * 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) {
            map = cache.get(getCacheKey(a)); //Remote entry get.

            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);
    });
}
项目:ignite    文件:SparseDistributedMatrixStorage.java   
/**
 * 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) {
            map = cache.get(getCacheKey(a)); //Remote entry get.

            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);
    });
}
项目:naisc    文件:SparseVector.java   
/**
 * Convenience constructor for tests, use DenseVector for production code
 * @param data 
 */
public SparseVector(double[] data) {
    this.underlying = new Int2DoubleRBTreeMap();
    this.size = data.length;
    for(int i = 0; i < data.length; i++) {
        underlying.put(i, data[i]);
    }
}
项目:naisc    文件:SparseVector.java   
public SparseVector(int size) {
    this.underlying = new Int2DoubleRBTreeMap();
    this.size = size;
}