34.8 TraceMat

TraceMat( mat )

TraceMat returns the trace of the square matrix mat. The trace is the sum of all entries on the diagonal of mat.

    gap> TraceMat( [ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] ] );
    15
    gap> TraceMat( IdentityMat( 4, GF(2) ) );
    0*Z(2) 

Previous Up Top Next
Index

GAP 3.4.4
April 1997