use of com.tencent.angel.ps.server.data.request.UpdateOp in project angel by Tencent.
the class UpdateColsFunc method partitionUpdate.
@Override
public void partitionUpdate(PartitionUpdateParam partParam) {
PartitionUpdateColsParam param = (PartitionUpdateColsParam) partParam;
int[] rows = param.rows;
long[] cols = param.cols;
Vector vector = param.vector;
UpdateOp op = param.op;
int matId = param.getMatrixId();
int partitionId = param.getPartKey().getPartitionId();
RowBasedPartition partition = (RowBasedPartition) psContext.getMatrixStorageManager().getPart(matId, partitionId);
switch(partition.getRowType()) {
case T_DOUBLE_DENSE:
case T_DOUBLE_SPARSE:
{
ServerIntDoubleRow[] doubles = new ServerIntDoubleRow[rows.length];
for (int r = 0; r < rows.length; r++) doubles[r] = (ServerIntDoubleRow) partition.getRow(rows[r]);
doUpdate((CompIntDoubleVector) vector, rows, cols, doubles, op);
return;
}
case T_DOUBLE_SPARSE_LONGKEY:
{
ServerLongDoubleRow[] doubles = new ServerLongDoubleRow[rows.length];
for (int r = 0; r < rows.length; r++) doubles[r] = (ServerLongDoubleRow) partition.getRow(rows[r]);
doUpdate((CompIntDoubleVector) vector, rows, cols, doubles, op);
return;
}
case T_FLOAT_DENSE:
case T_FLOAT_SPARSE:
{
ServerIntFloatRow[] floats = new ServerIntFloatRow[rows.length];
for (int r = 0; r < rows.length; r++) floats[r] = (ServerIntFloatRow) partition.getRow(rows[r]);
doUpdate((CompIntFloatVector) vector, rows, cols, floats, op);
return;
}
case T_FLOAT_SPARSE_LONGKEY:
{
ServerLongFloatRow[] floats = new ServerLongFloatRow[rows.length];
for (int r = 0; r < rows.length; r++) floats[r] = (ServerLongFloatRow) partition.getRow(rows[r]);
doUpdate((CompIntFloatVector) vector, rows, cols, floats, op);
return;
}
default:
throw new AngelException("Data type should be double or float!");
}
}
Aggregations