Skip to content

Named tuple field names of linear algebra functions #295

Closed

Description

@IvanYashchuk

Currently linalg.qr and linalg.svd specify the return tuple field names using lower case letters: q, r, u, s, vh.

Are there any previous discussions on the naming convention? It's common in the linear algebra domain to denote the matrices with upper case single letters. Therefore in PyTorch's linear algebra module (that already uses the namedtuple returns) it was chosen to use qr() -> (Q, R) and svd() -> (U, S, Vh) - upper case letters.

In Julia's LinearAlgebra module also upper case letters are used for accessing the result of QR and SVD decompositions.

Activity

  1. added this to the v2021 milestone on Nov 1, 2021
  2. kgryte commented on Nov 1, 2021

    @kgryte
    Contributor

    No discussion to which to refer. Using lowercase letters was initially chosen for case consistency throughout the API standard and reduce the need for users to know what case to use when. However, we can obviously revise this and elect to allow tuple fields to be uppercase. We'd just need a list fields which would need to be modified.

  3. leofang commented on Nov 1, 2021

    @leofang
    Contributor

    I think for consistency with other APIs it's probably better to stay with lowercases. Also save us one key stroke 🙂

  4. rgommers commented on Nov 1, 2021

    @rgommers
    Member

    I think the upper case names are very reasonable, probably even preferred if we'd do a greenfield design. Now that PyTorch is the only library that implements this already, it certainly makes sense - we didn't check this carefully enough perhaps, and we do not want to force PyTorch to make a backwards-incompatible change here (and namedtuples are limited, adding aliases in there seems tricky).

    So I'm +1 for changing this to upper-case.

  5. kgryte commented on Nov 4, 2021

    @kgryte
    Contributor

    In today's call, we decided to adopt @IvanYashchuk proposal to align with PyTorch in namedtuple field names for linear algebra APIs. I'll submit a PR shortly to update the specification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    API changeChanges to existing functions or objects in the API.topic: Linear AlgebraLinear algebra.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions