Fix #2015: diag returns ndarray instead of matrix

Fixes #2015.  Also, since I was making np.diag return a matrix (for matrix input), I figured we should also have np.ravel return a matrix (for matrix input), since I see no reason they should be different.

I also made the two files I edited PEP-8 compliant.