From: Srikanth K S on 16 Jun 2010 05:36 *Here is a way, but there could be other elegant ways than this! *In[8]:== mat1=={{1,0,0,0},{2,3,0,0},{4,9,5,0},{2,2,3,4}}; In[12]:== Union@@@MapThread[List,{mat1,MapThread[List,mat1]}] Out[12]== {{0,1,2,4},{0,2,3,9},{0,3,4,5,9},{0,2,3,4}}* *--- 2010/6/15 dragec <culinovic(a)gmail.com> > 1 0 0 0 > 2 3 0 0 > 4 9 5 0 > 2 2 3 4 >
From: Alexei Boulbitch on 16 Jun 2010 05:41 Try this: This is your initial matrix (or alike) in a form of a table M = {{1, 0, 0, 0}, {2, 3, 0, 0}, {4, 5, 6, 0}, {7, 8, 9, 10}} // Grid That is what you need: Table[If[i > j, M[[i, j]], M[[j, i]]], {i, 1, Length[M[[1]]]}, {j, 1, Length[M[[1]]]}] // Grid ?? please help me with simple to apply function that will construct symmetric matrix from given just a half matrix with diagonal. Eg: From: 1 0 0 0 2 3 0 0 4 9 5 0 2 2 3 4 To give: 1 2 4 2 2 3 9 2 4 9 5 3 2 2 3 4 -- Alexei Boulbitch, Dr. habil. Senior Scientist Material Development IEE S.A. ZAE Weiergewan 11, rue Edmond Reuter L-5326 CONTERN Luxembourg Tel: +352 2454 2566 Fax: +352 2454 3566 Mobile: +49 (0) 151 52 40 66 44 e-mail: alexei.boulbitch(a)iee.lu www.iee.lu -- This e-mail may contain trade secrets or privileged, undisclosed or otherwise confidential information. If you are not the intended recipient and have received this e-mail in error, you are hereby notified that any review, copying or distribution of it is strictly prohibited. Please inform us immediately and destroy the original transmittal from your system. Thank you for your co-operation.
From: Srikanth K S on 16 Jun 2010 05:42 *Here it is: mat1 + Transpose[mat1] - DiagonalMatrix[Diagonal[mat1]] *--- 2010/6/15 Srikanth K S <sriperso(a)gmail.com> > *Sorry, that seems like a mistake! > *--- > > > 2010/6/15 Srikanth K S <sriperso(a)gmail.com> > > *Here is a way, but there could be other elegant ways than this! >> >> *In[8]:== mat1=={{1,0,0,0},{2,3,0,0},{4,9,5,0},{2,2,3,4}}; >> In[12]:== Union@@@MapThread[List,{mat1,MapThread[List,mat1]}] >> Out[12]== {{0,1,2,4},{0,2,3,9},{0,3,4,5,9},{0,2,3,4}}* >> *--- >> >> >> 2010/6/15 dragec <culinovic(a)gmail.com> >> >> 1 0 0 0 >>> 2 3 0 0 >>> 4 9 5 0 >>> 2 2 3 4 >>> >> >>
From: Srikanth K S on 16 Jun 2010 05:42 *Sorry, that seems like a mistake! *--- 2010/6/15 Srikanth K S <sriperso(a)gmail.com> > *Here is a way, but there could be other elegant ways than this! > > *In[8]:== mat1=={{1,0,0,0},{2,3,0,0},{4,9,5,0},{2,2,3,4}}; > In[12]:== Union@@@MapThread[List,{mat1,MapThread[List,mat1]}] > Out[12]== {{0,1,2,4},{0,2,3,9},{0,3,4,5,9},{0,2,3,4}}* > *--- > > > 2010/6/15 dragec <culinovic(a)gmail.com> > > 1 0 0 0 >> 2 3 0 0 >> 4 9 5 0 >> 2 2 3 4 >> > >
|
Pages: 1 Prev: How to construct symmetric matrix from just a one Next: Normal with GeometricTransformation |