Search in sources :

Example 1 with ServerLongDoubleRow

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

the class RowSplitCombineUtils method combineServerLongDoubleRowSplits.

private static Vector combineServerLongDoubleRowSplits(List<ServerRow> rowSplits, MatrixMeta matrixMeta, int rowIndex) {
    long colNum = matrixMeta.getColNum();
    int elemNum = 0;
    int size = rowSplits.size();
    for (int i = 0; i < size; i++) {
        elemNum += rowSplits.get(i).size();
    }
    LongDoubleVector row = VFactory.sparseLongKeyDoubleVector(colNum, elemNum);
    row.setMatrixId(matrixMeta.getId());
    row.setRowId(rowIndex);
    Collections.sort(rowSplits, serverRowComp);
    int clock = Integer.MAX_VALUE;
    for (int i = 0; i < size; i++) {
        if (rowSplits.get(i) == null) {
            continue;
        }
        if (rowSplits.get(i).getClock() < clock) {
            clock = rowSplits.get(i).getClock();
        }
        ((ServerLongDoubleRow) rowSplits.get(i)).mergeTo(row);
    }
    row.setClock(clock);
    return row;
}
Also used : LongDoubleVector(com.tencent.angel.ml.math2.vector.LongDoubleVector) ServerLongDoubleRow(com.tencent.angel.ps.storage.vector.ServerLongDoubleRow)

Example 2 with ServerLongDoubleRow

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

the class MergeUtils method combineServerLongDoubleRowSplits.

private static Vector combineServerLongDoubleRowSplits(List<ServerRow> rowSplits, MatrixMeta matrixMeta, int rowIndex) {
    long colNum = matrixMeta.getColNum();
    int elemNum = 0;
    int size = rowSplits.size();
    for (int i = 0; i < size; i++) {
        elemNum += rowSplits.get(i).size();
    }
    LongDoubleVector row = VFactory.sparseLongKeyDoubleVector(colNum, elemNum);
    row.setMatrixId(matrixMeta.getId());
    row.setRowId(rowIndex);
    Collections.sort(rowSplits, serverRowComp);
    for (int i = 0; i < size; i++) {
        if (rowSplits.get(i) == null) {
            continue;
        }
        ((ServerLongDoubleRow) rowSplits.get(i)).mergeTo(row);
    }
    return row;
}
Also used : LongDoubleVector(com.tencent.angel.ml.math2.vector.LongDoubleVector) ServerLongDoubleRow(com.tencent.angel.ps.storage.vector.ServerLongDoubleRow)

Aggregations

LongDoubleVector (com.tencent.angel.ml.math2.vector.LongDoubleVector)2 ServerLongDoubleRow (com.tencent.angel.ps.storage.vector.ServerLongDoubleRow)2