chakravala / chakravala/Grassmann.jl

grade selection syntax

Open
#101 6 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
Julia
Stars
514
Forks
41
PR merge metrics
No merged PRs in 30d

Description

When getting the elements of a `MultiVector`, you can use parentheses to select the grade, i.e.

```
A = 1 + 2v1 + 3v12 + 4v123 # 1 + 2v₁ + 3v₁₂ + 4v₁₂₃
typeof(A) # MultiVector{⟨1,1,1⟩, Int64, 8}
sizeof(A) # 64
A(0) # 1v
```

However, if the type if a `Chain`, then the parentheses act as an indexing operation, and only into the elements that are non-zero in the `Chain`. Attempting to access the scalar part of a `Chain` via `(0) returns an index error.

```
B = 3v12 + 4v23 # B = 3v₁₂ + 0v₁₃ + 4v₂₃
typeof(B) # Chain{⟨1,1,1⟩, 2, Int64, 3}
sizeof(B) # 24
B(0) # BoundsError: attempt to access 3-element Vector{UInt64} at index [0]

```

There is a work-around for this, it is to wrap the `Chain` in a `MultiVector`, but a `MultiVector` is (depending on the basis) many times the size of a `Chain`. It seems to me that this behaviour of `Chain` is useful for the internal implementation, but at the user level, the difference between a `Chain` and a `MultiVector` should be abstracted away.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the documented calls on both MultiVector and Chain, especially B(0), and compare their grade-selection and indexing behavior. Determine the intended user-facing behavior for Chain without expanding it to a MultiVector, then verify that scalar and nonzero-grade access work consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
developer-experience
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.