global occurrences matrix impl-d