Cache-oblivous complex "copy-and-transpose" Input parameters: M - number of rows N - number of columns A - source matrix, MxN submatrix is copied and transposed IA - submatrix offset (row index) JA - submatrix offset (column index) A - destination matrix IB - submatrix offset (row index) JB - submatrix offset (column index) *************
| 248 | JB - submatrix offset (column index) |
| 249 | *************************************************************************/ |
| 250 | void cmatrixtranspose(int m, |
| 251 | int n, |
| 252 | const ap::complex_2d_array& a, |
| 253 | int ia, |
| 254 | int ja, |
| 255 | ap::complex_2d_array& b, |
| 256 | int ib, |
| 257 | int jb) |
| 258 | { |
| 259 | int i; |
| 260 | int s1; |
| 261 | int s2; |
| 262 | |
| 263 | if( m<=2*ablascomplexblocksize(a)&&n<=2*ablascomplexblocksize(a) ) |
| 264 | { |
| 265 | |
| 266 | // |
| 267 | // base case |
| 268 | // |
| 269 | for(i = 0; i <= m-1; i++) |
| 270 | { |
| 271 | ap::vmove(&b(ib, jb+i), b.getstride(), &a(ia+i, ja), 1, "N", ap::vlen(ib,ib+n-1)); |
| 272 | } |
| 273 | } |
| 274 | else |
| 275 | { |
| 276 | |
| 277 | // |
| 278 | // Cache-oblivious recursion |
| 279 | // |
| 280 | if( m>n ) |
| 281 | { |
| 282 | ablascomplexsplitlength(a, m, s1, s2); |
| 283 | cmatrixtranspose(s1, n, a, ia, ja, b, ib, jb); |
| 284 | cmatrixtranspose(s2, n, a, ia+s1, ja, b, ib, jb+s1); |
| 285 | } |
| 286 | else |
| 287 | { |
| 288 | ablascomplexsplitlength(a, n, s1, s2); |
| 289 | cmatrixtranspose(m, s1, a, ia, ja, b, ib, jb); |
| 290 | cmatrixtranspose(m, s2, a, ia, ja+s1, b, ib+s1, jb); |
| 291 | } |
| 292 | } |
| 293 | } |
| 294 | |
| 295 | |
| 296 | /************************************************************************* |
nothing calls this directly
no test coverage detected