We introduce Sparse Matrix Preconditioner for Iterative Refinement and Inversion Toolkit (SPIRIT), a general-purpose sparse matrix solver with a novel preconditioner designed for the large, sparse, and ill-conditioned Jacobian systems that arise in r-process nucleosynthesis simulations. The preconditioner employs a dual-threshold filtering strategy applied before factorization, yielding highly sparse yet stable approximations. Coupled with the Krylov subspace solver biconjugate gradient-stabilized method, SPIRIT dramatically accelerates the matrix inversion step during reaction network evolution. In tests on 500 Jacobian matrices of dimension 7836 & times; 7836 generated in an r-process run, SPIRIT outperformed traditional incomplete LU preconditioners by several orders of magnitude in both runtime and residual accuracy. Benchmarks against Intel Math Kernel Library (Intel MKL) show that SPIRIT reduced matrix inversion costs from 68% to 16% of total runtime while maintaining agreement with MKL solutions to within 10-6 error. Final abundance distributions matched those from standard solvers across all astrophysical relevant nuclear species. SPIRIT also performed reliably for smaller test cases, including trivial and small networks, as well as X-ray burst scenarios (with minor deviations). We have integrated SPIRIT into the network code SkyNet, providing a fast, robust, and open-source alternative for high-performance simulations in nuclear astrophysics and other scientific applications requiring efficient solutions of large, sparse, and ill-conditioned linear systems.
QC 20260521