Re: How to remove all cycles
- To: mathgroup at smc.vnet.net
- Subject: [mg98319] Re: How to remove all cycles
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Mon, 6 Apr 2009 04:59:48 -0400 (EDT)
- References: <gr6c4a$poi$1@smc.vnet.net>
Hi, With[{n = 4}, B = Table[Prime[2*j*k], {j, 1, 2}, {k, 1, 2^n}] ] A=Flatten[Transpose[B]] ? Regards Jens buts wrote: > Hello, > I want to write the following code using functional > programming, i.e. to remove all Do's. > There are two arrays: > > A[[i]], i=1,...,2^(n+1) > B[[j,k]], j=1,2; k=1,...,2^n. > > I need to assign B to A setting the first bit of the index i > to be the index j. Explicitly > > Do[Do[A[[ j + BitShiftLeft[k-1,1] ]]= B[[j,k]], > {j,1,2}],{k,1,2^n}] > > I need to do it for multi-dimensional large arrays. > Is it possible to write it without Do's ? > > Thanks. >