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.

3 posts
• Page **1** of **1**

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.

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.

- lawrence mulholland
**Posts:**18**Joined:**Mon Jun 11, 2012 6:33 am**Location:**NAG Ltd, Oxford, UK

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.

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.

- admin
- Site Admin
**Posts:**543**Joined:**Wed Dec 08, 2004 7:07 pm

Yes the problem comes with a zero V.

You are correct that the case m=k needs to be protected:

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

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

- lawrence mulholland
**Posts:**18**Joined:**Mon Jun 11, 2012 6:33 am**Location:**NAG Ltd, Oxford, UK

3 posts
• Page **1** of **1**

Users browsing this forum: No registered users and 1 guest