Re: How to construct symmetric matrix from just a one

• To: mathgroup at smc.vnet.net
• Subject: [mg110419] Re: How to construct symmetric matrix from just a one
• From: Bob Hanlon <hanlonr at cox.net>
• Date: Thu, 17 Jun 2010 02:04:21 -0400 (EDT)

```SetAttributes[f, HoldAll];

f[mat_?MatrixQ] :=
Module[
{n = Length[mat]},
Table[
mat[[r, c]] = mat[[c, r]],
{r, n - 1}, {c, r + 1, n}];
m]

m = {{1, 0, 0, 0},
{2, 3, 0, 0},
{4, 9, 5, 0},
{2, 2, 3, 4}};

f[m]

{{1, 2, 4, 2}, {2, 3, 9, 2}, {4, 9, 5, 3}, {2, 2, 3, 4}}

Bob Hanlon

---- dragec <culinovic 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

```

• Prev by Date: Ballistic launch trajectory code
• Next by Date: Re: Simplification question
• Previous by thread: Re: How to construct symmetric matrix from just a one
• Next by thread: Normal with GeometricTransformation