/** * Adds specified permutation written in one-line notation to this symmetries. * * @param permutation permutation written in one-line notation * @throws java.lang.IllegalStateException if this instance of symmetries is already in use (permutation group * calculated) * @throws java.lang.IllegalArgumentException if specified permutation is inconsistent with one-line notation * @throws java.lang.IllegalArgumentException if this structure of indices is inconsistent with specified * permutation (permutation mixes indices of different types) */ public void addSymmetry(int... permutation) { add(false, permutation); }
/** * Adds specified antisymmetry written in one-line notation to this symmetries. * * @param permutation permutation written in one-line notation * @throws java.lang.IllegalStateException if this instance of symmetries is already in use (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 this structure of indices is inconsistent with specified * permutation (permutation mixes indices of different types) */ public void addAntiSymmetry(int... permutation) { add(true, permutation); }
/** * Adds specified permutation written in one-line notation to symmetries of indices of specified type. * * @param type type of indices * @param permutation permutation written in one-line notation * @throws java.lang.IllegalStateException if this instance of symmetries is already in use (permutation group * calculated) * @throws java.lang.IllegalArgumentException if specified permutation is inconsistent with one-line notation * @throws java.lang.IllegalArgumentException if length of specified permutation differs from the size of indices * of specified type */ public void addSymmetry(IndexType type, int... permutation) { add(type, false, permutation); }
/** * Adds specified antisymmetry written in one-line notation to symmetries of indices of specified type. * * @param type type of indices * @param permutation permutation written in one-line notation * @throws java.lang.IllegalStateException if this instance of symmetries is already in use (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 length of specified permutation differs from the size of indices * of specified type */ public void addAntiSymmetry(IndexType type, int... permutation) { add(type, true, 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); }
/** * 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); }
private NameDescriptor createDescriptor(final String sname, final StructureOfIndices[] structuresOfIndices, int id) { if (structuresOfIndices.length != 1) return new NameDescriptorForTensorFieldImpl(sname, structuresOfIndices, id, sname.equals(diracDeltaName) && structuresOfIndices.length == 3); final StructureOfIndices its = structuresOfIndices[0]; if (its.size() != 2) return new NameDescriptorForSimpleTensor(sname, structuresOfIndices, id); for (byte b = 0; b < IndexType.TYPES_COUNT; ++b) if (its.typeCount(b) == 2) { if (CC.isMetric(b)) { if (sname.equals(kroneckerAndMetricNames[0]) || sname.equals(kroneckerAndMetricNames[1])) { NameDescriptor descriptor = new NameDescriptorForMetricAndKronecker(kroneckerAndMetricNames, b, id); descriptor.getSymmetries().add(b, false, 1, 0); return descriptor; } } else { if (sname.equals(kroneckerAndMetricNames[1])) throw new ParserException("Metric is not specified for non metric index type."); if (sname.equals(kroneckerAndMetricNames[0])) { if (its.getTypeData(b).states.get(0) != true || its.getTypeData(b).states.get(1) != false) throw new ParserException("Illegal Kroneckers indices states."); NameDescriptor descriptor = new NameDescriptorForMetricAndKronecker(kroneckerAndMetricNames, b, id); return descriptor; } } } return new NameDescriptorForSimpleTensor(sname, structuresOfIndices, id); }