private static Tensor unsafeApplyIndexMappingFromSortedClonedPreparedSource(
Tensor tensor, int[] from, int[] to, int[] forbidden) {
Set<Integer> dummyIndices = TensorUtils.getAllIndicesNames(tensor);
//extracting contracted only
Indices indices = tensor.getIndices().getFree();
int i;
for (i = indices.size() - 1; i >= 0; --i)
dummyIndices.remove(IndicesUtils.getNameWithType(indices.get(i)));
int[] allForbidden = new int[to.length + forbidden.length];
System.arraycopy(to, 0, allForbidden, 0, to.length);
System.arraycopy(forbidden, 0, allForbidden, to.length, forbidden.length);