Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix handling of AbstractSparseMatrixCSC #525

Merged
merged 1 commit into from
Aug 18, 2024

Conversation

j-fu
Copy link
Contributor

@j-fu j-fu commented Aug 18, 2024

  • SciMLBase.init did check only for SparseMatrixCSC, thus leading to dispatches for AbstractSparseMatrixCSC with awful timings.
  • Now, if A (resp. b) is an AbstractSparseMatrixCSC, instead of making a copy (or even deepcopy), a SparseMatrixCSC is constructed using size, getcolptr, rowvals and nonzeros.

Checklist

  • Appropriate tests were added
  • Any code changes were done in a way that does not break public API
  • All documentation related to code changes were updated
  • The new code follows the
    contributor guidelines, in particular the SciML Style Guide and
    COLPRAC.
  • Any new documentation only uses public API

Additional context

Add any other context about the problem here.

* `SciMLBase.init` did check only for `SparseMatrixCSC`, thus leading to  dispatches for AbstractSparseMatrixCSC with awful timings.
* Now, if A (resp. b) is an `AbstractSparseMatrixCSC`, instead of making a `copy` (or even `deepcopy`), a `SparseMatrixCSC` is constructed using `size`, `getcolptr`, `rowvals` and `nonzeros`.
@ChrisRackauckas ChrisRackauckas merged commit 9affd50 into SciML:main Aug 18, 2024
9 of 18 checks passed
j-fu added a commit to j-fu/LinearSolve.jl that referenced this pull request Aug 19, 2024
Both are subtypes of AbstractFactorization.

This allows to set default_alias_A=true for sparse factorizations (which
just cannot overwrite A anyway). This allows to create the cache parametrized with
the original matrix type and we can use `reinit!(cache;A)`
or `cache.A=A` if `A` is an AbstractSparseMatrixCSC, like with Krylov solvers.

Before, due to SciML#525, these methods would require a SparseMatrixCSC,
even if the Problem was created with a AbstractSparseMatrixCSC.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants