-
Notifications
You must be signed in to change notification settings - Fork 223
feat (linalg_iterative) : add gmres solver to the iterative methods library #1186
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
jalvesz
wants to merge
24
commits into
fortran-lang:master
Choose a base branch
from
jalvesz:gmres
base: master
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 all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
e830a02
start gmres draft
jalvesz eb6bfc6
add comments
jalvesz 877f435
remove kdim from test
jalvesz af06e0d
use dot_product
jalvesz 43b06c7
Merge branch 'gmres' of https://github.com/jalvesz/stdlib into gmres
jalvesz 314189f
Merge branch 'fortran-lang:master' into gmres
jalvesz bf59c02
gmres: add Hilbert matrix test
AlexanderGSC da90ab2
linalg: add MGS reorthogonalization to GMRES
AlexanderGSC 38048ce
fix: rename loop variable to avoid fypp collision
AlexanderGSC 36f81b5
fix: hilbert sp tolerance test
AlexanderGSC 87e9f32
fix: hilbert sp tolerance test
AlexanderGSC b9a99e1
fix: hilbert dp tolerance test
AlexanderGSC 5fa5583
fix: hilbert dp tolerance test for Intel 2024 1 cmake
AlexanderGSC c33097c
Merge pull request #9 from AlexanderGSC/colab-gmres
jalvesz 54769fe
Update test/linalg/test_linalg_solve_iterative.fypp
jalvesz cce7368
Update test/linalg/test_linalg_solve_iterative.fypp
jalvesz 450e7c0
Update test/linalg/test_linalg_solve_iterative.fypp
jalvesz b35926e
Update test/linalg/test_linalg_solve_iterative.fypp
jalvesz 902054c
Update test/linalg/test_linalg_solve_iterative.fypp
jalvesz 825fd51
fix declarations
jalvesz 6ebfe6b
make gmres implementation flexible by allowing switching between memo…
jalvesz 7dab12d
add example
jalvesz 3ba5a4f
convert static enum to integer helper function to determine the numbe…
jalvesz 0069cd3
simplify iterations logic
jalvesz 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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| program example_solve_gmres | ||
| use stdlib_kinds, only: dp | ||
| use stdlib_linalg_iterative_solvers, only: stdlib_solve_gmres, pc_jacobi | ||
| implicit none | ||
|
|
||
| real(dp), parameter :: A(4,4) = reshape([5.0_dp, 1.0_dp, 2.0_dp, 0.0_dp, & | ||
| 0.0_dp, 4.0_dp, -1.0_dp, 1.0_dp, & | ||
| 1.0_dp, 0.0_dp, 3.0_dp, 2.0_dp, & | ||
| 2.0_dp, -1.0_dp, 0.0_dp, 6.0_dp], [4,4]) | ||
| real(dp), parameter :: x0(4) = [0.2_dp, -0.1_dp, 0.3_dp, 0.0_dp] | ||
| real(dp), parameter :: xref(4) = [1.0_dp, 2.0_dp, -1.0_dp, 0.5_dp] | ||
| real(dp) :: rhs(4), x(4) | ||
|
|
||
| rhs = matmul(A, xref) | ||
|
|
||
| ! GMRES lets the user tune the restart size and the storage mode. | ||
| x = x0 | ||
| call stdlib_solve_gmres(A, rhs, x, restart=.false., kdim=2, maxiter=12, precond=pc_jacobi) | ||
| print *, 'compact:', x | ||
|
|
||
| x = x0 | ||
| call stdlib_solve_gmres(A, rhs, x, restart=.false., kdim=2, maxiter=12, precond=pc_jacobi, compact=.false.) | ||
| print *, 'cached :', x | ||
| end program example_solve_gmres |
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should it be
!>as the docstring precedes the declaration?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yes it could. In that case all the docstring characters in this file should be changed.