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

defining a new AbstractSparseMatrixCSC requires defining _checkbuffers (internal function) #9

Closed
longemen3000 opened this issue Jan 11, 2022 · 2 comments · Fixed by #77

Comments

@longemen3000
Copy link

i was in need to define my own type <: AbstractSparseMatrixCSC (basically i needed the indexing behaviour of a SparseMatrixCSC, but with another storage type). The (not written in the docs) interface for an AbstractSparseMatrixCSC requires:

  • getcolptr
  • rowvals
  • nonzeros
  • size
    the problem is that an internal function _checkbuffers is required, mainly for the display machinery. this function does not require new methods, in fact, is defined in terms of the functions mentioned above (getrowval gets dispatched to rowvals):

https://github.com/JuliaLang/julia/blob/3b5f98510368d757f468d5ea0674229a27a7c526/stdlib/SparseArrays/src/sparsematrix.jl#L82-L90

_checkbuffers (and _goodbuffers) should be defined in terms of AbstractSparseMatrixCSC instead of the concrete type.

@longemen3000 longemen3000 changed the title Jan 11, 2022
@stev47
Copy link
Contributor

stev47 commented Jan 13, 2022

I agree, _goodbuffers seems to check the assumptions one would expect from AbstractSparseMatrixCSC, no need to overspecify.

@ViralBShah
Copy link
Member

Submit a PR?

@KristofferC KristofferC transferred this issue from JuliaLang/julia Jan 14, 2022
abraemer added a commit to abraemer/SparseArrays.jl that referenced this issue Feb 14, 2022
These methods check the assumptions on colptr, rowval and nonzeros and thus should work for all AbstractSparseMatrixCSC. Changing the signature also removes the need for every subtype to implement it.

Fixes JuliaSparse#9
ViralBShah pushed a commit that referenced this issue Feb 18, 2022
These methods check the assumptions on colptr, rowval and nonzeros and thus should work for all AbstractSparseMatrixCSC. Changing the signature also removes the need for every subtype to implement it.

Fixes #9
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 a pull request may close this issue.

3 participants