The matrix functions all operate on rank-2 objects of any type. The function idet() computes the determinant of its argument via the cofactor method. The result is an algebraic value that is also stored on the object under the key det; future calls to idet() will return this value immediately. The user can change the stored value of the determinant by giving idet() a second argument.
The functions cofactor() and determ() compute the cofactor matrix and the determinant from that matrix. The second argument to cofactor() is the name to use for the cofactor matrix, and that name is to be used as the second argument to determ() after cofactor has been called. Again, the determinant is stored on the object, and can be read-out with either det() or determ().
The invert() function computes the matrix inverse of its argument, the inverse is given a name of the form <name>_inv; this is how metric inverses are computed. The shift property of the object is updated to include the inverse, and the appropriate delta-functions are also added.
Finally, trace() will compute the trace of a rank-2 object in the obvious way, and return a scalar value.