}
//creating term & processing combinatorics
Tensor coefficient;
if (symmetries == null) {
Symmetrize symmetrize = new Symmetrize(indices,
Symmetries.getFullSymmetriesForSortedIndices(totalUpCount, totalLowCount), false);
Tensor terms = symmetrize.transform(new Product(tCombination));
if (terms instanceof Sum)
for (Tensor t : terms) {
result.add(new Product(coefficient = scalarTensorGenerator.next(), t));
coefficients.add(coefficient.clone());
}
else {
result.add(new Product(coefficient = scalarTensorGenerator.next(), terms));
coefficients.add(coefficient.clone());
}
} else {
Symmetrize symmetrize = new Symmetrize(indices,
symmetries, true);
Tensor terms = symmetrize.transform(new Product(tCombination));
result.add(new Product(coefficient = scalarTensorGenerator.next(), terms));
coefficients.add(coefficient.clone());
}
}
}