MathGroup Archive 2000

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

Search the Archive

Re: Ron Knapp's time function


This may be what you want:

time::usage = "time[expr_] finds the number of seconds,t, taken to evaluate
Do[expr,{2^n}]] for n=0,1,2,..., until t >= 1.0; it then returns the  t/
2^n.

SetAttributes[time, HoldAll];
time[expr_] :=
  Module[{t = Timing[expr;][[1, 1]], n = 1},
    While[t < 1.,
      t = Timing[Do[expr, {n *= 2}]][[1, 1]]
      ];
    t/n  Second ]

--
Allan
---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565

"fkampas" <fkampas at email.msn.com> wrote in message
news:8kjehf$e6o at smc.vnet.net...
> Does anybody have the Mathematica code
> for the generalized timing function that Ron
> Knapp presented at the last developer's
> conference?  It isn't given in his notebooks
> in the conference section on the Wolfram
> web site.
>
>
>
>




  • Prev by Date: Digital Image Processing
  • Next by Date: Confluent hypergeometric function of matrix argument
  • Previous by thread: Ron Knapp's time function
  • Next by thread: Re: Ron Knapp's time function