Computing with matrix invariants