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

A proposal for N-Dimensional sparse arrays #20

Merged
merged 19 commits into from
Oct 30, 2023

Conversation

willow-ahrens
Copy link
Collaborator

Here's my proposal for n-dimensional arrays in binsparse, to advocate for Erik's sparse[n] and dense[n] approach. I have tried to keep things as close to the existing standard as possible, so the array names have stayed exactly the same as the proposed 1.0.

I had to move iso from the value type to the format descriptor.

@github-actions
Copy link

github-actions bot commented Mar 18, 2023

Automated Review URLs

@willow-ahrens
Copy link
Collaborator Author

@willow-ahrens
Copy link
Collaborator Author

One note: I included dense[n] because it makes things easy to explain, but I really think that because dense[1], dense[1] is equal to dense[2], we should only support dense[1] to keep things normalized.

@willow-ahrens
Copy link
Collaborator Author

willow-ahrens commented Mar 18, 2023

Another note: Finch understands things recursively, so that's how I've written the spec and the parser, but I get the sense that people may have been hoping for a list of format descriptors (i.e. "format": ["dense[1]", "sparse[2]"]), which is easier to write by hand but does need a little bit of string parsing to get the rank info out.

@eriknw
Copy link
Member

eriknw commented Mar 19, 2023

I see--hierarchical is especially nice when a level spans multiple dimensions (such as COO). This may also be useful for e.g. DIA so there is less concern for how to compose and transform "1-d" levels to get more advanced levels.

@willow-ahrens willow-ahrens mentioned this pull request Mar 20, 2023
spec/latest/index.bs Outdated Show resolved Hide resolved
@willow-ahrens
Copy link
Collaborator Author

Here's an example of a property graph for CSC with an iso int capacity and a float weight

{
  "swizzle": [1, 0],
  "format": {
    "level": "dense",
    "rank": 1,
    "subformat": {
      "level": "sparse",
      "rank": 1,
      "subformat": {
        "level": "multiplex",
        "subformats": {
          "weight": {
            "level": "element",
            "value_type": "float32"
          }
          "capacity": {
            "level": "iso",
            "value_type": "int32"
          }
        }
      }
    }
  },
}

@willow-ahrens
Copy link
Collaborator Author

@BenBrock @ivirshup Do we think there's a way that we can merge this into the spec in a section titled "Experimental v2.0 extensions (Subject To Change)" or something similar so that it doesn't have to live in a PR while we finalize 1.0?

@BenBrock
Copy link
Contributor

I think that sounds like a fine idea. Ultimately we all want it to live in one spec document, and we'll have to have some way of specifying what's v1 and what's a v2 extension. What you suggested sounds good to me.

@willow-ahrens
Copy link
Collaborator Author

Alright, I'm merging this with language saying it's v2.0 only and subject to further discussion

@willow-ahrens willow-ahrens merged commit e218c13 into GraphBLAS:main Oct 30, 2023
1 check passed
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.

3 participants