Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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); # IsFlatPlistMatrixRep
RunMatTest("GF(257) IsFlatPlistMatrixRep", 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) IsFlatPlistMatrixRep", IsFlatPlistMatrixRep, GF(257));

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

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

# TODO: other reps
# TODO: other compare with creating plist-of-plist
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="IsFlatPlistMatrixRep">
<#Include Label="IsZmodnZMatrixRep">

</Section>
Expand Down
46 changes: 46 additions & 0 deletions lib/matobjflatplist.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="IsFlatPlistMatrixRep">
Comment thread
fingolfin marked this conversation as resolved.
Outdated
## <ManSection>
## <Filt Name="IsFlatPlistMatrixRep" Arg='obj' Type="Representation"/>
##
## <Description>
## An object <A>obj</A> in <Ref Filt="IsFlatPlistMatrixRep"/> describes
## a matrix object (see <Ref Filt="IsMatrixObj"/>) whose entries are stored
## as a dense plain list of dense plain row lists.
## <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( "IsFlatPlistMatrixRep",
IsMatrixObj and IsPositionalObjectRep
and IsCopyable
and IsNoImmediateMethodsObject
and HasNumberRows and HasNumberColumns
and HasBaseDomain and HasOneOfBaseDomain and HasZeroOfBaseDomain,
[] );


# Internal positions for flat plist matrices.
BindConstant( "FBDPOS", 1 );
BindConstant( "FCOLSPOS", 2 );
BindConstant( "FROWSPOS", 3 );
Loading
Loading