l = 0;
for (i = 0; i < combination.length; ++i)
for (int j = 0; j < combination[i]; ++j) {
Tensor temp = samples[i].clone();
IndexMappingDirect im = new IndexMappingDirect();
IntArray termLow = temp.getIndices().getLower();
im.add(termLow, Arrays.copyOfRange(lowArray, l, l + termLow.length()));
l += termLow.length();
IntArray termUp = temp.getIndices().getUpper();
im.add(termUp, Arrays.copyOfRange(upArray, u, u + termUp.length()));
u += termUp.length();
temp = ApplyIndexMappingDirectTransformation.INSTANCE.perform(temp, im);
tCombination.add(temp);
}