use of com.tencent.angel.ps.storage.vector.ServerIntLongRow in project angel by Tencent.
the class MergeUtils method combineServerIntLongRowSplits.
private static Vector combineServerIntLongRowSplits(List<ServerRow> rowSplits, MatrixMeta matrixMeta, int rowIndex) {
int colNum = (int) matrixMeta.getColNum();
int elemNum = 0;
int size = rowSplits.size();
for (int i = 0; i < size; i++) {
elemNum += rowSplits.get(i).size();
}
IntLongVector row;
if (matrixMeta.isHash()) {
row = VFactory.sparseLongVector(colNum, elemNum);
} else {
if (elemNum >= (int) (storageConvFactor * colNum)) {
row = VFactory.denseLongVector(colNum);
} else {
row = VFactory.sparseLongVector(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;
}
((ServerIntLongRow) rowSplits.get(i)).mergeTo(row);
}
return row;
}
use of com.tencent.angel.ps.storage.vector.ServerIntLongRow in project angel by Tencent.
the class RowSplitCombineUtils method combineServerIntLongRowSplits.
private static Vector combineServerIntLongRowSplits(List<ServerRow> rowSplits, MatrixMeta matrixMeta, int rowIndex) {
int colNum = (int) matrixMeta.getColNum();
int elemNum = 0;
int size = rowSplits.size();
for (int i = 0; i < size; i++) {
elemNum += rowSplits.get(i).size();
}
IntLongVector row;
if (elemNum >= (int) (storageConvFactor * colNum)) {
row = VFactory.denseLongVector(colNum);
} else {
row = VFactory.sparseLongVector(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();
}
((ServerIntLongRow) rowSplits.get(i)).mergeTo(row);
}
row.setClock(clock);
return row;
}
Aggregations