MathGroup Archive 2011

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

Search the Archive

Re: How to deal with big matrix?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg116625] Re: How to deal with big matrix?
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Tue, 22 Feb 2011 04:42:10 -0500 (EST)

data = Table[{x[i, j], y[i, j]}, {i, 3}, {j, 4}]

{{{x[1, 1], y[1, 1]}, {x[1, 2], y[1, 2]}, {x[1, 3], 
   y[1, 3]}, {x[1, 4], y[1, 4]}}, {{x[2, 1], y[2, 1]}, {x[2, 2], 
   y[2, 2]}, {x[2, 3], y[2, 3]}, {x[2, 4], y[2, 4]}}, {{x[3, 1], 
   y[3, 1]}, {x[3, 2], y[3, 2]}, {x[3, 3], y[3, 3]}, {x[3, 4], 
   y[3, 4]}}}

Flatten[data[[All, All, 1]], 1]

{x[1, 1], x[1, 2], x[1, 3], x[1, 4], x[2, 1], x[2, 2], x[2, 3], 
 x[2, 4], x[3, 1], x[3, 2], x[3, 3], x[3, 4]}

Flatten[data[[All, All, 2]], 1]

{y[1, 1], y[1, 2], y[1, 3], y[1, 4], y[2, 1], y[2, 2], y[2, 3], 
 y[2, 4], y[3, 1], y[3, 2], y[3, 3], y[3, 4]}


Bob Hanlon

---- Szymon Roziewski <szymon.roziewski at gmail.com> wrote: 

=============
Hello there,

I have quite big matrix with let say 1000 rows and 1100 columns.
Each of element of this matrix is a point on a surface e.g. {1.232,12.123}
How can I quickly get first element of each point for whole matrix and put
it in a vector (1000*1100 - this will be a length of that vector) without do
it in a nested loop (Do[Do[...]])?
And the similar to get the second element of each point into vector.

kind regards,
Szymon Roziewski



  • Prev by Date: Re: Delete elements from list..
  • Next by Date: Re: Rational[a,b] vs Rational[1,2]
  • Previous by thread: Re: How to deal with big matrix?
  • Next by thread: Re: How to deal with big matrix?