(bind-func mtranspose
(lambda (m1:double* nrows:i64 ncols:i64 result:double*)
(let ((i 0) (j 0))
(dotimes (i nrows)
(dotimes (j ncols)
(pset! result (+ (* j ncols) i)
(pref m1 (+ (* i ncols) j)))))
result)))