Search in sources :

Example 1 with FastMatrixParameter

use of dr.inference.model.FastMatrixParameter in project beast-mcmc by beast-dev.

the class AncestralTraitTreeModelParser method parseNodeTraits.

private static void parseNodeTraits(XMLObject cxo, Tree tree, List<AncestralTaxonInTree> ancestors) throws XMLParseException {
    String name = cxo.getAttribute(NAME, "trait");
    int dim = cxo.getAttribute(MULTIVARIATE_TRAIT, 1);
    // double[] initialValues = null;
    // if (cxo.hasAttribute(INITIAL_VALUE)) {
    // initialValues = cxo.getDoubleArrayAttribute(INITIAL_VALUE);
    // }
    final int rowDim = dim;
    final int colDim = tree.getExternalNodeCount() + ancestors.size();
    FastMatrixParameter parameter = new FastMatrixParameter(name, rowDim, colDim, 0.0);
    parameter.addBounds(new Parameter.DefaultBounds(Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY, rowDim * colDim));
    int parameterIndex = 0;
    for (int i = 0; i < tree.getExternalNodeCount(); i++) {
        // if (leafNodes) {
        // nodes[i].addTraitParameter(name, parameter.getParameter(parameterIndex), initialValues, firesTreeEvents);
        ++parameterIndex;
    // }
    }
    for (AncestralTaxonInTree ancestor : ancestors) {
        ++parameterIndex;
    }
    ParameterParser.replaceParameter(cxo, parameter);
}
Also used : AncestralTaxonInTree(dr.evomodel.continuous.AncestralTaxonInTree) FastMatrixParameter(dr.inference.model.FastMatrixParameter) Parameter(dr.inference.model.Parameter) FastMatrixParameter(dr.inference.model.FastMatrixParameter)

Aggregations

AncestralTaxonInTree (dr.evomodel.continuous.AncestralTaxonInTree)1 FastMatrixParameter (dr.inference.model.FastMatrixParameter)1 Parameter (dr.inference.model.Parameter)1