/** * Attaches symmetry to simple tensor. * * @param tensor simple tensor * @param permutation permutation * @throws java.lang.IllegalStateException if this tensor is already in use (it's permutation group calculated) * @throws java.lang.IllegalArgumentException if degree of specified permutation differs from the size of indices * of specified tensor */ public static void addSymmetry(SimpleTensor tensor, Permutation permutation) { tensor.getIndices().getSymmetries().addSymmetry(permutation); }
/** * Makes simple tensor antisymmetric. * * @param tensor simple tensor * @throws java.lang.IllegalStateException if this tensor is already in use (it's permutation group calculated) */ public static void setAntiSymmetric(SimpleTensor tensor) { tensor.getIndices().getSymmetries().setAntiSymmetric(); }
/** * Makes simple tensor symmetric. * * @param tensor simple tensor * @throws java.lang.IllegalStateException if this tensor is already in use (it's permutation group calculated) */ public static void setSymmetric(SimpleTensor tensor) { tensor.getIndices().getSymmetries().setSymmetric(); }
/** * Attaches symmetries to simple tensor. * * @param tensor simple tensor * @param permutations permutations * @throws java.lang.IllegalStateException if this tensor is already in use (it's permutation group calculated) * @throws java.lang.IllegalArgumentException if degree of some permutation differs from the size of indices * of specified tensor */ public static void addSymmetries(SimpleTensor tensor, Permutation... permutations) { for (Permutation p : permutations) tensor.getIndices().getSymmetries().addSymmetry(p); }
/** * Attaches symmetry to simple tensor. * * @param tensor simple tensor * @param permutation permutation * @throws java.lang.IllegalStateException if this tensor is already in use (it's permutation group calculated) * @throws java.lang.IllegalArgumentException if specified permutation is inconsistent with one-line notation * @throws java.lang.IllegalArgumentException if degree of specified permutation differs from the size of indices * of specified tensor */ public static void addSymmetry(SimpleTensor tensor, int... permutation) { tensor.getIndices().getSymmetries().addSymmetry(permutation); }
/** * Attaches antisymmetry to simple tensor. * * @param tensor simple tensor * @param permutation permutation * @throws java.lang.IllegalStateException if this tensor is already in use (it's permutation group calculated) * @throws java.lang.IllegalArgumentException if specified permutation is inconsistent with one-line notation * @throws java.lang.IllegalArgumentException if order of specified permutation is odd * @throws java.lang.IllegalArgumentException if degree of specified permutation differs from the size of indices * of specified tensor */ public static void addAntiSymmetry(SimpleTensor tensor, int... permutation) { tensor.getIndices().getSymmetries().addAntiSymmetry(permutation); }
/** * Creates transformation that makes tensors symmetric in specified indices, symmetry group of the result will be * guaranteed a super group of permutation group of specified indices. * * @param indices simple indices with symmetries * @param multiplyBySymmetryFactor if specified, then resulting sum will be divided by its size */ public SymmetrizeTransformation(SimpleIndices indices, boolean multiplyBySymmetryFactor) { this.indices = indices; this.indicesArray = indices.toArray(); this.sortedIndicesNames = IndicesUtils.getIndicesNames(indices); Arrays.sort(this.sortedIndicesNames); this.indicesGroup = indices.getSymmetries().getPermutationGroup(); this.multiplyBySymmetryFactor = multiplyBySymmetryFactor; }
/** * Attaches symmetry to simple tensor with respect to indices of specified type. * * @param tensor simple tensor * @param type type of indices * @param permutation permutation * @throws java.lang.IllegalStateException if this tensor is already in use (it's permutation group calculated) * @throws java.lang.IllegalArgumentException if degree of specified permutation differs from the size of indices * of specified type */ public static void addSymmetry(SimpleTensor tensor, IndexType type, Permutation permutation) { tensor.getIndices().getSymmetries().addSymmetry(type.getType(), permutation); }
/** * Attaches symmetry to simple tensor. * * @param tensor string representation of simple tensor * @param permutation permutation * @throws java.lang.IllegalStateException if this tensor is already in use (it's permutation group calculated) * @throws java.lang.IllegalArgumentException if specified permutation is inconsistent with one-line notation * @throws java.lang.IllegalArgumentException if degree of specified permutation differs from the size of indices * of specified tensor */ public static void addSymmetry(String tensor, int... permutation) { parseSimple(tensor).getIndices().getSymmetries().addSymmetry(permutation); }
/** * Attaches antisymmetry to simple tensor. * * @param tensor string representation of simple tensor * @param permutation permutation * @throws java.lang.IllegalStateException if this tensor is already in use (it's permutation group calculated) * @throws java.lang.IllegalArgumentException if specified permutation is inconsistent with one-line notation * @throws java.lang.IllegalArgumentException if order of specified permutation is odd * @throws java.lang.IllegalArgumentException if degree of specified permutation differs from the size of indices * of specified tensor */ public static void addAntiSymmetry(String tensor, int... permutation) { parseSimple(tensor).getIndices().getSymmetries().addAntiSymmetry(permutation); }
/** * Attaches symmetry to simple tensor with respect to indices of specified type. * * @param tensor simple tensor * @param permutation permutation * @param sign {@code true} for antisymmetry, {@code false} for symmetry * @param type type of indices * @throws java.lang.IllegalStateException if this tensor is already in use (it's permutation group calculated) * @throws java.lang.IllegalArgumentException if specified permutation is inconsistent with one-line notation * @throws java.lang.IllegalArgumentException if order of specified permutation is odd and sign is {@code true} * @throws java.lang.IllegalArgumentException if degree of specified permutation differs from the size of indices * of specified type */ public static void addSymmetry(SimpleTensor tensor, IndexType type, boolean sign, int... permutation) { tensor.getIndices().getSymmetries().add(type.getType(), sign, permutation); }
/** * Appends specified simple indices to this taking into account symmetries of passing indices. * * @param indices simple indices * @return this */ public SimpleIndicesBuilder append(SimpleIndices indices) { if (indices.size() == 0) return this; data.addAll(((AbstractSimpleIndices) indices).data); symmetries.add(new SymmetriesHolder(indices.size(), indices.getSymmetries().getGenerators())); return this; }
/** * Makes simple tensor symmetric with respect to indices of specified type. * * @param tensor simple tensor * @param type type of indices * @throws java.lang.IllegalStateException if this tensor is already in use (it's permutation group calculated) */ public static void setSymmetric(SimpleTensor tensor, IndexType type) { int dimension = tensor.getIndices().size(type); tensor.getIndices().getSymmetries().addSymmetry(type, Permutations.createCycle(dimension)); tensor.getIndices().getSymmetries().addSymmetry(type, Permutations.createTransposition(dimension)); }
/** * Attaches symmetry to simple tensor with respect to indices of specified type. * * @param tensor string representation of simple tensor * @param permutation permutation * @param sign {@code true} for antisymmetry, {@code false} for symmetry * @param type type of indices * @throws java.lang.IllegalStateException if this tensor is already in use (it's permutation group calculated) * @throws java.lang.IllegalArgumentException if specified permutation is inconsistent with one-line notation * @throws java.lang.IllegalArgumentException if order of specified permutation is odd and sign is {@code true} * @throws java.lang.IllegalArgumentException if degree of specified permutation differs from the size of indices * of specified type */ public static void addSymmetry(String tensor, IndexType type, boolean sign, int... permutation) { parseSimple(tensor).getIndices().getSymmetries().add(type.getType(), sign, permutation); }
/** * Makes simple tensor antisymmetric with respect to indices of specified type. * * @param tensor simple tensor * @param type type of indices * @throws java.lang.IllegalStateException if this tensor is already in use (it's permutation group calculated) */ public static void setAntiSymmetric(SimpleTensor tensor, IndexType type) { int dimension = tensor.getIndices().size(type); addSymmetry(tensor, type, true, Permutations.createTransposition(dimension)); if (dimension > 2) tensor.getIndices().getSymmetries().addSymmetry(type.getType(), Permutations.createPermutation(dimension % 2 == 0 ? true : false, Permutations.createCycle(dimension))); }
if (Tensors.parseSimple("R_lmab").getIndices().getSymmetries().availableForModification()) { Tensors.addSymmetry("R_lmab", IndexType.LatinLower, true, new int[]{0, 1, 3, 2}); Tensors.addSymmetry("R_lmab", IndexType.LatinLower, false, new int[]{2, 3, 0, 1}); if (Tensors.parseSimple("R_lm").getIndices().getSymmetries().availableForModification()) Tensors.addSymmetry("R_lm", IndexType.LatinLower, false, new int[]{1, 0}); for (i = 2; i < symmetry.length; ++i) symmetry[i] = i; if (((SimpleTensor) F.get(0)).getIndices().getSymmetries().availableForModification()) //<= this is ok.
private PermutationGroup conjugatedSymmetriesOfSubIndices(SimpleIndices allIndices) { //positions of indices in allIndices that should be stabilized int[] stabilizedPoints = new int[allIndices.size() - indices.size()]; int[] nonStabilizedPoints = new int[indices.size()]; int[] mapping = new int[indices.size()]; int sPointer = 0, nPointer = 0, index; for (int s = 0; s < allIndices.size(); ++s) { index = Arrays.binarySearch(sortedIndicesNames, getNameWithType(allIndices.get(s))); if (index < 0) stabilizedPoints[sPointer++] = s; else { nonStabilizedPoints[nPointer] = s; mapping[nPointer++] = index; } } PermutationGroup result = allIndices.getSymmetries().getPermutationGroup(). pointwiseStabilizerRestricted(stabilizedPoints); return result.conjugate(Permutations.createPermutation(mapping)); }
if (fromIndices.size() == 1 || fromIndices.getSymmetries().isTrivial()) { IndexMappingBuffer tempBuffer = currentBuffer; for (int i = 0; i < size; ++i) searchForPermutations = fromIndices.getSymmetries().getPermutationGroup().iterator(); else searchForPermutations = new OutputPort.PortIterator<>( fromIndices.getSymmetries().getPermutationGroup().mapping( permMappingFrom.toArray(), permMappingTo.toArray())); return take();
result.put(term); this.result = indices.getSymmetries().isTrivial() ? result.build() : symmetrize(result.build());
SimpleIndices dIndices = IndicesFactory.createSimple(null, allIndices); SimpleTensor symmetric = simpleTensor("@!@#@##_AS@23@@#", dIndices); SimpleIndices allFreeVarIndicesI = IndicesFactory.createSimple(varIndices.getSymmetries(), allFreeVarIndices); Tensor derivative = new SymmetrizeTransformation(allFreeVarIndicesI, true).transform(symmetric);