private ScoreMatrix getMatrixScores(Instance instance) {
        ScoreMatrix m = new ScoreMatrix(this.matrix);
        Cartographer grapher = new Cartographer(this.matrix,instance);
        int nVar = this.matrix.getNumberOfVariants();
        int nInv = this.matrix.getNumberOfInvariants();
        for(int var=0; var<nVar; var++) {
            Box varBox = grapher.getUpperLeftBoxOfVariant(var);
            if (varBox==null) continue;
            for(int inv=0; inv<nInv; inv++) {
                Box invBox = grapher.getUpperLeftBoxOfInvariant(inv);
                if (invBox==null) continue;
                if ( isAllowedDistance(varBox,invBox) &&  isAboveOrLeft(invBox, varBox)  && !isOblique(invBox, varBox)) {
                    Double score = new java.lang.Double(score(invBox, varBox));
                    if (this.checkScoreThreshold(score.doubleValue()))
                        m.setScore(score, inv, var);
                }
            }
        }
        checkInBetweenBoxes(grapher,m);
        return m;
    }