Operations that produce dense results #307
LilithHafner
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Not all operations on sparse inputs produce sparse outputs. Addition with nonzero scalars produces a sparse result with all entries stored.
sort!
creates a whole bunch of structural nonzeros. Reinterpret throws an error.All three of these cases could (should) produce sparse results, and there are likely many other examples.
When presented with an operation that will not produce a sparse result, we have several options:
Option 0 is almost always best if someone is willing to do it, and option 1 is typically better than option 2. Other than that, the order is ambiguous.
It would be nice to have a consistent, documented policy for what to do in cases where 0 isn't (yet) an option.
Discussion sparked from #296
Beta Was this translation helpful? Give feedback.
All reactions