MathGroup Archive 2007

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

Search the Archive

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

  • To: mathgroup at smc.vnet.net
  • Subject: [mg83755] Re: Convert nxn matrix to a column vector with (n^2) elements
  • From: Szabolcs Horvát <szhorvat at gmail.com>
  • Date: Thu, 29 Nov 2007 06:41:03 -0500 (EST)
  • References: <fiji4u$ijb$1@smc.vnet.net>

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

You should read some of the tutorials on the guide/ListManipulation doc 
page.  If by a *column vector* you mean a matrix of dimension {n^2, 1}, 
then both List /@ Flatten[mat] and List /@ Join @@ mat will do it, where 
mat is the {n, n} matrix.  Omit "List /@" to get a simple vector.

See
<http://groups.google.com/group/comp.soft-sys.math.mathematica/browse_thread/thread/24fa2f19317734fa/69770c22c257ca29#69770c22c257ca29>
on matrices vs vectors in Mathematica.

-- 
Szabolcs


  • Prev by Date: Re: MapThread over ragged arrays
  • Next by Date: A problem with FindRoot
  • Previous by thread: Re: Convert nxn matrix to a column vector with (n^2) elements
  • Next by thread: Re: Convert nxn matrix to a column vector with (n^2) elements