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

Cannot use complex bli_scal2s with &x == &y #828

Open
devinamatthews opened this issue Sep 23, 2024 · 1 comment · May be fixed by #830
Open

Cannot use complex bli_scal2s with &x == &y #828

devinamatthews opened this issue Sep 23, 2024 · 1 comment · May be fixed by #830
Assignees

Comments

@devinamatthews
Copy link
Member

The level0 macros bli_scal2s, bli_scal2js, bli_scal2ris, and bli_scal2jris (collectively, y = alpha*conj?(x)) all boil down to the same implementation which, for complex numbers, writes the real part of y before the real part of x is finished being read. Thus, if the same address or variable is used for both x and y, the incorrect result is computed.

Of course, scal2s with &x == &y is just scals, but there are situations where the single operand in-place version cannot be used (for example, via bli_scal2v which can conjugate the x vector, while bli_scalv cannot---I will be submitting a separate issue about this).

To be completely general, all complex level0 macros should use temporary local variables to avoid writing to the output until after all inputs have been read.

@devinamatthews
Copy link
Member Author

@fgvanzee if you happen to get around to making a PR for this before I do, great, but I'll do one in the next few weeks otherwise.

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 a pull request may close this issue.

1 participant