Re: How to construct symmetric matrix from just a one half matrix
- To: mathgroup at smc.vnet.net
- Subject: [mg110399] Re: How to construct symmetric matrix from just a one half matrix
- From: Simon <simonjtyler at gmail.com>
- Date: Wed, 16 Jun 2010 05:40:56 -0400 (EDT)
- References: <hv76li$k4j$1@smc.vnet.net>
Here's a couple of ways...
half=ImportString["1 0 0 0
2 3 0 0
4 9 5 0
2 2 3 4","Table"];
half+half\[Transpose]-DiagonalMatrix[Diagonal[half]]
(1 2 4 2
2 3 9 2
4 9 5 3
2 2 3 4)
In[36]:= Array[half[[Sequence@@Sort[{#1,#2},Greater]]]&,{1,1}
Length[half]]
(1 2 4 2
2 3 9 2
4 9 5 3
2 2 3 4)
On Jun 15, 4:30 pm, dragec <culino... at gmail.com> wrote:
> 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