Search in sources :

Example 1 with MatrixOpLogType

use of com.tencent.angel.ml.matrix.MatrixOpLogType in project angel by Tencent.

the class MatrixOpLogCache method createMatrixOpLog.

private MatrixOpLog createMatrixOpLog(MatrixMeta matrixMeta) {
    int matrixId = matrixMeta.getId();
    String type = matrixMeta.getAttribute(MatrixConf.MATRIX_OPLOG_TYPE);
    boolean enableFilter = matrixMeta.getAttribute(MatrixConf.MATRIX_OPLOG_ENABLEFILTER, MatrixConf.DEFAULT_MATRIX_OPLOG_ENABLEFILTER).equalsIgnoreCase("true");
    if (type == null) {
        RowType rowType = matrixMeta.getRowType();
        switch(rowType) {
            case T_DOUBLE_DENSE:
                return new DenseDoubleMatrixOpLog(matrixId, enableFilter);
            case T_DOUBLE_SPARSE:
                return new SparseDoubleMatrixOplog(matrixId, enableFilter);
            case T_INT_DENSE:
                return new DenseIntMatrixOpLog(matrixId, enableFilter);
            case T_INT_SPARSE:
                return new SparseIntMatrixOpLog(matrixId, enableFilter);
            case T_FLOAT_DENSE:
                return new DenseFloatMatrixOplog(matrixId, enableFilter);
            case T_FLOAT_SPARSE:
                return new SparseFloatMatrixOpLog(matrixId, enableFilter);
            case T_DOUBLE_SPARSE_LONGKEY:
                return new SparseDoubleLongKeyMatrixOpLog(matrixId, enableFilter);
            case T_DOUBLE_SPARSE_LONGKEY_COMPONENT:
                return new CompSparseDoubleLongKeyMatrixOpLog(matrixId, enableFilter);
            case T_DOUBLE_SPARSE_COMPONENT:
                return new CompSparseDoubleMatrixOpLog(matrixId, enableFilter);
            case T_FLOAT_SPARSE_COMPONENT:
                return new CompSparseFloatMatrixOpLog(matrixId, enableFilter);
            case T_INT_SPARSE_COMPONENT:
                return new CompSparseIntMatrixOpLog(matrixId, enableFilter);
        }
    } else {
        MatrixOpLogType opLogType = MatrixOpLogType.valueOf(type);
        switch(opLogType) {
            case DENSE_DOUBLE:
                return new DenseDoubleMatrixOpLog(matrixId, enableFilter);
            case SPARSE_DOUBLE:
                return new SparseDoubleMatrixOplog(matrixId, enableFilter);
            case DENSE_INT:
                return new DenseIntMatrixOpLog(matrixId, enableFilter);
            case SPARSE_INT:
                return new SparseIntMatrixOpLog(matrixId, enableFilter);
            case DENSE_FLOAT:
                return new DenseFloatMatrixOplog(matrixId, enableFilter);
            case SPARSE_FLOAT:
                return new SparseFloatMatrixOpLog(matrixId, enableFilter);
            case SPARSE_DOUBLE_LONGKEY:
                return new SparseDoubleLongKeyMatrixOpLog(matrixId, enableFilter);
            case COMPONENT_SPARSE_DOUBLE:
                return new CompSparseDoubleMatrixOpLog(matrixId, enableFilter);
            case COMPONENT_SPARSE_FLOAT:
                return new CompSparseFloatMatrixOpLog(matrixId, enableFilter);
            case COMPONENT_SPARSE_INT:
                return new CompSparseIntMatrixOpLog(matrixId, enableFilter);
            case COMPONENT_SPARSE_DOUBLE_LONGKEY:
                return new CompSparseDoubleLongKeyMatrixOpLog(matrixId, enableFilter);
        }
    }
    return new DenseDoubleMatrixOpLog(matrixId, enableFilter);
}
Also used : RowType(com.tencent.angel.ml.matrix.RowType) MatrixOpLogType(com.tencent.angel.ml.matrix.MatrixOpLogType)

Aggregations

MatrixOpLogType (com.tencent.angel.ml.matrix.MatrixOpLogType)1 RowType (com.tencent.angel.ml.matrix.RowType)1