in-place matrix transpose: partially deFORTRANize, and credit original author