TensorUtils.getAllIndicesNames(multiplyer));
}
}
if (tensor instanceof Derivative) {
//Very similar to Product case
Derivative derivative = (Derivative) tensor;
//Collecting all indices from derivative vars
TensorIterator it = derivative.iterator();
IntArrayList usedIndices = new IntArrayList();
Tensor current;
while (it.hasNext()) {
current = it.next();
if (Derivative.onVarsIndicator.is(it))
usedIndices.addAll(TensorUtils.getAllIndicesNames(current));
}
//Creating int set from collected indices
int[] usedIndicesArray = MathUtils.getSortedDistinct(usedIndices.toArray());
Tensor target = derivative.getTarget();
//Calculating used indices for AIM transformation
int[] targetIndices = IndicesUtils.getSortedDistinctIndicesNames(target.getIndices().getFreeIndices());
int[] currentUsedIndices = MathUtils.intSetDifference(targetIndices, usedIndices.toArray());
//Applying AIM transformation