Execution time bottleneck: How to speed up execution?
csp at gtenmc.UUCP
csp at gtenmc.UUCP
Sat Feb 23 11:20:28 AEST 1991
In article <1991Feb12.233522.5195 at Think.COM> barmar at think.com (Barry Margolin) writes:
>In article <21658 at yunexus.YorkU.CA> racine at 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
--
More information about the Comp.lang.c
mailing list