0

I have banded matrices with lower band kl and upper band ku. I want to put them in lower triangular form and to do so, I am employing QR Householder. So, I modified the QR Householder algorithm for the lower band but can't get to a modification of the algorithm for the upper band to work. Here below, for the lower band I take the x array to only where it's non-zero. Then, when updating A, it updates a rectangular array which takes zeros from the upper band (which I would like to ignore). I've tried to vectorize that part (ignoring the zeros of the upper band) but can't get it to work.

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
Math Stout
  • 141
  • 1
  • 13
  • The zeroes above the band will become non zero when you apply the householder transforms. – dmuir Oct 11 '17 at 13:15
  • Yes but is there a way to vectorize so that you only take the nonzero entries on the rows above the diagonal? – Math Stout Oct 11 '17 at 13:37
  • My point was that after applying the first householder transform all columns will, most likely, have non zero entries wherever the first column has non zero entries, and after the second wherever either of the first two columns are non zero. So yes, there will be a small, and getting smaller, island of zeroes but I wonder if avoiding using that will be worth while. After some transforms the remaining columns will each be a vector of non-zero,a vector of zeroes, a vector of zeroes and then the zeroes below the diagonal, and estimate the size of the middle zeroes. – dmuir Oct 11 '17 at 13:48

0 Answers0