gen_fun::Hadamard_product: optimize computation of terms with same denominator