Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC: sort eigenvalues in a canonical order #21598

Merged
merged 15 commits into from
Feb 5, 2019
Prev Previous commit
Next Next commit
fixes
  • Loading branch information
stevengj committed Jan 24, 2019
commit e63917133a3c29018195be10ddb054d59ad57e3a
9 changes: 5 additions & 4 deletions base/combinatorics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,10 @@ isperm(p::Tuple{Int,Int}) = ((p[1] == 1) & (p[2] == 2)) | ((p[1] == 2) & (p[2] =
# swap columns i and j of a, in-place
function swapcols!(a::AbstractMatrix, i, j)
i == j && return
cols = indices(a,2)
(i in cols && j in cols) || throw(BoundsError())
for k in indices(a,1)
cols = axes(a,2)
@boundscheck i in cols || throw(BoundsError(a, (:,i)))
@boundscheck j in cols || throw(BoundsError(a, (:,j)))
for k in axes(a,1)
@inbounds a[k,i],a[k,j] = a[k,j],a[k,i]
end
end
Expand All @@ -77,7 +78,7 @@ function permutecols!!(a::AbstractMatrix, p::AbstractVector{<:Integer})
count = 0
start = 0
while count < length(p)
ptr = start = findnext(p, start+1)
ptr = start = findnext(!iszero, p, start+1)::Int
next = p[start]
count += 1
while next != start
Expand Down
4 changes: 2 additions & 2 deletions stdlib/LinearAlgebra/docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ julia> A = [-4. -17.; 2. 2.]

julia> eigvals(A)
2-element Array{Complex{Float64},1}:
-1.0 + 5.0im
-1.0 - 5.0im
-1.0 + 5.0im

julia> eigvecs(A)
2×2 Array{Complex{Float64},2}:
0.945905+0.0im 0.945905-0.0im
-0.166924-0.278207im -0.166924+0.278207im
-0.166924+0.278207im -0.166924-0.278207im
```

In addition, Julia provides many [factorizations](@ref man-linalg-factorizations) which can be used to
Expand Down