Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Start with an array of arrays; in this case, they are different lengths in order to demonstrate the technique, but they do not have to be.

[[1,2,3,4], [5,6,7], [8,9,10], [11,12,13,14,15]]

At the other end of the transformation, you have an array of arrays where the first array contains the first element from each of the original arrays, the second array contains the second element from each of the original arrays, and so on.

[[1,5,8,11], [2,6,9,12], [3,7,10,13], [4,14], [15]]

Is there a mathematical or CS term for this operation?

share|improve this question

1 Answer 1

up vote 5 down vote accepted

It's called transposing except for the deal with the flaggedness of the arrays

In linear algebra, the transpose of a matrix A is another matrix AT... created by any one of the following equivalent actions:

  • reflect A over its main diagonal (which runs from top-left to bottom-right) to obtain AT
  • write the rows of A as the columns of AT
  • write the columns of A as the rows of AT

http://upload.wikimedia.org/wikipedia/commons/thumb/e/e4/Matrix_transpose.gif/200px-Matrix_transpose.gif

share|improve this answer
    
I feel like I should have recalled this from a math class, but alas, that was some time ago. Thanks. –  Brandon Tilley Jul 1 '13 at 1:27
1  
Do you mean "raggedness"? –  detly Jul 1 '13 at 2:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.