use of dr.inference.model.GradientProvider in project beast-mcmc by beast-dev.
the class GradientWrapperParser method parseXMLObject.
@Override
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
Object obj = xo.getChild(0);
if (obj instanceof MultivariateDistributionLikelihood) {
final MultivariateDistributionLikelihood mdl = (MultivariateDistributionLikelihood) xo.getChild(MultivariateDistributionLikelihood.class);
if (!(mdl.getDistribution() instanceof GradientProvider)) {
throw new XMLParseException("Not a gradient provider");
}
final GradientProvider provider = (GradientProvider) mdl.getDistribution();
final Parameter parameter = mdl.getDataParameter();
return new GradientWrtParameterProvider.ParameterWrapper(provider, parameter, mdl);
} else {
DistributionLikelihood dl = (DistributionLikelihood) obj;
if (!(dl.getDistribution() instanceof GradientProvider)) {
throw new XMLParseException("Not a gradient provider");
}
throw new RuntimeException("Not yet implemented");
}
}
Aggregations