super(from, to);
}
@Override
Tensor newTo_(Tensor currentNode, SubstitutionIterator iterator) {
TensorField currentField = (TensorField) currentNode;
TensorField from = (TensorField) this.from;
IndexMappingBuffer buffer = IndexMappings.simpleTensorsPort(from, currentField).take();
if (buffer == null)
return currentNode;
Indices[] fromIndices = from.getArgIndices(), currentIndices = currentField.getArgIndices();
List<Tensor> argFrom = new ArrayList<>(), argTo = new ArrayList<>();
Tensor fArg;
int[] cIndices, fIndices;
int i;
for (i = from.size() - 1; i >= 0; --i) {
if (IndexMappings.mappingExists(currentNode.get(i), from.get(i)))
continue;
fIndices = fromIndices[i].getAllIndices().copy();
cIndices = currentIndices[i].getAllIndices().copy();
assert cIndices.length == fIndices.length;
fArg = ApplyIndexMapping.applyIndexMapping(from.get(i), fIndices, cIndices, new int[0]);
argFrom.add(fArg);
argTo.add(currentNode.get(i));
}