implement dot-product as a function of riemann-sum