Closed tky823 closed 1 year ago
experimental notebooks: https://colab.research.google.com/github/tky823/ssspy/blob/5954d98d8a3755799a24d218143b1981c81a4175/notebooks/ISSUE/issue199.ipynb
Current implementation
Implementation referred to [1]
In terms of computational stability, I will choose the current implementation.
I found this is due to the stability of np.linalg.eigh
. The naive implementation of np.linalg.eigh
for a 2x2 matrix using closed form is unstable.
https://colab.research.google.com/github/tky823/ssspy/blob/bf8bd1187543ab163f8ff445040ee9e38ecb1c8a/notebooks/ISSUE/issue199.ipynb
Summary
In
IP2
, we solve the following generalized eigenvalue decomposition for positive definite matrices A and B. A @ x = lambda @ B @ xCurrent implementation By using Cholesky decomposition L @ L.H = B, solve the following eigenvalue problem. C @ y = lambda @ y, where C = L^{-1} A @ L.H^{-1} and y = L.H @ x Then, x = L.H^{-1} @ y.
Implementation referred to [1] Compute G = B^{-1} @ A (not positive definite). lamb_max = (tr(G) + sqrt(tr(G)*2 - 4 det(G))) / 2 lamb_min = (tr(G) - sqrt(tr(G)*2 - 4 det(G))) / 2 x_max = (-G_12, G_11 - lamb_max) x_min = (G_22 - lamb_min, - G_21) The order in [1] may be incorrect.
Which is faster?
[1] paper of ISS2