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

Only preallocated one vector for preconditioners #187

Merged
merged 2 commits into from
Mar 24, 2020

Conversation

amontoison
Copy link
Member

No description provided.

@coveralls
Copy link

coveralls commented Mar 24, 2020

Coverage Status

Coverage remained the same at 97.141% when pulling e1c1b84 on amontoison:wrap_preconditioners into c0d4099 on JuliaSmoothOptimizers:master.

@@ -4,7 +4,7 @@ using LinearAlgebra
function wrap_preconditioners(kwargs)
if (haskey(kwargs, :M) && typeof(kwargs[:M]) <: AbstractMatrix) || (haskey(kwargs, :N) && typeof(kwargs[:N]) <: AbstractMatrix)
k = keys(kwargs)
v = Tuple(typeof(arg) <: AbstractMatrix ? PreallocatedLinearOperator(arg) : arg for arg in values(kwargs))
v = Tuple(typeof(arg) <: AbstractMatrix ? PreallocatedLinearOperator(arg, symmetric=true) : arg for arg in values(kwargs))
Copy link
Member

Choose a reason for hiding this comment

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

With GMRES & co., preconditioners could be non-symmetric.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, but we only need M⁻¹ * v products. I did the same thing with A for CGS, DIOM and DQGMRES even if A is not symmetric.

Copy link
Member

Choose a reason for hiding this comment

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

I see. It's worth adding a comment around your last change to explain that.

Copy link
Member Author

Choose a reason for hiding this comment

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

With the option symmetric=true, we preallocate matrix-vector products with A and A' with the same vector. If we don't use / need products with A' it's the good thing to do even if A is not symmetric.

@codecov
Copy link

codecov bot commented Mar 24, 2020

Codecov Report

Merging #187 into master will not change coverage by %.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #187   +/-   ##
=======================================
  Coverage   97.14%   97.14%           
=======================================
  Files          28       28           
  Lines        2483     2483           
=======================================
  Hits         2412     2412           
  Misses         71       71           
Impacted Files Coverage Δ
src/variants.jl 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 584da46...e1c1b84. Read the comment docs.

@@ -4,6 +4,7 @@ using LinearAlgebra
function wrap_preconditioners(kwargs)
if (haskey(kwargs, :M) && typeof(kwargs[:M]) <: AbstractMatrix) || (haskey(kwargs, :N) && typeof(kwargs[:N]) <: AbstractMatrix)
k = keys(kwargs)
# Matrix-vector products with Mᵀ and Nᵀ are not required, we can safely use one vector for products with M / Mᵀ and N / Nᵀ
Copy link
Member

Choose a reason for hiding this comment

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

Please explain that that's why you set symmetric=true somewhere. Otherwise, I'm sure we'll forget and puzzle over this in 6 months time.

@amontoison amontoison force-pushed the wrap_preconditioners branch from 7ad588d to e1c1b84 Compare March 24, 2020 02:06
@dpo dpo merged commit a6faf75 into JuliaSmoothOptimizers:master Mar 24, 2020
@dpo
Copy link
Member

dpo commented Mar 24, 2020

Thank you.

@amontoison amontoison deleted the wrap_preconditioners branch August 4, 2021 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants