What is the fastest way to transpose a matrix in 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? 回答1: This is a good question. There are many reason you would want to actually transpose the matrix in memory rather than just swap coordinates, e.g. in matrix multiplication and Gaussian smearing. First let me list one of the functions I use for the transpose