Skip to content

bli_scalv has inconsistent semantics #829

Open
@devinamatthews

Description

The operations bli_(inv)?scal[vdm] are alone in having a conjalpha parameter (in the typed API and kernel definitions), while also taking an input vector (matrix diagonal, matrix) x which does not carry a conjugation flag. Functionally, this means that there is no operation which has the semantics of in-place conjugation. This is also in contrast to all other level1 operations which support arbitrary conjugation of inputs, while conversely not supporting conjugation flags for scalars. The value of conjalpha for its present purpose is debatable since it is trivial to conjugate scalars externally, and as just mentioned is not supported elsewhere (via the typed API at least). In principle, the functions bli_scal2[vdm] can be used to achieve conjugation of x, although there are currently bugs in the implementation for complex values (#828). No alternative exists for bli_invscal[vdm].

Note that bli_set[vdm] also has conjalpha which is harmless, although in the same vein arguably superfluous.

Ideally I would propose changing the semantics of the conjalpha to conjx to better align with other level1 functions and enable easy (and correct) in-place conjugation with optional scaling. However, I wonder: is anyone currently using bli_scal[vdm] with the conjalpha parameter for its present purpose? This would be a breaking API change... For the narrow use case of conjugation only, a separate bli_conj[vdm] function would work, but for example in TBLIS I often need both scaling and conjugation at the same time.

Metadata

Assignees

No one assigned

    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