无法理解为什么scipy.linalg.qr_update无法正常工作。 来自scipy文档:
qr_update(Q,R,u,v,overwrite_qruv = False,check_finite = True)
如果A = Q R是A的QR分解,则返回QR分解 对于复数A,A + u vT对于实数A或A + u vH。
http://docs.scipy.org/doc/scipy-0.16.1/reference/generated/scipy.linalg.qr_update.html
但它不起作用!这是一个例子:
import numpy as np
from numpy.linalg import *
N = 3
coef = 0.5
Q = np.eye(N)
R = coef * np.eye(N)
u = np.matrix([[ 1.92981364, 0.2505024, 1.25051418]])
print "What should be:"
print Q*R + u.T * u
q1, r1 = qr_update(Q, R, u.T, u.T)
print "What we have:"
print q1 * r1
输出:
What should be:
[[ 4.22418069 0.48342295 2.41325932]
[ 0.48342295 0.56275145 0.3132568 ]
[ 2.41325932 0.3132568 2.06378571]]
What we have:
[[ 4.22418069e+00 -7.36996838e-02 -1.53468755e+00]
[ 0.00000000e+00 5.00656362e-01 -2.62290295e-03]
[ 0.00000000e+00 0.00000000e+00 5.16088504e-01]]
如果你能给我任何帮助,我将不胜感激!