Open varshil-shah opened 2 months ago
:wave: Hi there! :wave:
And thank you for opening your first issue! We will get back to you shortly. :runner: :dash:
@varshil-shah Thanks for raising this issue. I think the main concern I have with implementing sparse arrays is that, in order to perform computation efficiently, you need a sparse array compiler in order to be able to handle the different sparse matrix formats, operator fusion, fill values, and internal structure. This is non-trivial to do well.
In general, I am not opposed; however, undertaking this effort would require considerable R&D.
Description
I would like to propose adding a sparse matrix utility under the utility section of stdlib.io. In many cases, when users create 2D matrices, they often do not fully utilize all the cells, leading to unnecessary storage consumption. Sparse matrices can optimize this by only storing non-zero (or meaningful) values, thereby reducing memory usage.
Why is this needed? A sparse matrix is useful in scenarios where the matrix has a large number of zero (or default) values, which is common in scientific computing, machine learning, and other data-heavy operations. With a sparse matrix implementation, users can:
Proposed Solution: The solution will involve creating a 1D array, which will be used to simulate a 2D matrix via a mathematical formula. This approach ensures that only the non-default values are stored, significantly optimizing memory usage. The utility will:
Looking forward to your feedback!
Checklist
RFC:
.