|
| 1 | +gap> START_TEST("IdentityMatrix.tst"); |
| 2 | + |
| 3 | +# |
| 4 | +gap> m:=IdentityMatrix( GF(2), 5 ); Display(m); |
| 5 | +<a 5x5 matrix over GF2> |
| 6 | + 1 . . . . |
| 7 | + . 1 . . . |
| 8 | + . . 1 . . |
| 9 | + . . . 1 . |
| 10 | + . . . . 1 |
| 11 | +gap> m:=IdentityMatrix( GF(3), 5 ); Display(m); |
| 12 | +[ [ Z(3)^0, 0*Z(3), 0*Z(3), 0*Z(3), 0*Z(3) ], |
| 13 | + [ 0*Z(3), Z(3)^0, 0*Z(3), 0*Z(3), 0*Z(3) ], |
| 14 | + [ 0*Z(3), 0*Z(3), Z(3)^0, 0*Z(3), 0*Z(3) ], |
| 15 | + [ 0*Z(3), 0*Z(3), 0*Z(3), Z(3)^0, 0*Z(3) ], |
| 16 | + [ 0*Z(3), 0*Z(3), 0*Z(3), 0*Z(3), Z(3)^0 ] ] |
| 17 | + 1 . . . . |
| 18 | + . 1 . . . |
| 19 | + . . 1 . . |
| 20 | + . . . 1 . |
| 21 | + . . . . 1 |
| 22 | +gap> m:=IdentityMatrix( GF(4), 5 ); Display(m); |
| 23 | +[ [ Z(2)^0, 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2) ], |
| 24 | + [ 0*Z(2), Z(2)^0, 0*Z(2), 0*Z(2), 0*Z(2) ], |
| 25 | + [ 0*Z(2), 0*Z(2), Z(2)^0, 0*Z(2), 0*Z(2) ], |
| 26 | + [ 0*Z(2), 0*Z(2), 0*Z(2), Z(2)^0, 0*Z(2) ], |
| 27 | + [ 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2), Z(2)^0 ] ] |
| 28 | + 1 . . . . |
| 29 | + . 1 . . . |
| 30 | + . . 1 . . |
| 31 | + . . . 1 . |
| 32 | + . . . . 1 |
| 33 | +gap> m:=IdentityMatrix( Integers, 5 ); Display(m); |
| 34 | +<5x5-matrix over Integers> |
| 35 | +<5x5-matrix over Integers: |
| 36 | +[[ 1, 0, 0, 0, 0 ] |
| 37 | + [ 0, 1, 0, 0, 0 ] |
| 38 | + [ 0, 0, 1, 0, 0 ] |
| 39 | + [ 0, 0, 0, 1, 0 ] |
| 40 | + [ 0, 0, 0, 0, 1 ] |
| 41 | +]> |
| 42 | +gap> m:=IdentityMatrix( Integers mod 4, 5 ); Display(m); |
| 43 | +<5x5-matrix over (Integers mod 4)> |
| 44 | +<5x5-matrix over (Integers mod 4): |
| 45 | +[[ ZmodnZObj( 1, 4 ), ZmodnZObj( 0, 4 ), ZmodnZObj( 0, 4 ), ZmodnZObj( 0, 4 ), |
| 46 | + ZmodnZObj( 0, 4 ) ] |
| 47 | + [ ZmodnZObj( 0, 4 ), ZmodnZObj( 1, 4 ), ZmodnZObj( 0, 4 ), ZmodnZObj( 0, 4 ), |
| 48 | + ZmodnZObj( 0, 4 ) ] |
| 49 | + [ ZmodnZObj( 0, 4 ), ZmodnZObj( 0, 4 ), ZmodnZObj( 1, 4 ), ZmodnZObj( 0, 4 ), |
| 50 | + ZmodnZObj( 0, 4 ) ] |
| 51 | + [ ZmodnZObj( 0, 4 ), ZmodnZObj( 0, 4 ), ZmodnZObj( 0, 4 ), ZmodnZObj( 1, 4 ), |
| 52 | + ZmodnZObj( 0, 4 ) ] |
| 53 | + [ ZmodnZObj( 0, 4 ), ZmodnZObj( 0, 4 ), ZmodnZObj( 0, 4 ), ZmodnZObj( 0, 4 ), |
| 54 | + ZmodnZObj( 1, 4 ) ] |
| 55 | +]> |
| 56 | + |
| 57 | +# |
| 58 | +gap> m:=IdentityMatrix( Integers, 0 ); Display(m); |
| 59 | +<0x0-matrix over Integers> |
| 60 | +<0x0-matrix over Integers: |
| 61 | +]> |
| 62 | + |
| 63 | +# some error checking |
| 64 | +gap> m:=IdentityMatrix( GF(2), -1 ); |
| 65 | +Error, <n> must be a non-negative integer (not a integer) |
| 66 | +gap> m:=IdentityMatrix( GF(3), -1 ); |
| 67 | +Error, <n> must be a non-negative integer (not a integer) |
| 68 | +gap> m:=IdentityMatrix( GF(4), -1 ); |
| 69 | +Error, <n> must be a non-negative integer (not a integer) |
| 70 | +gap> m:=IdentityMatrix( Integers mod 4, -1 ); |
| 71 | +Error, <n> must be a non-negative integer (not a integer) |
| 72 | + |
| 73 | +# |
| 74 | +gap> STOP_TEST("IdentityMatrix.tst"); |
0 commit comments