Re: Speed Up Routines
- To: mathgroup at smc.vnet.net
- Subject: [mg109416] Re: Speed Up Routines
- From: David Bailey <dave at removedbailey.co.uk>
- Date: Mon, 26 Apr 2010 04:51:00 -0400 (EDT)
- References: <hqu8at$rp3$1@smc.vnet.net>
Benedetto Bongiorno wrote: > Bob, > > What kind of data is stored in "data" and "cntrlUnits"? > Dimensions of "data" is 370161 x 15 > "data "are columns of real values and strings > "cntrlUnits" are strings > > "headings02"? > Numerical column identification, i.e. "6" > > > Thank You > > Benedetto Bongiorno CPA CRE > Cell 214-707-6546 > Land 972-470-9138 > Fax 972-470-9748 > bongiob at sbcglobal.net > > This Email is covered by the Electronic Communications Privacy Act, 18 > U.S.C. Sections 2510-2521 and is legally privileged. The information > contained in this Email is intended only for the use of the individual > or entity named above. If the reader of this message is not the intended > recipient, you are hereby notified that any dissemination, distributions > or copying of this communication is strictly prohibited. If you have > received this communication in error, please notify sender. > > > -----Original Message----- > From: DrMajorBob [mailto:btreat1 at austin.rr.com] > Sent: Friday, April 23, 2010 10:20 AM > To: Benedetto Bongiorno; mathgroup at smc.vnet.net > Subject: Re: Speed Up Routines > > What kind of data is stored in "data" and "cntrlUnits"? > > What are the dimensions and data type of "headings02"? > > Could we see a short example of each? > > Without any of that, how can we tell what you're trying to accomplish? > > Bobby > > On Fri, 23 Apr 2010 02:49:23 -0500, Benedetto Bongiorno > <bongiob at sbcglobal.net> wrote: > >> Mathgroup, >> >> >> I have the following routines that take approx 5 minutes. >> >> Can you give me suggestions to implement MAP in the areas of For >> >> >> Length[data] >> >> 370161 >> >> Length[cntrlUnits} >> >> 456 >> >> >> n=Length[cntrlUnits]+1; >> >> cntrlUnitsData=Table[0,{i,1,Length[cntrlUnits]}]; >> >> > For[i=1,i<n,i++,cntrlUnitsData[[i]]=Position[data[[All,Flatten[Position[head >> ings02,"GLICU"]][[1]]]],_?(#==cntrlUnits[[i]]&)]]; >> >> >> Length[cntrlUnitsData] >> >> 456 >> >> >> n=Length[cntrlUnits]+1; >> >> cntrlUnitsTrans=Table[0,{i,1,Length[cntrlUnits]}]; >> >> For[i=1,i<n,i++,cntrlUnitsTrans[[i]]=Map[data[[#]]&,cntrlUnitsData[[i]]]]; >> >> >> Length[cntrlUnitsTrans] >> >> 456 >> >> >> Thank you, >> >> It might help to step back a bit and describe what it is you want Mathematica to do, rather than the code you have devised to process the problem. David Bailey http://www.dbaileyconsultancy.co.uk