How to remove all cycles
- To: mathgroup at smc.vnet.net
- Subject: [mg98269] How to remove all cycles
- From: buts <manger31 at yahoo.com>
- Date: Sun, 5 Apr 2009 06:32:16 -0400 (EDT)
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.