Skip to content

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

Closed

Description

@devinamatthews

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.

Activity

  1. devinamatthews commented on Sep 23, 2024

    @devinamatthews
    MemberAuthor

    @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

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions