use of dr.inference.operators.AdaptableVarianceMultivariateNormalOperator in project beast-mcmc by beast-dev.
the class TwoPhaseOperatorParser method parseXMLObject.
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
if (DEBUG) {
System.err.println("\nParsing TwoPhaseOperator");
}
final CoercionMode mode = CoercionMode.parseMode(xo);
final double weight = xo.getDoubleAttribute(WEIGHT);
final int initial = xo.getIntegerAttribute(INITIAL);
final int burnin = xo.getIntegerAttribute(BURNIN);
if (DEBUG) {
System.err.println("child count: " + xo.getChildCount());
System.err.println(xo.getChild(PHASE_ONE));
System.err.println(xo.getChild(PHASE_ONE).getChildCount());
System.err.println(xo.getChild(PHASE_TWO));
System.err.println(xo.getChild(PHASE_TWO).getChildCount());
}
List<AbstractCoercableOperator> phaseOneOperators = new ArrayList<AbstractCoercableOperator>();
int phaseOneCount = xo.getChild(PHASE_ONE).getChildCount();
for (int i = 0; i < phaseOneCount; i++) {
phaseOneOperators.add((AbstractCoercableOperator) xo.getChild(PHASE_ONE).getChild(i));
}
if (DEBUG) {
System.err.println("arrayList one size: " + phaseOneOperators.size());
for (int i = 0; i < phaseOneOperators.size(); i++) {
System.err.println(" " + phaseOneOperators.get(i));
}
}
/*List<AbstractCoercableOperator> phaseTwoOperators = new ArrayList<AbstractCoercableOperator>();
int phaseTwoCount = xo.getChild(PHASE_TWO).getChildCount();
for (int i = 0; i < phaseTwoCount; i++) {
phaseTwoOperators.add((AbstractCoercableOperator)xo.getChild(PHASE_TWO).getChild(i));
}*/
List<AdaptableVarianceMultivariateNormalOperator> phaseTwoOperators = new ArrayList<AdaptableVarianceMultivariateNormalOperator>();
int phaseTwoCount = xo.getChild(PHASE_TWO).getChildCount();
for (int i = 0; i < phaseTwoCount; i++) {
phaseTwoOperators.add((AdaptableVarianceMultivariateNormalOperator) xo.getChild(PHASE_TWO).getChild(i));
}
if (DEBUG) {
System.err.println("arrayList two size: " + phaseTwoOperators.size());
for (int i = 0; i < phaseTwoOperators.size(); i++) {
System.err.println(" " + phaseTwoOperators.get(i));
}
}
//keep track of the parameters of phase one here, as apparently we can't get to them afterwards
//let's just get them from phase two, as there I can implement whatever I want
List<Parameter> parameters = new ArrayList<Parameter>();
for (int i = 0; i < phaseTwoCount; i++) {
parameters.add(phaseTwoOperators.get(i).getParameter());
}
if (DEBUG) {
System.err.println("parameter list size: " + parameters.size());
for (int i = 0; i < parameters.size(); i++) {
System.err.println(" " + parameters.get(i));
}
}
return new TwoPhaseOperator(phaseOneOperators, phaseTwoOperators, parameters, initial, burnin, weight, mode);
}
Aggregations