rok commented on pull request #7114: URL: https://github.com/apache/arrow/pull/7114#issuecomment-625285482
> @pitrou > I think the driving question should be the use cases. Is there a need for random access to singular values? Agreed! Ideally reading individual values should happen rarely. However as a user of pyarrow I'd sometimes want to understand what is inside my (sparse)tensor. So I would really want a way to access some arbitrary values for debugging. Or perhaps I'm solving a system of equations and want to access a specific coefficient. So this is then becomes a question of arrows scope - are we looking to be memory only or general purpose and have feature parity with e.g. [scipy.sparse](https://docs.scipy.org/doc/scipy/reference/sparse.html) or [torch.sparse](https://pytorch.org/docs/stable/sparse.html)? Perhaps even better would be to wait for users to ask for this functionality and rather implement things like multiplication, addition and slicing before. > @mrkn > ... functionality can be decomposed the following sub-features, and providing them can be alternative to only SparseTensor::Value<T>. > * Iterating existing indices in a SparseIndex > * Finding the given index in a SparseIndex and returning the offset of the index > * Returning the value of the given offset > * Making the slice of a SparseTensor > > By the way, this implementation proposal is not acceptable even if there are any realistic use cases of SparseTensor::Value<T>. CalculateValueOffset function should be implemented in each subclass of SparseIndex class. If we decide to proceed with this I would propose to split this into three potential tickets: 1. Calculate offset and return value - this could come from current ticket 2. Iterate indices 3. Slice SparseTensor ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
