HILA
Loading...
Searching...
No Matches
hila::linalg Namespace Reference

Inversed diagnal + const. matrix using Sherman-Morrison formula. More...

Functions

template<int N, typename T , typename C , std::enable_if_t< hila::is_complex_or_arithmetic< C >::value, int > = 0>
auto invert_diagonal_plus_constant_matrix (const DiagonalMatrix< N, T > &D, const C c)
 

Detailed Description

Inversed diagnal + const. matrix using Sherman-Morrison formula.

Function Documentation

◆ invert_diagonal_plus_constant_matrix()

template<int N, typename T , typename C , std::enable_if_t< hila::is_complex_or_arithmetic< C >::value, int > = 0>
auto hila::linalg::invert_diagonal_plus_constant_matrix ( const DiagonalMatrix< N, T > &  D,
const C  c 
)

Sherman-Morrison formula (generalized to complex) is

\[ (A + u v^{\dagger})^{-1} = A^{-1} - \frac{A^{-1} u v^{\dagger} A^{-1}}{(1 + v^{\dagger} A^{-1} u)}, \]

where \(A\) is invertible matrix and \(u\), \(v\) are vectors with outer product \(u v^{\dagger}\). Let's specialize this here for the case where \(A\) is diagonal and

\[ u = v = \sqrt{c} [1, 1, 1, ...]^{T} \]

i.e. the inversed matrix \(M^{-1} = (A + C)^{-1}\), where \(C = c uv^{\dagger}\) is constant matrix. The inversed matrix \( M^{-1}\) exists iff \((1 + v^{\dagger} A^{-1} u) \neq 0\).

Definition at line 812 of file matrix_linalg.h.