Open
Description
Currently, monomials are represented as unboxed vectors of Int
s. This seems rather inefficient: an unboxed vector stores an offset, a length, and the data is stored byte-per-byte instead of word-per-word.
Two ideas come to mind instead:
newtype Monomial ( n :: Nat ) = Monomial ( Array# Word )
or, avoiding all indirections entirely:
data family Monomial ( n :: Nat ) :: TYPE ( 'TupleRep ( Replicate n WordRep ) )
newtype instance Monomial 0 = M0 (# #)
newtype instance Monomial 1 = M1 (# Word# #)
newtype instance Monomial 2 = M2 (# Word#, Word# #)
newtype instance Monomial 3 = M3 (# Word#, Word#, Word# #)
newtype instance Monomial 4 = M4 (# Word#, Word#, Word#, Word# #)
...
I'm also wondering if a Map
is the best data-structure to use to represent polynomials, but I suppose that's best left to a separate ticket.
Metadata
Metadata
Assignees
Labels
No labels