Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

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

Search the Archive

Re: How to remove all cycles

  • To: mathgroup at smc.vnet.net
  • Subject: [mg98310] Re: How to remove all cycles
  • From: "Sjoerd C. de Vries" <sjoerd.c.devries at gmail.com>
  • Date: Sun, 5 Apr 2009 06:39:59 -0400 (EDT)
  • References: <gr6c4a$poi$1@smc.vnet.net>

This looks like an April fools joke if you ask me. You've gone to
great lengths to obfuscate what you are doing, but a BitShiftLeft is a
simple times 2. Effectively, you're almost directly assigning B to A:

A=Flatten[Transpose[B]]

For multi-dimensional matrices check the extended syntax of Transpose.

Cheers -- Sjoerd

On Apr 4, 3:11 am, buts <mange... at yahoo.com> 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.



  • Prev by Date: Re: How to remove all cycles
  • Next by Date: Re: release memory
  • Previous by thread: Re: How to remove all cycles
  • Next by thread: Re: How to remove all cycles