update sparse computation, add initial version of BlockCSR
and BlockELL
#81
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces significant changes to the
brainunit/sparse
module, including the addition of new sparse matrix formats (BlockCSR
andBlockELL
), their corresponding benchmarks, and updates to existing imports. The most important changes are outlined below:New Sparse Matrix Formats:
brainunit/sparse/_block_csr.py
: Added theBlockCSR
class, which represents a unit-aware Block-CSR sparse matrix, along with methods for validation, conversion to dense format, matrix multiplication, and sampling sparse matrices.brainunit/sparse/_block_ell.py
: Added theBlockELL
class, which represents a unit-aware Block-ELL sparse matrix, along with methods for validation, conversion to dense format, matrix multiplication, and sampling sparse matrices.Benchmarking:
brainunit/sparse/_block_csr_benchmark.py
: Added a benchmarking script forBlockCSR
matrices to measure the performance of sparse-dense matrix multiplication using different methods.brainunit/sparse/_block_ell_benchmark.py
: Added a benchmarking script forBlockELL
matrices to measure the performance of sparse-dense matrix multiplication using different methods.Import Updates:
brainunit/sparse/__init__.py
: Updated imports to reflect the new module structure, including the addition ofSparseMatrix
and changes to import paths forCOO
andCSR
classes.