91 CHEVIE utility functions -- Matrices

This chapter documents various functions which enhance GAP's ability to work with matrices.

Subsections

  1. DecomposedMat
  2. DiagonalMat
  3. IsDiagonalMat
  4. RepresentativeDiagonalConjugation
  5. ProportionalityCoefficient
  6. IsLowerTriangularMat
  7. ExteriorPower
  8. IsNormalizing
  9. OnMatrices
  10. PermMatMat

91.1 DecomposedMat

DecomposedMat( mat )

finds if the square matrix mat admits a block decomposition.

Define a graph G with vertices [1..Length(mat)] and with an edge between i and j if either mat[i][j] or mat[j][i] is non-zero. DecomposedMat return a list of lists l such that l[1],l[2], etc.. are the vertices in each connected component of G. In other words, the matrices mat{l[1]}{l[1]},mat{l[2]}{l[2]}, etc... are blocks of the matrix mat.

    gap> m := [ [  0,  0,  0,  1 ],
    >           [  0,  0,  1,  0 ],
    >           [  0,  1,  0,  0 ],
    >           [  1,  0,  0,  0 ] ];;
    gap> DecomposedMat( m );
    [ [ 1, 4 ], [ 2, 3 ] ]
    gap> PrintArray( m{[ 1, 4 ]}{[ 1, 4 ]});
    [ [  0,  1 ],
      [  1,  0 ] ] 

This function requires the package "chevie" (see RequirePackage).

91.2 DiagonalMat

DiagonalMat( mat1, ... , matn )

returns the block diagonal direct sum of the matrices mat1, ..., matn. Blocks of size 1x1 may be given as scalars.

    gap> C1 := [ [   2,  -1,   0,   0 ],
    >            [  -1,   2,  -1,   0 ],
    >            [   0,  -1,   2,  -1 ],
    >            [   0,   0,  -1,   2 ] ];;
    gap> C2 := [ [   2,   0,  -1,   0 ],
    >            [   0,   2,  -1,   0 ],
    >            [  -1,  -1,   2,  -1 ],
    >            [   0,   0,  -1,   2 ] ];;
    gap> PrintArray( DiagonalMat( C1, C2 ) );
    [ [   2,  -1,   0,   0,   0,   0,   0,   0 ],
      [  -1,   2,  -1,   0,   0,   0,   0,   0 ],
      [   0,  -1,   2,  -1,   0,   0,   0,   0 ],
      [   0,   0,  -1,   2,   0,   0,   0,   0 ],
      [   0,   0,   0,   0,   2,   0,  -1,   0 ],
      [   0,   0,   0,   0,   0,   2,  -1,   0 ],
      [   0,   0,   0,   0,  -1,  -1,   2,  -1 ],
      [   0,   0,   0,   0,   0,   0,  -1,   2 ] ] 

One can also use a computed list of matrices as an argument; the function call then reads ApplyFunc(DiagonalMat, [mat1, ... , matn] ).

This function requires the package "chevie" (see RequirePackage).

91.3 IsDiagonalMat

IsDiagonalMat( mat )

mat must be a matrix. This function returns true if all entries mat[i][j] with i<>j are equal to 0*mat[i][j] and false otherwise.

    gap> a := [ [ 1, 2 ], [ 3, 1 ] ];;
    gap> IsDiagonalMat( a );
    false 

This function requires the package "chevie" (see RequirePackage).

91.4 RepresentativeDiagonalConjugation

RepresentativeDiagonalConjugation( M, N )

M and N must be square matrices. This function returns a list d such that N=M^DiagonalMat(d) is such a list exists, and false otherwise.

    gap> M:=[[1,2],[2,1]];
    [ [ 1, 2 ], [ 2, 1 ] ]
    gap> N:=[[1,4],[1,1]];
    [ [ 1, 4 ], [ 1, 1 ] ]
    gap> RepresentativeDiagonalConjugation(M,N);
    [ 1, 2 ]

This function requires the package "chevie" (see RequirePackage).

91.5 ProportionalityCoefficient

ProportionalityCoefficient( v, w )

v and w should be two vectors of the same length. The function returns a scalar c such that v=c*w if such a scalar exists, and false otherwise.

     gap>ProportionalityCoefficient([1,2],[2,4]);
     1/2
     gap>ProportionalityCoefficient([1,2],[2,3]);
     false

This function requires the package "chevie" (see RequirePackage).

91.6 IsLowerTriangularMat

IsLowerTriangularMat( mat )

mat must be a matrix. This function returns true if all entries mat[i][j] with j>i are equal to 0*mat[i][j] and false otherwise.

    gap> a := [ [ 1, 2 ], [ 3, 1 ] ];;
    gap> IsLowerTriangularMat( a );
    false
    gap> a[1][2] := 0;;
    gap> IsLowerTriangularMat( a );
    true 

This function requires the package "chevie" (see RequirePackage).

91.7 ExteriorPower

ExteriorPower( mat, n )

mat should be a square matrix. The function returns the n-th exterior power of mat.

    gap> M:=[[1,2],[2,1]];
    [ [ 1, 2 ], [ 2, 1 ] ]
    gap> N:=[[1,4],[1,1]];
    [ [ 1, 4 ], [ 1, 1 ] ]
    gap> RepresentativeDiagonalConjugation(M,N);
    [ 1, 2 ]

This function requires the package "chevie" (see RequirePackage).

91.8 IsNormalizing

IsNormalizing( lst, mat )

returns true or false according to whether the matrix mat leaves the vectors in lst as a set invariant, i.e., Set(l * M) = Set( l ).

    gap> a := [ [ 1, 2 ], [ 3, 1 ] ];;
    gap> l := [ [ 1, 0 ], [ 0, 1 ], [ 1, 1 ], [ 0, 0 ] ];;
    gap> l * a;
    [ [ 1, 2 ], [ 3, 1 ], [ 4, 3 ], [ 0, 0 ] ]
    gap> IsNormalizing( l, a );
    false 

This function requires the package "chevie" (see RequirePackage).

91.9 OnMatrices

OnMatrices( M , p)

Effects the permutation of the lines and columns of the matrix M specified by the permutation p.

   gap> M:=DiagonalMat([1,2,3]);
   [ [ 1, 0, 0 ], [ 0, 2, 0 ], [ 0, 0, 3 ] ]
   gap> OnMatrices(M,(1,2,3));
   [ [ 3, 0, 0 ], [ 0, 1, 0 ], [ 0, 0, 2 ] ]

This function requires the package "chevie" (see RequirePackage).

91.10 PermMatMat

PermMatMat( M , N [, l1, l2])

M and N should be symmetric matrices. PermMatMat returns a permutation p such that OnMatrices(M,p)=N if such a permutation exists, and false otherwise. If list arguments l1 and l1 are given, the permutation p should also satisfy Permuted(l1,p)=l2.

This routine is useful to identify two objects which are isomorphic but with different labelings. It is used in CHEVIE to identify Cartan matrices and Lusztig Fourier transform matrices with standard (classified) data. The program uses sophisticated algorithms, and can often handle matrices up to 80x 80.

    gap> M:=CartanMat("D",12);;
    gap> p:=Random(SymmetricGroup(12));
    ( 1,12, 7, 5, 9, 8, 3, 6)( 2,10)( 4,11)
    gap> N:=OnMatrices(M,p);;
    gap> PermMatMat(M,N);
    ( 1,12, 7, 5, 9, 8, 3, 6)( 2,10)( 4,11) 

This function requires the package "chevie" (see RequirePackage). Previous Up Next
Index

GAP 3.4.4
April 1997