-
-
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
Rename issparse? #24645
Comments
The methods are very old and most likely inherited from Matlab. In Julia, I think it makes more sense to check if the type is a |
as @andreasnoack said it can't be just replaced with:
Its currently defined in julia/base/sparse/abstractsparse.jl Lines 13 to 23 in ea34968
It would be marginally cleaner if it were:
But is it an useful trait is a good question. Having it as a trait might be marginally cleaner in julia/base/sparse/sparsevector.jl Line 1015 in 82ae10d
|
Here is a list of uses of |
I like the Perhaps FemtoCleaner can automate it all. |
HI, It looks like this was merged with #34308 in Dec 18. Does that mean this issue can be closed? Matt. |
... aka Bikeshed and/or improve documentation for
issparse
. The docstring forissparse
saysbut this is ambiguous. What, precisely, does it mean for
S
(presumably an array) to be sparse? Here are two (very different) possible definitions:x
(x
could have some default value, but this would be rather arbitrary).It is the second option that is implemented by
issparse
. In a way this makes sense, as the function does not take such a parameterx
(representing the threshold density of nonzero elements). But at a minimum this should be more clearly explained in the documentation. (I'm also unable to explain whyissparse(::Diagonal)
and related types returnfalse
-- perhaps it's a bug, or perhaps I do not understand fully what this function is meant to do.)On the other hand, the current behavior makes
issparse
different from many other functions I can think of, such asistril
,istriu
,issymmetric
,ishermitian
, andisreal
. Each of these considers the value itself rather than the datatype; for instance,isreal(0im) == true
.Perhaps a better name for this function, then, would be
issparsetype
? I can think of downsides to this name (you do not pass a type to it). Another idea would beissparsestorage
, but I don't know if I like this either.So I ask:
issparse
is a poor name? If it is, can we come up with anything better?issparse(::Diagonal)
,issparse(::Tridiagonal)
, etc. return?it is used only in the concatenation functions in
sparsevector.jl
. I have not grepped the package ecosystem, but I wonder how frequently it is used there.The text was updated successfully, but these errors were encountered: