HQR index out of bounds


Toshi
02-17-2003, 07:54 AM
Hi!

I have a problem with an index running over the bounds in the hqr routine...

in the beginning, n is set to the number of rows:
int n=a.rows();

then nn is set to the maximal index:
nn = n-1;

later, doing the column modification, there is an access to:
a[i][k+2]
and the only check before that is:
if (k != nn)

But if k=nn-1, then k+2 = nn+1, and therefore out of bounds...

Is that a typo? Is it supposed to be k+1?
Did I miss something along the way?
Can someone please fill me in?

Thanks, Toshi

Saul Teukolsky
02-17-2003, 09:12 PM
Yes, this a bug. The statement just before the reference to a[i][k+2] should be

if (k+1 != nn) {

(line 14 from the end of the routine)

Toshi
02-18-2003, 07:15 AM
Hi!

Thanks for the fast reply!

It makes me kind of wonder... is that a new bug, or doesn't anyone ever use the hqr routine? :confused:

Toshi