Reduce code duplication in inner products of LCWP classes