Skip to content

Use of the info field in the Smith and AbstractHermite types over throwing errors? #18

@brainandforce

Description

@brainandforce

Like other LinearAlgebra.Factorization types, the Smith, RowHermite, and ColumnHermite types have an info::LinearAlgebra.BlasInt field that is zero when the factorization is a success. This could be used to convey to a user why a factorization failed without throwing an exception. This is what factorization types in the linear algebra standard library do (for instance, LinearAlgebra.QR).

I don't know the details of how this value is intended to be interpreted, but I do think that we can use this value to convey information about why a factorization failed. For this, we'd need some standards, and my idea is to set each bit of info to indicate something about the factorization failure:

  • The first bit should be 1 if the Smith/Hermite normal form matrix does not take the expected form (diagonal for SNF, trapezoidal for HNF).
  • The second bit should be 1 if the left unimodular factor is not unimodular.
  • The third bit should be 1 if the right unimodular factor is not unimodular.

This information can be exploited by the show(::IO, ::MIME"text/plain", ::T) method to explain to a user why a factorization failed in interactive use. My issue is that users writing non-interactive code would have to manually check for successful factorizations with LinearAlgebra.issuccess. Of course, this would be a breaking change if implemented.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions