if (diffIds == null) {
List<Symmetry> list = symmetries.getBasisSymmetries();
diffIds = new short[symmetries.dimension()];
Arrays.fill(diffIds, (short) -1);
short number = 0;
IntArrayList removed = new IntArrayList(2);
int i0, i1;
for (Symmetry symmetry : list)
for (i0 = diffIds.length - 1; i0 >= 0; --i0)
if ((i1 = symmetry.newIndexOf(i0)) != i0)
if (diffIds[i0] == -1 && diffIds[i1] == -1)
diffIds[i0] = diffIds[i1] = number++;
else if (diffIds[i0] == -1)
diffIds[i0] = diffIds[i1];
else if (diffIds[i1] == -1)
diffIds[i1] = diffIds[i0];
else if (diffIds[i1] != diffIds[i0]) {
int n = diffIds[i1];
for (int k = 0; k < diffIds.length; ++k)
if (diffIds[k] == n)
diffIds[k] = diffIds[i0];
removed.add(n);
}
for (i1 = 0; i1 < diffIds.length; ++i1)
if (diffIds[i1] == -1)
diffIds[i1] = number++;
removed.sort();
for (i0 = diffIds.length - 1; i0 >= 0; --i0) {
diffIds[i0] += ArraysUtils.binarySearch(removed, diffIds[i0]) + 1;
}
}
return diffIds;