转置32x64矩阵

时间:2014-05-16 04:47:27

标签: c matrix transpose

if(N == 64 && M == 32) {

    int i, j, C[M][M], CC[M][M], D[M][M], DD[M][M];

    // get left half of the matrix, and transpose
    for (i = 0; i < M; i++) {
        for (j = 0; j < M; j++) {
            C[i][j] = A[i][j];
        }
    }
    squareblocktranspose(M, M, C, CC, 4);

    // get right half of the matrix, and transpose
    for (i = 0; i < M; i++) {
        for (j = M; j < N; j++) {
            D[i][j-M] = A[i][j];
        }
    }
    squareblocktranspose(M, M, D, DD, 4);

    // put transposed left half of the matrix as top half of new matrix
    for (i=0; i < M; i++) {
        for (j = 0; j < M; j++) {
            B[i][j] = CC[i][j];
        }
    }

    // put transposed right half of the matrix as bottom half of the old matrix
    for (i=M; i<N; i++) {
        for (j = 0; j < M; j++) {
            B[i][j] = DD[i-M][j];
        }
    }
} 

squareblocktranspose是一个转置任何方阵的函数,它被确认可以工作。但是,当我尝试测试此函数时,它不会成功转置矩阵。我在这做错了什么?我的工作将在13分钟内完成......这只是解决问题的最后努力。

0 个答案:

没有答案