Search in sources :

Example 1 with ArrayAggrResult

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

the class PullWithCols method merge.

@Override
public GetResult merge(List<PartitionGetResult> partResults) {
    ArrayList<Long> cols = new ArrayList<>();
    ArrayList<Double> result = new ArrayList<>();
    for (PartitionGetResult part : partResults) {
        ArrayPartitionAggrResult partResult = (ArrayPartitionAggrResult) part;
        long[] keys = partResult.getCols();
        double[] values = partResult.getResult();
        assert (keys.length == values.length);
        for (int i = 0; i < keys.length; i++) {
            cols.add(keys[i]);
            result.add(values[i]);
        }
    }
    return new ArrayAggrResult(Utils.longListToArray(cols), Utils.doubleListToArray(result));
}
Also used : ArrayPartitionAggrResult(com.tencent.angel.ml.matrix.psf.aggr.enhance.ArrayPartitionAggrResult) ArrayAggrResult(com.tencent.angel.ml.matrix.psf.aggr.enhance.ArrayAggrResult) PartitionGetResult(com.tencent.angel.ml.matrix.psf.get.base.PartitionGetResult)

Aggregations

ArrayAggrResult (com.tencent.angel.ml.matrix.psf.aggr.enhance.ArrayAggrResult)1 ArrayPartitionAggrResult (com.tencent.angel.ml.matrix.psf.aggr.enhance.ArrayPartitionAggrResult)1 PartitionGetResult (com.tencent.angel.ml.matrix.psf.get.base.PartitionGetResult)1