pint.utils.sherman_morrison_dot

pint.utils.sherman_morrison_dot(Ndiag, v, w, x, y)[source]
Compute an inner product of the form

(x| C^-1 |y)

where

C = N + w |v)(v| ,

N is a diagonal matrix, and w is a positive real number, using the Sherman-Morrison identity

C^-1 = N^-1 - ( w N^-1 |v)(v| N^-1 / (1 + w (v| N^-1 |v)) )

Additionally,

det[C] = det[N] * (1 + w (v| N^-1 |v)) )

Paremeters

Ndiag: array-like

Diagonal elements of the diagonal matrix N

v: array-like

A vector that represents a rank-1 update to N

w: float

Weight associated with the rank-1 update

x: array-like

Vector 1 for the inner product

y: array-like

Vector 2 for the inner product

returns:
  • result (float) – The inner product

  • logdetC (float) – log-determinant of C