0

我有带下带 kl 和上带 ku 的带状矩阵。我想把它们做成下三角形,为此,我正在使用 QR Householder。所以,我修改了低频段的 QR Householder 算法,但无法修改高频段的算法。在下面,对于较低的波段,我将 x 数组仅带到它非零的位置。然后,在更新 A 时,它会更新一个矩形数组,该数组从上频带取零(我想忽略它)。我试图对那部分进行矢量化(忽略上频带的零),但无法让它工作。

function [U, R] = HouseH_QR(A, lowband) % so would like to add the upperband argument
[m, n] = size(A);
% algo from Trefethen with my mod for kl
% this works but not taking advantage of upperband 
for k = 1:n,
    kl = min(k+lowband, m);  % the lower band
    x = A(k:kl,k);
    e = zeros(length(x),1); e(1) = 1;
    u = sign(x(1))*norm(x)*e + x;
    u = u./norm(u);
    A(k:kl, k:n) = A(k:kl, k:n) - 2*u*u'*A(k:kl, k:n); % lower triang
    U(k:m,k) = u;
end
4

0 回答 0