Search in sources :

Example 1 with FullPartitionAggrResult

use of com.tencent.angel.ml.matrix.psf.aggr.enhance.FullPartitionAggrResult in project angel by Tencent.

the class FullPull method merge.

@Override
public GetResult merge(List<PartitionGetResult> partResults) {
    int endRow = -1;
    int endCol = -1;
    for (PartitionGetResult partResult : partResults) {
        FullPartitionAggrResult result = (FullPartitionAggrResult) partResult;
        int[] partInfo = result.getPartInfo();
        assert (partInfo.length == 4);
        if (endRow < partInfo[1])
            endRow = partInfo[1];
        if (endCol < partInfo[3])
            endCol = partInfo[3];
    }
    double[][] result = new double[endRow][endCol];
    for (PartitionGetResult partResult : partResults) {
        FullPartitionAggrResult aggrResult = (FullPartitionAggrResult) partResult;
        double[][] pResult = aggrResult.getResult();
        int[] partInfo = aggrResult.getPartInfo();
        int thisStartRow = partInfo[0];
        int thisEndRow = partInfo[1];
        int thisStartCol = partInfo[2];
        int thisEndCol = partInfo[3];
        int thisColSize = thisEndCol - thisStartCol;
        for (int i = 0; i < pResult.length; i++) {
            System.arraycopy(pResult[i], 0, result[thisStartRow + i], thisStartCol, thisColSize);
        }
    }
    return new FullAggrResult(result);
}
Also used : FullAggrResult(com.tencent.angel.ml.matrix.psf.aggr.enhance.FullAggrResult) PartitionGetResult(com.tencent.angel.ml.matrix.psf.get.base.PartitionGetResult) FullPartitionAggrResult(com.tencent.angel.ml.matrix.psf.aggr.enhance.FullPartitionAggrResult)

Aggregations

FullAggrResult (com.tencent.angel.ml.matrix.psf.aggr.enhance.FullAggrResult)1 FullPartitionAggrResult (com.tencent.angel.ml.matrix.psf.aggr.enhance.FullPartitionAggrResult)1 PartitionGetResult (com.tencent.angel.ml.matrix.psf.get.base.PartitionGetResult)1