Skip to content

Conversation

@jalvesz
Copy link
Contributor

@jalvesz jalvesz commented May 17, 2025

This PR introduces the base for iterative solvers.

Two methods are proposed:

  • Conjugate Gradient (CG)
  • Preconditioned Conjugate Gradient (PCG)

Each method is made public with two public interface flavors:

  • stdlib_solve_<method>_kernel: All arguments are mandatory (no optionals/no internal allocations), it contains the methods steps. The linear system (and preconditioner) is defined through a public DT stdlib_linop which enables to extend two key procedures: matvec equivalent to a matrix-vector product and inner_product equivalent to the dot_product. This is the interface recommended to extend the method when dealing with a matrix type not available in stdlib or when working in distributed-memory frameworks for which the matvec, dot_product and factorization steps need to be adapted to account for parallel synchronization.
  • stdlib_solve_<method>: API with optional arguments, the linear system can be defined with dense or CSR_<>_type matrices. For the PCG, the following preconditioners are available: none (identity), jacobi (1/diagonal). It internally uses stdlib_solve_<method>_kernel.
  • tests
  • examples
  • documentation

jalvesz and others added 30 commits March 2, 2025 22:26
jalvesz and others added 18 commits September 16, 2025 16:00
@jalvesz
Copy link
Contributor Author

jalvesz commented Sep 19, 2025

@jvdp1 thanks for your reviews. I think I managed to address all of them. Let me know your thoughts.

Copy link
Member

@jvdp1 jvdp1 left a comment

Choose a reason for hiding this comment

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

Thank you @jalvesz. LGTM.

@jalvesz
Copy link
Contributor Author

jalvesz commented Sep 25, 2025

With no more comments I'll go ahead and merge this.

@jalvesz jalvesz merged commit fb404bb into fortran-lang:master Sep 25, 2025
16 checks passed
@jalvesz jalvesz deleted the iterative branch September 26, 2025 10:22
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