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: [mg98322] Re: How to remove all cycles
  • From: dh <dh at metrohm.com>
  • Date: Mon, 6 Apr 2009 05:00:20 -0400 (EDT)
  • References: <gr6c4a$poi$1@smc.vnet.net>


Hi,

here is a fast way to do it:

A = Riffle @@ B;

Daniel



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.

> 




  • Prev by Date: Re: Integrating package documentation with the documentation center
  • Next by Date: Re: Partial derivatives for implicit functions
  • Previous by thread: Re: How to remove all cycles
  • Next by thread: Re: How to remove all cycles