@@ -21,7 +21,8 @@ using SciMLBase: SciMLBase, LinearAliasSpecifier, AbstractSciMLOperator,
2121using SciMLOperators: SciMLOperators, AbstractSciMLOperator, IdentityOperator,
2222 MatrixOperator,
2323 has_ldiv!, issquare
24- using SciMLLogging: Verbosity, @SciMLMessage , verbosity_to_int, @match , AbstractVerbositySpecifier
24+ using SciMLLogging: Verbosity, @SciMLMessage , verbosity_to_int, @match ,
25+ AbstractVerbositySpecifier
2526using Setfield: @set , @set!
2627using UnPack: @unpack
2728using DocStringExtensions: DocStringExtensions
6768 const useopenblas = false
6869end
6970
70-
7171@reexport using SciMLBase
7272
7373"""
7474 SciMLLinearSolveAlgorithm <: SciMLBase.AbstractLinearAlgorithm
7575
7676The root abstract type for all linear solver algorithms in LinearSolve.jl.
77- All concrete linear solver implementations should inherit from one of the
77+ All concrete linear solver implementations should inherit from one of the
7878specialized subtypes rather than directly from this type.
7979
8080This type integrates with the SciMLBase ecosystem, providing a consistent
@@ -92,39 +92,44 @@ matrices (e.g., `A = LU`, `A = QR`, `A = LDL'`) and then solve the system
9292using forward/backward substitution.
9393
9494## Characteristics
95- - Requires concrete matrix representation (`needs_concrete_A() = true`)
96- - Typically efficient for multiple solves with the same matrix
97- - Generally provides high accuracy for well-conditioned problems
98- - Memory requirements depend on the specific factorization type
95+
96+ - Requires concrete matrix representation (`needs_concrete_A() = true`)
97+ - Typically efficient for multiple solves with the same matrix
98+ - Generally provides high accuracy for well-conditioned problems
99+ - Memory requirements depend on the specific factorization type
99100
100101## Subtypes
101- - `AbstractDenseFactorization`: For dense matrix factorizations
102- - `AbstractSparseFactorization`: For sparse matrix factorizations
102+
103+ - `AbstractDenseFactorization`: For dense matrix factorizations
104+ - `AbstractSparseFactorization`: For sparse matrix factorizations
103105
104106## Examples of concrete subtypes
105- - `LUFactorization`, `QRFactorization`, `CholeskyFactorization`
106- - `UMFPACKFactorization`, `KLUFactorization`
107+
108+ - `LUFactorization`, `QRFactorization`, `CholeskyFactorization`
109+ - `UMFPACKFactorization`, `KLUFactorization`
107110"""
108111abstract type AbstractFactorization <: SciMLLinearSolveAlgorithm end
109112
110113"""
111114 AbstractSparseFactorization <: AbstractFactorization
112115
113116Abstract type for factorization-based linear solvers optimized for sparse matrices.
114- These algorithms take advantage of sparsity patterns to reduce memory usage and
117+ These algorithms take advantage of sparsity patterns to reduce memory usage and
115118computational cost compared to dense factorizations.
116119
117- ## Characteristics
118- - Optimized for matrices with many zero entries
119- - Often use specialized pivoting strategies to preserve sparsity
120- - May reorder rows/columns to minimize fill-in during factorization
121- - Typically more memory-efficient than dense methods for sparse problems
120+ ## Characteristics
121+
122+ - Optimized for matrices with many zero entries
123+ - Often use specialized pivoting strategies to preserve sparsity
124+ - May reorder rows/columns to minimize fill-in during factorization
125+ - Typically more memory-efficient than dense methods for sparse problems
122126
123127## Examples of concrete subtypes
124- - `UMFPACKFactorization`: General sparse LU with partial pivoting
125- - `KLUFactorization`: Sparse LU optimized for circuit simulation
126- - `CHOLMODFactorization`: Sparse Cholesky for positive definite systems
127- - `SparspakFactorization`: Envelope/profile method for sparse systems
128+
129+ - `UMFPACKFactorization`: General sparse LU with partial pivoting
130+ - `KLUFactorization`: Sparse LU optimized for circuit simulation
131+ - `CHOLMODFactorization`: Sparse Cholesky for positive definite systems
132+ - `SparspakFactorization`: Envelope/profile method for sparse systems
128133"""
129134abstract type AbstractSparseFactorization <: AbstractFactorization end
130135
@@ -136,16 +141,18 @@ These algorithms assume the matrix has no particular sparsity structure and use
136141dense linear algebra routines (typically from BLAS/LAPACK) for optimal performance.
137142
138143## Characteristics
139- - Optimized for matrices with few zeros or no sparsity structure
140- - Leverage highly optimized BLAS/LAPACK routines when available
141- - Generally provide excellent performance for moderately-sized dense problems
142- - Memory usage scales as O(n²) with matrix size
143-
144- ## Examples of concrete subtypes
145- - `LUFactorization`: Dense LU with partial pivoting (via LAPACK)
146- - `QRFactorization`: Dense QR factorization for overdetermined systems
147- - `CholeskyFactorization`: Dense Cholesky for symmetric positive definite matrices
148- - `BunchKaufmanFactorization`: For symmetric indefinite matrices
144+
145+ - Optimized for matrices with few zeros or no sparsity structure
146+ - Leverage highly optimized BLAS/LAPACK routines when available
147+ - Generally provide excellent performance for moderately-sized dense problems
148+ - Memory usage scales as O(n²) with matrix size
149+
150+ ## Examples of concrete subtypes
151+
152+ - `LUFactorization`: Dense LU with partial pivoting (via LAPACK)
153+ - `QRFactorization`: Dense QR factorization for overdetermined systems
154+ - `CholeskyFactorization`: Dense Cholesky for symmetric positive definite matrices
155+ - `BunchKaufmanFactorization`: For symmetric indefinite matrices
149156"""
150157abstract type AbstractDenseFactorization <: AbstractFactorization end
151158
@@ -157,23 +164,26 @@ These algorithms solve linear systems by iteratively building an approximation
157164from a sequence of Krylov subspaces, without requiring explicit matrix factorization.
158165
159166## Characteristics
160- - Does not require concrete matrix representation (`needs_concrete_A() = false`)
161- - Only needs matrix-vector products `A*v` (can work with operators/functions)
162- - Memory usage typically O(n) or O(kn) where k << n
163- - Convergence depends on matrix properties (condition number, eigenvalue distribution)
164- - Often benefits significantly from preconditioning
167+
168+ - Does not require concrete matrix representation (`needs_concrete_A() = false`)
169+ - Only needs matrix-vector products `A*v` (can work with operators/functions)
170+ - Memory usage typically O(n) or O(kn) where k << n
171+ - Convergence depends on matrix properties (condition number, eigenvalue distribution)
172+ - Often benefits significantly from preconditioning
165173
166174## Advantages
167- - Low memory requirements for large sparse systems
168- - Can handle matrix-free operators (functions that compute `A*v`)
169- - Often the only feasible approach for very large systems
170- - Can exploit matrix structure through specialized operators
175+
176+ - Low memory requirements for large sparse systems
177+ - Can handle matrix-free operators (functions that compute `A*v`)
178+ - Often the only feasible approach for very large systems
179+ - Can exploit matrix structure through specialized operators
171180
172181## Examples of concrete subtypes
173- - `GMRESIteration`: Generalized Minimal Residual method
174- - `CGIteration`: Conjugate Gradient (for symmetric positive definite systems)
175- - `BiCGStabLIteration`: Bi-Conjugate Gradient Stabilized
176- - Wrapped external iterative solvers (KrylovKit.jl, IterativeSolvers.jl)
182+
183+ - `GMRESIteration`: Generalized Minimal Residual method
184+ - `CGIteration`: Conjugate Gradient (for symmetric positive definite systems)
185+ - `BiCGStabLIteration`: Bi-Conjugate Gradient Stabilized
186+ - Wrapped external iterative solvers (KrylovKit.jl, IterativeSolvers.jl)
177187"""
178188abstract type AbstractKrylovSubspaceMethod <: SciMLLinearSolveAlgorithm end
179189
@@ -184,15 +194,17 @@ Abstract type for linear solvers that wrap custom solving functions or
184194provide direct interfaces to specific solve methods. These provide flexibility
185195for integrating custom algorithms or simple solve strategies.
186196
187- ## Characteristics
188- - Does not require concrete matrix representation (`needs_concrete_A() = false`)
189- - Provides maximum flexibility for custom solving strategies
190- - Can wrap external solver libraries or implement specialized algorithms
191- - Performance and stability depend entirely on the wrapped implementation
197+ ## Characteristics
198+
199+ - Does not require concrete matrix representation (`needs_concrete_A() = false`)
200+ - Provides maximum flexibility for custom solving strategies
201+ - Can wrap external solver libraries or implement specialized algorithms
202+ - Performance and stability depend entirely on the wrapped implementation
192203
193204## Examples of concrete subtypes
194- - `LinearSolveFunction`: Wraps arbitrary user-defined solve functions
195- - `DirectLdiv!`: Direct application of the `\\ ` operator
205+
206+ - `LinearSolveFunction`: Wraps arbitrary user-defined solve functions
207+ - `DirectLdiv!`: Direct application of the `\\ ` operator
196208"""
197209abstract type AbstractSolveFunction <: SciMLLinearSolveAlgorithm end
198210
@@ -205,22 +217,27 @@ Trait function that determines whether a linear solver algorithm requires
205217a concrete matrix representation or can work with abstract operators.
206218
207219## Arguments
208- - `alg`: A linear solver algorithm instance
220+
221+ - `alg`: A linear solver algorithm instance
209222
210223## Returns
211- - `true`: Algorithm requires a concrete matrix (e.g., for factorization)
212- - `false`: Algorithm can work with abstract operators (e.g., matrix-free methods)
224+
225+ - `true`: Algorithm requires a concrete matrix (e.g., for factorization)
226+ - `false`: Algorithm can work with abstract operators (e.g., matrix-free methods)
213227
214228## Usage
229+
215230This trait is used internally by LinearSolve.jl to optimize algorithm dispatch
216231and determine when matrix operators need to be converted to concrete arrays.
217232
218233## Algorithm-Specific Behavior
219- - `AbstractFactorization`: `true` (needs explicit matrix entries for factorization)
220- - `AbstractKrylovSubspaceMethod`: `false` (only needs matrix-vector products)
221- - `AbstractSolveFunction`: `false` (depends on the wrapped function's requirements)
234+
235+ - `AbstractFactorization`: `true` (needs explicit matrix entries for factorization)
236+ - `AbstractKrylovSubspaceMethod`: `false` (only needs matrix-vector products)
237+ - `AbstractSolveFunction`: `false` (depends on the wrapped function's requirements)
222238
223239## Example
240+
224241```julia
225242needs_concrete_A(LUFactorization()) # true
226243needs_concrete_A(GMRESIteration()) # false
0 commit comments