Search in sources :

Example 1 with FloatVector

use of com.tencent.angel.ml.math2.vector.FloatVector in project angel by Tencent.

the class MyPull method partitionGet.

@Override
public PartitionGetResult partitionGet(PartitionGetParam partParam) {
    MyPullPartParam param = (MyPullPartParam) partParam;
    ServerRow msgRows = psContext.getMatrixStorageManager().getRow(param.getPartKey(), param.getDeltaId());
    ServerRow sumsRow = psContext.getMatrixStorageManager().getRow(param.getPartKey(), param.getSumId());
    long start = param.getPartKey().getStartCol();
    long range = param.getPartKey().getEndCol() - start;
    FloatVector msgs = ServerRowUtils.getVector((ServerLongFloatRow) msgRows);
    FloatVector sums = ServerRowUtils.getVector((ServerLongFloatRow) sumsRow);
    return new MyPullPartResult(param.getKeys(), start, msgs, sums, param.getResetProb(), param.getTol());
}
Also used : ServerRow(com.tencent.angel.ps.storage.vector.ServerRow) FloatVector(com.tencent.angel.ml.math2.vector.FloatVector)

Example 2 with FloatVector

use of com.tencent.angel.ml.math2.vector.FloatVector in project angel by Tencent.

the class GetNodes method partitionGet.

@Override
public PartitionGetResult partitionGet(PartitionGetParam partParam) {
    ServerPartition part = psContext.getMatrixStorageManager().getPart(partParam.getPartKey());
    ServerRow ranks = psContext.getMatrixStorageManager().getRow(partParam.getPartKey(), 2);
    FloatVector ranksVector = ServerRowUtils.getVector((ServerLongFloatRow) ranks);
    long[] ret;
    if (ranksVector instanceof IntFloatVector)
        ret = gatherNodes((IntFloatVector) ranksVector, part.getPartitionKey().getStartCol());
    else if (ranksVector instanceof LongFloatVector)
        ret = gatherNodes((LongFloatVector) ranksVector, part.getPartitionKey().getStartCol());
    else {
        throw new AngelException("vector should be intfloat or longfloat but is " + ranksVector.getClass().getName());
    }
    return new IndexPartGetLongResult(part.getPartitionKey(), ret);
}
Also used : AngelException(com.tencent.angel.exception.AngelException) IndexPartGetLongResult(com.tencent.angel.ml.matrix.psf.get.indexed.IndexPartGetLongResult) ServerRow(com.tencent.angel.ps.storage.vector.ServerRow) IntFloatVector(com.tencent.angel.ml.math2.vector.IntFloatVector) FloatVector(com.tencent.angel.ml.math2.vector.FloatVector) LongFloatVector(com.tencent.angel.ml.math2.vector.LongFloatVector) LongFloatVector(com.tencent.angel.ml.math2.vector.LongFloatVector) ServerPartition(com.tencent.angel.ps.storage.partition.ServerPartition) IntFloatVector(com.tencent.angel.ml.math2.vector.IntFloatVector)

Aggregations

FloatVector (com.tencent.angel.ml.math2.vector.FloatVector)2 ServerRow (com.tencent.angel.ps.storage.vector.ServerRow)2 AngelException (com.tencent.angel.exception.AngelException)1 IntFloatVector (com.tencent.angel.ml.math2.vector.IntFloatVector)1 LongFloatVector (com.tencent.angel.ml.math2.vector.LongFloatVector)1 IndexPartGetLongResult (com.tencent.angel.ml.matrix.psf.get.indexed.IndexPartGetLongResult)1 ServerPartition (com.tencent.angel.ps.storage.partition.ServerPartition)1