1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551
|
#############################################################################
##
#W resolutionAccess_LargeGroupRep.gi HAPcryst package Marc Roeder
##
##
##
##
#Y Copyright (C) 2006 Marc Roeder
#Y
#Y This program is free software; you can redistribute it and/or
#Y modify it under the terms of the GNU General Public License
#Y as published by the Free Software Foundation; either version 2
#Y of the License, or (at your option) any later version.
#Y
#Y This program is distributed in the hope that it will be useful,
#Y but WITHOUT ANY WARRANTY; without even the implied warranty of
#Y MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#Y GNU General Public License for more details.
#Y
#Y You should have received a copy of the GNU General Public License
#Y along with this program; if not, write to the Free Software
#Y Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
##
#############################################################################
##
## This file implements a representation for HapResolutions of large groups
##
## Elemements of the modules of this resolution are represented by
## integer-group element pairs.
##
## R!.elt must be present, but is not used for internal computations.
## It is used for conversion to and from the standard representation.
##
##
#############################################################################
##
#O Dimension(<resolution>)
##
## overload the Hap function using !.diension2
##
InstallOtherMethod(Dimension,
[IsHapLargeGroupResolutionRep],
function(resolution)
return function(k) return resolution!.dimension2(resolution,k);end;
end);
#############################################################################
##
#O MultiplyGroupEltsNC(<resolution>,<x>,<y>)
#O MultiplyGroupEltsNC_LargeGroupRep(<resolution>,<x>,<y>)
##
## catch, convert, delegate, convert
##
InstallMethod(MultiplyGroupEltsNC,"for HapResolutions of large groups",
[IsHapLargeGroupResolutionRep,IsPosInt,IsPosInt],
function(resolution,x,y)
local xgroup, ygroup, product;
xgroup:=GroupElementFromPosition(resolution,x);
ygroup:=GroupElementFromPosition(resolution,y);
product:=MultiplyGroupEltsNC_LargeGroupRep(resolution,xgroup,ygroup);
return PositionInGroupOfResolutionNC(resolution,product);
end);
InstallMethod(MultiplyGroupEltsNC_LargeGroupRep,"for HapResolutions of large groups",
[IsHapLargeGroupResolutionRep,IsObject,IsObject],
function(resolution,x,y)
return x*y;
end);
#############################################################################
##
#O MultiplyGroupElts_LargeGroupRep(<resolution>,<x>,<y>)
##
## interenal method for this representation.
##
InstallMethod(MultiplyGroupElts_LargeGroupRep,"for HapResolutions of large groups",
[IsHapLargeGroupResolutionRep,IsObject,IsObject],
function(resolution,x,y)
if not IsSubset(GroupOfResolution(resolution),[x,y])
then
Error("<x> and <y> must belong to <resolution>'s group");
else
return MultiplyGroupEltsNC_LargeGroupRep(resolution,x,y);
fi;
end);
#############################################################################
##
#O MultiplyGroupElts(<resolution>,<x>,<y>)
##
## interenal method for this representation.
##
InstallMethod(MultiplyGroupElts,"for HapResolutions of large groups",
[IsHapLargeGroupResolutionRep,IsObject,IsObject],
function(resolution,x,y)
if IsSubset(GroupOfResolution(resolution),[x,y])
then
return MultiplyGroupEltsNC_LargeGroupRep(resolution,x,y);
elif ForAll([x,y],i->IsValidGroupInt(resolution,i))
then
return MultiplyGroupEltsNC(resolution,x,y);
else
TryNextMethod();
fi;
end);
#############################################################################
##
## No "!"s allowed beyond this point
##
#############################################################################
#############################################################################
##
#O StrongtestValidRepresentationForLetter(resolution,term,letter)
##
## returns the strongest representation in which <letter> is a valid letter
## for <resolution>
##
InstallMethod(StrongestValidRepresentationForLetter,
[IsHapLargeGroupResolutionRep,IsInt,IsDenseList],
function(resolution,term, letter)
if IsFreeZGLetter_LargeGroupRep(resolution,term,letter)
then
return IsHapLargeGroupResolutionRep;
else
TryNextMethod();
fi;
end);
#############################################################################
##
#O StrongtestValidRepresentationForWord(resolution,term,word)
##
## returns the strongest representation in which <word> is a valid letter
## for <word>
##
InstallMethod(StrongestValidRepresentationForWord,
[IsHapLargeGroupResolutionRep,IsInt,IsDenseList],
function(resolution,term, word)
if IsFreeZGWord_LargeGroupRep(resolution,term,word)
then
return IsHapLargeGroupResolutionRep;
else
TryNextMethod();
fi;
end);
#############################################################################
##
#O ConvertStandardLetterToLargeGroupRepNC(<resolution>,<term>,<letter>)
#O ConvertStandardLetterToLargeGroupRep(<resolution>,<term>,<letter>)
##
InstallMethod(ConvertStandardLetter,
[IsHapResolutionRep,IsInt,IsDenseList],
function(resolution,term,letter)
if not IsFreeZGLetter(resolution,term,letter)
then
Error("<letter> is not a valid letter");
fi;
return ConvertStandardLetterNC(resolution,term,letter);
end);
InstallMethod(ConvertStandardLetterNC,
[IsHapResolutionRep,IsInt,IsDenseList],
function(resolution,term,letter)
return [letter[1],GroupElementFromPosition(resolution,letter[2])];
end);
#############################################################################
##
#O ConvertStandardWordNC(<resolution>,<term>,<letter>)
#O ConvertStandardWord(<resolution>,<term>,<letter>)
##
InstallMethod(ConvertStandardWord,
[IsHapResolutionRep,IsInt,IsDenseList],
function(resolution,term,word)
if not IsFreeZGWord(resolution,term,word)
then
Error("<word> is not a valid word");
fi;
return ConvertStandardWordNC(resolution,term,word);
end);
InstallMethod(ConvertStandardWordNC,
[IsHapResolutionRep,IsInt,IsDenseList],
function(resolution,term,word)
return List(word,letter->ConvertStandardLetterNC(resolution,term,letter));
end);
#############################################################################
##
#O ConvertLetterToStandardRepNC
#O ConvertLetterToStandardRep
##
InstallMethod(ConvertLetterToStandardRep,
[IsHapLargeGroupResolutionRep,IsInt,IsDenseList],
function(resolution,term,letter)
if not IsFreeZGLetter_LargeGroupRep(resolution,term,letter)
then
Error("<letter> is not a valid letter in large group representation.");
fi;
return ConvertLetterToStandardRepNC(resolution,term,letter);
end);
InstallMethod(ConvertLetterToStandardRepNC,
[IsHapLargeGroupResolutionRep,IsInt,IsDenseList],
function(resolution,term,letter)
return [letter[1],PositionInGroupOfResolution(resolution,letter[2])];
end);
#############################################################################
##
#O ConvertWordToStandardRepNC
#O ConvertWordToStandardRep
##
InstallMethod(ConvertWordToStandardRep,
[IsHapLargeGroupResolutionRep,IsInt,IsDenseList],
function(resolution,term,word)
if not IsFreeZGWord_LargeGroupRep(resolution,term,word)
then
Error("<letter> is not a valid letter in large group representation.");
fi;
return ConvertWordToStandardRepNC(resolution,term,word);
end);
InstallMethod(ConvertWordToStandardRepNC,
[IsHapLargeGroupResolutionRep,IsInt,IsDenseList],
function(resolution,term,word)
return List(word,letter->ConvertLetterToStandardRepNC(resolution,term,letter));
end);
#############################################################################
##
#O IsFreeZGLetter_LargeGroupRep(<resolution>,<term>,<letter>)
##
## check if <letter> is a letter of the <term>th module of <resolution>.
## A letter is a word of length 1.
##
##
InstallMethod(IsFreeZGLetter_LargeGroupRep,"For HapResolutions of large groups",
[IsHapLargeGroupResolutionRep,IsInt,IsDenseList],
function(resolution,term,letter)
if not (
Size(letter)=2
and IsInt(letter[1])
and AbsInt(letter[1])<=Dimension(resolution)(term)
and letter[2] in GroupOfResolution(resolution)
)
then
return false;
else
return true;
fi;
end);
#############################################################################
##
#O IsFreeZGWord_LargeGroupRep(<resolution>,<term>,<word>)
##
## Check if <word> is an element of the <term>th module in <resolution>
##
##
InstallMethod(IsFreeZGWord_LargeGroupRep,"For HapResolutions of large groups",
[IsHapLargeGroupResolutionRep,IsInt,IsDenseList],
function(resolution,term,word)
local firstEntries, secondEntries;
if not ForAll(word,IsDenseList)
then
return false;
fi;
firstEntries:=List(word,i->AbsInt(i[1]));
secondEntries:=Set(word,i->i[2]);
if Maximum(firstEntries)<=Dimension(resolution)(term)
and IsSubset(GroupOfResolution(resolution),secondEntries)
then
return true;
else
return false;
fi;
end);
#############################################################################
##
#O MultiplyFreeZGLetterWithGroupEltNC_LargeGroupRep(<resolution>,<letter>,<g>)
##
## given a pair <letter> of positive integers which represent a generator-
## group element pair, this returns the letter multiplied with the group
## element <g>.
##
##
InstallMethod(MultiplyFreeZGLetterWithGroupEltNC_LargeGroupRep,"For HapResolutions of large groups",
[IsHapLargeGroupResolutionRep,IsDenseList,IsObject],
function(resolution,letter,g)
local newgroupel;
return [letter[1],letter[2]*g];
end);
#############################################################################
##
#O MultiplyFreeZGLetterWithGroupElt_LargeGroupRep(<resolution>,<letter>,<g>)
#O MultiplyFreeZGLetterWithGroupElt(<resolution>,<letter>,<g>)
##
## Check input for sanity and delegate to NC version
##
InstallMethod(MultiplyFreeZGLetterWithGroupElt_LargeGroupRep,"For HapResolutions of large groups",
[IsHapLargeGroupResolutionRep,IsDenseList,IsObject],
function(resolution,letter,g)
if not (IsSubset(GroupOfResolution(resolution),[g,letter[2]])
and IsInt(letter[1])
)
then
Error("<letter> or <g> of wrong form");
fi;
return MultiplyFreeZGLetterWithGroupEltNC_LargeGroupRep(resolution,letter,g);
end);
#############################################################################
##
InstallMethod(MultiplyFreeZGLetterWithGroupElt,"For HapResolutions of large groups",
[IsHapLargeGroupResolutionRep,IsDenseList,IsObject],
function(resolution,letter,g)
if not (IsSubset(GroupOfResolution(resolution),[g,letter[2]])
and IsInt(letter[1])
)
then
TryNextMethod();
fi;
return MultiplyFreeZGLetterWithGroupEltNC_LargeGroupRep(resolution,letter,g);
end);
#############################################################################
##
#O MultiplyFreeZGWordWithGroupEltNC_LargeGroupRep(<resolution>,<word>,<g>)
##
## multiplies the word <word> with the group element <g>.
## No checks are performed.
##
InstallMethod(MultiplyFreeZGWordWithGroupEltNC_LargeGroupRep,"For HapResolutions of large groups",
[IsHapLargeGroupResolutionRep,IsDenseList,IsObject],
function(resolution,word,g)
return List(word,cell->MultiplyFreeZGLetterWithGroupEltNC_LargeGroupRep(resolution,cell,g));
end);
#############################################################################
##
#O MultiplyFreeZGWordWithGroupElt_LargeGroupRep(<resolution>,<word>,<g>)
#O MultiplyFreeZGWordWithGroupElt(<resolution>,<word>,<g>)
##
## Check input and delegate to NC version.
##
InstallMethod(MultiplyFreeZGWordWithGroupElt_LargeGroupRep,"For HapResolution",
[IsHapLargeGroupResolutionRep,IsDenseList,IsObject],
function(resolution,word,g)
local group;
group:=GroupOfResolution(resolution);
if not (ForAll(word,i->IsInt(i[1]) and i[2] in group)
and g in group
)
then
Error("<g> or <word> are not valid");
fi;
return MultiplyFreeZGWordWithGroupEltNC_LargeGroupRep(resolution,word,g);
end);
#############################################################################
##
InstallMethod(MultiplyFreeZGWordWithGroupElt,"For HapResolution",
[IsHapLargeGroupResolutionRep,IsDenseList,IsObject],
function(resolution,word,g)
local group;
group:=GroupOfResolution(resolution);
if not (ForAll(word,i->IsInt(i[1]) and i[2] in group)
and g in group
)
then
TryNextMethod();
fi;
return MultiplyFreeZGWordWithGroupEltNC_LargeGroupRep(resolution,word,g);
end);
#############################################################################
##
#O BoundaryOfFreeZGLetterNC(<resolution>,<term>,<cell>)
#O BoundaryOfFreeZGLetterNC_LargeGroupRep(<resolution>,<term>,<cell>)
##
## calculates the boundary of a cell in the <term>th module.
##
## catch, convert, delegate, convert
##
InstallMethod(BoundaryOfFreeZGLetterNC,"For HapResolutions of large groups",
[IsHapLargeGroupResolutionRep,IsInt,IsDenseList],
function(resolution,term,cell)
local cell_LargeGroupRep, boundary;
cell_LargeGroupRep:=[cell[1],GroupElementFromPosition(resolution,cell[2])];
boundary:=BoundaryOfFreeZGLetterNC_LargeGroupRep(resolution,term,cell_LargeGroupRep);
Apply(boundary,i->[i[1],
PositionInGroupOfResolutionNC(resolution,i[2])]);
return boundary;
end);
#############################################################################
##
InstallMethod(BoundaryOfFreeZGLetterNC_LargeGroupRep,
"For HapResolutions of large groups",
[IsHapLargeGroupResolutionRep,IsInt,IsDenseList],
function(resolution,term,cell)
local sign, boundary;
sign:=SignInt(cell[1]);
boundary:=resolution!.boundary2(resolution,term,AbsInt(cell[1]));
boundary:=MultiplyFreeZGWordWithGroupEltNC_LargeGroupRep(resolution,boundary,cell[2]);
if sign=-1
then
return NegateWord(boundary);
else
return boundary;
fi;
end);
#############################################################################
##
#O BoundaryOfFreeZGLetter_LargeGroupRep(<resolution>,<term>,<letter>)
#O BoundaryOfFreeZGLetter(<resolution>,<term>,<letter>)
##
## checks input and delegates to NC version
##
InstallMethod(BoundaryOfFreeZGLetter_LargeGroupRep,"For HapResolutions of large groups",
[IsHapLargeGroupResolutionRep,IsInt,IsDenseList],
function(resolution,term,letter)
if not IsFreeZGLetter_LargeGroupRep(resolution,term,letter)
then
Error("<letter> is not a proper letter");
fi;
return BoundaryOfFreeZGLetterNC_LargeGroupRep(resolution,term,letter);
end);
#############################################################################
##
InstallMethod(BoundaryOfFreeZGLetter,
[IsHapLargeGroupResolutionRep,IsInt,IsDenseList],
function(resolution,term,letter)
local letter_large;
if IsFreeZGLetter_LargeGroupRep(resolution,term,letter)
then
return BoundaryOfFreeZGLetterNC_LargeGroupRep(resolution,term,letter);
elif IsFreeZGLetter(resolution,term,letter)
then
letter_large:=ConvertStandardLetterNC(resolution,term,letter);
return ConvertWordToStandardRepNC(resolution,term,BoundaryOfFreeZGLetterNC_LargeGroupRep(resolution,term,letter_large));
else
TryNextMethod();
fi;
end);
#############################################################################
##
#O BoundaryOfFreeZGWordNC_LargeGroupRep(<resolution>,<term>,<word>)
##
## calculate the boundary of the element <word> of the <term>th module of the
## resolution <resolution>.
## No checks done.
##
InstallMethod(BoundaryOfFreeZGWordNC_LargeGroupRep,"For HapResolutions of large groups",
[IsHapLargeGroupResolutionRep,IsInt,IsDenseList],
function(resolution,term,word)
local boundary, letter, letterbound;
boundary:=[];
for letter in word
do
letterbound:=BoundaryOfFreeZGLetterNC_LargeGroupRep(resolution,term,letter);
boundary:=AddFreeWords(boundary,letterbound);
od;
return boundary;
end);
#############################################################################
##
#O BoundaryOfFreeZGWord_LargeGroupRep(<resolution>,<term>,<word>)
#O BoundaryOfFreeZGWord(<resolution>,<term>,<word>)
##
## Check input and delegate to NC version.
##
InstallMethod(BoundaryOfFreeZGWord_LargeGroupRep,"For HapResolution",
[IsHapLargeGroupResolutionRep,IsInt,IsDenseList],
function(resolution,term,word)
if not IsFreeZGWord_LargeGroupRep(resolution,term,word)
then
Error("<word> is not an element of the <term>th module");
fi;
return BoundaryOfFreeZGWordNC_LargeGroupRep(resolution,term,word);
end);
#############################################################################
##
InstallMethod(BoundaryOfFreeZGWord,
[IsHapLargeGroupResolutionRep,IsInt,IsDenseList],
function(resolution,term,letter)
local word_large;
if IsFreeZGWord_LargeGroupRep(resolution,term,letter)
then
return BoundaryOfFreeZGWordNC_LargeGroupRep(resolution,term,letter);
elif IsFreeZGLetter(resolution,term,letter)
then
word_large:=ConvertWordToStandardRepNC(resolution,term,letter);
return ConvertWordToStandardRepNC(resolution,term,BoundaryOfFreeZGWordNC(resolution,term,word_large));
else
TryNextMethod();
fi;
end);
|