Added a matrix transpose utility function and updated tests.