Skip to content
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

Add new kernel operations ELM_MAT, ASS_MAT #3551

Merged
merged 3 commits into from
Jul 12, 2019
Merged
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
70 changes: 35 additions & 35 deletions hpcgap/lib/vec8bit.gi
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,15 @@ InstallValue( TYPE_FIELDINFO_8BIT, TYPE_KERNEL_OBJECT);
#M Length( <vec> )
##

InstallOtherMethod( Length, "For a compressed VecFFE",
InstallOtherMethod( Length, "for a compressed VecFFE",
true, [IsList and Is8BitVectorRep], 0, LEN_VEC8BIT);

#############################################################################
##
#M <vec> [ <pos> ]
##

InstallOtherMethod( \[\], "For a compressed VecFFE",
InstallOtherMethod( \[\], "for a compressed VecFFE",
true, [IsList and Is8BitVectorRep, IsPosInt], 0, ELM_VEC8BIT);

#############################################################################
Expand All @@ -127,7 +127,7 @@ InstallOtherMethod( \[\], "For a compressed VecFFE",
## <vec> may also be converted back into vector rep over a bigger field.
##

InstallOtherMethod( \[\]\:\=, "For a compressed VecFFE",
InstallOtherMethod( \[\]\:\=, "for a compressed VecFFE",
true, [IsMutable and IsList and Is8BitVectorRep, IsPosInt, IsObject],
0, ASS_VEC8BIT);

Expand All @@ -139,7 +139,7 @@ InstallOtherMethod( \[\]\:\=, "For a compressed VecFFE",
## turning into a plain list
##

InstallMethod( Unbind\[\], "For a compressed VecFFE",
InstallMethod( Unbind\[\], "for a compressed VecFFE",
true, [IsMutable and IsList and Is8BitVectorRep, IsPosInt],
0, UNB_VEC8BIT);

Expand All @@ -151,7 +151,7 @@ InstallMethod( Unbind\[\], "For a compressed VecFFE",
## description is printed
##

InstallMethod( ViewObj, "For a compressed VecFFE",
InstallMethod( ViewObj, "for a compressed VecFFE",
true, [Is8BitVectorRep and IsSmallList], 0,
function( vec )
local len;
Expand All @@ -175,7 +175,7 @@ end);
## Same method as for lists in internal rep.
##

InstallMethod( PrintObj, "For a compressed VecFFE",
InstallMethod( PrintObj, "for a compressed VecFFE",
true, [Is8BitVectorRep and IsSmallList], 0,
function( vec )
local i,l;
Expand All @@ -198,7 +198,7 @@ end);
## kernel method produces a copy in the same representation
##

InstallMethod(ShallowCopy, "For a compressed VecFFE",
InstallMethod(ShallowCopy, "for a compressed VecFFE",
true, [Is8BitVectorRep and IsSmallList], 0,
SHALLOWCOPY_VEC8BIT);

Expand All @@ -211,12 +211,12 @@ InstallMethod(ShallowCopy, "For a compressed VecFFE",
## characteristic. Compatability of fields and vector lengths is
## handled in the method

InstallMethod( \+, "For two 8 bit vectors in same characteristic",
InstallMethod( \+, "for two 8 bit vectors in same characteristic",
IsIdenticalObj, [IsRowVector and Is8BitVectorRep,
IsRowVector and Is8BitVectorRep], 0,
SUM_VEC8BIT_VEC8BIT);

InstallMethod( \+, "For a GF2 vector and an 8 bit vector of char 2",
InstallMethod( \+, "for a GF2 vector and an 8 bit vector of char 2",
IsIdenticalObj, [IsRowVector and IsGF2VectorRep,
IsRowVector and Is8BitVectorRep], 0,
function(v,w)
Expand All @@ -227,7 +227,7 @@ InstallMethod( \+, "For a GF2 vector and an 8 bit vector of char 2",
fi;
end);

InstallMethod( \+, "For an 8 bit vector of char 2 and a GF2 vector",
InstallMethod( \+, "for an 8 bit vector of char 2 and a GF2 vector",
IsIdenticalObj, [IsRowVector and Is8BitVectorRep,
IsRowVector and IsGF2VectorRep ], 0,
function(w,v)
Expand All @@ -245,7 +245,7 @@ end);
## Make the vector into a plain list (in place)
##

InstallMethod( PlainListCopyOp, "For an 8 bit vector",
InstallMethod( PlainListCopyOp, "for an 8 bit vector",
true, [IsSmallList and Is8BitVectorRep], 0,
function (v)
PLAIN_VEC8BIT(v);
Expand All @@ -259,7 +259,7 @@ end);
## alternatibe element access interface, returns fail when unbound
##

InstallMethod(ELM0_LIST, "For an 8 bit vector",
InstallMethod(ELM0_LIST, "for an 8 bit vector",
true, [IsList and Is8BitVectorRep, IsPosInt], 0,
ELM0_VEC8BIT);

Expand Down Expand Up @@ -304,12 +304,12 @@ end );
##
## multi-element access
##
InstallOtherMethod(ELMS_LIST, "For an 8 bit vector and a plain list",
InstallOtherMethod(ELMS_LIST, "for an 8 bit vector and a plain list",
true, [IsList and Is8BitVectorRep,
IsPlistRep and IsDenseList ], 0,
ELMS_VEC8BIT);

InstallOtherMethod(ELMS_LIST, "For an 8 bit vector and a range",
InstallOtherMethod(ELMS_LIST, "for an 8 bit vector and a range",
true, [IsList and Is8BitVectorRep,
IsRange and IsInternalRep ], 0,
ELMS_VEC8BIT_RANGE);
Expand All @@ -319,7 +319,7 @@ InstallOtherMethod(ELMS_LIST, "For an 8 bit vector and a range",
#M <vec>*<ffe>
##

InstallMethod(\*, "For an 8 bit vector and an FFE",
InstallMethod(\*, "for an 8 bit vector and an FFE",
IsCollsElms, [IsRowVector and Is8BitVectorRep,
IsFFE and IsInternalRep], 0,
PROD_VEC8BIT_FFE);
Expand All @@ -329,7 +329,7 @@ InstallMethod(\*, "For an 8 bit vector and an FFE",
#M <vec>*<mat>
##

InstallMethod(\*, "For an 8 bit vector and a compatible matrix",
InstallMethod(\*, "for an 8 bit vector and a compatible matrix",
IsElmsColls, [IsRowVector and Is8BitVectorRep and IsSmallList
and IsRingElementList,
IsRingElementTable and IsPlistRep], 0,
Expand Down Expand Up @@ -363,7 +363,7 @@ end );
#M <ffe>*<vec>
##

InstallMethod(\*, "For an FFE and an 8 bit vector ",
InstallMethod(\*, "for an FFE and an 8 bit vector ",
IsElmsColls, [IsFFE and IsInternalRep,
IsRowVector and Is8BitVectorRep],
0,
Expand Down Expand Up @@ -397,13 +397,13 @@ end );
##
#M <vecl> - <vecr>
##
InstallMethod(\-, "For two 8bit vectors",
InstallMethod(\-, "for two 8bit vectors",
IsIdenticalObj, [IsRowVector and Is8BitVectorRep,
IsRowVector and Is8BitVectorRep],
0,
DIFF_VEC8BIT_VEC8BIT );

InstallMethod( \-, "For a GF2 vector and an 8 bit vector of char 2",
InstallMethod( \-, "for a GF2 vector and an 8 bit vector of char 2",
IsIdenticalObj, [IsRowVector and IsGF2VectorRep ,
IsRowVector and Is8BitVectorRep], 0,
function(v,w)
Expand All @@ -414,7 +414,7 @@ InstallMethod( \-, "For a GF2 vector and an 8 bit vector of char 2",
fi;
end);

InstallMethod( \-, "For an 8 bit vector of char 2 and a GF2 vector",
InstallMethod( \-, "for an 8 bit vector of char 2 and a GF2 vector",
IsIdenticalObj, [IsRowVector and Is8BitVectorRep ,
IsRowVector and IsGF2VectorRep], 0,
function(w,v)
Expand All @@ -430,7 +430,7 @@ end);
#M -<vec>
##

InstallMethod( AdditiveInverseOp, "For an 8 bit vector",
InstallMethod( AdditiveInverseOp, "for an 8 bit vector",
true, [IsRowVector and Is8BitVectorRep],
0,
AINV_VEC8BIT_MUTABLE);
Expand All @@ -440,7 +440,7 @@ InstallMethod( AdditiveInverseOp, "For an 8 bit vector",
#M -<vec>
##

InstallMethod( AdditiveInverseSameMutability, "For an 8 bit vector",
InstallMethod( AdditiveInverseSameMutability, "for an 8 bit vector",
true, [IsRowVector and Is8BitVectorRep],
0,
AINV_VEC8BIT_SAME_MUTABILITY );
Expand All @@ -450,7 +450,7 @@ InstallMethod( AdditiveInverseSameMutability, "For an 8 bit vector",
#M -<vec>
##

InstallMethod( AdditiveInverseImmutable, "For an 8 bit vector",
InstallMethod( AdditiveInverseImmutable, "for an 8 bit vector",
true, [IsRowVector and Is8BitVectorRep],
0,
AINV_VEC8BIT_IMMUTABLE );
Expand All @@ -462,7 +462,7 @@ InstallMethod( AdditiveInverseImmutable, "For an 8 bit vector",
## A mutable zero vector of the same field and length
##

InstallMethod( ZeroOp, "For an 8 bit vector",
InstallMethod( ZeroOp, "for an 8 bit vector",
true, [IsRowVector and Is8BitVectorRep],
0,
ZERO_VEC8BIT);
Expand All @@ -474,7 +474,7 @@ InstallMethod( ZeroOp, "For an 8 bit vector",
## A zero vector of the same field and length and mutability
##

InstallMethod( ZeroSameMutability, "For an 8 bit vector",
InstallMethod( ZeroSameMutability, "for an 8 bit vector",
true, [IsRowVector and Is8BitVectorRep],
0,
function(v)
Expand All @@ -491,7 +491,7 @@ end );
#M <vec1> = <vec2>
##

InstallMethod( \=, "For 2 8 bit vectors",
InstallMethod( \=, "for 2 8 bit vectors",
IsIdenticalObj, [IsRowVector and Is8BitVectorRep,
IsRowVector and Is8BitVectorRep],
0,
Expand All @@ -504,7 +504,7 @@ InstallMethod( \=, "For 2 8 bit vectors",
## Usual lexicographic ordering
##

InstallMethod( \<, "For 2 8 bit vectors",
InstallMethod( \<, "for 2 8 bit vectors",
IsIdenticalObj, [IsRowVector and Is8BitVectorRep,
IsRowVector and Is8BitVectorRep],
0,
Expand All @@ -516,13 +516,13 @@ InstallMethod( \<, "For 2 8 bit vectors",
##
## scalar product
#'
InstallMethod( \*, "For 2 8 bit vectors",
InstallMethod( \*, "for 2 8 bit vectors",
IsIdenticalObj, [IsRingElementList and Is8BitVectorRep,
IsRingElementList and Is8BitVectorRep],
0,
PROD_VEC8BIT_VEC8BIT);

InstallMethod( \*, "For a GF2 vector and an 8 bit vector of char 2",
InstallMethod( \*, "for a GF2 vector and an 8 bit vector of char 2",
IsIdenticalObj, [IsRowVector and IsGF2VectorRep,
IsRowVector and Is8BitVectorRep], 0,
function(v,w)
Expand All @@ -533,7 +533,7 @@ InstallMethod( \*, "For a GF2 vector and an 8 bit vector of char 2",
fi;
end);

InstallMethod( \*, "For an 8 bit vector of char 2 and a GF2 vector",
InstallMethod( \*, "for an 8 bit vector of char 2 and a GF2 vector",
IsIdenticalObj, [IsRowVector and Is8BitVectorRep,
IsRowVector and IsGF2VectorRep ], 0,
function(w,v)
Expand All @@ -551,7 +551,7 @@ end);
## add <mult>*<vec2> to <vec1> in place
##

InstallOtherMethod( AddRowVector, "For 2 8 bit vectors and a field element and from and to",
InstallOtherMethod( AddRowVector, "for 2 8 bit vectors and a field element and from and to",
IsCollsCollsElmsXX, [ IsRowVector and Is8BitVectorRep,
IsRowVector and Is8BitVectorRep,
IsFFE and IsInternalRep, IsPosInt, IsPosInt ], 0,
Expand All @@ -564,7 +564,7 @@ InstallOtherMethod( AddRowVector, "For 2 8 bit vectors and a field element and f
## add <mult>*<vec2> to <vec1> in place
##

InstallOtherMethod( AddRowVector, "For 2 8 bit vectors and a field element",
InstallOtherMethod( AddRowVector, "for 2 8 bit vectors and a field element",
IsCollsCollsElms, [ IsRowVector and Is8BitVectorRep,
IsRowVector and Is8BitVectorRep,
IsFFE and IsInternalRep ], 0,
Expand All @@ -577,7 +577,7 @@ InstallOtherMethod( AddRowVector, "For 2 8 bit vectors and a field element",
## add <vec2> to <vec1> in place
##

InstallOtherMethod( AddRowVector, "For 2 8 bit vectors",
InstallOtherMethod( AddRowVector, "for 2 8 bit vectors",
IsIdenticalObj, [ IsRowVector and Is8BitVectorRep,
IsRowVector and Is8BitVectorRep], 0,
ADD_ROWVECTOR_VEC8BITS_2);
Expand All @@ -589,7 +589,7 @@ InstallOtherMethod( AddRowVector, "For 2 8 bit vectors",
## multiply <vec> by <ffe> in place
##

InstallOtherMethod( MultVector, "For an 8 bit vector and an ffe",
InstallOtherMethod( MultVector, "for an 8 bit vector and an ffe",
IsCollsElms, [ IsRowVector and Is8BitVectorRep,
IsFFE and IsInternalRep], 0,
MULT_VECTOR_VEC8BITS);
Expand Down Expand Up @@ -1074,7 +1074,7 @@ InstallMethod( MatElm, "for an 8bit matrix and two integers",
[ Is8BitMatrixRep, IsPosInt, IsPosInt ],
MAT_ELM_MAT8BIT );
InstallMethod( SetMatElm, "for an 8bit matrix, two integers, and a ffe",
[ Is8BitMatrixRep, IsPosInt, IsPosInt, IsFFE ],
[ Is8BitMatrixRep and IsMutable, IsPosInt, IsPosInt, IsFFE ],
SET_MAT_ELM_MAT8BIT );
InstallMethod( Matrix, "for a list of vecs, an integer, and an 8bit mat",
[IsList, IsInt, Is8BitMatrixRep],
Expand Down
14 changes: 1 addition & 13 deletions hpcgap/lib/vecmat.gi
Original file line number Diff line number Diff line change
Expand Up @@ -586,11 +586,6 @@ InstallOtherMethod( \[\], "for GF2 matrix",
IsPosInt ],
ELM_GF2MAT );

InstallMethod( \[\], "for GF2 matrix",
[ IsGF2MatrixRep,
IsPosInt, IsPosInt ],
MAT_ELM_GF2MAT );
Copy link
Member Author

Choose a reason for hiding this comment

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

This is now redundant as we already do InstallMethod(MatElm, ..., MAT_ELM_GF2MAT); later in the file.



#############################################################################
##
Expand All @@ -610,13 +605,6 @@ InstallOtherMethod( \[\]\:\=,
IsObject ],
ASS_GF2MAT );

InstallMethod( \[\]\:\=,
"for GF2 matrix",
[ IsGF2MatrixRep,
IsPosInt, IsPosInt,
IsObject ],
SET_MAT_ELM_GF2MAT );
Copy link
Member Author

Choose a reason for hiding this comment

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

This is now redundant as we already do InstallMethod(SetMatElm, ..., SET_MAT_ELM_GF2MAT); later in the file.



#############################################################################
##
Expand Down Expand Up @@ -2383,7 +2371,7 @@ InstallMethod( MatElm, "for a gf2 matrix and two integers",
[ IsGF2MatrixRep, IsPosInt, IsPosInt ],
MAT_ELM_GF2MAT );
InstallMethod( SetMatElm, "for a gf2 matrix, two integers, and a ffe",
[ IsGF2MatrixRep, IsPosInt, IsPosInt, IsFFE ],
[ IsGF2MatrixRep and IsMutable, IsPosInt, IsPosInt, IsFFE ],
SET_MAT_ELM_GF2MAT );

InstallMethod( Matrix, "for a list of vecs, an integer, and a gf2 mat",
Expand Down
12 changes: 6 additions & 6 deletions lib/ffeconway.gi
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ end);
## output methods
##

InstallMethod(String,"For large finite field elements",
InstallMethod(String,"for large finite field elements",
[IsFFE and IsCoeffsModConwayPolRep],
function(x)
local started, coeffs, fam, s, str, i;
Expand Down Expand Up @@ -281,17 +281,17 @@ BindGlobal( "DisplayStringForLargeFiniteFieldElements",
return s;
end );

InstallMethod(DisplayString,"For large finite field elements",
InstallMethod(DisplayString,"for large finite field elements",
[IsFFE and IsCoeffsModConwayPolRep],
DisplayStringForLargeFiniteFieldElements );

InstallMethod(Display,"For large finite field elements",
InstallMethod(Display,"for large finite field elements",
[IsFFE and IsCoeffsModConwayPolRep],
function(x)
Print(DisplayString(x));
end);

InstallMethod(ViewString,"For large finite field elements",
InstallMethod(ViewString,"for large finite field elements",
[IsFFE and IsCoeffsModConwayPolRep],
function(x)
local s;
Expand All @@ -306,7 +306,7 @@ InstallMethod(ViewString,"For large finite field elements",
fi;
end);

InstallMethod(ViewObj, "For large finite field elements",
InstallMethod(ViewObj, "for large finite field elements",
[IsFFE and IsCoeffsModConwayPolRep],
function(x)
Print(ViewString(x));
Expand Down Expand Up @@ -1469,7 +1469,7 @@ end);
#M Coefficients of an element wrt the canonical basis -- are stored in the
## element
InstallMethod(Coefficients,
"For a FFE in Conway polynomial represntation wrt the canonical basis of its natural field",
"for a FFE in Conway polynomial represntation wrt the canonical basis of its natural field",
IsCollsElms,
[IsCanonicalBasis and IsBasisFiniteFieldRep, IsFFE and IsCoeffsModConwayPolRep],
function(cb,x)
Expand Down
2 changes: 1 addition & 1 deletion lib/grpfp.gi
Original file line number Diff line number Diff line change
Expand Up @@ -5661,7 +5661,7 @@ IndependentGeneratorsOfMaximalAbelianQuotientOfFpGroup := function( G )
end;

InstallMethod( IndependentGeneratorsOfAbelianGroup,
"For abelian fpgroup, use Smith normal form",
"for abelian fpgroup, use Smith normal form",
[ IsFpGroup and IsAbelian ],
IndependentGeneratorsOfMaximalAbelianQuotientOfFpGroup );

Expand Down
Loading