Search in sources :

Example 6 with IndexPartGetLongResult

use of com.tencent.angel.ml.matrix.psf.get.indexed.IndexPartGetLongResult in project angel by Tencent.

the class GetNodes method merge.

@Override
public GetResult merge(List<PartitionGetResult> partResults) {
    int size = 0;
    for (PartitionGetResult result : partResults) {
        if (result instanceof IndexPartGetLongResult) {
            size += ((IndexPartGetLongResult) result).getValues().length;
        }
    }
    long[] values = new long[size];
    int start = 0;
    for (PartitionGetResult result : partResults) {
        if (result instanceof IndexPartGetLongResult) {
            long[] vals = ((IndexPartGetLongResult) result).getValues();
            System.arraycopy(vals, 0, values, start, vals.length);
            start += vals.length;
        }
    }
    return new GetRowResult(ResponseType.SUCCESS, VFactory.denseLongVector(values));
}
Also used : IndexPartGetLongResult(com.tencent.angel.ml.matrix.psf.get.indexed.IndexPartGetLongResult) GetRowResult(com.tencent.angel.ml.matrix.psf.get.getrow.GetRowResult) PartitionGetResult(com.tencent.angel.ml.matrix.psf.get.base.PartitionGetResult)

Aggregations

IndexPartGetLongResult (com.tencent.angel.ml.matrix.psf.get.indexed.IndexPartGetLongResult)6 ServerLongAnyRow (com.tencent.angel.ps.storage.vector.ServerLongAnyRow)3 Long2ObjectMap (it.unimi.dsi.fastutil.longs.Long2ObjectMap)3 LongArrayList (it.unimi.dsi.fastutil.longs.LongArrayList)3 PartitionGetResult (com.tencent.angel.ml.matrix.psf.get.base.PartitionGetResult)2 GetRowResult (com.tencent.angel.ml.matrix.psf.get.getrow.GetRowResult)2 ServerPartition (com.tencent.angel.ps.storage.partition.ServerPartition)2 AngelException (com.tencent.angel.exception.AngelException)1 GraphNode (com.tencent.angel.graph.data.GraphNode)1 Node (com.tencent.angel.graph.data.Node)1 FloatVector (com.tencent.angel.ml.math2.vector.FloatVector)1 IntFloatVector (com.tencent.angel.ml.math2.vector.IntFloatVector)1 LongFloatVector (com.tencent.angel.ml.math2.vector.LongFloatVector)1 ServerRow (com.tencent.angel.ps.storage.vector.ServerRow)1 IElement (com.tencent.angel.ps.storage.vector.element.IElement)1 Entry (it.unimi.dsi.fastutil.longs.Long2ObjectMap.Entry)1