Re: compile / optimize
- To: mathgroup at smc.vnet.net
- Subject: [mg53600] Re: compile / optimize
- From: "Jens-Peer Kuska" <kuska at informatik.uni-leipzig.de>
- Date: Thu, 20 Jan 2005 03:47:41 -0500 (EST)
- Organization: Uni Leipzig
- References: <comgvp$9hg$1@smc.vnet.net> <copavk$ps8$1@smc.vnet.net> <csl1pm$6ve$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi,
ff = Experimental`OptimizeExpression[
Module[{x = 0}, Do[x += Sin[t^2]/(1 + x), {12}]; x]]
myfun=Compile[{{t, _Real}}, Evaluate[ff]]
??
Regards
Jens
"Frank Brand" <frank.brand at t-online.de> schrieb im Newsbeitrag
news:csl1pm$6ve$1 at smc.vnet.net...
> Dear mathgroup members,
>
> can anybody give me an advice how to generally
>
> 1.optimize (using the optimization package "optimize.m") and after that
> 2. compile pieces of code like
>
> Module[{t}, t = x; Do[t = (t + x/t)/2, {n}]; t]
>
> Applying the two-step approach to the code above with a given n (=15)
> there is a speed up ratio of 8500 compared with the original exprssion.
>
> Is it possible to apply this procedure to general expressions?
>
> Thanks in advance
> Frank
>