Skip to content

Commit

Permalink
accommodate newer versions of ArnoldiMethod
Browse files Browse the repository at this point in the history
  • Loading branch information
RalphAS committed Apr 16, 2024
1 parent e936cbc commit d474010
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "PeriodicSchurDecompositions"
uuid = "e5aedecb-f6c0-4c91-b6ff-fbae4296f459"
authors = ["Ralph A. Smith and contributors"]
version = "0.1.4"
version = "0.1.5"

[deps]
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Expand All @@ -11,7 +11,7 @@ ArnoldiMethod = "ec485272-7323-5ecc-a04f-4719b315124d"

[compat]
MatrixFactorizations = "0.8,0.9,1"
ArnoldiMethod = "0.1,0.2"
ArnoldiMethod = "0.1,0.2,0.3,0.4"
julia = "1"

[extras]
Expand Down
19 changes: 11 additions & 8 deletions src/krylov.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ using ArnoldiMethod:
RitzValues,
include_conjugate_pair,
OrderPerm,
partition!,
Target
using Random

Expand Down Expand Up @@ -600,7 +599,7 @@ function _partial_pschur!(As,
Hpfoot = Hs[p][(kmax + 1):(kmax + 1), active:kmax] # rowvector

# old logic (sorting 1:kmax) was wrong if we acquire an unconverged eigval
# preferable to the previously locked ones. (This is true of AM too.)
# preferable to the previously locked ones. (This was true of AM too.)

copyto!(ritz.ord, Base.OneTo(kmax))
sort!(ritz.ord, active, kmax, QuickSort, OrderPerm(ritz.λs, ordering))
Expand All @@ -616,11 +615,9 @@ function _partial_pschur!(As,
_showritz(ritz, " (after Arnoldi)")
end

# partition!(pred, seq, rg) reorders seq[rg] into preimages of pred -> true,false
# returning index of first false

# find how many preferred ev may have converged
first_not_conv_idx = partition!(isconverged, ritz.ord, active:effective_nev)
sort!(view(ritz.ord, active:effective_nev), by=(x -> isconverged(x) ? 0 : 1))
first_not_conv_idx = findfirst(x -> !isconverged(x), ritz.ord)
_kry_verby[] > 0 && println("ritz.ord after lock ordering: ", ritz.ord)
nlockprev = nlock
nlock = first_not_conv_idx === nothing ? effective_nev : first_not_conv_idx - 1
Expand Down Expand Up @@ -678,8 +675,14 @@ function _partial_pschur!(As,
# pace AM, there is no reason to expect them to converge in order of preference,
# so we normally allow a "buffer" of partially converged hopefuls.
istart = nlock + 1 + purgebuffer
nopurge(i) = !isconverged(i)
conv_idx = partition!(nopurge, ritz.ord, istart:kgood)
sort!(view(ritz.ord, istart:kgood), by=(x -> isconverged(x) ? 1 : 0))
conv_idx = nothing
for i in istart:kgood
if isconverged(ritz.ord[i])
conv_idx = i
break
end
end
else
conv_idx = nothing
end
Expand Down

2 comments on commit d474010

@RalphAS
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/104974

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.1.5 -m "<description of version>" d47401086d4f3def538197438cf7e49db4472193
git push origin v0.1.5

Please sign in to comment.