Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!wuarchive!mit-eddie!uw-beaver!milton!sumax!amc-gw!pilchuck!dataio!gtenmc!csp From: csp@gtenmc.UUCP Newsgroups: comp.lang.c Subject: Re: Execution time bottleneck: How to speed up execution? Keywords: Execution time, would like to speed up. Alternatives? Message-ID: <1066@gtenmc.UUCP> Date: 23 Feb 91 00:20:28 GMT References: <21658@yunexus.YorkU.CA> <1991Feb12.233522.5195@Think.COM> Reply-To: csp@gtenmc.UUCP () Organization: GTE Telecom, Inc. Bothell, WA Lines: 20 In article <1991Feb12.233522.5195@Think.COM> barmar@think.com (Barry Margolin) writes: >In article <21658@yunexus.YorkU.CA> racine@yunexus.yorku.ca (Jeff Racine) writes: >> for (j=1; j <= n; j++) { >> sum = 0.0; >> for (i=1; i<= n; i++) { >> sum += exp( con * (x[i]-x[j]) * (x[i]-x[j]) ); >> } >> a[j] = k*sum; >> } > Here is my solution :- for ( p++ = x , b++ = a , j = 1 ; j <= n ; j++ , p++ , *b++ = k * sum ) for ( p2++ = x , sum = 0.0 , i = 1 ; i <= n ; p2++ , i++ ) temp = *p2 - *p, sum += exp( temp * temp * con ); C S Palkar --