Search in sources :

Example 1 with ConjugateWishartStatisticsProvider

use of dr.math.interfaces.ConjugateWishartStatisticsProvider in project beast-mcmc by beast-dev.

the class PrecisionMatrixGibbsOperator method incrementOuterProduct.

private void incrementOuterProduct(double[][] S, ConjugateWishartStatisticsProvider integratedLikelihood) {
    final WishartSufficientStatistics sufficientStatistics = integratedLikelihood.getWishartStatistics();
    final double[] outerProducts = sufficientStatistics.getScaleMatrix();
    final double df = sufficientStatistics.getDf();
    if (DEBUG) {
        System.err.println("OP df = " + df);
        System.err.println("OP    = " + new Vector(outerProducts));
    }
    if (debugModel != null) {
        final WishartSufficientStatistics debug = ((ConjugateWishartStatisticsProvider) debugModel).getWishartStatistics();
        System.err.println(df + " ?= " + debug.getDf());
        System.err.println(new Vector(outerProducts));
        System.err.println("");
        System.err.println(new Vector(debug.getScaleMatrix()));
        System.exit(-1);
    }
    //        final double df = 2;
    //        final double df = integratedLikelihood.getTotalTreePrecision();
    //        System.err.println("OuterProducts = \n" + new Matrix(outerProducts));
    //        System.err.println("Total tree DF  = " + df);
    //        System.exit(-1);
    final int dim = S.length;
    for (int i = 0; i < dim; i++) {
        System.arraycopy(outerProducts, i * dim, S[i], 0, dim);
    }
    numberObservations = df;
//        checkDiagonals(outerProducts);
}
Also used : WishartSufficientStatistics(dr.math.distributions.WishartSufficientStatistics) ConjugateWishartStatisticsProvider(dr.math.interfaces.ConjugateWishartStatisticsProvider) Vector(dr.math.matrixAlgebra.Vector)

Aggregations

WishartSufficientStatistics (dr.math.distributions.WishartSufficientStatistics)1 ConjugateWishartStatisticsProvider (dr.math.interfaces.ConjugateWishartStatisticsProvider)1 Vector (dr.math.matrixAlgebra.Vector)1