Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions benchmark/matobj/bench-matelm-access.g
Original file line number Diff line number Diff line change
Expand Up @@ -136,17 +136,23 @@ RunMatTest := function(desc, m)
TestWritingMatrix(m);
end;

m:=IdentityMat(10);;
RunMatTest("integer matrix", m);
m:=IdentityMat(10,GF(257));; # plain list of plain lists
RunMatTest("GF(257) plist-of-plist matrix", m);

m:=IdentityMat(10,GF(2));;
m:=IdentityMatrix(GF(257), 10); # IsPlistMatrixRep
RunMatTest("GF(257) IsPlistMatrixRep", m);

m:=IdentityMatrix(GF(257), 10); # IsGenericMatrixRep
RunMatTest("GF(257) IsGenericMatrixRep", m);

m:=IdentityMat(10,GF(2));; # plain list of IsGF2VectorRep
RunMatTest("GF(2) rowlist", m);

m:=IdentityMat(10,GF(2));; ConvertToMatrixRep(m);;
m:=IdentityMatrix(GF(2), 10); # IsGF2MatrixRep
RunMatTest("GF(2) compressed matrix", m);

m:=IdentityMat(10,GF(7));;
m:=IdentityMat(10,GF(7));; # plain list of Is8BitVectorRep
RunMatTest("GF(7) rowlist", m);

m:=IdentityMat(10,GF(7));; ConvertToMatrixRep(m);;
m:=IdentityMatrix(GF(7), 10); # Is8BitMatrixRep
RunMatTest("GF(7) compressed matrix", m);
13 changes: 9 additions & 4 deletions benchmark/matobj/bench-matobj-creation.g
Original file line number Diff line number Diff line change
Expand Up @@ -91,18 +91,23 @@ RunMatTest := function(desc, ring)
TestCreatingMatrix(ring);
end;

RunMatTest("GF(2)", GF(2));
RunMatTest("Rationals", Rationals);

RunMatObjTest := function(desc, filter, ring)
Print("\n");
PrintBoxed(Concatenation("Testing ", desc));
TestCreatingMatrixObj(filter, ring);
end;

RunMatObjTest("GF(2) IsPlistMatrixRep", IsPlistMatrixRep, GF(2));
RunMatTest("GF(257)", GF(257));
RunMatObjTest("GF(257) IsPlistMatrixRep", IsPlistMatrixRep, GF(257));
RunMatObjTest("GF(257) IsGenericMatrixRep", IsGenericMatrixRep, GF(257));

RunMatTest("Integers", Integers);
RunMatObjTest("integer IsPlistMatrixRep", IsPlistMatrixRep, Integers);
RunMatObjTest("integer IsGenericMatrixRep", IsGenericMatrixRep, Integers);

RunMatTest("Rationals", Rationals);
RunMatObjTest("rational IsPlistMatrixRep", IsPlistMatrixRep, Rationals);
RunMatObjTest("rational IsGenericMatrixRep", IsGenericMatrixRep, Rationals);

# TODO: other reps
# TODO: other compare with creating plist-of-plist
1 change: 1 addition & 0 deletions doc/ref/makedocreldata.g
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ GAPInfo.ManualDataRef:= rec(
"../../lib/matobj2.gd",
"../../lib/matobjnz.gd",
"../../lib/matobjplist.gd",
#"../../lib/matobjgeneric.gd", # TODO: enable this if we decide to keep IsGenericMatrixRep
"../../lib/matrix.gd",
"../../lib/meataxe.gi",
"../../lib/memory.gd",
Expand Down
1 change: 1 addition & 0 deletions doc/ref/matobj.xml
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@ described in this chapter is supported.
<#Include Label="IsGF2MatrixRep">
<#Include Label="Is8BitMatrixRep">
<#Include Label="IsPlistMatrixRep">
<!-- <#Include Label="IsGenericMatrixRep"> TODO: enable this if we decide to keep IsGenericMatrixRep -->
<#Include Label="IsZmodnZMatrixRep">

</Section>
Expand Down
46 changes: 46 additions & 0 deletions lib/matobjgeneric.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#############################################################################
##
## 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.
##

############################################################################
#
# Dense matrix objects backed by plain lists of plain row lists.
#

#############################################################################
##
## <#GAPDoc Label="IsGenericMatrixRep">
## <ManSection>
## <Filt Name="IsGenericMatrixRep" Arg='obj' Type="Representation"/>
##
## <Description>
## An object <A>obj</A> in <Ref Filt="IsGenericMatrixRep"/> describes
## a matrix object (see <Ref Filt="IsMatrixObj"/>) whose entries are stored
## as a dense plain list of dense plain row lists.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be good to clarify what the difference is between IsPlistMatrixRep and IsGenericMatrixRep is here, as described in one of the comments elsewhere.

Copy link
Copy Markdown
Contributor

@james-d-mitchell james-d-mitchell Apr 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For example, although I know what is intended "a dense plain list of dense plain row lists" and "is not a row list matrix" seem contradictory. More words might indicate more clearly what is meant here.

## <P/>
## This representation is optimized for efficient entry access via
## <M>M[i,j]</M>. Unlike <Ref Filt="IsPlistMatrixRep"/>, it is not a row
## list matrix, so direct row access via <M>M[i]</M> is not supported.
## </Description>
## </ManSection>
## <#/GAPDoc>
##
DeclareRepresentation( "IsGenericMatrixRep",
IsMatrixObj and IsPositionalObjectRep
and IsCopyable
and IsNoImmediateMethodsObject
and HasNumberRows and HasNumberColumns
and HasBaseDomain and HasOneOfBaseDomain and HasZeroOfBaseDomain,
[] );


# Internal positions for IsGenericMatrixRep:
BindConstant( "FBDPOS", 1 ); # BaseDomain
BindConstant( "FCOLSPOS", 2 ); # NumberColumns
BindConstant( "FROWSPOS", 3 ); # "rows" as a plist-of-plists
Loading
Loading