Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1995
*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 1995

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

Search the Archive

Help [Q] with Timing[] problem

  • To: mathgroup at smc.vnet.net
  • Subject: [mg2766] Help [Q] with Timing[] problem
  • From: David at smc.vnet.net, A.Johnson at news.acns.nwu.edu
  • Date: Thu, 14 Dec 1995 01:47:22 -0500
  • Organization: Northwestern University, Evanston, IL, US

I'm trying to compare the timing of doing a couple of functions.  Can anyone tell me if I've done something wrong?  

here is my code segment:

$PreRead = StringReplace[#, ";;" -> "; 0;"]&

(* version 1 *)
gain = Table[1.0, {n, Length[data]}];;
t1 = First[N[ Timing[ InverseFourier[gain*Fourier[data]]], 50 ]];;
t2 = First[N[Timing[MovingAverage[data, 17]], 50]];;
Print[t1, "\t", t2];;


(* version 2 *)
t1 = t2 = 0;;
Do[
      t1 += First[Timing[ InverseFourier[gain*Fourier[data]]] ];;
      t2 += First[Timing[ MovingAverage[data, 17]] ];;
,{n, 1000}];;
Print[t1,"\t", t2];;


Actual data I'm testing is below.

As you can tell from the code the functions I am trying to compare for efficiency are filter functions.  The problems I'm having are that t1 and t2 don't vary in precision using the N[] function as expected.  My second problem is that it doesn't appear that Timing[] returns a time value with enough precision.  In version 2 of this I add up the processing times and I get fairly consistant values for t1 and t2 of  8.63333 Second &10.0667 Second respectively but I would never expect that the Fourier method would be faster.  Can anyone tell me what's going on and how to accurately measure this?


Probably part of the problem I'm seeing is may due to using a multitasking platform (NeXTSTEP) however I'm not getting anything like what I'd expect.

Thank's in advance,



david....

Now for that data I promised:
data = {-5.06, -5.06, -4.62, -4.18, -3.74, -2.86, -3.08, -2.64, -2.64, -2.42, -2.86, -3.08, -3.3, -3.96, -4.4, -4.84, -4.84, -4.62, -4.18,  -3.52, -2.86, -2.2, -1.32, -0.66, 0., 0.22, 0.22, 0.22, -0.22, -0.66, -1.1}




  • Prev by Date: RE: Bug ListPlot?
  • Next by Date: Re: Bug ListPlot?
  • Previous by thread: Help [Q] with Timing[] problem
  • Next by thread: How to get labels correctly plotted