Last active
July 6, 2017 00:48
-
-
Save sbugrov/cc03c9cb120043069cdae061fdd24017 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vector <float> transpose (float *m, const int C, const int R) { | |
/* Returns a transpose matrix of input matrix. | |
Inputs: | |
m: vector, input matrix | |
C: int, number of columns in the input matrix | |
R: int, number of rows in the input matrix | |
Output: vector, transpose matrix mT of input matrix m | |
*/ | |
vector <float> mT (C*R); | |
for(int n = 0; n!=C*R; n++) { | |
int i = n/C; | |
int j = n%C; | |
mT[n] = m[R*j + i]; | |
} | |
return mT; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment