【PLA】基于Python实现的线性代数算法库之QR分解
算法包下载链接:https://download.youkuaiyun.com/download/qq_42629529/79481514
from PLA.Matrix import Matrix
from PLA.GramSchmidtProcess import qr
if __name__ == "__main__":
#1
A1 = Matrix([[1, 1, 2],
[1, 1, 0],
[1, 0, 0]])
Q1, R1 = qr(A1)
print(Q1)
print(R1)
print(Q1.dot(R1))
print()
#2
A2 = Matrix([[2, -1, -1],
[2, 0, 2],
[2, -1, 3]])
Q2, R2 = qr(A2)
print(Q2)
print(R2)
print(Q2.dot(R2))

本文介绍了如何使用基于Python的PLA库进行QR分解,通过实例演示了QR分解在矩阵操作中的应用,包括A1和A2矩阵的分解过程,并验证了Q与R的乘积。适合理解线性代数算法在编程中的应用。
940

被折叠的 条评论
为什么被折叠?



