Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2000
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2000

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

Search the Archive

Re: Ron Knapp's time function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg24558] Re: Ron Knapp's time function
  • From: "Allan Hayes" <hay at haystack.demon.co.uk>
  • Date: Mon, 24 Jul 2000 03:04:39 -0400 (EDT)
  • References: <8kjehf$e6o@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

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