       Re: Convert nxn matrix to a column vector with (n^2)

• To: mathgroup at smc.vnet.net
• Subject: [mg83757] Re: [mg83705] Convert nxn matrix to a column vector with (n^2)
• From: Bob Hanlon <hanlonr at cox.net>
• Date: Thu, 29 Nov 2007 06:42:07 -0500 (EST)

```n = 3;
nxn = Array[a, {n, n}]

{{a[1, 1], a[1, 2], a[1, 3]},
{a[2, 1], a[2, 2], a[2, 3]},
{a[3, 1], a[3, 2], a[3, 3]}}

List /@ Flatten[nxn]

{{a[1, 1]}, {a[1, 2]}, {a[1, 3]},
{a[2, 1]}, {a[2, 2]}, {a[2, 3]},
{a[3, 1]}, {a[3, 2]}, {a[3, 3]}}

List /@ Flatten[Transpose[nxn]]

{{a[1, 1]}, {a[2, 1]}, {a[3, 1]},
{a[1, 2]}, {a[2, 2]}, {a[3, 2]},
{a[1, 3]}, {a[2, 3]}, {a[3, 3]}}

Bob Hanlon

---- Tara.Ann.Lorenz at gmail.com wrote:
> Any ideas how to convert an nxn matrix to a column vector with n^2
> elements?
>

```

• Prev by Date: Re: Fast way of checking for perfect squares?
• Next by Date: Re: Convert nxn matrix to a column vector with (n^2) elements
• Previous by thread: Re: Recursive function
• Next by thread: "vector" Map[] / functional outer product?