Update the "Q-less" QR factorization of a matrix. Routines are provided for adding and deleting columns, adding rows, and solving the least-squares systems.
#Enter package mode by typing ]
add "https://github.com/jekyllstein/QRupdate.jl"
Pkg.test("QRupdate")
Build the "Q-less" QR factorization of A one column at a time.
m, n = 100, 50
A = randn(m,0)
R = Array{Float64}(undef, 0,0)
for i in 1:n
a = randn(m)
global R = qraddcol(A, R, a)
global A = [A a]
end
Solve a least-squares problem using R.
b = randn(m)
x, r = csne(R, A, b)
Delete a column and compute new R.
n = size(A,2)
k = rand(1:n)
A = A[:, 1:n .!= k]
R = qrdelcol(R, k)
Solve a least-squares problem using R.
x, r = csne(R, A, b)
Add a row to A.
n = size(A,2)
a = randn(n)' # must be row vector
A = [A; a]
R = qraddrow(R, a)
Solve a least-squares problem using R.
b = [b; randn()]
x, r = csne(R, A, b)
Björck, A. (1996). Numerical methods for least squares problems. SIAM.