-
Notifications
You must be signed in to change notification settings - Fork 52
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
AbstractSparseMatrixCSC not exported #265
Comments
That should be sufficient for most operations yes. There will definitely be some things missing, there are not many other subtypes of AbstractSparseMatrixCSC in the ecosystem to test it out. You can qualify the name |
... bump... |
Is it possible to provide a PR? We should also document the interface. |
Ok will try. Can get on this in a couple of days. |
What the SparseArrays.jl/src/sparsematrix.jl Line 1000 in 0d2d30a
SparseArrays.jl/src/sparsematrix.jl Line 729 in 0d2d30a
All of them copy the AbstractSparseMatrixCSC. IMHO all of them could return a SparseMatrixCSC via this constructor, So the question here is: is a |
If you have your own concrete implementation of AbstractSparseMatrixCSC, then |
Ok, that may be the philosophy behind |
The |
... this is exactly my reason to try to help to move this forward :) |
But still: why do we need these ? SparseArrays.jl/src/sparsematrix.jl Line 729 in 0d2d30a
SparseArrays.jl/src/sparsematrix.jl Line 733 in 0d2d30a
In both cases, one would expect a SparseMatrixCSC as a result and not whichever else subtype of AbstractSparseMatrixCSC... |
Yes, for the BTW, I always felt it was a bit weird to have AbstractSparseMatrixCSC and the right thing would have been to have AbstractSparseMatrix. |
So a PR should fix this ?
... I can understand that one - there is at least the SparseMatrixCSR storage scheme which is also an AbstractSparseMatrix: |
I agree with 729, 731, 733 are wrong; they should all fall back to what is defined in line 734 For line 1000 I would prefer |
For |
I think it's a good to just expect an AbstractMatrixCSC, changing it will break things, probably fixedsparse. The point of the sparse function is to just return something sparse. I think the copy is there for safety so that the returned matrix can be edited. This way the returned matrix can be edited for both dense and sparse matrices. Also at the end of the day, sparse(s::Abstract) is just a fallback, types that cannot be edited can and should overload it. |
I tend to support an immediate abstract type for matrix types. For instance a SparseMatrixCSC with the addition of a lazy insertion capability is still an AbstractSparseMatrixCSC, and should by and large use the same methods. The fixed stuff for instance uses this AFAIR. |
fixedsparse: does this refer to some particular package ? |
It's in this package ... |
Please give a link - I don't find it... |
SparseArrays.jl/src/sparsematrix.jl Line 62 in 1c46709
|
anyhow point is, sparse for already sparse matrices works, if you need SparseMatrixCSC, just call SparseMatrixCSC on the thing. |
I think, we should not forget |
From my point of view it should be possible to construct a SparseMatrixCSC from this interface, see e.g. https://github.com/SciML/LinearSolve.jl/blob/main/src/factorization.jl#L349 |
I think you don't even need to do that, see SparseArrays.jl/src/sparsematrix.jl Line 734 in d938744
calling SparseMatrixCSC, should just "work". |
There is already an interface nnz - nzrange - nonzeros - rowvals established for |
Yes, the interface is established but not really documented. As I said in the start of the issue thread I will try to make PR to fix this (including exporting AbstractSparseMatrixCSC), which should also fix the errors in lines 729, 731, 733 of sparsematrix.jl, just need to find time to focus on this (not before mid of next week...) I agree upon I would keep |
See also #52 and the discussions referred to there |
IMHO it seems it is too late now to rename or remove getcolptr as Though formally it cannot be breaking, the resulting work effort IMHO would be not worth it - it appears to me that it is more important to stabilize the API here. |
AbstractSparseMatrixCSC interface. See discussion on JuliaSparse#265
a SparseMatrixCSC, but would not. See JuliaSparse#265 (comment)
Hi, I would like to use the AbstractSparseMatrixCSC interface with my sparse matrix struct, however it seems that it is not exported.
Also, it is not completely clear what needs to be implemented to conform to the interface.
I currently assume it is
getcolptr
,getrowval
,nonzeros
,nnz
,size
.The text was updated successfully, but these errors were encountered: