-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
[WIP] Introduce AbstractSparseMatrixCSC into Type Hierarchy #24973
Conversation
This seems like an oxymoronic type – it's an abstraction with a very specific implementation... |
Depends on what you mean by implementation. All |
But isn't |
|
I guess my question is why do you need to dispatch on whether the representation is CSC versus CSR? I'm not saying you don't have to, I'd just like to know why. |
Potential subtypes of However, they will also differ, because if they didn't, a single |
If there two libraries that can do LU factorzations, for example, one or CSC and the other for CSR, having abstract types would let them extend
The |
As you rightly pointed out these details differ even in different CSC implementations. In any case, I think we should hold this until we can move sparse out of base into stdlib, which will have to wait for a bunch of other things that are in flight. |
We're also going to reserve the right to insert supertypes into the type hierarchy and explicitly warn people not to depend on the precise supertype of a type but code to subtype relationships instead, so this could be done at any point in the 1.x timeframe. There will be a "writing future-proof code" guide spelling out dos and don'ts. |
Is there a particular benefit to waiting? I was really hoping to get this into 0.7 (its one of the last things to do before upgrading my codebase from 0.4). Most of the changes are to |
I still don't understand the rationale. For the different kinds of CSC implementations, how does having On CSC vs. CSR, yes, I agree it is good to be able to distinguish and having CSR would be valuable too - but I'm not sure that points in the direction of Just trying to understand what in your codebase needs this. Can you share relevant bits of code if open source? |
As I have suggested, we should build a new sparse implementation in an external package, which is flexible and abstract as necessary. |
This PR introduces the minimal set of changes needed to let users define their own sparse matrix CSC types and retain access to the
SuiteSparse
libraries.Specifically, it introduces an
AbstractSparseMatrixCSC
type and modifies theSuiteSparse
wrappers to accept it (rather than onlySparseMatrixCSC
). This allows users to implement new sparse matrix types with their own indexing behavior (ref #15579, #22733, #5424, particularly #9906, edit: added issue 9906).I have updated the tests to make sure a sample
TestCSC <: AbstractSparseMatrixCSC
works, and they all pass. For some reason, theambiguous
tests now cause julia to segfault, and I'm not sure how to debug this.To reproduce, run
in the repo root directory. The backtrace generated by the segfault is here and running
julia-debug
under gdb produced this.