Unfortunately, there may not be any API to compute the matrix cosine or a matrix sine
(I'm not familiar with the topic of quantum mechanics, but if you mean by computing the matrix-valued functions with diagonalization)
And unfortunately, I'm not very willing to introduce some new matrix-functional API until expression blowup problems are resolved,
but as there already is `Matrix.exp` method, you can be able to compute matrix cosine from the exponential with the Euler identity.