Skip to content

Conversation

jalvesz
Copy link
Contributor

@jalvesz jalvesz commented Sep 28, 2025

This PR co-developed with CoPilot introduces the Bi-Conjugate Gradient stabilized method. It is inspired from SciPy's implementation https://github.com/scipy/scipy/blob/v1.16.2/scipy/sparse/linalg/_isolve/iterative.py#L158-L304 but following the internal framework introduced in #994

Key interfaces :

  • call stdlib_solve_bicgstab_kernel (A, M, b, x, rtol, atol, maxiter, workspace)
  • call stdlib_solve_bicgstab(A, b, x [, di, rtol, atol, maxiter, restart, precond, M, workspace])
  • Implementation
  • Documentation
  • unit testing (symmetric and non-symmetric)
  • examples ( 2 : dense and CSR )

@jalvesz jalvesz requested a review from Copilot September 28, 2025 11:56
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces the Bi-Conjugate Gradient Stabilized (BiCGSTAB) method for solving non-symmetric linear systems. The implementation follows the internal framework established in #994 and is inspired by SciPy's BiCGSTAB implementation.

Key changes:

  • Adds BiCGSTAB kernel and user-friendly interface for dense and CSR matrices
  • Moves preconditioner enums to main module for shared use across solvers
  • Includes comprehensive test coverage and example programs

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/stdlib_linalg_iterative_solvers_bicgstab.fypp Core BiCGSTAB implementation with kernel and interface procedures
src/stdlib_linalg_iterative_solvers.fypp Main module updated with BiCGSTAB interfaces and shared preconditioner enums
src/stdlib_linalg_iterative_solvers_pcg.fypp Removes duplicate preconditioner enum definitions
test/linalg/test_linalg_solve_iterative.fypp Adds comprehensive test cases for BiCGSTAB method
example/linalg/example_solve_bicgstab.f90 Basic BiCGSTAB usage example
example/linalg/example_solve_bicgstab_wilkinson.f90 Advanced example using Wilkinson matrix with CSR format
src/CMakeLists.txt Adds new BiCGSTAB source file to build
example/linalg/CMakeLists.txt Adds BiCGSTAB examples to build
doc/specs/stdlib_linalg_iterative_solvers.md Documentation for BiCGSTAB interfaces and usage

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

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.

LGTM! Thank you @jalvesz

@jalvesz
Copy link
Contributor Author

jalvesz commented Oct 6, 2025

Thanks for your reviews @jvdp1, I'll merge this one which I think is ready. I just opened an issue to don't forget about the coo2csr discussion.

@jalvesz jalvesz merged commit eb46153 into fortran-lang:master Oct 6, 2025
16 checks passed
@jalvesz jalvesz deleted the bicgstab branch October 6, 2025 07:11
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.

2 participants