ListTools - Maple Programming Help

Home : Support : Online Help : Programming : Data Types : Tables, lists, and sets : ListTools Package : ListTools/Transpose

ListTools

 Transpose
 transpose a list of lists (as if it were a matrix)

 Calling Sequence Transpose(L)

Parameters

 L - list of lists (type listlist)

Description

 • The Transpose(L) function transposes a list of lists as if it were a matrix.
 Note: Within a procedure, it is likely that changing the indices is more efficient than creating a new transposed list of lists. Therefore, procedure Transpose should only be used for modifying lists of lists that need to be returned in transposed form.
 • In the special case where the argument is of type $\mathrm{list}\left(\left[\right]\right)$, $\left[\left[\right]\right]$ is returned.

Examples

 > $\mathrm{with}\left(\mathrm{ListTools}\right):$
 > $L≔\left[\left[1,2,3\right],\left[a,b,c\right],\left[X,Y,Z\right]\right]$
 ${L}{≔}\left[\left[{1}{,}{2}{,}{3}\right]{,}\left[{a}{,}{b}{,}{c}\right]{,}\left[{X}{,}{Y}{,}{Z}\right]\right]$ (1)
 > ${L}_{1,2}$
 ${2}$ (2)
 > ${L}_{2,1}$
 ${a}$ (3)
 > $R≔\mathrm{Transpose}\left(L\right)$
 ${R}{≔}\left[\left[{1}{,}{a}{,}{X}\right]{,}\left[{2}{,}{b}{,}{Y}\right]{,}\left[{3}{,}{c}{,}{Z}\right]\right]$ (4)
 > ${R}_{1,2}$
 ${a}$ (5)
 > $\mathrm{Transpose}\left(\left[\left[\right],\left[\right],\left[\right]\right]\right)$
 $\left[\left[{}\right]\right]$ (6)