cholesky 分解加速求解线性方程组

原理

求解
A x = b Ax=b

A A 对称正定,对其分解:
A = L L A = LL^\top


L L x = b LL^\top x = b

问题转换成先求 y y
L y = b Ly = b

再求 x x
L x = y L^\top x= y

生成数据

x = np.random.random((10000,1))

H = np.random.random((10000,10000))
A = H @ H.T

b = A @ x

直接求解

x_ = np.linalg.solve(A, b)

cholesky 分解后求解

L = np.linalg.cholesky(A)
y = solve_triangular(L, b, lower=True)
x_ = solve_triangular(L.T, y, lower=False)
原创文章 338 获赞 621 访问量 50万+

猜你喜欢

转载自blog.csdn.net/itnerd/article/details/105215505