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
|
# Embryonic test for DirectProductElement objects, could be expanded.
gap> START_TEST("DirectProductElement.tst");
#
# empty DPEs
#
gap> dpe:=DirectProductElement([]);
DirectProductElement( [ ] )
gap> DirectProductElement(FamilyObj(dpe), []);
DirectProductElement( [ ] )
#
# arithmetic on DPEs
#
gap> numdpe1 := DirectProductElement([1,2]);
DirectProductElement( [ 1, 2 ] )
gap> numdpe2 := DirectProductElement([3,4]);
DirectProductElement( [ 3, 4 ] )
#
gap> numdpe1 + numdpe2;
DirectProductElement( [ 4, 6 ] )
#
gap> numdpe1 + 1;
DirectProductElement( [ 2, 3 ] )
gap> 1 + numdpe1;
DirectProductElement( [ 2, 3 ] )
#
gap> numdpe1 * 3;
DirectProductElement( [ 3, 6 ] )
gap> 3 * numdpe1;
DirectProductElement( [ 3, 6 ] )
gap> numdpe1 / 3;
DirectProductElement( [ 1/3, 2/3 ] )
#
gap> numdpe1 * [2, 3];
[ DirectProductElement( [ 2, 4 ] ), DirectProductElement( [ 3, 6 ] ) ]
gap> [2, 3] * numdpe1;
[ DirectProductElement( [ 2, 4 ] ), DirectProductElement( [ 3, 6 ] ) ]
#
gap> numdpe1 + [numdpe1, numdpe2];
[ DirectProductElement( [ 2, 4 ] ), DirectProductElement( [ 4, 6 ] ) ]
gap> [numdpe1, numdpe2] + numdpe1;
[ DirectProductElement( [ 2, 4 ] ), DirectProductElement( [ 4, 6 ] ) ]
# Using SymmetricGroup below specifically because its String() and
# PrintString() are different.
gap> adpe := DirectProductElement([SymmetricGroup(3), 1]);;
gap> String(adpe);
"DirectProductElement( [ SymmetricGroup( [ 1 .. 3 ] ), 1 ] )"
gap> PrintString(adpe);
"DirectProductElement( [ Group( \>[ (1,2,3), (1,2) ]\<\> )\<,\<\> 1 ] )"
gap> Display(adpe);
DirectProductElement( [ Group( [ (1,2,3), (1,2) ] ), 1 ] )
# verify bug #1824 (2) is fixed
gap> elt := DirectProductElement([1,1]);;
gap> IsFinite(elt);
true
#
# Test CanEasilyCompareElements for DPEs
#
gap> CanEasilyCompareElements(DirectProductElement([]));
true
#
gap> G:=SymmetricGroup(5);
Sym( [ 1 .. 5 ] )
gap> CanEasilyCompareElements(G);
true
gap> CanEasilyCompareElements(G.1);
true
gap> D := DirectProduct(G, G);;
gap> CanEasilyCompareElements(D);
true
gap> CanEasilyCompareElements(D.1);
true
#
gap> H:=Image(IsomorphismFpGroup(G));;
gap> CanEasilyCompareElements(H);
false
gap> CanEasilyCompareElements(H.1);
false
gap> D2 := DirectProduct(H, H);;
gap> CanEasilyCompareElements(D2);
false
gap> CanEasilyCompareElements(D2.1);
false
#
# component access
#
gap> dpe := DirectProductElement([(1,2), (3,4)]);
DirectProductElement( [ (1,2), (3,4) ] )
gap> dpe[1];
(1,2)
gap> dpe[2];
(3,4)
gap> dpe[3];
Error, <index> too large for <dpelm>, you may return another index
#
# IsGeneratorsOfMagmaWithInverses for DPEs
#
gap> coll:=[dpe];;
gap> IsDirectProductElementCollection(coll);
true
gap> IsGeneratorsOfMagmaWithInverses( [ dpe ] );
true
gap> IsGeneratorsOfMagmaWithInverses( [ numdpe1 ] );
#I no groups of cyclotomics allowed because of incompatible ^
false
#
# AdditiveInverseOp, ZeroOp
#
gap> numdpe := DirectProductElement([1,2]);
DirectProductElement( [ 1, 2 ] )
gap> -numdpe;
DirectProductElement( [ -1, -2 ] )
gap> Zero(numdpe);
DirectProductElement( [ 0, 0 ] )
#
gap> STOP_TEST("DirectProductElement.tst");
|