speedup by utilizing column-major storage mode of R + fast transposition of matrices