stdlib-js / stdlib-js/stdlib

RFC: add support for sparse matrices

Đang mở
#2,866 2 bình luận 0 reaction 0 người được giao Xem trên GitHub
Needs Discussion RFC
Ngôn ngữ chính
JavaScript
Star
6k
Fork
1.3k
Merge trung bình
1 ngày 3 giờ
Pull request đã merge (30 ngày)
611

Mô tả

### 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:

- Save memory by only storing the necessary values.
- Improve computational efficiency with large, sparsely populated matrices.

**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:

- Allow users to interact with the matrix as if it were a standard 2D array.
- Provide methods for adding, removing, and accessing values.
- Use an internal mapping function to translate 2D indices into the 1D array.

Looking forward to your feedback!

### Checklist

- [X] I have read and understood the [Code of Conduct](https://github.com/stdlib-js/stdlib/blob/develop/CODE_OF_CONDUCT.md).
- [X] Searched for existing issues and pull requests.
- [X] The issue name begins with `RFC:`.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Start by reviewing the utility section of stdlib.io and existing matrix-related conventions. Define how a 1D array and index-mapping function will represent a 2D sparse matrix, including how default values are stored or omitted. Done means users can add, remove, and access values through a matrix-like interface with reduced storage for sparse data.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
javascript
Lĩnh vực
data, performance
Loại issue
Tính năng
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
25/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.