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;
}
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);
}
Aggregations