Search in sources :

Example 1 with MVOUCovarianceOperator

use of dr.inference.operators.MVOUCovarianceOperator in project beast-mcmc by beast-dev.

the class MVOUCovarianceOperatorParser method parseXMLObject.

public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    CoercionMode mode = CoercionMode.parseMode(xo);
    double weight = xo.getDoubleAttribute(MCMCOperator.WEIGHT);
    double mixingFactor = xo.getDoubleAttribute(MIXING_FACTOR);
    int priorDf = xo.getIntegerAttribute(PRIOR_DF);
    if (mixingFactor <= 0.0 || mixingFactor >= 1.0) {
        throw new XMLParseException("mixingFactor must be greater than 0.0 and less thatn 1.0");
    }
    //            Parameter parameter = (Parameter) xo.getChild(Parameter.class);
    //            XMLObject cxo = (XMLObject) xo.getChild(VARIANCE_MATRIX);
    MatrixParameter varMatrix = (MatrixParameter) xo.getChild(MatrixParameter.class);
    if (varMatrix.getColumnDimension() != varMatrix.getRowDimension())
        throw new XMLParseException("The variance matrix is not square");
    return new MVOUCovarianceOperator(mixingFactor, varMatrix, priorDf, weight, mode);
}
Also used : MVOUCovarianceOperator(dr.inference.operators.MVOUCovarianceOperator) MatrixParameter(dr.inference.model.MatrixParameter) CoercionMode(dr.inference.operators.CoercionMode)

Aggregations

MatrixParameter (dr.inference.model.MatrixParameter)1 CoercionMode (dr.inference.operators.CoercionMode)1 MVOUCovarianceOperator (dr.inference.operators.MVOUCovarianceOperator)1