inner_product¶
- probnum.utils.linalg.inner_product(v, w, A=None)[source]¶
Inner product \(\langle v, w \rangle_A := v^T A w\).
For n-d arrays the function computes the inner product over the last axis of the two arrays
v
andw
.- Parameters
v (np.ndarray) – First array.
w (np.ndarray) – Second array.
A (Optional[Union[np.ndarray, linops.LinearOperator]]) – Symmetric positive (semi-)definite matrix defining the geometry.
- Returns
Inner product(s) of
v
andw
.- Return type
inprod
Notes
Note that the broadcasting behavior of
inner_product()
differs fromnumpy.inner()
. Rather it follows the broadcasting rules ofnumpy.matmul()
in that n-d arrays are treated as stacks of vectors.