-
-
Notifications
You must be signed in to change notification settings - Fork 40
Open
Labels
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.