SciML / LinearSolve.jl

LinearSolve.jl: High-Performance Unified Interface for Linear Solvers in Julia. Easily switch between factorization and Krylov methods, add preconditioners, and all in one interface.
https://docs.sciml.ai/LinearSolve/stable/
Other
245 stars 52 forks source link

Support SciMLOperators in LinearSolve #270

Closed vpuri3 closed 1 year ago

vpuri3 commented 1 year ago

Plan: https://github.com/SciML/SciMLOperators.jl/issues/142

Merge these first: https://github.com/SciML/SciMLBase.jl/pull/377 https://github.com/SciML/LinearSolve.jl/pull/269

The changes in the PR are as follows:

  1. Replaced AbstractDiffEqOperator with AbstractSciMLOperators.
  2. Created DirectLdiv! <: AbstractLinearSolveAlgorithm so that types that have a ldiv! defined may skip a second factorization step and simply use their ldiv!. Example, when A isa Factorization, or a BiDiagonal, or a SciMLOperator with has_ldiv!(A) == true.
  3. removed InvPreconditioner, as it is no longer needed: https://github.com/JuliaSmoothOptimizers/Krylov.jl/issues/612#issuecomment-1227391841.
  4. Haven't removed ComposePreconditioner as it is used in OrdinaryDiffEq
  5. Replaced IterativeSolvers.I with SciMLOperators.IdentityOperator{N}() as identity matrix placeholder. wrote static method _isidentity_struct for checking.
  6. wrote TODO's for future changes WRT plan, some OperatorAssumptions notes.
  7. wrote tests for these changes
ChrisRackauckas commented 1 year ago

This looks good, I like the direct ldiv! route. Just needs some clean up and upstream merges first.

codecov[bot] commented 1 year ago

Codecov Report

Merging #270 (c763a17) into main (af09c4e) will increase coverage by 32.57%. The diff coverage is 69.23%.

@@             Coverage Diff             @@
##             main     #270       +/-   ##
===========================================
+ Coverage   38.51%   71.09%   +32.57%     
===========================================
  Files          13       14        +1     
  Lines         810      858       +48     
===========================================
+ Hits          312      610      +298     
+ Misses        498      248      -250     
Impacted Files Coverage Δ
ext/LinearSolveHYPRE.jl 92.59% <ø> (+92.59%) :arrow_up:
lib/LinearSolveCUDA/src/LinearSolveCUDA.jl 0.00% <0.00%> (ø)
src/default.jl 54.21% <55.55%> (+17.85%) :arrow_up:
src/iterative_wrappers.jl 77.31% <75.00%> (+23.43%) :arrow_up:
src/LinearSolve.jl 96.55% <83.33%> (+21.55%) :arrow_up:
src/common.jl 89.83% <100.00%> (+5.34%) :arrow_up:
src/solve_function.jl 100.00% <100.00%> (ø)
src/HYPRE.jl 100.00% <0.00%> (ø)
lib/LinearSolvePardiso/src/LinearSolvePardiso.jl 75.00% <0.00%> (+2.08%) :arrow_up:
... and 7 more

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

vpuri3 commented 1 year ago

gotta put InvPreconditioner back. It is used in NonlinearSolve.

vpuri3 commented 1 year ago

rerunning CI. some tests were cancelled.