Re: Transposing a triangular matrix.
- To: mathgroup at smc.vnet.net
- Subject: [mg24368] Re: Transposing a triangular matrix.
- From: d8442803 at student.nsysu.edu.tw (Wen-Feng Hsiao)
- Date: Wed, 12 Jul 2000 23:13:10 -0400 (EDT)
- Organization: NSYSU
- References: <8k3o5s$41t@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Regarding transposing a triangular matrix (in list form), Rob Pratt has shown me a smart way by using Table to deal with an upper triangular input. According to his illustration I added the function for lower triangular input cases as below. Wen-Feng -------- upperTriTranspose[lis_List]:=Table[lis[[i,k+1-i]],{k,Length[lis]},{i,k}] lowerTriTranspose[lis_List]:= Table[lis[[i,k]],{k,Length[lis]},{i,k, Length[lis]}] triTranpose[lst_List]:=If[lowerTriMatrixQ[lst], Return[lowerTriTranspose[lst]];, If[upperTriMatrixQ[lst], Return[upperTriTranspose[lst]];, Print["Not a triangular list!"]]];