Makes dual_inner_prod() more generic to increase its use