Skip to content

Some linalg functions are not well-defined #207

Closed
@lezcano

Description

@lezcano

The functions eigh, svd, qr and lstsq are not well-defined as written.

Uniqueness lstsq

linalg.lstsq docs currently read:
“Returns the least-squares solution to a linear matrix equation”
but the solution needn't be unique whenever A has non-trivial kernel (e.g. A = 0).

Proposed solution:

  • Rewrite it as "Returns a least-square solution [...]"
  • Perhaps we want to add a note on how to handle these cases (e.g. the solution with smallest norm is chosen) so that this function is well-defined for every input matrix. Note that this would not allow for the implementation of this function via faster but less robust algorithms such as LAPACK's gels, which assumes that A is full-rank and performs a QR decomposition.

Uniqueness eigh and svd:

  • Eigenvectors (resp. singular vectors) of a generic matrix are only defined up to sign in the real case and multiplication by a scalar of norm 1 in the complex case
  • When the matrix has repeated eigenvalues (resp. singular values) the associated eigenvectors are just defined up to multiplication by a rotation (or multiplication by a unitary matrix in the complex case).

Proposed solution:

  • Change the wording from "Returns the eigenvalues and eigenvectors of a symmetric matrix" to "Returns an eigendecomposition of a symmetric matrix".
  • Change the wording of linalg.svd as well.

QR decomposition cannot be defined

The qr decomposition is just well-defined whenever the matrix has full column rank. In the singular case pivoting is necessary.

Proposed solution: The behaviour of this function should be marked as unspecified whenever the input matrix does not have full column rank.

cc @rgommers @mruberry

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions