Inner product on quantum computer

Inner product Definiton and example Supposedly, we are given two vector \(\mathbf{x}, \mathbf{y} \in \mathbb{R}^{n}\), the inner product between them is defined as \[ \braket{\mathbf{x}, \mathbf{y}} \triangleq \mathbf{x}^\top \mathbf{y} \triangleq \mathbf{y}^\top \mathbf{x} := \sum_{i=1}^{n}x_iy_i. \]For example, \(\mathbf{x} = \begin{bmatrix}1 & -2 & 3 & -4\end{bmatrix}^\top\), and \(\mathbf{y} = \begin{bmatrix}-3 & 2 & 0 & -2.3\end{bmatrix}^\top\), the inner product between \(\mathbf{x}\) and \(\mathbf{y}\) is \[ \braket{\mathbf{x}, \mathbf{y}} = \sum_{i=1}^{4}x_iy_i = 1\cdot (-3) + (-2) \cdot 2 + 3 \cdot 0 + (-4)\cdot (-2.3) = 2.22. \]import numpy as np x = np.array([1, -2, 3, -4]) y = np.array([-3, 2, 0, -2.3]) print("Inner product between x, y: {}".format(x @ y)) Click here to see the output Inner product between x, y: 2.1999999999999993 Geometry intuition What does the inner product between two vectors tell us? Well, to answer this question, let see the relation between the angle between two vectors and its innner product through the formula, ...

March 26, 2025 · 9 min · Van Tien Nguyen