In the header, you ask about matrix multiplication, while in the question you ask about transposing a matrix. Transposing a matrix is just to switch the rows and columns:
TransposeA[i][j]=A[j][i]
Matrix multiplication is a bit more cumbersome as you need to make sure that the columns in the first matrix have an equal number of rows in the second matrix. That it is just to perform a dot product of the column in the first matrix and the row in the second matix.
$ Result[i][j] = \sum_{k}{A(i,k) \cdot B(k,j)} $
However, If the speed of calculation is of importance it would certainly be better to implement a math library like:
Intel® Math Kernel Library (Intel® MKL) | Intel® Software[
^]
or use your GPU:
performance - Why is MATLAB so fast in matrix multiplication? - Stack Overflow[
^]