Search in sources :

Example 1 with ElementaryVectorDataModel

use of dr.evomodel.treedatalikelihood.continuous.ElementaryVectorDataModel in project beast-mcmc by beast-dev.

the class TreePrecisionColumnProvider method setDataModelAndGetColumn.

private double[] setDataModelAndGetColumn(int index) {
    Parameter parameter = tipData.getParameter();
    WrappedVector savedParameter;
    if (RESET_DATA) {
        savedParameter = new WrappedVector.Raw(parameter.getParameterValues());
    }
    if (tipData instanceof ContinuousTraitDataModel) {
        setParameter(makeElementaryVector(index), tipData.getParameter());
    } else if (tipData instanceof ElementaryVectorDataModel) {
        ElementaryVectorDataModel elementaryData = (ElementaryVectorDataModel) tipData;
        int tip = index / dimTrait;
        int dim = index % dimTrait;
        elementaryData.setTipTraitDimParameters(tip, 0, dim);
    } else {
        throw new RuntimeException("Not yet implemented");
    }
    double[] column = productProvider.getProduct(parameter);
    if (RESET_DATA) {
        setParameter(savedParameter, parameter);
    }
    return column;
}
Also used : ContinuousTraitDataModel(dr.evomodel.treedatalikelihood.continuous.ContinuousTraitDataModel) Utils.setParameter(dr.math.matrixAlgebra.ReadableVector.Utils.setParameter) Parameter(dr.inference.model.Parameter) WrappedVector(dr.math.matrixAlgebra.WrappedVector) ElementaryVectorDataModel(dr.evomodel.treedatalikelihood.continuous.ElementaryVectorDataModel)

Example 2 with ElementaryVectorDataModel

use of dr.evomodel.treedatalikelihood.continuous.ElementaryVectorDataModel in project beast-mcmc by beast-dev.

the class ElementaryVectorDataModelParser method parseXMLObject.

@Override
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    Parameter tipIndicator = (Parameter) xo.getElementFirstChild(TIP_INDICATOR);
    Parameter dimIndicator = null;
    if (xo.hasChildNamed(DIM_INDICATOR)) {
        dimIndicator = (Parameter) xo.getElementFirstChild(DIM_INDICATOR);
    }
    int tips = parsePositiveInteger(xo, TIPS);
    int dim = parsePositiveInteger(xo, DIMENSION);
    PrecisionType precisionType = parsePrecisionType(xo);
    return new ElementaryVectorDataModel(xo.getId(), tipIndicator, dimIndicator, tips, dim, precisionType);
}
Also used : Parameter(dr.inference.model.Parameter) ElementaryVectorDataModel(dr.evomodel.treedatalikelihood.continuous.ElementaryVectorDataModel) PrecisionType(dr.evomodel.treedatalikelihood.continuous.cdi.PrecisionType)

Aggregations

ElementaryVectorDataModel (dr.evomodel.treedatalikelihood.continuous.ElementaryVectorDataModel)2 Parameter (dr.inference.model.Parameter)2 ContinuousTraitDataModel (dr.evomodel.treedatalikelihood.continuous.ContinuousTraitDataModel)1 PrecisionType (dr.evomodel.treedatalikelihood.continuous.cdi.PrecisionType)1 Utils.setParameter (dr.math.matrixAlgebra.ReadableVector.Utils.setParameter)1 WrappedVector (dr.math.matrixAlgebra.WrappedVector)1