use of com.tencent.angel.ps.storage.vector.ServerIntFloatRow in project angel by Tencent.
the class RowSplitCombineUtils method combineServerIntFloatRowSplits.
private static Vector combineServerIntFloatRowSplits(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();
}
IntFloatVector row;
if (elemNum >= (int) (storageConvFactor * colNum)) {
row = VFactory.denseFloatVector(colNum);
} else {
row = VFactory.sparseFloatVector(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();
}
((ServerIntFloatRow) rowSplits.get(i)).mergeTo(row);
}
row.setClock(clock);
return row;
}
use of com.tencent.angel.ps.storage.vector.ServerIntFloatRow in project angel by Tencent.
the class MergeUtils method combineServerIntFloatRowSplits.
private static Vector combineServerIntFloatRowSplits(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();
}
IntFloatVector row;
if (matrixMeta.isHash()) {
row = VFactory.sparseFloatVector(colNum, elemNum);
} else {
if (elemNum >= (int) (storageConvFactor * colNum)) {
row = VFactory.denseFloatVector(colNum);
} else {
row = VFactory.sparseFloatVector(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;
}
((ServerIntFloatRow) rowSplits.get(i)).mergeTo(row);
}
return row;
}
Aggregations