Skip to content

Commit 434a9cf

Browse files
authored
remove claim that complex numbers cannot be sorted (#1479)
Closes #1478. Instead of talking about ordered fields and talking about why not use lexicographical ordering, I decided to just delete everything.
1 parent 8d79b34 commit 434a9cf

File tree

1 file changed

+9
-20
lines changed

1 file changed

+9
-20
lines changed

src/eigen.jl

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -359,13 +359,8 @@ eigvals(x::Number; kwargs...) = imag(x) == 0 ? real(x) : x
359359
"""
360360
eigmax(A; permute::Bool=true, scale::Bool=true)
361361
362-
Return the largest eigenvalue of `A`.
363-
The option `permute=true` permutes the matrix to become
364-
closer to upper triangular, and `scale=true` scales the matrix by its diagonal elements to
365-
make rows and columns more equal in norm.
366-
Note that if the eigenvalues of `A` are complex,
367-
this method will fail, since complex numbers cannot
368-
be sorted.
362+
Return the largest eigenvalue of `A`, assuming they are all real, and throwing an error otherwise.
363+
The `permute` and `scale` keyword arguments are the same as for [`eigen`](@ref).
369364
370365
# Examples
371366
```jldoctest
@@ -390,23 +385,18 @@ Stacktrace:
390385
```
391386
"""
392387
function eigmax(A::Union{Number, AbstractMatrix}; permute::Bool=true, scale::Bool=true)
393-
v = eigvals(A, permute = permute, scale = scale)
388+
v = eigvals(A; permute, scale)
394389
if eltype(v)<:Complex
395390
throw(DomainError(A, "`A` cannot have complex eigenvalues."))
396391
end
397-
maximum(v)
392+
return maximum(v)
398393
end
399394

400395
"""
401396
eigmin(A; permute::Bool=true, scale::Bool=true)
402397
403-
Return the smallest eigenvalue of `A`.
404-
The option `permute=true` permutes the matrix to become
405-
closer to upper triangular, and `scale=true` scales the matrix by its diagonal elements to
406-
make rows and columns more equal in norm.
407-
Note that if the eigenvalues of `A` are complex,
408-
this method will fail, since complex numbers cannot
409-
be sorted.
398+
Return the smallest eigenvalue of `A`, assuming they are all real, and throwing an error otherwise.
399+
The `permute` and `scale` keyword arguments are the same as for [`eigen`](@ref).
410400
411401
# Examples
412402
```jldoctest
@@ -430,13 +420,12 @@ Stacktrace:
430420
[...]
431421
```
432422
"""
433-
function eigmin(A::Union{Number, AbstractMatrix};
434-
permute::Bool=true, scale::Bool=true)
435-
v = eigvals(A, permute = permute, scale = scale)
423+
function eigmin(A::Union{Number, AbstractMatrix}; permute::Bool=true, scale::Bool=true)
424+
v = eigvals(A; permute, scale)
436425
if eltype(v)<:Complex
437426
throw(DomainError(A, "`A` cannot have complex eigenvalues."))
438427
end
439-
minimum(v)
428+
return minimum(v)
440429
end
441430

442431
inv(A::Eigen) = A.vectors * inv(Diagonal(A.values)) / A.vectors

0 commit comments

Comments
 (0)