else
newStabilizers = new ArrayList<>(BSGS.get(i + 2).stabilizerGenerators);
//allowed points
BitArray allowedPoints = new BitArray(effectiveDegree);
allowedPoints.setAll(BSGS.get(i).orbitList, true);
allowedPoints.set(ithBeta, false);
allowedPoints.set(jthBeta, false);
//we shall store the orbit of ithBeta under new stabilizers in BSGSCandidateElement
BSGSCandidateElement newOrbitStabilizer =
new BSGSCandidateElement(ithBeta, newStabilizers, effectiveDegree);
//main loop
main:
while (newOrbitStabilizer.orbitSize() != s) {
//this loop is redundant but helps to avoid unnecessary calculations of orbits in the main loop condition
int nextBasePoint = -1;
while ((nextBasePoint = allowedPoints.nextBit(++nextBasePoint)) != -1) {
//transversal
Permutation transversal = BSGS.get(i).getTransversalOf(nextBasePoint);
int newIndexUnderInverse = transversal.newIndexOfUnderInverse(jthBeta);
//check whether beta_{i+1}^(inverse transversal) belongs to orbit of G^{i+1}
if (!BSGS.get(i + 1).belongsToOrbit(newIndexUnderInverse)) {
//then this transversal is bad and we can skip the orbit of this point under new stabilizers
IntArrayList toRemove = Permutations.getOrbitList(
newOrbitStabilizer.stabilizerGenerators, nextBasePoint, effectiveDegree);
allowedPoints.setAll(toRemove, false);
} else {
//<-ok this transversal is good
//we need an element in G^(4) that beta_{i+1}^element = beta_{i+1}^{inverse transversal}
//so that beta_{i+1} is fixed under product of element * transversal
//todo unnecessary composition can be carried out!
Permutation newStabilizer =
BSGS.get(i + 1).getTransversalOf(newIndexUnderInverse).composition(transversal);
//if this element was not yet seen
if (!newOrbitStabilizer.belongsToOrbit(newStabilizer.newIndexOf(ithBeta))) {
newOrbitStabilizer.addStabilizer(newStabilizer);
IntArrayList toRemove = Permutations.getOrbitList(
newOrbitStabilizer.stabilizerGenerators, nextBasePoint, effectiveDegree);
allowedPoints.setAll(toRemove, false);
continue main;
}
}
}
}