Basis of invariants and canonical forms for linear dynamic systems