Search in sources :

Example 1 with MatrixMatrixProduct

use of dr.inference.model.MatrixMatrixProduct in project beast-mcmc by beast-dev.

the class MatrixMatrixProductParser method parseXMLObject.

@Override
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    MatrixParameter[] temp = new MatrixParameter[3];
    temp[0] = (MatrixParameter) xo.getChild(LEFT).getChild(MatrixParameter.class);
    temp[1] = MatrixParameter.recast(((CompoundParameter) xo.getChild(RIGHT).getChild(CompoundParameter.class)).getVariableName(), (CompoundParameter) xo.getChild(RIGHT).getChild(CompoundParameter.class));
    if (xo.getChild(IN_PLACE) != null) {
        temp[2] = (MatrixParameter) xo.getChild(IN_PLACE).getChild(MatrixParameter.class);
    } else {
        int rowDim = temp[0].getRowDimension();
        int colDim = temp[1].getColumnDimension();
        Parameter[] params = new Parameter[colDim];
        for (int i = 0; i < colDim; i++) {
            params[i] = new Parameter.Default(rowDim);
        }
        temp[2] = new MatrixParameter(null, params);
    }
    Parameter ColumnMask;
    if (xo.getChild(COLUMN_MASK) != null)
        ColumnMask = (Parameter) xo.getChild(COLUMN_MASK).getChild(MatrixParameter.class);
    else
        ColumnMask = new Parameter.Default(null, temp[1].getColumnDimension(), 1);
    return new MatrixMatrixProduct(temp, ColumnMask);
}
Also used : CompoundParameter(dr.inference.model.CompoundParameter) MatrixParameter(dr.inference.model.MatrixParameter) MatrixMatrixProduct(dr.inference.model.MatrixMatrixProduct) CompoundParameter(dr.inference.model.CompoundParameter) Parameter(dr.inference.model.Parameter) MatrixParameter(dr.inference.model.MatrixParameter)

Aggregations

CompoundParameter (dr.inference.model.CompoundParameter)1 MatrixMatrixProduct (dr.inference.model.MatrixMatrixProduct)1 MatrixParameter (dr.inference.model.MatrixParameter)1 Parameter (dr.inference.model.Parameter)1