implement inner product