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.
Like other
LinearAlgebra.Factorizationtypes, theSmith,RowHermite, andColumnHermitetypes have aninfo::LinearAlgebra.BlasIntfield 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
infoto indicate something about the factorization failure: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 withLinearAlgebra.issuccess. Of course, this would be a breaking change if implemented.