Skip to content

Reuse Arpack in order to compute norm of Bk #159

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

Merged

Conversation

MohamedLaghdafHABIBOULLAH
Copy link
Contributor

@MohamedLaghdafHABIBOULLAH
Copy link
Contributor Author

Please hold off on merging for now, as some tests are affected by #42 .

@nathanemac you can try to merge this PR locally with R2N in order to use ADNLPModels

@nathanemac
Copy link

@MohamedLaghdafHABIBOULLAH, using Arpack instead of TSVD indeed solves the Lapack issue for R2N on the dummy example:

nlp = ADNLPModel(x -> (1-x[1])^2 + 100(x[1]-x[2]^2)^2, [1., 1.], backend=:generic) h = NormL1(1.0) options = ROSolverOptions() res_r2n = R2N(nlp, h, options)

@MohamedLaghdafHABIBOULLAH
Copy link
Contributor Author

@nathanemac thanks for the confirmation, we believe that Arrack may be more accurate than TSVD, but still have some bugs...
If you encounter one, do not hesitate to share it.

@MohamedLaghdafHABIBOULLAH
Copy link
Contributor Author

MohamedLaghdafHABIBOULLAH commented Nov 4, 2024

This PR should address the problem encountered in this issue #42
by catching the XYAUPD_Exception error in Arpack calls and dynamically increase NCV as needed to handle convergence issues. This modification addresses instability in LSR1 computations due to insufficient NCV.

@MaxenceGollier
Copy link
Collaborator

Just wondering, @MohamedLaghdafHABIBOULLAH, is it possible to use the frobenius norm instead of the operator norm for your algorithm ? QRMumps has a function (see qrm_spmat_nrm) that allows to compute this quite efficiently I think and it could allow to reduce the number of dependencies because I am already adding QRMumps in my own PR #145.

@MohamedLaghdafHABIBOULLAH
Copy link
Contributor Author

MohamedLaghdafHABIBOULLAH commented Nov 27, 2024

@MaxenceGollier yes one could and it has been discussed in the paper and in this issue #133 , however I'm afraid that the solver will become slower as the step size is related to 1/|B_k|, in this case the Frobenius norm might represent a loose bound on the operator norm or the largest eig norm.

@dpo
Copy link
Member

dpo commented Nov 28, 2024

You can’t compute the Frobenius norm of a quasi-Newton operator without a lot of work.

@MaxenceGollier
Copy link
Collaborator

@MohamedLaghdafHABIBOULLAH can we add a wrapped allocs unit test to be sure that opnorm does not allocate as well ?

@MaxenceGollier
Copy link
Collaborator

Arpack actually uses restarted Lanczos or Arnoldi iterations and allocates, wouldn't it be easier to try to make something work with Krylov.jl that has the same type of method and has in place methods @dpo ? I can open a PR with Krylov instead if this sounds ok.

@MohamedLaghdafHABIBOULLAH
Copy link
Contributor Author

@MohamedLaghdafHABIBOULLAH can we add a wrapped allocs unit test to be sure that opnorm does not allocate as well ?

It sure does allocate, but I can add it, although it's not the objective of this package.

@MohamedLaghdafHABIBOULLAH
Copy link
Contributor Author

Arpack actually uses restarted Lanczos or Arnoldi iterations and allocates, wouldn't it be easier to try to make something work with Krylov.jl that has the same type of method and has in place methods @dpo ? I can open a PR with Krylov instead if this sounds ok.

Does Krylov contain any solver that enable to approximate the opnorm ?

Co-authored-by: Dominique <[email protected]>
Use alphabetical order for external dependencies and remove unused variables.
Enhance robustness of Arpack usage by catching NCV-related errors

Catch the XYAUPD_Exception error in Arpack calls and dynamically increase NCV as needed to handle convergence issues. This modification addresses instability in LSR1 computations due to insufficient NCV.
@MohamedLaghdafHABIBOULLAH
Copy link
Contributor Author

@MohamedLaghdafHABIBOULLAH can we add a wrapped allocs unit test to be sure that opnorm does not allocate as well ?

What do you think, @dpo? The issue is that we're almost certain the tests will fail…

Copy link
Member

@dpo dpo left a comment

Choose a reason for hiding this comment

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

All tests fail. Did you test these changes locally? It doesn’t look like you did.

@MohamedLaghdafHABIBOULLAH
Copy link
Contributor Author

I apologize, indeed because we added R2N recently, I should have taken into account the way it computes the norm of Bk as well.

@dpo dpo merged commit d0a6107 into JuliaSmoothOptimizers:master Feb 26, 2025
10 of 12 checks passed
@dpo
Copy link
Member

dpo commented Feb 26, 2025

Thank you.

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.

4 participants