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 and w.

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 and w.

Return type

inprod

Notes

Note that the broadcasting behavior of inner_product() differs from numpy.inner(). Rather it follows the broadcasting rules of numpy.matmul() in that n-d arrays are treated as stacks of vectors.