什么是转用C ++矩阵中的最快方法是什么? [英] What is the fastest way to transpose a matrix in C++?
本文介绍了什么是转用C ++矩阵中的最快方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个矩阵(比较大的),我需要转。例如,假设我的矩阵是
I have a matrix (relatively big) that I need to transpose. For example assume that my matrix is
a b c d e f
g h i j k l
m n o p q r
我想要的结果如下:
I want the result be as follows:
a g m
b h n
c I o
d j p
e k q
f l r
什么是做到这一点的最快方法?
What is the fastest way to do this?
推荐答案
这是要取决于你的应用程序,但一般以最快的方式转矩阵是当你做一个仰望反转的坐标,那么你不必实际移动任何数据。
This is going to depend on your application but in general the fastest way to transpose a matrix would be to invert your coordinates when you do a look up, then you do not have to actually move any data.
这篇关于什么是转用C ++矩阵中的最快方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文