use of dr.inference.model.HessianProvider in project beast-mcmc by beast-dev.
the class HessianWrapperParser 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 HessianProvider)) {
throw new XMLParseException("Not a hessian provider");
}
final HessianProvider provider = (HessianProvider) mdl.getDistribution();
final Parameter parameter = mdl.getDataParameter();
return new HessianWrtParameterProvider.ParameterWrapper(provider, parameter, mdl);
} else {
DistributionLikelihood dl = (DistributionLikelihood) obj;
if (!(dl.getDistribution() instanceof HessianProvider)) {
throw new XMLParseException("Not a hessian provider");
}
final HessianProvider provider = (HessianProvider) dl.getDistribution();
final Parameter parameter = (Parameter) xo.getChild(Parameter.class);
return new HessianWrtParameterProvider.ParameterWrapper(provider, parameter, dl);
}
}
Aggregations