Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NDTensors] Start SparseArrayDOKs module #1270

Merged
merged 17 commits into from
Nov 29, 2023
Merged

Conversation

mtfishman
Copy link
Member

@mtfishman mtfishman commented Nov 25, 2023

This introduces the module SparseArrayInterface, which defines sparse versions of various Julia Base functions like sparse_getindex, sparse_setindex!, sparse_map[!], etc. which make use of the sparsity structure of an array given some minimal overloads accessing the sparse storage and how multidimensional indices map back and forth to locations in the sparse storage.

Then, it defines a concrete sparse array type called SparseArrayDOK (for dictionary-of-keys) in a SparseArrayDOKs module that makes use of SparseArrayInterface to provide a lot of AbstractArray Julia functionality. The design is similar to that in SparseArrayKit.jl, with some key differences such as being based on SparseArrayInterface, using Dictionaries.jl for the dictionary implementation instead of Base.Dict, and allowing for a more generic zero element type which will be used by the BlockSparseArray type in BlockSparseArrays.

Some things to do:

  • Use SparseArrayInterface in DiagonalArrays to simplify the implementation there (i.e. make it simpler to define indexing, map/broadcast, etc.).

The rest of the action items were moved to #1250 to keep this PR more self-contained.

NDTensors/src/NDTensors.jl Outdated Show resolved Hide resolved
NDTensors/src/lib/SparseArrayDOKs/src/SparseArrayDOKs.jl Outdated Show resolved Hide resolved
NDTensors/src/lib/SparseArrayDOKs/src/SparseArrayDOKs.jl Outdated Show resolved Hide resolved
NDTensors/src/lib/SparseArrayDOKs/src/SparseArrayDOKs.jl Outdated Show resolved Hide resolved
NDTensors/src/lib/SparseArrayDOKs/src/SparseArrayDOKs.jl Outdated Show resolved Hide resolved
NDTensors/src/lib/SparseArrayDOKs/src/SparseArrayDOKs.jl Outdated Show resolved Hide resolved
NDTensors/src/lib/SparseArrayDOKs/test/runtests.jl Outdated Show resolved Hide resolved
src/imports.jl Outdated Show resolved Hide resolved
@mtfishman mtfishman marked this pull request as ready for review November 29, 2023 00:14
@mtfishman mtfishman marked this pull request as draft November 29, 2023 00:28
@codecov-commenter
Copy link

codecov-commenter commented Nov 29, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (fbf4a1d) 84.07% compared to head (8c90583) 53.94%.

❗ Current head 8c90583 differs from pull request most recent head c5b8ff4. Consider uploading reports for the commit c5b8ff4 to get more accurate results

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #1270       +/-   ##
===========================================
- Coverage   84.07%   53.94%   -30.14%     
===========================================
  Files          99       98        -1     
  Lines        8542     8489       -53     
===========================================
- Hits         7182     4579     -2603     
- Misses       1360     3910     +2550     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mtfishman mtfishman marked this pull request as ready for review November 29, 2023 18:29
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@mtfishman mtfishman merged commit 1722ba4 into main Nov 29, 2023
7 checks passed
@mtfishman mtfishman deleted the NDTensors_SparseArrayDOKs branch November 29, 2023 23:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants