add sum and dot product function