File: DiagonalMatrix.tst

package info (click to toggle)
gap 4.15.1-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 110,212 kB
  • sloc: ansic: 97,261; xml: 48,343; cpp: 13,946; sh: 4,900; perl: 1,650; javascript: 255; makefile: 252; ruby: 9
file content (48 lines) | stat: -rw-r--r-- 1,593 bytes parent folder | download | duplicates (2)
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
#@local M
gap> START_TEST( "DiagonalMatrix.tst" );

# with base domain and vector of diagonal entries
gap> Is8BitMatrixRep( DiagonalMatrix( GF(9), [ 1, 2 ] * Z(3)^0 ) );
true
gap> DiagonalMatrix( GF(9), [] );
Error, Is8BitMatrixRep with zero rows not yet supported
gap> IsPlistMatrixRep( DiagonalMatrix( Integers, [ 1, 2 ] ) );
true
gap> IsPlistMatrixRep( DiagonalMatrix( Integers, [] ) );
true

# with constructing filter, base domain, and vector of diagonal entries
gap> Is8BitMatrixRep( DiagonalMatrix( Is8BitMatrixRep, GF(9), [ 1, 2 ] * Z(3)^0 ) );
true
gap> IsPlistMatrixRep( DiagonalMatrix( IsPlistMatrixRep, GF(9), [] ) );
true
gap> IsPlistRep( DiagonalMatrix( IsPlistRep, Integers, [ 1, 2 ] ) );
true

# with vector of diagonal entries and example matrix
gap> M:= Matrix( IsPlistMatrixRep, Integers, [ 1 ], 1 );;
gap> DiagonalMatrix( [ 1, 2 ], M );
<2x2-matrix over Integers>
gap> DiagonalMatrix( [], M );
<0x0-matrix over Integers>
gap> M:= [ [ 1 ] ];;
gap> DiagonalMatrix( [ 1, 2 ], M );
[ [ 1, 0 ], [ 0, 2 ] ]
gap> DiagonalMatrix( [], M );
[  ]
gap> M:= Matrix( IsPlistMatrixRep, GF(3), [ Z(3) ], 1 );;
gap> DiagonalMatrix( [ 1, 2 ] * Z(3), M );
<2x2-matrix over GF(3)>
gap> DiagonalMatrix( [ 1, 2 ], M );
Error, <ob> must lie in the base domain of <M>

# with vector of diagonal entries only (choose a default representation)
gap> Is8BitMatrixRep( DiagonalMatrix( [ 1, 2 ] * Z(3) ) );
true
gap> IsPlistMatrixRep( DiagonalMatrix( [ 1, 2 ] ) );
true
gap> DiagonalMatrix( [] );
Error, do not know over which ring the matrix shall be defined

#
gap> STOP_TEST( "DiagonalMatrix.tst" );