/** * Makes this {@code symmetries} totally symmetric in all its indices (for each type). The invocation of this * method makes this instance unmodifiable, i.e. invocation of method {@code add(...)} after invocation of this * method will cause exception. * * @throws java.lang.IllegalStateException if this instance of symmetries is already in use (permutation group * calculated) */ public void setSymmetric() { if (permutationGroup != null) throw new IllegalStateException("Permutation group is already in use."); PermutationGroup sym = null; int[] counts = structureOfIndices.getTypesCounts(); for (int c : counts) { if (c != 0) if (sym == null) sym = PermutationGroup.symmetricGroup(c); else sym = sym.directProduct(PermutationGroup.symmetricGroup(c)); } permutationGroup = sym; generators.clear(); generators.addAll(sym.generators()); }
/** * Makes this {@code symmetries} totally antisymmetric in all its indices (for each type). The invocation of this * method makes this instance unmodifiable, i.e. invocation of method {@code add(...)} after invocation of this * method will cause exception. * * @throws java.lang.IllegalStateException if this instance of symmetries is already in use (permutation group * calculated) */ public void setAntiSymmetric() { if (permutationGroup != null) throw new IllegalStateException("Permutation group is already in use."); PermutationGroup sym = null; int[] counts = structureOfIndices.getTypesCounts(); for (int c : counts) { if (c != 0) { if (sym == null) sym = PermutationGroup.antisymmetricGroup(c); else sym = sym.directProduct(PermutationGroup.antisymmetricGroup(c)); } } permutationGroup = sym; generators.clear(); generators.addAll(sym.generators()); }
public NameAndStructureOfIndices[] getKeys() { IndexType[] toOmit = indicesAllowedToOmit.toArray(new IndexType[indicesAllowedToOmit.size()]); int omitted, i; NameAndStructureOfIndices[] keys = new NameAndStructureOfIndices[(1 << toOmit.length) - 1]; int[] allCounts; BitArray[] states; for (omitted = 1; omitted <= keys.length; ++omitted) { allCounts = originalStructureAndName.getStructure()[0].getTypesCounts(); states = originalStructureAndName.getStructure()[0].getStates(); for (i = 0; i < toOmit.length; ++i) if ((omitted & (1 << i)) != 0) { allCounts[toOmit[i].getType()] = 0; states[toOmit[i].getType()] = states[toOmit[i].getType()] == null ? null : BitArray.EMPTY; } StructureOfIndices[] structures = originalStructureAndName.getStructure().clone(); structures[0] = StructureOfIndices.create(allCounts, states); keys[omitted - 1] = new NameAndStructureOfIndices(originalStructureAndName.getName(), structures); } return keys; } }