1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Matrix Transpose

Discussion in 'Java' started by onako, Jul 29, 2010.

Thread Status:
Not open for further replies.
  1. onako

    onako New Member

    Joined:
    Jul 29, 2010
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    I store matrix entries in std::vector<double>, such that the reading is row by row.
    This means, for matrix
    1 3 4 8 9 3
    3 6 8 1 1 2
    2 0 9 8 7 6

    the std::vector<double> would have entries: {1,3,4,8,9,3,3,6,8,1,1,2,2,0,9,8,7,6}.
    To transpose the matrix I use the naive approach of iterating through std::vector, calculating for each
    entry its position in a matrix transpose. Recently, I got one suggestion:

    "When you have a matrix and a mapping to a one-dimensional vector, transposing is equivalent to a permutation. Now execute this permutation by sorting the elements by requested rank in the permutation result."

    I understand that transposing is equivalent to a permutation, but I dont know how to approach the problem this way.
    Any suggestion on how to do this (or to do matrix transpose is a faster way) is welcome.
    --- I understand it is C++ specific (according to the description), but it is general programming problem. Thanks
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,293
    Likes Received:
    365
    Trophy Points:
    83
Thread Status:
Not open for further replies.

Share This Page