-
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
Draft
wucas
wants to merge
3
commits into
gap-system:master
Choose a base branch
from
wucas:lw/matobjflatlist
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,74 @@ | ||||||||||||||||||||||||||||||||
############################################################################# | ||||||||||||||||||||||||||||||||
## | ||||||||||||||||||||||||||||||||
## This file is part of GAP, a system for computational discrete algebra. | ||||||||||||||||||||||||||||||||
## | ||||||||||||||||||||||||||||||||
## SPDX-License-Identifier: GPL-2.0-or-later | ||||||||||||||||||||||||||||||||
## | ||||||||||||||||||||||||||||||||
## Copyright of GAP belongs to its developers, whose names are too numerous | ||||||||||||||||||||||||||||||||
## to list here. Please refer to the COPYRIGHT file for details. | ||||||||||||||||||||||||||||||||
## | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
############################################################################ | ||||||||||||||||||||||||||||||||
# | ||||||||||||||||||||||||||||||||
# This is an implementation for nxm matrices | ||||||||||||||||||||||||||||||||
# stored as a flat n*m element list. In this | ||||||||||||||||||||||||||||||||
# file the representation, types and global | ||||||||||||||||||||||||||||||||
# functions are declared. | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
############################################################################# | ||||||||||||||||||||||||||||||||
## | ||||||||||||||||||||||||||||||||
## <#GAPDoc Label="IsFlistMatrixRep"> | ||||||||||||||||||||||||||||||||
## <ManSection> | ||||||||||||||||||||||||||||||||
## <Filt Name="IsFlistMatrixRep" Arg='obj' Type="representation"/> | ||||||||||||||||||||||||||||||||
## | ||||||||||||||||||||||||||||||||
## <Description> | ||||||||||||||||||||||||||||||||
## An object <A>obj</A> in <Ref Filt="IsFlistMatrixRep"/> describes | ||||||||||||||||||||||||||||||||
## a matrix object that stores the matrix entries as a flat list. It is | ||||||||||||||||||||||||||||||||
## internally represented as a positional object | ||||||||||||||||||||||||||||||||
## (see <Ref Filt="IsPositionalObjectRep"/> that stores 4 entries: | ||||||||||||||||||||||||||||||||
## <Enum> | ||||||||||||||||||||||||||||||||
## <Item> | ||||||||||||||||||||||||||||||||
## its base domain | ||||||||||||||||||||||||||||||||
## (see <Ref Attr="BaseDomain" Label="for a matrix object"/>), | ||||||||||||||||||||||||||||||||
## </Item> | ||||||||||||||||||||||||||||||||
## <Item> | ||||||||||||||||||||||||||||||||
## the number of rows (see <Ref Attr="NumberRows" Label="for a matrix object"/>), | ||||||||||||||||||||||||||||||||
## </Item> | ||||||||||||||||||||||||||||||||
## <Item> | ||||||||||||||||||||||||||||||||
## the number of columns | ||||||||||||||||||||||||||||||||
## (see <Ref Attr="NumberColumns" Label="for a matrix object"/>), and | ||||||||||||||||||||||||||||||||
## </Item> | ||||||||||||||||||||||||||||||||
## <Item> | ||||||||||||||||||||||||||||||||
## a plain list (see <Ref Filt="IsPlistRep"/> of its entries. | ||||||||||||||||||||||||||||||||
## </Item> | ||||||||||||||||||||||||||||||||
## </Enum> | ||||||||||||||||||||||||||||||||
## </Description> | ||||||||||||||||||||||||||||||||
## </ManSection> | ||||||||||||||||||||||||||||||||
## <#/GAPDoc> | ||||||||||||||||||||||||||||||||
## | ||||||||||||||||||||||||||||||||
# Here we declare the new representation and tell GAP which properties it | ||||||||||||||||||||||||||||||||
# implies. FListMatrices e.g. are positional objects and so on. | ||||||||||||||||||||||||||||||||
DeclareRepresentation( "IsFlistMatrixRep", | ||||||||||||||||||||||||||||||||
IsMatrixObj and IsMatrixOrMatrixObj and IsPositionalObjectRep | ||||||||||||||||||||||||||||||||
and IsNoImmediateMethodsObject | ||||||||||||||||||||||||||||||||
and HasNumberRows and HasNumberColumns | ||||||||||||||||||||||||||||||||
and HasBaseDomain and HasOneOfBaseDomain and HasZeroOfBaseDomain, | ||||||||||||||||||||||||||||||||
[] ); | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
# If we implement our object a a positional object we often have to access its | ||||||||||||||||||||||||||||||||
# properties in the code. To make that more readable we declare global | ||||||||||||||||||||||||||||||||
# variables. If you do this too make sure you use variables that are unique and | ||||||||||||||||||||||||||||||||
# unlikely to be used someplace else, even though that might mean using longer | ||||||||||||||||||||||||||||||||
# names. Here we prefixed the names with the name of the representation. See | ||||||||||||||||||||||||||||||||
# also Reference Manual Chapter 79 for more information about Objects. | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
# Some constants for matrix access: | ||||||||||||||||||||||||||||||||
# Position in the positional object of the base domain | ||||||||||||||||||||||||||||||||
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 ); | ||||||||||||||||||||||||||||||||
Comment on lines
+68
to
+74
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make sure to end files with a newline. Also, we can use
Suggested change
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.