Skip to content

Commit

Permalink
Add tr shortcut
Browse files Browse the repository at this point in the history
  • Loading branch information
lgoettgens committed Sep 6, 2024
1 parent 28f6068 commit 06ca653
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Matrix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3700,8 +3700,9 @@ such that $A^k = 0$. If `A` is not square an exception is raised.
"""
function is_nilpotent(A::MatrixElem{T}) where {T <: RingElement}
!is_square(A) && error("Dimensions don't match in is_nilpotent")
A = deepcopy(A)
is_zero(tr(A)) || return false
n = nrows(A)
A = deepcopy(A)
i = 1
is_zero(A) && return true
while i < n
Expand Down

0 comments on commit 06ca653

Please sign in to comment.