Re-enable BiCGSTAB and linSolve0 iterative solvers#95
Conversation
Co-authored-by: ocramz <5902760+ocramz@users.noreply.github.com>
…tedError Co-authored-by: ocramz <5902760+ocramz@users.noreply.github.com>
Co-authored-by: ocramz <5902760+ocramz@users.noreply.github.com>
Co-authored-by: ocramz <5902760+ocramz@users.noreply.github.com>
… dead code Co-authored-by: ocramz <5902760+ocramz@users.noreply.github.com>
…fix doc Co-authored-by: ocramz <5902760+ocramz@users.noreply.github.com>
ocramz
left a comment
There was a problem hiding this comment.
@copilot build error:
/home/runner/work/sparse-linear-algebra/sparse-linear-algebra/src/Numeric/LinearAlgebra/Sparse.hs:1027:23: error: [GHC-83865]
Error: • Couldn't match type: CGS a
with: BICGSTAB a
Expected: BICGSTAB a -> SpVector a
Actual: CGS a -> SpVector a
• In the first argument of ‘solver’, namely ‘_x’
In the expression: solver x (cgsStep aa r0hat) (cgsInit aa b x0)
In a case alternative:
CGS -> solver x (cgsStep aa r0hat) (cgsInit aa b x0)
• Relevant bindings include
xHat :: m (SpVector a)
(bound at src/Numeric/LinearAlgebra/Sparse.hs:1025:6)
r0hat :: SpVector a
(bound at src/Numeric/LinearAlgebra/Sparse.hs:1030:6)
solver :: (BICGSTAB a -> SpVector a)
-> (BICGSTAB a -> BICGSTAB a) -> BICGSTAB a -> m (SpVector a)
(bound at src/Numeric/LinearAlgebra/Sparse.hs:1034:6)
dm :: FDSize (SpMatrix a)
(bound at src/Numeric/LinearAlgebra/Sparse.hs:1032:6)
nb :: FDSize (SpVector a)
(bound at src/Numeric/LinearAlgebra/Sparse.hs:1033:6)
x0 :: SpVector a
(bound at src/Numeric/LinearAlgebra/Sparse.hs:1019:23)
(Some bindings suppressed; use -fmax-relevant-binds=N or -fno-max-relevant-binds)
|
1027 | CGS -> solver _x (cgsStep aa r0hat) (cgsInit aa b x0)
| ^^
… types Co-authored-by: ocramz <5902760+ocramz@users.noreply.github.com>
Fixed in e4abffd. The issue was that the |
|
@copilot build error: /home/runner/work/sparse-linear-algebra/sparse-linear-algebra/src/Numeric/LinearAlgebra/Sparse.hs:1028:35: error: [GHC-39999] |
|
@copilot build error: /home/runner/work/sparse-linear-algebra/sparse-linear-algebra/src/Numeric/LinearAlgebra/Sparse.hs:1029:13: error: [GHC-39999] |
|
@copilot build error: /home/runner/work/sparse-linear-algebra/sparse-linear-algebra/src/Numeric/LinearAlgebra/Sparse.hs:1037:28: error: [GHC-39999] |
Co-authored-by: ocramz <5902760+ocramz@users.noreply.github.com>
Fixed in 5e0c2cd. Added the missing constraints to the |
Co-authored-by: ocramz <5902760+ocramz@users.noreply.github.com>
Fixed in de5ef53. Added explicit type annotation
Fixed in de5ef53. Added |
|
@copilot build error: /home/runner/work/sparse-linear-algebra/sparse-linear-algebra/src/Numeric/LinearAlgebra/Sparse.hs:1039:28: error: [GHC-39999] |
… proper type inference Co-authored-by: ocramz <5902760+ocramz@users.noreply.github.com>
Fixed in 7de84e4. Removed the explicit type signature from |
|
@copilot please update the README with the new status of BiCGSTAB and the flaky test for SPD matrices |
…vior Co-authored-by: ocramz <5902760+ocramz@users.noreply.github.com>
Updated in 831dc48. The README now documents:
|
Re-enable BiCGSTAB and linSolve0 - Complete Implementation
This PR re-enables the BiCGSTAB (Biconjugate Gradient Stabilized) iterative solver and the
linSolve0interface function that were previously commented out during-Wall -Werrorcompliance work.Summary of All Changes:
Code Changes:
bicgsInit,bicgstabStep, Show instance)linSolve0interfacerunSolverhelper function polymorphic over solver state typesMatrixRing,LinearVectorSpace,InnerSpace)Monad mconstraint for monadic operationsrunSolverto allow proper type inferenceTest Changes:
specBiCGSTABwith 4 unit tests + 1 property testspecLinSolvewith 6 integration tests covering BiCGSTAB, CGS, and CGNE methodscheckBiCGSTAB,prop_bicgstab)Documentation:
COMMENTED_OUT_FUNCTIONS.mdto mark BiCGSTAB as re-enabledIMPLEMENTATION_SUMMARY_BICGSTAB.mdwith comprehensive implementation detailsBUILD_AND_TEST.mdwith build and test instructionsREADME.md:linSolve0interfaceKey Features:
BiCGSTAB Advantages:
linSolve0 Interface:
Testing Notes:
The property-based tests for iterative solvers (BiCGSTAB, CGS) guard against degenerate cases which can cause flaky behavior with randomly generated SPD matrices. This is expected behavior and reflects the numerical limitations of iterative methods on ill-conditioned systems.
All build errors have been resolved, comprehensive tests added, and documentation updated.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.