Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Out of bounds reads #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

mlourakis
Copy link

@mlourakis mlourakis commented Apr 1, 2022

Hi,

I needed a bare bones QR and your code came in handy. Going though it, I realized that it had an out of bounds error in partialdot_product() which I have fixed in this PR. Interestingly, this error does not seem to affect the computed factorization.

If called with length=10 and index=1, the original code will access vector elements at indices
1 2 3 4 5 6 7 8 9 10 (all in the 2nd loop)
Note that the last one (10) is out of bounds.

Similarly, for a call with 10 2, the code accesses
2 3 4 5 6 7 8 9 10 11
where the last two indices are again out of bounds.

With the new code, for (10, 1) the indices accessed are
1 2 3 4 (1st loop)
5 6 7 8 9 (2nd loop)
and are all within bounds.

For the call (2, 10), the new indices are
2 3 4 (1st loop)
5 6 7 8 9 (2nd loop)

Fixed out of bounds reads in partialdot_product()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant