@Override public String toString() { return getName(null) + ":" + Arrays.toString(structuresOfIndices); }
/** * Returns string name of tensor. The argument can be {@code null}. * * @param indices indices (in case of metric or Kronecker) and null in other cases * @return string name of tensor */ public String getName(SimpleIndices indices) { return getName(indices, CC.getDefaultOutputFormat()); }
public String getStringName() { return CC.current().getNameDescriptor(name).getName(indices); }
private static String newCoefficientName(Tensor... tensors) { Set<SimpleTensor> simpleTensors = TensorUtils.getAllSymbols(tensors); List<Character> forbidden = new ArrayList<>(); for (SimpleTensor tensor : simpleTensors) { String name = CC.getNameDescriptor(tensor.getName()).getName(tensor.getIndices()); try { Integer.parseInt(name.substring(1)); forbidden.add(name.charAt(0)); } catch (NumberFormatException e) { } } Collections.sort(forbidden); char c = 'a'; for (int i = 0; i < forbidden.size(); ++i) { if (c != forbidden.get(i).charValue()) break; else { ++c; } } return String.valueOf(c); }
String toString0(OutputFormat mode) { //Initializing StringBuilder StringBuilder sb = new StringBuilder(); sb.append(CC.getNameDescriptor(name).getName(indices, mode)); //If there are no indices return builder content if (indices.size() == 0) return sb.toString(); //Writing indices boolean external = mode.is(OutputFormat.WolframMathematica) || mode.is(OutputFormat.Maple); if (external) sb.append("["); sb.append(indices.toString(mode)); if (external) sb.append("]"); return sb.toString(); }
private void checkConsistency() { int i; for (i = 0; i < actualInput; ++i) { if (!(inputValues[i].get(0) instanceof SimpleTensor)) throw new IllegalArgumentException(); SimpleTensor st = (SimpleTensor) inputValues[i].get(0); NameDescriptor nd = CC.getNameDescriptor(st.getName()); if (!nd.getName(null).equals(getStringInputName(i))) throw new IllegalArgumentException(); } for (; i < INPUT_VALUES_GENERAL_COUNT; ++i) if (inputValues[i] != null) throw new IllegalArgumentException(); SimpleIndices indices = (SimpleIndices) inputValues[1].get(0).getIndices(); StructureOfIndices structureOfIndices = indices.getStructureOfIndices(); if (structureOfIndices.getTypeData(IndexType.LatinLower.getType()).length != structureOfIndices.size()) throw new IllegalArgumentException("Only Latin lower indices are legal."); int matrixIndicesCount = indices.size() - operatorOrder; if (matrixIndicesCount % 2 != 0) throw new IllegalArgumentException(); if (inputValues[0].get(0).getIndices().size() != matrixIndicesCount) throw new IllegalArgumentException(); for (i = 1; i < actualInput; ++i) { structureOfIndices = ((SimpleIndices) inputValues[i].get(0).getIndices()).getStructureOfIndices(); if (structureOfIndices.getTypeData(IndexType.LatinLower.getType()).length != structureOfIndices.size()) throw new IllegalArgumentException("Only Latin lower indices are legal."); if (structureOfIndices.size() + i - 1 != operatorOrder + matrixIndicesCount) throw new IllegalArgumentException(); } }
this.typeOfLeviCivitaIndices = IndicesUtils.getTypeEnum(leviCivita.getIndices().get(0)); final String leviCivitaName = CC.getNameManager().getNameDescriptor(leviCivita.getName()).getName(null);