transpose

The transpose function transposes the rows and columns of its argument.

Laziness

transpose is lazy in its elements
>>> take 1 (transpose ['a' : undefined, 'b' : undefined])
["ab"]

Examples

>>> transpose [[1,2,3],[4,5,6]]
[[1,4],[2,5],[3,6]]
If some of the rows are shorter than the following rows, their elements are skipped:
>>> transpose [[10,11],[20],[],[30,31,32]]
[[10,20,30],[11,31],[32]]
For this reason the outer list must be finite; otherwise transpose hangs:
>>> transpose (repeat [])
* Hangs forever *
transpose for NonEmpty, behaves the same as transpose The rows/columns need not be the same length, in which case > transpose . transpose /= id
The transpose function transposes the rows and columns of its ByteString argument.
O(n) The transpose function transposes the rows and columns of its Text argument. Note that this function uses pack, unpack, and the list version of transpose, and is thus not very efficient. Examples:
>>> transpose ["green","orange"]
["go","rr","ea","en","ng","e"]
>>> transpose ["blue","red"]
["br","le","ud","e"]
O(n) The transpose function transposes the rows and columns of its Text argument. Note that this function uses pack, unpack, and the list version of transpose, and is thus not very efficient.
transpose is just an alias for distribute
transpose (V3 (V2 1 2) (V2 3 4) (V2 5 6))
V2 (V3 1 3 5) (V3 2 4 6)
The transpose function transposes the rows and columns of its argument. For example,
>>> transpose [[1,2,3],[4,5,6]]
[[1,4],[2,5],[3,6]]
If some of the rows are shorter than the following rows, their elements are skipped:
>>> transpose [[10,11],[20],[],[30,31,32]]
[[10,20,30],[11,31],[32]]
For this reason the outer list must be finite; otherwise transpose hangs:
>>> transpose (repeat [])
* Hangs forever *
transpose is lazy:
>>> take 1 (transpose ['a' : undefined, 'b' : undefined])
["ab"]
The transpose function transposes the rows and columns of its argument. For example,
>>> transpose [[1,2,3],[4,5,6]]
[[1,4],[2,5],[3,6]]
If some of the rows are shorter than the following rows, their elements are skipped:
>>> transpose [[10,11],[20],[],[30,31,32]]
[[10,20,30],[11,31],[32]]
O(rows*cols). The transpose of a matrix. Example:
( 1 2 3 )   ( 1 4 7 )
( 4 5 6 )   ( 2 5 8 )
transpose ( 7 8 9 ) = ( 3 6 9 )
Transpose the lowest two dimensions of an array. Transposing an array twice yields the original.
O(n) The transpose function transposes the rows and columns of its JSString argument. Note that this function uses pack, unpack, and the list version of transpose, and is thus not very efficient.
Transposition of matrices is just transposition in the sense of Data.List.
genIntMatrix /\ \a -> Matrix.rows a == Matrix.columns (Matrix.transpose a)
genIntMatrix /\ \a -> Matrix.columns a == Matrix.rows (Matrix.transpose a)
genIntMatrix /\ \a -> genSameMatrix a /\ \b -> Laws.homomorphism Matrix.transpose (+) (+) a b
The transpose function transposes the rows and columns of its Vector argument.
Transpose a given graph. Complexity: O(s) time, memory and size. Good consumer and producer.
transpose empty       == empty
transpose (vertex x)  == vertex x
transpose (edge x y)  == edge y x
transpose . transpose == id
transpose (box x y)   == box (transpose x) (transpose y)
edgeList . transpose  == sort . map swap . edgeList
Transpose a given acyclic graph. Complexity: O(m * log(n)) time, O(n + m) memory.
transpose empty       == empty
transpose (vertex x)  == vertex x
transpose . transpose == id
edgeList . transpose  == sort . map swap . edgeList
Transpose a given graph. Complexity: O(m * log(n)) time, O(n + m) memory.
transpose empty       == empty
transpose (vertex x)  == vertex x
transpose (edge x y)  == edge y x
transpose . transpose == id
edgeList . transpose  == sort . map swap . edgeList
Transpose a given graph. Complexity: O(m * log(n)) time, O(n + m) memory.
transpose empty       == empty
transpose (vertex x)  == vertex x
transpose (edge x y)  == edge y x
transpose . transpose == id
edgeList . transpose  == sort . map swap . edgeList
Transpose a given graph. Complexity: O(s) time, memory and size.
transpose empty        == empty
transpose (vertex x)   == vertex x
transpose (edge e x y) == edge e y x
transpose . transpose  == id
Transpose a given graph. Complexity: O(m * log(n)) time, O(n + m) memory.
transpose empty        == empty
transpose (vertex x)   == vertex x
transpose (edge e x y) == edge e y x
transpose . transpose  == id
Transpose a given graph. Complexity: O(s) time, memory and size.
transpose (vertex x)  == vertex x
transpose (edge x y)  == edge y x
transpose . transpose == id
transpose (box x y)   == box (transpose x) (transpose y)
edgeList . transpose  == sort . map swap . edgeList
Transpose a given graph. Complexity: O(m * log(n)) time, O(n + m) memory.
transpose (vertex x)  == vertex x
transpose (edge x y)  == edge y x
transpose . transpose == id
edgeList . transpose  == sort . map swap . edgeList
Transpose a given graph. Complexity: O(m * log(m)) time.
transpose empty       == empty
transpose (vertex x)  == vertex x
transpose (edge x y)  == edge y x
transpose . transpose == id
edgeList . transpose  == sort . map swap . edgeList
The transpose function transposes the rows and columns of its argument. For example,
>>> transpose [[1,2,3],[4,5,6]]
[[1,4],[2,5],[3,6]]
If some of the rows are shorter than the following rows, their elements are skipped:
>>> transpose [[10,11],[20],[],[30,31,32]]
[[10,20,30],[11,31],[32]]
For this reason the outer list must be finite; otherwise transpose hangs:
>>> transpose (repeat [])
* Hangs forever *
transpose computes the transposition of a stream of streams.
Transpose a 2-dimensional array

Examples

>>> import Data.Massiv.Array

>>> arr = makeArrayLinearR D Seq (Sz (2 :. 3)) id

>>> arr
Array D Seq (Sz (2 :. 3))
[ [ 0, 1, 2 ]
, [ 3, 4, 5 ]
]

>>> transpose arr
Array D Seq (Sz (3 :. 2))
[ [ 0, 3 ]
, [ 1, 4 ]
, [ 2, 5 ]
]