Untitled



In [1]:
import numpy as np
import Algorithms as alg

In [5]:
G = np.array([[5,1],[-5,5]])
GD = np.diag(np.diag(G))
GA = G-GD
S = np.dot(np.linalg.inv(GD),GA)
np.linalg.svd(np.dot(S,S), compute_uv = False)


Out[5]:
array([ 0.2,  0.2])

In [11]:
GInv


Out[11]:
array([[-0.0+0.4j ,  0.2+0.04j],
       [ 0.0-0.2j ,  0.0+0.08j]])

In [30]:
D = np.array([[1.05, -0.01],[0.01,1.05]])
G = np.array([[2,-1],[5,10]])
np.dot(np.linalg.inv(np.dot(D,G)),G)


Out[30]:
array([[ 0.96970796,  0.03664067],
       [-0.01052059,  0.93488119]])

In [31]:
np.dot(D,G)/G


Out[31]:
array([[ 1.025,  1.15 ],
       [ 1.054,  1.049]])

In [ ]: