dq.braket
braket(x: QArrayLike, y: QArrayLike) -> Array
Returns the inner product \(\braket{\psi|\varphi}\) between two kets.
Parameters:
-
x(qarray-like of shape (..., n, 1)) –Left-side ket.
-
y(qarray-like of shape (..., n, 1)) –Right-side ket.
Returns:
-
(array of shape (...))
–
Complex-valued inner product.
Examples:
>>> fock0 = dq.fock(3, 0)
>>> fock01 = (dq.fock(3, 0) + dq.fock(3, 1)).unit()
>>> dq.braket(fock0, fock01)
Array(0.707+0.j, dtype=complex64)