Skip to content

Commit

Permalink
Fix inefficiency when dealing with certain algebra modules
Browse files Browse the repository at this point in the history
The issue was originally reported by Rudolf Tange on the GAP support
mailing list. The fix is virtually identical to a fix for a similar
issue, see 7aec45f
  • Loading branch information
fingolfin committed Jan 2, 2018
1 parent 2735612 commit afc698a
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
5 changes: 5 additions & 0 deletions lib/algrep.gd
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,11 @@ DeclareCategory( "IsMonomialElement", IsVector );
DeclareCategoryCollections( "IsMonomialElement" );
DeclareCategoryFamily( "IsMonomialElement" );

#
DeclareHandlingByNiceBasis( "IsMonomialElementVectorSpace",
"for free left modules of monomial elements");


#############################################################################
##
#O ConvertToNormalFormMonomialElement( <me> )
Expand Down
18 changes: 16 additions & 2 deletions lib/algrep.gi
Original file line number Diff line number Diff line change
Expand Up @@ -3180,8 +3180,9 @@ end );
#############################################################################
##
## Prevent nice basis handling to kick in for vector spaces over sparse
## elements, as that ends up trying to enumerate the vector space, which
## is not a good idea for non-trivial examples.
## elements (including monomial elements), as that ends up trying to
## enumerate the vector space, which is not a good idea for non-trivial
## examples.
##
InstallHandlingByNiceBasis( "IsSparseVectorSpace", rec(
detect:= function( R, gens, V, zero )
Expand All @@ -3196,6 +3197,19 @@ InstallHandlingByNiceBasis( "IsSparseVectorSpace", rec(
UglyVector := function( C, vec ) end,
) );

InstallHandlingByNiceBasis( "IsMonomialElementVectorSpace", rec(
detect:= function( R, gens, V, zero )
if IsMonomialElementCollection(V) then
return fail;
else
return false;
fi;
end,
NiceFreeLeftModuleInfo := function( C ) end,
NiceVector := function( C, c ) end,
UglyVector := function( C, vec ) end,
) );


#############################################################################
##
Expand Down
16 changes: 16 additions & 0 deletions tst/testinstall/algrep.tst
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,21 @@ true
gap> ForAll([1..10], i -> Random(A) in A);
true

#
# creating subalgebra
#
gap> L:=FullMatrixLieAlgebra(GF(3), 2);; Dimension(L);;
gap> V:=AdjointModule(L);
<left-module over <Lie algebra of dimension 4 over GF(3)>>
gap> S:=SymmetricPowerOfAlgebraModule(V, 4);
<35-dimensional left-module over <Lie algebra of dimension 4 over GF(3)>>
gap> bas:=Basis(S){[ 1, 2, 4, 5, 6, 9, 13, 14, 15, 16, 19, 25, 32, 33, 34, 35 ]};;
gap> S1:=SubAlgebraModule(S,bas);
<left-module over <Lie algebra of dimension 4 over GF(3)>>
gap> Dimension(S1);
16
gap> S1:=SubAlgebraModule(S,bas,"basis");
<16-dimensional left-module over <Lie algebra of dimension 4 over GF(3)>>

#
gap> STOP_TEST( "algrep.tst", 1);

0 comments on commit afc698a

Please sign in to comment.