Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
decomp
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kaashif Hymabaccus
decomp
Commits
5f7885d9
Commit
5f7885d9
authored
Feb 13, 2019
by
Kaashif Hymabaccus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
convert some tests to use new randomised testing
this is more robust
parent
1e013e08
Pipeline
#47420773
passed with stage
in 21 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
77 additions
and
74 deletions
+77
-74
tests.gi
lib/tests.gi
+60
-17
CanonicalDecomposition.tst
tst/CanonicalDecomposition.tst
+3
-16
IrreducibleDecomposition.tst
tst/IrreducibleDecomposition.tst
+3
-20
IrreducibleDecompositionCollected.tst
tst/IrreducibleDecompositionCollected.tst
+3
-21
RepresentationCentralizer.tst
tst/RepresentationCentralizer.tst
+8
-0
No files found.
lib/tests.gi
View file @
5f7885d9
...
...
@@ -3,8 +3,11 @@
# Generate a random representation of a random group
RandomRepresentation@ := function()
local size, id, G, irreps, irrep1, irrep2, rho, n, A, centralizer_basis, isomorphism_type;
# smallgrp has groups of order at most 2000 except 1024
size := Random(Concatenation([1..1023], [1025..2000]));
#size := Random(Concatenation([1..1023], [1025..2000]));
size := Random([1..100]); # don't want tests to take forever
id := Random([1..NrSmallGroups(size)]);
G := SmallGroup(size, id);
irreps := IrreducibleRepresentations(G);
...
...
@@ -23,27 +26,36 @@ RandomRepresentation@ := function()
# We know some things about rho without needing to compute them
# the long way. We return them for use in testing.
# centralizer basis
centralizer_basis := [rec(dimension := DegreeOfRepresentation(irrep1),
nblocks := 2),
rec(dimension := DegreeOfRepresentation(irrep2),
nblocks := 1)];
# if the irreps ended up the same, we have to correct the info
if irrep1 = irrep2 then
centralizer_basis := [rec(dimension := DegreeOfRepresentation(irrep1),
nblocks := 3)];
isomorphism_type := [rec(rep := irrep1, m := 3)];
else
centralizer_basis := [rec(dimension := DegreeOfRepresentation(irrep1),
nblocks := 2),
rec(dimension := DegreeOfRepresentation(irrep2),
nblocks := 1)];
isomorphism_type := [rec(rep := irrep1, m := 2),
rec(rep := irrep2, m := 1)];
fi;
centralizer_basis := List(SizesToBlocks@(centralizer_basis), BlockDiagonalMatrix);
# put them in the scrambled basis
centralizer_basis := List(centralizer_basis, M -> A^-1 * M * A);
isomorphism_type := [rec(rep := irrep1, m := 2),
rec(rep := irrep2, m := 1)];
return rec(rep := rho,
isomorphism_type := isomorphism_type,
centralizer_basis := centralizer_basis,
G := G);
candidate_nice_basis := TransposedMat(A), # note this is not the unique right answer...
G := [size, id]);
end;
# checks if the given centralizer basis is correct
TestCentralizerBasis@ := function(rep, cent_basis)
TestCentralizerBasis@ := function(rep, cent_basis
, args...
)
local correct_basis, C1, C2;
correct_basis := rep.centralizer_basis;
...
...
@@ -55,18 +67,18 @@ TestCentralizerBasis@ := function(rep, cent_basis)
end;
# checks if decomp is a decomposition into G-invariant subspaces
TestInvariantDecomposition@ := function(rep, decomp)
TestInvariantDecomposition@ := function(rep, decomp
, args...
)
local rho, G;
rho := rep.rep;
G := Source(rho);
return ForAll(decomp, V -> IsGInvariant
(G,
rho, V));
return ForAll(decomp, V -> IsGInvariant
@(
rho, V));
end;
# checks some necessary conditions for decomp to be the full
# irreducible (collected) decomposition of rho
TestIrreducibleDecomposition@ := function(rep, decomp)
TestIrreducibleDecomposition@ := function(rep, decomp
, args...
)
local rho, G, conds;
rho := rep.rep;
...
...
@@ -94,12 +106,17 @@ TestIrreducibleDecomposition@ := function(rep, decomp)
# TODO: add some more necessary conditions
return ForAll(conds, x->x);
if ForAll(conds, x->x) then
return true;
else
Error("test failed!");
return false;
fi;
end;
# same as irreducible decomp, these are only necessary conditions
# for correctness
TestCanonicalDecomposition@ := function(rep, decomp)
TestCanonicalDecomposition@ := function(rep, decomp
, args...
)
local conds;
conds := [];
...
...
@@ -115,5 +132,31 @@ TestCanonicalDecomposition@ := function(rep, decomp)
SortedList(List(rep.isomorphism_type,
t -> DegreeOfRepresentation(t.rep)*t.m)));
return ForAll(conds, x->x);
if ForAll(conds, x->x) then
return true;
else
Error("test failed!");
return false;
fi;
end;
# takes a function f : random representation -> boolean and tests it
# on n random representations
TestMany@ := function(f, n)
local tested, rep;
tested := 0;
repeat
rep := RandomRepresentation@();
if not f(rep) then
Print("FAILED: ", rep, "\n");
return false;
fi;
tested := tested + 1;
until tested = n;
return true;
end;
tst/CanonicalDecomposition.tst
View file @
5f7885d9
gap> G := SymmetricGroup(4);;
gap> gens := GeneratorsOfGroup(G);;
gap> irreps := IrreducibleRepresentations(G);;
gap> # note deg irrep1 = 1, deg irrep2 = 1, deg irrep3 = 2, deg irrep4 = 3
gap> imgs := List(gens, g -> BlockDiagonalMatrix([Image(irreps[2], g), Image(irreps[3], g), Image(irreps[4], g)]));;
gap> # we make rho = irrep2 oplus irrep3 oplus irrep4
gap> rho := GroupHomomorphismByImages(G, Group(imgs), gens, imgs);;
gap> # so the canonical decomposition should have 3 nonzero parts with correct dim
gap> List(CanonicalDecomposition(rho), Dimension);
[ 1, 2, 3 ]
gap> # now we do one which has repeat summands
gap> imgs := List(gens, g -> BlockDiagonalMatrix([Image(irreps[2], g), Image(irreps[2], g), Image(irreps[2], g)]));;
gap> rho := GroupHomomorphismByImages(G, Group(imgs), gens, imgs);;
gap> # so the canonical decomposition should have 1 nonzero part with correct dim
gap> List(CanonicalDecomposition(rho), Dimension);
[ 3 ]
gap> tester := rep -> TestCanonicalDecomposition@RepnDecomp(rep, CanonicalDecomposition(rep.rep));;
gap> TestMany@RepnDecomp(tester, 5);
true
\ No newline at end of file
tst/IrreducibleDecomposition.tst
View file @
5f7885d9
gap> G:=AlternatingGroup(5);;
gap> P:=PermutationGModule(G,Rationals);;
gap> h:=GroupHomomorphismByImages(G,Group(P.generators));;
gap> h:=ConvertRhoIfNeeded@RepnDecomp(h);;
gap> l:=IrreducibleDecomposition(h); # check the dimensions are correct
[ <vector space over Cyclotomics, with 1 generators>,
<vector space over Cyclotomics, with 4 generators> ]
gap> ForAll(l, space -> IsGInvariant@RepnDecomp(h, space)); # check the spaces are actually subrepresentations
true
gap> G:=SymmetricGroup(3);;
gap> R:=RegularActionHomomorphism(G);;
gap> h:=GroupHomomorphismByImages(G,Image(R,G));;
gap> h:=ConvertRhoIfNeeded@RepnDecomp(h);;
gap> l:=IrreducibleDecomposition(h); # check the dimensions are correct
[ <vector space over Cyclotomics, with 1 generators>,
<vector space over Cyclotomics, with 1 generators>,
<vector space over Cyclotomics, with 2 generators>,
<vector space over Cyclotomics, with 2 generators> ]
gap> ForAll(l, space -> IsGInvariant@RepnDecomp(h, space)); # check the spaces are actually subrepresentations
true
gap> tester := rep -> TestInvariantDecomposition@RepnDecomp(rep, IrreducibleDecomposition(rep.rep));;
gap> TestMany@RepnDecomp(tester, 5);
true
\ No newline at end of file
tst/IrreducibleDecompositionCollected.tst
View file @
5f7885d9
gap> # some random group
gap> G := SmallGroup(20, 4);;
gap> irreps := IrreducibleRepresentations(G);;
gap> # note deg irreps[2] = 1, deg irreps[5] = 2
gap> gens := GeneratorsOfGroup(G);;
gap> imgs := List(gens, g -> BlockDiagonalMatrix([Image(irreps[2], g), Image(irreps[2], g), Image(irreps[2], g), Image(irreps[5], g), Image(irreps[5], g)]));;
gap> rho := GroupHomomorphismByImages(G, Group(imgs), gens, imgs);;
gap> # rho should split into 3 lines and 2 planes
gap> IrreducibleDecompositionCollected(rho).decomp;
[
[
rec( basis := [ [ 1, 0, 0, 0, 0, 0, 0 ] ],
space := <vector space over Cyclotomics, with 1 generators> ),
rec( basis := [ [ 0, 1, 0, 0, 0, 0, 0 ] ],
space := <vector space over Cyclotomics, with 1 generators> ),
rec( basis := [ [ 0, 0, 1, 0, 0, 0, 0 ] ],
space := <vector space over Cyclotomics, with 1 generators> ) ],
[ rec( basis := [ [ 0, 0, 0, 1, 0, 0, 0 ], [ 0, 0, 0, 0, 1, 0, 0 ] ],
space := <vector space over Cyclotomics, with 2 generators> ),
rec( basis := [ [ 0, 0, 0, 0, 0, 1, 0 ], [ 0, 0, 0, 0, 0, 0, 1 ] ],
space := <vector space over Cyclotomics, with 2 generators> ) ] ]
\ No newline at end of file
gap> tester := rep -> TestIrreducibleDecomposition@RepnDecomp(rep, List(IrreducibleDecompositionCollected(rep.rep).decomp, l -> List(l, r -> r.space)));;
gap> TestMany@RepnDecomp(tester, 5);
true
\ No newline at end of file
tst/RepresentationCentralizer.tst
0 → 100644
View file @
5f7885d9
gap> tester := function(rep)
> local A;
> A := BlockDiagonalBasis(rep.rep);
> A := TransposedMat(A);
> return TestCentralizerBasis@RepnDecomp(rep, List(RepresentationCentralizer(rep.rep), M -> A * M * A^-1));
> end;;
gap> TestMany@RepnDecomp(tester, 5);
true
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment