use of com.tencent.angel.ml.matrix.RowType in project angel by Tencent.
the class GetRowSplitResponse method deserialize.
@Override
public void deserialize(ByteBuf buf) {
super.deserialize(buf);
if (buf.readableBytes() == 0) {
rowSplit = null;
return;
}
RowType type = RowType.valueOf(buf.readInt());
if (rowSplit == null) {
switch(type) {
case T_DOUBLE_DENSE:
{
rowSplit = new ServerDenseDoubleRow();
break;
}
case T_FLOAT_DENSE:
{
rowSplit = new ServerDenseFloatRow();
break;
}
case T_DOUBLE_SPARSE:
case T_DOUBLE_SPARSE_COMPONENT:
{
rowSplit = new ServerSparseDoubleRow();
break;
}
case T_DOUBLE_SPARSE_LONGKEY:
{
rowSplit = new ServerSparseDoubleLongKeyRow();
break;
}
case T_INT_DENSE:
{
rowSplit = new ServerDenseIntRow();
break;
}
case T_FLOAT_SPARSE:
case T_FLOAT_SPARSE_COMPONENT:
{
rowSplit = new ServerSparseFloatRow();
break;
}
case T_INT_SPARSE:
case T_INT_SPARSE_COMPONENT:
{
rowSplit = new ServerSparseIntRow();
break;
}
default:
break;
}
}
if (rowSplit != null) {
rowSplit.deserialize(buf);
}
}
use of com.tencent.angel.ml.matrix.RowType in project angel by Tencent.
the class ServerPartition method update.
public void update(ByteBuf buf, RowUpdater updater) throws Exception {
startUpdate();
try {
int rowNum = buf.readInt();
int rowId;
RowType rowType;
int size;
for (int i = 0; i < rowNum; i++) {
rowId = buf.readInt();
rowType = RowType.valueOf(buf.readInt());
size = buf.readInt();
if (size == 0)
continue;
ServerRow row = getRow(rowId);
updater.update(rowType, size, buf, row);
}
} finally {
endUpdate();
}
}
use of com.tencent.angel.ml.matrix.RowType in project angel by Tencent.
the class ServerPartition method deserialize.
@Override
public void deserialize(ByteBuf buf) {
partitionKey = new PartitionKey();
partitionKey.deserialize(buf);
rowType = RowType.valueOf(buf.readInt());
int rowNum = buf.readInt();
RowType rowType;
for (int i = 0; i < rowNum; i++) {
rowType = RowType.valueOf(buf.readInt());
ServerRow row = initRow(rowType);
row.deserialize(buf);
rows.put(row.getRowId(), row);
}
}
Aggregations