-
Notifications
You must be signed in to change notification settings - Fork 161
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
Implement a new matrix object using flat lists in row-major form #5121
base: master
Are you sure you want to change the base?
Conversation
[ IsFlistMatrixRep ], | ||
function( mat ) | ||
local n; | ||
if m![FLISTREP_NCPOS] <> mat![FLISTREP_NRPOS] then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you probably mean mat![FLISTREP_NCPOS] <> mat![FLISTREP_NRPOS]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh yes thank you!
and HasBaseDomain and HasOneOfBaseDomain and HasZeroOfBaseDomain, | ||
[] ); | ||
|
||
# If we implement our object a a positional object we often have to access its |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# If we implement our object a a positional object we often have to access its | |
# If we implement our object as a positional object we often have to access its |
BindGlobal( "FLISTREP_BDPOS", 1 ); | ||
# Position in the positional object of the number of rows | ||
BindGlobal( "FLISTREP_NRPOS", 2 ); | ||
# Position in the positional object of the number of columns | ||
BindGlobal( "FLISTREP_NCPOS", 3 ); | ||
# Position in the positional object of the list of entries | ||
BindGlobal( "FLISTREP_ELSPOS", 4 ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure to end files with a newline. Also, we can use BindConstant
here for a tiny further speed-up.
BindGlobal( "FLISTREP_BDPOS", 1 ); | |
# Position in the positional object of the number of rows | |
BindGlobal( "FLISTREP_NRPOS", 2 ); | |
# Position in the positional object of the number of columns | |
BindGlobal( "FLISTREP_NCPOS", 3 ); | |
# Position in the positional object of the list of entries | |
BindGlobal( "FLISTREP_ELSPOS", 4 ); | |
BindConstant( "FLISTREP_BDPOS", 1 ); | |
# Position in the positional object of the number of rows | |
BindConstant( "FLISTREP_NRPOS", 2 ); | |
# Position in the positional object of the number of columns | |
BindConstant( "FLISTREP_NCPOS", 3 ); | |
# Position in the positional object of the list of entries | |
BindConstant( "FLISTREP_ELSPOS", 4 ); | |
Error( "NewMatrix: Length of list must be a multiple of ncols." ); | ||
fi; | ||
list := list_in; | ||
fi; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a lot of "this code is not covered by a test" comments by the Codecov bot here. I guess a nice task for this week would be to work on exactly such tests, in a way that makes them re-usable (we discussed this before, so I am guessing that was part of your intention anyway). Great :-)
local index_start, index_end; | ||
index_start := (row-1)*mat![FLISTREP_NCPOS] + 1; | ||
index_end := index_start + mat![FLISTREP_NCPOS]; | ||
return NewVector(IsPlistVectorRep,mat![FLISTREP_BDPOS],mat![FLISTREP_ELSPOS]{[index_start..index_end]}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this correct. In the sense that doing mat[i][j] := 0
won't work correctly. Will be discussed in my talk
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: just return an immutable vector, then at least the above will raise an error.
Also see comments on PR #5130
[ IsFlistMatrixRep ], | ||
function( mat ) | ||
local n; | ||
if m![FLISTREP_NCPOS] <> mat![FLISTREP_NRPOS] then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if m![FLISTREP_NCPOS] <> mat![FLISTREP_NRPOS] then | |
if mat![FLISTREP_NCPOS] <> mat![FLISTREP_NRPOS] then |
return m![FLISTREP_NCPOS]; | ||
end ); | ||
|
||
InstallMethod( DimensionsMat, "for a flist matrix", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need to provide this, as the default method should be good enough
This PR provides a work in progress of a a new matrix object representing matrices as flat lists in row-major form. It is intended to guide participants of the GAP Days in their work on other matrix objects.
Text for release notes
none