MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Creating a symmetric matrix


Andrzej Kozlowski wrote:
> On 11 Mar 2004, at 09:50, Mark Coleman wrote:
> 
> 
>>Greetings,
>>
>>How can I efficiently build a symmetric matrix from an upper triangular
>>one, i.e., extract the upper triangular elements and insert them into
>>the lower triangle in such a way as to make the resulting square matrix
>>symmetric?
>>
>>Thanks,
>>
>>Mark
>>
>>
>>
> 
> 
> The most natural way must be
> 
> A+Tranpose[A]
> 
> e.g.
> 
> A = Array[KroneckerDelta[#1 < #2, True] & , {3, 3}];
> 
> 
> {{0, 1, 1}, {0, 0, 1}, {0, 0, 0}}
> 
> 
> A + Transpose[A]
> 
> 
> {{0, 1, 1}, {1, 0, 1}, {1, 1, 0}}

Very good compared to the other sugestions!

If the diagonal of A contains elements !=0 the formula is of course for 
every  Matrix A


Symmetric part:
A_s =1/2 (A+Transpose[A])

antisymmetric trace free part
A_a = 1/2 (a-Transpose[A])

--

Roland Franzius


  • Prev by Date: Re: Undiscovered Bug?
  • Next by Date: Re: Undiscovered Bug?
  • Previous by thread: Re: Creating a symmetric matrix
  • Next by thread: Re: Creating a symmetric matrix