Hello,

The "bugs" list seems to be deserted so I am posting it here. It appears to
be an overflow issue in MDEDescriptor.java that produces zero values for
long chains (the code is unchanged across 1.4, 1.5, and 2.0 series).
Specifically, MDEC-22 becomes zero starting from C23 (tricosane). It is
caused by geometric mean evaluation via direct product; replacing product
with the sum of logs fixes the issue:

    private double evalCValue(int[][] distmat, int[][] codemat, int type1,
int type2) {
        /* double lambda = 1; */
        double lambda = 0;
        double n = 0;

        List<Integer> v1 = new ArrayList<Integer>();
        List<Integer> v2 = new ArrayList<Integer>();
        for (int i = 0; i < codemat.length; i++) {
            if (codemat[i][0] == type1) v1.add(codemat[i][1]);
            if (codemat[i][0] == type2) v2.add(codemat[i][1]);
        }

        for (int i = 0; i < v1.size(); i++) {
            for (int j = 0; j < v2.size(); j++) {
                int a = v1.get(i);
                int b = v2.get(j);
                if (a == b) continue;
                double distance = distmat[a][b];
                /* lambda = lambda * distance; */
                lambda += Math.log(distance);
                n++;
            }
        }

        if (type1 == type2) {
            /* lambda = Math.sqrt(lambda); */
            lambda /= 2;
            n = n / 2;
        }
        if (n == 0) return 0.0;
        else
            /* return n / Math.pow(Math.pow(lambda, 1.0 / (2.0 * n)), 2); */
            return n / Math.exp(lambda / n);
    }


--Andrei
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Cdk-user mailing list
Cdk-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cdk-user

Reply via email to