MathGroup Archive 2005

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

Search the Archive

Re: For to Map to Increase Speed

  • To: mathgroup at smc.vnet.net
  • Subject: [mg53269] Re: For to Map to Increase Speed
  • From: "Ray Koopman" <koopman at sfu.ca>
  • Date: Tue, 4 Jan 2005 03:12:33 -0500 (EST)
  • References: <cr8e90$r7k$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Benedetto Bongiorno wrote:
> Is there a Map routine that can shorten the computation time of data
to
> data02?
>
> The variable data is a list of 1036 lists within which are lists of
> sublists of 1 or more, usually more.
>
> I cannot flatten data because I need to keep the groupings (1036)
that was
> created by Split.
>
> Dimensions[data]
>
> {1036}
>
> data02={};
>
> n=Length[data]+1;
>
> For[i=1,i<n,i++,step1=Mean[ColumnTake[data[[i]],{4,21}]];
>
> AppendTo[data02,Join[data[[i,1,{1,2}]],step1]]]
>
> Dimensions[data02]
>
> {1036,20}
> 


data02 = Join[#[[1,{1,2}]],Mean@ColumnTake[#,{4,21}]]& /@ data


  • Prev by Date: Re: direct product of two sets
  • Next by Date: Re: direct product of two sets
  • Previous by thread: Re: For to Map to Increase Speed
  • Next by thread: Partial evaulation of function terms