Re: How to deal with big matrix 2
- To: mathgroup at smc.vnet.net
- Subject: [mg116737] Re: How to deal with big matrix 2
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Fri, 25 Feb 2011 06:37:26 -0500 (EST)
m = 3; n = 2; mat1 = Array[x, {m, n}]; mat2 = Array[y, {m, n}]; Timing[mat3 = Transpose[{Flatten[mat1], Flatten[mat2]}]] {0.131434, {{x[1, 1], y[1, 1]}, {x[1, 2], y[1, 2]}, {x[2, 1], y[2, 1]}, {x[2, 2], y[2, 2]}, {x[3, 1], y[3, 1]}, {x[3, 2], y[3, 2]}}} m = 1100; n = 1300; mat1 = Array[x, {m, n}]; mat2 = Array[y, {m, n}]; Timing[mat3 = Transpose[{Flatten[mat1], Flatten[mat2]}];] {1.21796, Null} Bob Hanlon ---- Szymon Roziewski <szymon.roziewski at gmail.com> wrote: ============= Any suggestions? 2011/2/23 Szymon Roziewski <szymon.roziewski at gmail.com> > Hello there, > > I have such a case, I have two matrices and each of them is sized 1100x1300 > e.g. > I would like to create a vector with length 1 430 000 and each of element > of > this vector should be {matrxi1_el1x1, matrix2_el1x1}, {matrxi1_el1x2, > matrix2_el1x2},... , {matrxi1_el1100x1300, matrix2_el1100x1300} > How to do it without using Do[Do[...]] because it consumes a lot of my > time. > > > kind regards, > Szymon Roziewski >