Page 1 of 1

dlarfb - uninitialized reference possible

PostPosted: Mon Jun 11, 2012 6:43 am
by lawrence mulholland
Line 256 of DLARFB.f
LASTV = MAX( K, ILADLR( M, K, V, LDV ) )
should be
lastv = k + ILADLR(m-k,k,v(k+1,1),ldv)

the former can access unititialized elements of V when this has column of zeros.

Re: dlarfb - uninitialized reference possible

PostPosted: Tue Jun 12, 2012 1:33 pm
by admin
We found that your solution would break if m=n=k, for example, since v(k+1,1) could be out of bounds.
Could you be more explicit on "the former can access unititialized elements of V when this has column of zeros"? do you mean when V is the zero matrix? If so, that's not a problem as long as you have a valid value of k.

Re: dlarfb - uninitialized reference possible

PostPosted: Fri Aug 02, 2013 5:29 am
by lawrence mulholland
Yes the problem comes with a zero V.
You are correct that the case m=k needs to be protected:

Code: Select all
If (k==m) then
   lastv = k
else
...
end if


In the case
DIRECT = 'F' and STOREV = 'C'
V is lower trapezoidal and the upper triangular part of V may be unset.
Further, the '1's on the diagonal are not stored and may also be unset.
Consider, in ILADLR, the pass up the third column, with the leading
lower triangular part of V contains zeros up to V(4,3);
V(3,3) is then accessed, and if this is zero then V(2,3) is referenced.
What we are really interested of course is lastv>k so we needn't be looking
up as far as the leading lower triangle part anyway.
Lawrence