@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Wrapper wrapper = (Wrapper) o; return freeIndices.equals(wrapper.freeIndices) && IndexMappings.anyMappingExists(tensor, wrapper.tensor); }
@Override public boolean is(ParseTokenSimpleTensor object) { String name = object.name; for (String matrix : matrices) if (name.equals(matrix)) return true; if (name.equals("F") && object.indices.getStructureOfIndices().equals(F_TYPE_STRUCTURE)) return true; return false; } };
/** * Returns {@code true} if this is structure of specified indices. * * @param indices indices * @return {@code true} if this is structure of specified indices */ public boolean isStructureOf(SimpleIndices indices) { if (size != indices.size()) return false; return equals(indices.getStructureOfIndices()); }
private NameDescriptor nextNameDescriptor(StructureOfIndices typeStructure) { //search IntArrayList positions = new IntArrayList(); for (int i = namespace.size() - 1; i >= 0; --i) if (namespace.get(i).getStructureOfIndices().equals(typeStructure)) positions.add(i); if (!positions.isEmpty()) return namespace.get(positions.get(random.nextInt(positions.size()))); if (!generateNewDescriptors) throw new IllegalArgumentException("No descriptor for such structure: " + typeStructure); //create new nameDescriptor NameDescriptor nameDescriptor = CC.getNameManager().mapNameDescriptor(nextName(), typeStructure); if (withSymmetries) addRandomSymmetries(nameDescriptor); if (namespace.indexOf(nameDescriptor) == -1) namespace.add(nameDescriptor); return nameDescriptor; }
final int argPosition, final int order) { if (!derivativeIndices.getStructureOfIndices().equals(parent.argIndices[argPosition].getInverted().getStructureOfIndices().pow(order))) throw new IllegalArgumentException("Illegal derivative indices.");