public static IntMatrix computeIntersectionMatrix(List<IIntervalsTimeDomain> domains) {
        
        // create matrix
        IntMatrix matrix = new IntMatrix(domains.size());
        
        // for each pair test if intersecting
        for (int i = 0; i < domains.size(); i++) {
            matrix.set(i, i, 0);
            for (int j = i+1; j < domains.size(); j++) {
                boolean intersects = domains.get(i).intersects(domains.get(j));
                matrix.set(i, j, intersects ? 1 : 0);
                matrix.set(j, i, intersects ? 1 : 0);
            }
        }
        
        return matrix;
    }