linear-solvers

Select linear solvers for Ax=b problems on dense and sparse matrices.

61|4|Updated Dec 24, 2025
One-click install
npx skills add https://github.com/HeshamFS/materials-simulation-skills --skill linear-solvers
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: linear-solvers
Source: https://github.com/HeshamFS/materials-simulation-skills/tree/main/skills/core-numerical/linear-solvers
Command: npx skills add https://github.com/HeshamFS/materials-simulation-skills --skill linear-solvers

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires numpy, and includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill helps you pick and configure linear solvers for Ax = b, covering direct versus iterative methods, diagnosing convergence issues, estimating conditioning, selecting preconditioners, and debugging stagnation in common solvers like GMRES, CG, and BiCGSTAB.

Core Features & Use Cases

  • Solver selection: Decide between direct and iterative solvers based on matrix size, sparsity, and structure.
  • Convergence diagnostics: Assess stagnation, convergence rate, and residual trends to adjust strategy.
  • Preconditioner advice: Recommend appropriate preconditioners (e.g., ILU, IC, AMG) for improved robustness.
  • Scaling guidance: Suggest scaling/equilibration steps when conditioning is poor.
  • Use Case: You have a large SPD sparse system; this Skill guides you to use CG with AMG/IC preconditioning and to monitor residuals for stagnation.

Quick Start

Run a quick solver recommendation for a symmetric positive definite sparse matrix: python3 scripts/solver_selector.py --symmetric --positive-definite --sparse --size 1000000 --json

Frequently Asked Questions about linear-solvers

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I choose between direct and iterative solvers for large linear systems?

Direct solvers work well for dense or small matrices but become memory-intensive at scale; iterative solvers (CG, GMRES, BiCGSTAB) suit large sparse systems. This Skill guides you through the tradeoff based on matrix size, sparsity, and structure to pick the right method for Ax=b problems.

Why is my iterative solver stagnating or converging slowly?

Stagnation typically stems from poor matrix conditioning or inappropriate solver choice. This Skill diagnoses convergence issues by analyzing residual trends and conditioning estimates, then recommends preconditioners like ILU, IC, or AMG to accelerate convergence.

What preconditioner should I use for a sparse symmetric positive definite matrix?

For SPD sparse matrices, IC (incomplete Cholesky) and AMG (algebraic multigrid) preconditioners are effective choices. This Skill evaluates matrix properties and recommends the preconditioner that balances robustness and computational cost for your problem scale.

Can I apply this Skill to nonsymmetric sparse matrices?

Yes. This Skill handles both symmetric and nonsymmetric cases, recommending solvers like BiCGSTAB or GMRES with appropriate preconditioners such as ILU to address convergence and conditioning challenges in nonsymmetric Ax=b problems.

How do I diagnose and fix poor conditioning in my linear system?

Poor conditioning slows convergence and amplifies numerical errors. This Skill estimates conditioning, suggests scaling or equilibration steps to improve it, and recommends preconditioners to mitigate ill-conditioning effects in dense and sparse matrices.

What are the minimum requirements to use this Skill?

You need Python 3.8+, NumPy, SciPy, and the provided scripts. The Skill works with sparse and dense matrices of any size and applies to SPD and nonsymmetric Ax=b problems without additional dependencies beyond NumPy.