This seems wrong. This is assuming that the elements of the matrix commute, isn't it? But that's not guaranteed.