-
Notifications
You must be signed in to change notification settings - Fork 54
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
Rename fields of SparseMatrixCSC
#52
Comments
I wholeheartedly sympathize. Could we postpone this discussion till after the release though? I have been meaning to write up some thoughts on the matter, but cannot spare the time for the foreseeable future :). Best! |
Yes, once we have |
That upside of getfield overloading had not occurred to me. Fantastic! 😄 |
Oh man, that's one of the main benefits – it decouples "virtual fields" from actual fields. |
|
why not |
I would call it |
Linking JuliaLang/julia#24910 (comment). Best! |
Are these fields meant to be public or private? Before this very essential question is answered its difficult to discuss.
In principle yes, but I am pretty sure that you don't want to use getfield overloading to maintain compatibility of internal interfaces. |
Currently, you need to use the fields to do almost any efficient sparse matrix manipulations. So they are de facto public. |
Could you make this please more precise? Which fields are public? -> We really need a clear communication (in the documentation) here. |
I'm fine with changing the names but it would better if we could generally use getters as in https://github.com/JuliaLang/julia/blob/292a3b4c73b91bcb3dbe2d9d7c56f8d747ce5207/base/sparse/sparsematrix.jl#L48-L53 since it would allow many algorithms to work efficiently for views of full columns of sparse matrices. |
The sparse higher order functions code takes a similar approach https://github.com/JuliaLang/julia/blob/292a3b4c73b91bcb3dbe2d9d7c56f8d747ce5207/base/sparse/higherorderfns.jl#L31 to provide a uniform interface to sparse vectors and matrices, and perhaps other (e.g. structured) objects as well going forward. My thinking on this front has been motivated by cleaning that interface up. Best! |
That would be fine, but those functions are neither exported nor documented. |
I think that for now we should consider these fields to be private even though library code has been effectively forced to use them in order to write faster sparse code. Change the names to better names and also provide an official API for accessing what one needs to write fast sparse code. This may cause some breakage; we can either use the new |
Hi, I'm proposing a new AbstractSparseMatrixCSC interface in PR JuliaLang/julia#33054. We need to document the accessor functions so people here may be interested in the discussion there. |
I am going to close this issue and request discussion in JuliaLang/julia#33054. This is an opportunity to use better names for the accessors. |
Let me summarize the recent changes I made related to this issue: In JuliaLang/julia#30173, @ViralBShah and I were discussing the way to expose SparseMatrixCSC functionality in such a way that it is easily extensible by the users. We came to the agreement that defining SparseMatrixCSC functions in terms of accessor methods and abstract type is the way to go. In JuliaLang/julia#32953 and JuliaLang/julia#33039 I did the refactoring so that most of the code touching SparseMatrixCSC is now defined in terms of AbstractSparseMatrixCSC and its accessor functions. At this point, nothing is breaking (or at least that's my intention) and pre-existing accessor functions (e.g. Now in JuliaLang/julia#33054 we are discussing how to document the interface of AbstractSparseMatrixCSC (e.g., accessor functions and assumed invariance of the underlying data). As A more controversial part of the discussion is that if we should add new accessor functions like |
Questions I'd like to ask here are:
Note that |
Cross ref. https://github.com/JuliaLang/julia/issues/31330#issuecomment-473575718 here too :). |
Thanks. So @Sacha0, @ViralBShah, and I all seem to think that it makes sense to use @Sacha0's comment also mentions |
That has been the direction we have been moving in. |
So should we adopt the new names, and support the old names with properties (until 2.0 rolls around)? The accessors can also be appropriately named then - and the deprecations can be carried out whenever 2.0 comes around. |
The only absolute blocker for Can this be discussed in triage? I think the desired outcome is one of the following:
|
Currently the 5 fields are named:
m
n
colptr
rowval
nzval
My complaints are:
m
andn
)rowval
is confusing (what are "row values"?)colptr
: isn't a pointer a C thing? we don't use it anywhere else in the languagenzval
: don't we now allow zeros in the non-sparse elements?I would propose
nrow
ncol
coloffsets
rowindices
values
The text was updated successfully, but these errors were encountered: