Function innerProduct