Re: How to construct symmetric matrix from just a one half matrix
- To: mathgroup at smc.vnet.net
- Subject: [mg110411] Re: How to construct symmetric matrix from just a one half matrix
- From: "Hans Michel" <hmichel at cox.net>
- Date: Wed, 16 Jun 2010 05:48:26 -0400 (EDT)
- References: <hv76li$k4j$1@smc.vnet.net>
I think you may want to try
In[1]:=
ma=SparseArray[{Band[{1,1}]->{1,3,5,4},Band[{2,1}]->{2,9,3},Band[{3,1}]->{4,2},Band[{4,1}]->{2}},{4,4}]
Out[1]= SparseArray[<10>,{4,4}]
In[2]:= (ma-(IdentityMatrix[4] Diagonal[ma])+Transpose[ma])//MatrixForm
Out[2]//MatrixForm= (1 2 4 2
2 3 9 2
4 9 5 3
2 2 3 4
)
Hans
"dragec" <culinovic at gmail.com> wrote in message
news:hv76li$k4j$1 at smc.vnet.net...
> 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
>