Nemocas/AbstractAlgebra.jl

`is_[lower/upper]_triangular` not useful for non-square matrices

thofma opened this issue · 5 comments

thofma commented
julia> is_lower_triangular(QQ[1 1;])
false

There is also an implementation in Nemo for ZZMatrix that should be fixed.

fieker commented

I think we need to define what it should be, the matrix aparently is upper triangular at least.
is_lower_triangular <=> m_(i,j) = 0 for all j>i then above is correct (m[1,2] != 0)

I think the function is correct, what is missing is a definition of what we mean with upper/lower triangular. The definition I know is indeed just like what @fieker suggests, and fits with what I get here:

julia> is_lower_triangular(QQ[1 1;])
false

julia> is_upper_triangular(QQ[1 1;])
true

This is also in line with what GAP does:

gap> IsLowerTriangularMat([[1, 1]]);
false
gap> IsUpperTriangularMat([[1, 1]]);
true

and it is also in line with what Julia itself does (note that is_lower_triangular is an alias for LinearAlgebra.istril):

julia> is_lower_triangular([ 1 1 ;])
false

julia> is_upper_triangular([ 1 1 ;])
true
thofma commented

The problem I have is that there is matrix triangularization (e.g. Asymptotically Fast Triangularization of Matrices over Rings), which would yield ZZ[1 1;] and this is a "lower triangular matrix". Apparently the matrix normal form people use "triangular" to mean "echelon form". I probably was looking for is_echelon_form or something like that.

Looking at that paper I don't see an obvious place that suggest what you say, can you pinpoint it? I did however find a spot that seems to support "my" definition of lower triangular on page 1072:

[...] to convert A into a lower triangular matrix L [...]
In order to introduce a zero in the $i, j$ location (where $i &lt; j$), [...]

thofma commented

My bad. I forgot that they assume full rank. Then it coincides with what we have. I probably want is_echelon_form. Sorry for the noise.