-
Notifications
You must be signed in to change notification settings - Fork 40
Add opnorm implementation #375
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
Open
farhadrclass
wants to merge
30
commits into
JuliaSmoothOptimizers:main
Choose a base branch
from
Farhad-phd:opNorm_branch
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
eeed18a
Add robust opnorm implementation and tests
farhadrclass a67ac20
Update test_opnorm.jl
farhadrclass 13c04c7
Add Arpack as dependency and import in utilities.jl
farhadrclass f2c3d06
Add robust opnorm implementation and tests
farhadrclass cf1031a
Update test_opnorm.jl
farhadrclass 88b5df5
Add Arpack as dependency and import in utilities.jl
farhadrclass e29a76e
Rename opnorm to estimate_opnorm and update tests
farhadrclass 4fce741
Apply suggestions from code review
farhadrclass 3b17e79
Apply suggestions from code review
farhadrclass 67aeac9
Update utilities.jl
farhadrclass 829a552
Update src/utilities.jl
farhadrclass 8b0da8c
Update utilities.jl
farhadrclass 2d7ba5d
Update Project.toml
farhadrclass 5af8752
Update Project.toml
farhadrclass a3d545f
Add new dependencies and update opnorm tests
farhadrclass a672263
Refactor opnorm estimation dispatch and improve tests
farhadrclass 779431f
Add Arpack/TSVD weakdeps extension
farhadrclass b4dd14d
Update utilities.jl
farhadrclass ad73692
Merge branch 'JuliaSmoothOptimizers:main' into opNorm_branch
farhadrclass 50b27b6
Merge branch 'JuliaSmoothOptimizers:main' into opNorm_branch
farhadrclass 7111af1
Merge branch 'opNorm_branch' of https://github.com/Farhad-phd/LinearO…
farhadrclass 15b6dbd
Support estimate_opnorm for AbstractLinearOperator
farhadrclass accfea2
Update test/Project.toml
farhadrclass 15ae552
Merge branch 'JuliaSmoothOptimizers:main' into opNorm_branch
farhadrclass a1d8bcc
Update test/test_estimate_opnorm.jl
farhadrclass 755f82f
Update src/utilities.jl
farhadrclass 12deb75
Edits based on Tangi's review
farhadrclass 1565241
extra end
farhadrclass 9d68e4a
Update src/utilities.jl
farhadrclass d97f699
Update utilities.jl
farhadrclass File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| function test_opnorm() | ||
|
farhadrclass marked this conversation as resolved.
Outdated
farhadrclass marked this conversation as resolved.
Outdated
|
||
| @testset "opnorm and TSVD tests (LinearOperators)" begin | ||
| # 1) Square Float64 via direct LAPACK or ARPACK | ||
| A_mat = [2.0 0.0; 0.0 -1.0] | ||
| A_op = LinearOperator(A_mat) | ||
| λ, ok = opnorm(A_op) | ||
| @test ok == true | ||
| @test isapprox(λ, 2.0; rtol=1e-12) | ||
|
|
||
| # 2) Rectangular Float64 via direct LAPACK or ARPACK SVD | ||
| J_mat = [3.0 0.0 0.0; 0.0 1.0 0.0] | ||
| J_op = LinearOperator(J_mat) | ||
| σ, ok_sv = opnorm(J_op) | ||
| @test ok_sv == true | ||
| @test isapprox(σ, 3.0; rtol=1e-12) | ||
|
|
||
| # 3) Square BigFloat via TSVD | ||
| B_mat = Matrix{BigFloat}([2.0 0.0; 0.0 -1.0]) | ||
| B_op = LinearOperator(B_mat) | ||
| λ_bf, ok_bf = opnorm(B_op) | ||
| @test ok_bf == true | ||
| @test isapprox(λ_bf, BigFloat(2); rtol=1e-12) | ||
|
|
||
| # 4) Rectangular BigFloat via rectangular TSVD | ||
| JR_mat = Matrix{BigFloat}([3.0 0.0 0.0; 0.0 1.0 0.0]) | ||
| JR_op = LinearOperator(JR_mat) | ||
| σ_bf, ok_bf2 = opnorm(JR_op) | ||
| @test ok_bf2 == true | ||
|
farhadrclass marked this conversation as resolved.
Outdated
farhadrclass marked this conversation as resolved.
Outdated
|
||
| @test isapprox(σ_bf, BigFloat(3); rtol=1e-12) | ||
| end | ||
|
farhadrclass marked this conversation as resolved.
Outdated
|
||
| end | ||
|
|
||
| test_opnorm() | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.