Search in sources :

Example 36 with RowType

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);
    }
}
Also used : RowType(com.tencent.angel.ml.matrix.RowType)

Example 37 with RowType

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();
    }
}
Also used : RowType(com.tencent.angel.ml.matrix.RowType)

Example 38 with RowType

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);
    }
}
Also used : PartitionKey(com.tencent.angel.PartitionKey) RowType(com.tencent.angel.ml.matrix.RowType)

Aggregations

RowType (com.tencent.angel.ml.matrix.RowType)38 MatrixMeta (com.tencent.angel.ml.matrix.MatrixMeta)7 MatrixFilesMeta (com.tencent.angel.model.output.format.MatrixFilesMeta)7 IOException (java.io.IOException)7 Vector (com.tencent.angel.ml.math2.vector.Vector)5 IntDoubleVector (com.tencent.angel.ml.math2.vector.IntDoubleVector)4 IntFloatVector (com.tencent.angel.ml.math2.vector.IntFloatVector)4 LongFloatVector (com.tencent.angel.ml.math2.vector.LongFloatVector)4 LongIntVector (com.tencent.angel.ml.math2.vector.LongIntVector)3 PartitionKey (com.tencent.angel.PartitionKey)2 AngelException (com.tencent.angel.exception.AngelException)2 RowBasedMatrix (com.tencent.angel.ml.math2.matrix.RowBasedMatrix)2 IntIntVector (com.tencent.angel.ml.math2.vector.IntIntVector)2 IntLongVector (com.tencent.angel.ml.math2.vector.IntLongVector)2 LongDoubleVector (com.tencent.angel.ml.math2.vector.LongDoubleVector)2 ServerRow (com.tencent.angel.ps.storage.vector.ServerRow)2 BlasDoubleMatrix (com.tencent.angel.ml.math2.matrix.BlasDoubleMatrix)1 BlasFloatMatrix (com.tencent.angel.ml.math2.matrix.BlasFloatMatrix)1 RBIntDoubleMatrix (com.tencent.angel.ml.math2.matrix.RBIntDoubleMatrix)1 RBIntFloatMatrix (com.tencent.angel.ml.math2.matrix.RBIntFloatMatrix)1