-
Notifications
You must be signed in to change notification settings - Fork 106
Always return convergence history #185
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
Comments
Sounds reasonable. This could potentially also make the functions type stable but now that we have constant propagation this might not be an issue anymore (but would have to check on 0.7). |
Closed
Goes part of the way: #238 |
Hi! I'm not sure I understand why constant propagation solves this issue? julia> using IterativeSolvers
julia> n = 100;
julia> A = rand(n, n);
julia> A = A + A' + 2*n*I;
julia> b = rand(n);
julia> @code_warntype cg(A, b)
MethodInstance for IterativeSolvers.cg(::Matrix{Float64}, ::Vector{Float64})
from cg(A, b; kwargs...) in IterativeSolvers at /home/guillaume/.julia/packages/IterativeSolvers/rhYBz/src/cg.jl:162
Arguments
#self#::Core.Const(IterativeSolvers.cg)
A::Matrix{Float64}
b::Vector{Float64}
Body::Union{Tuple{Vector{Float64}, ConvergenceHistory{_A, Nothing} where _A}, Vector{Float64}}
1 ─ %1 = Core.NamedTuple()::Core.Const(NamedTuple())
│ %2 = Base.pairs(%1)::Core.Const(Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}())
│ %3 = IterativeSolvers.:(var"#cg#22")(%2, #self#, A, b)::Union{Tuple{Vector{Float64}, ConvergenceHistory{_A, Nothing} where _A}, Vector{Float64}}
└── return %3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Right now there is no way of querying whether the method is converged other than retrieving the full convergence history with
log = true
.I would suggest always returning a minimal convergence history, without the resnorm array, which at least allows you to query whether it is converged and how many iterations that took. Setting
log = true
would then collect info during the iterations as well.It would look like this:
Maybe we could make the history object immutable as well.
The text was updated successfully, but these errors were encountered: