Search in sources :

Example 1 with LongElementStorage

use of com.tencent.angel.ps.storage.vector.storage.LongElementStorage in project angel by Tencent.

the class ComplexRowFormat method save.

private void save(ServerLongAnyRow row, PSMatrixSaveContext saveContext, MatrixPartitionMeta partMeta, DataOutputStream output) throws IOException {
    LongElementStorage storage = row.getStorage();
    ObjectIterator<Long2ObjectMap.Entry<IElement>> iter = storage.iterator();
    long startPos = partMeta.getStartCol();
    while (iter.hasNext()) {
        Long2ObjectMap.Entry<IElement> entry = iter.next();
        save(entry.getLongKey() + startPos, entry.getValue(), output);
    }
}
Also used : Entry(java.util.Map.Entry) IElement(com.tencent.angel.ps.storage.vector.element.IElement) Long2ObjectMap(it.unimi.dsi.fastutil.longs.Long2ObjectMap) LongElementStorage(com.tencent.angel.ps.storage.vector.storage.LongElementStorage)

Example 2 with LongElementStorage

use of com.tencent.angel.ps.storage.vector.storage.LongElementStorage in project angel by Tencent.

the class NnzFeature method processRow.

@Override
public double processRow(ServerRow row) {
    LongElementStorage storage = ((ServerLongAnyRow) row).getStorage();
    ObjectIterator<Long2ObjectMap.Entry<IElement>> it = storage.iterator();
    long size = 0;
    while (it.hasNext()) {
        Node node = (Node) (it.next().getValue());
        if (node.getFeats() != null) {
            size++;
        }
    }
    return size;
}
Also used : Node(com.tencent.angel.graph.data.Node) LongElementStorage(com.tencent.angel.ps.storage.vector.storage.LongElementStorage) ServerLongAnyRow(com.tencent.angel.ps.storage.vector.ServerLongAnyRow)

Example 3 with LongElementStorage

use of com.tencent.angel.ps.storage.vector.storage.LongElementStorage in project angel by Tencent.

the class NnzFeature method processRow.

@Override
public double processRow(ServerRow row) {
    LongElementStorage storage = ((ServerLongAnyRow) row).getStorage();
    ObjectIterator<Long2ObjectMap.Entry<IElement>> it = storage.iterator();
    long size = 0;
    while (it.hasNext()) {
        GraphNode node = (GraphNode) (it.next().getValue());
        if (node.getFeats() != null) {
            size++;
        }
    }
    return size;
}
Also used : LongElementStorage(com.tencent.angel.ps.storage.vector.storage.LongElementStorage) GraphNode(com.tencent.angel.graph.data.GraphNode) ServerLongAnyRow(com.tencent.angel.ps.storage.vector.ServerLongAnyRow)

Example 4 with LongElementStorage

use of com.tencent.angel.ps.storage.vector.storage.LongElementStorage in project angel by Tencent.

the class NnzEdge method processRow.

@Override
public double processRow(ServerRow row) {
    LongElementStorage storage = ((ServerLongAnyRow) row).getStorage();
    ObjectIterator<Long2ObjectMap.Entry<IElement>> it = storage.iterator();
    long size = 0;
    while (it.hasNext()) {
        GraphNode node = (GraphNode) (it.next().getValue());
        if (node.getNeighbors() != null) {
            size += node.getNeighbors().length;
        }
    }
    return size;
}
Also used : LongElementStorage(com.tencent.angel.ps.storage.vector.storage.LongElementStorage) GraphNode(com.tencent.angel.graph.data.GraphNode) ServerLongAnyRow(com.tencent.angel.ps.storage.vector.ServerLongAnyRow)

Example 5 with LongElementStorage

use of com.tencent.angel.ps.storage.vector.storage.LongElementStorage in project angel by Tencent.

the class NnzNeighbor method processRow.

@Override
public double processRow(ServerRow row) {
    LongElementStorage storage = ((ServerLongAnyRow) row).getStorage();
    ObjectIterator<Long2ObjectMap.Entry<IElement>> it = storage.iterator();
    int size = 0;
    while (it.hasNext()) {
        GraphNode node = (GraphNode) (it.next().getValue());
        if (node.getNeighbors() != null) {
            size++;
        }
    }
    return size;
}
Also used : LongElementStorage(com.tencent.angel.ps.storage.vector.storage.LongElementStorage) GraphNode(com.tencent.angel.graph.data.GraphNode) ServerLongAnyRow(com.tencent.angel.ps.storage.vector.ServerLongAnyRow)

Aggregations

LongElementStorage (com.tencent.angel.ps.storage.vector.storage.LongElementStorage)7 ServerLongAnyRow (com.tencent.angel.ps.storage.vector.ServerLongAnyRow)6 GraphNode (com.tencent.angel.graph.data.GraphNode)3 Node (com.tencent.angel.graph.data.Node)3 IElement (com.tencent.angel.ps.storage.vector.element.IElement)1 Long2ObjectMap (it.unimi.dsi.fastutil.longs.Long2ObjectMap)1 Entry (java.util.Map.Entry)1