1#############################################################################
2##
3#W resolutionAccess_SmallGroupRep.gi 			 HAPcryst package		 Marc Roeder
4##
5##
6
7##
8##
9#Y	 Copyright (C) 2006 Marc Roeder
10#Y
11#Y This program is free software; you can redistribute it and/or
12#Y modify it under the terms of the GNU General Public License
13#Y as published by the Free Software Foundation; either version 2
14#Y of the License, or (at your option) any later version.
15#Y
16#Y This program is distributed in the hope that it will be useful,
17#Y but WITHOUT ANY WARRANTY; without even the implied warranty of
18#Y MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19#Y GNU General Public License for more details.
20#Y
21#Y You should have received a copy of the GNU General Public License
22#Y along with this program; if not, write to the Free Software
23#Y Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24##
25#############################################################################
26##
27##  This file implements a representation for HapResolutions of small groups.
28##
29##  The additional feature of this representation is the multiplication
30##  via a multiplication table.
31##  Also, the list of group elements R!.elts is a set. So we can do binary
32##  search occasionally.
33##
34##  Elements of the modules in these resolutions are still pairs of integers.
35##
36##
37
38
39#############################################################################
40##
41#O PositionInGroupOfResolutionNC(<resolution>,<g>)
42#O PositionInGroupOfResolution(<resolution>,<g>)
43##
44##  find the position in <resolution>'s partial list of group elements
45##  <resolution!.elts>. If <g> is not contained in <resolution!.elts>, it is
46##  added and the length of <resolution!.elts> is returned.
47##
48##  The SmallGroupRep is consistent. So we just catch.
49##
50InstallMethod(PositionInGroupOfResolutionNC, "For HapResolutions of small groups",
51        [IsHapSmallGroupResolutionRep,IsObject],
52        function(resolution,g)
53    local   pos;
54    return PositionSet(resolution!.elts,g);
55end);
56
57InstallMethod(PositionInGroupOfResolution, "For HapResolutions of small groups",
58        [IsHapSmallGroupResolutionRep,IsObject],
59        function(resolution,g)
60    local   pos;
61    if not g in GroupOfResolution(resolution)
62       then
63        Error("<g> is not in <resolution>'s group");
64    fi;
65    return PositionInGroupOfResolutionNC(resolution,g);
66end);
67
68
69
70#############################################################################
71##
72#O MultiplyGroupEltsNC(<resolution>,<x>,<y>)
73##
74##  catch the call and delegate to special method. No conversion needed.
75##
76InstallMethod(MultiplyGroupEltsNC,"for HapResolutions of small groups",
77        [IsHapSmallGroupResolutionRep,IsPosInt,IsPosInt],
78        function(resolution,x,y)
79    return resolution!.multtable[x][y];
80end);
81
82
83
84
85
86#############################################################################
87#############################################################################
88##
89## NO "!"s allowed beyond this point
90##
91#############################################################################
92#############################################################################
93
94
95
96
97#############################################################################
98##
99#O MultiplyFreeZGLetterWithGroupEltNC(<resolution>,<letter>,<g>)
100##
101##  given a pair <letter> of positive integers which represent a generator-
102##  group element pair, this returns the letter multiplied with the group
103##  element <g>.
104##
105##
106InstallMethod(MultiplyFreeZGLetterWithGroupEltNC,"For HapResolutions of small groups",
107        [IsHapSmallGroupResolutionRep,IsDenseList,IsPosInt],
108        function(resolution,letter,g)
109    local newgroupel;
110    newgroupel:=MultiplyGroupEltsNC(resolution,letter[2],g);
111    return [letter[1],PositionInGroupOfResolution(resolution,newgroupel)];
112end);
113
114
115
116
117