Only minor changes. Changed some comments and such. Tried to use armadillo to find the eigenvalues, but it failed. Commented out that line.