MatrixObj: add a common super representation shared by IsPlistMatrixRep
#5143
Labels
gapdays2022-summer
Issues and PRs that arose at https://www.gapdays.de/gapdays2022-summer
Several MatrixObj implementations now share a similar structure: they are positional objects which store a basedomain, number of rows and columns, and a pointer to the elements, in whatever format. (The implementation of upper triangular matrices in PR #5130 optimizes this by not storing the columns as those matrices are always square, but this is a minor optimization for which I am not sure it is worth keeping it -- if one is truly concerned about this, I think then one should change far more about the inner representation.)
There is quite some code duplication because of this: methods for
BaseDomain
,NrRows
,NrCols
,ShallowCopy
,PostMakeImmutable
,MutableCopyMat
are basically identical. They also all define a few constants to store the positions of the basedomain/rows/cols/elements.So perhaps we should define all of these only once and have a kind of super representation
IsPositionalMatrixObjRep
and then haveIsPlistMatrixRep
etc. be extensions of this?Then this:
might become this:
In a quick test that seems to work.
Does it sound reasonable, @ThomasBreuer @wucas @AnnaKDS @danielrademacher ?
Then we could add this into a file, say
matobj_positional.gd
together the definitions of constants likeBDPOS
etc. (renamed suitably).If this seems reasonable I could give it a go this afternoon.
The text was updated successfully, but these errors were encountered: