[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: moments optimization
From: |
John Darrington |
Subject: |
Re: moments optimization |
Date: |
Tue, 6 Feb 2007 08:13:11 +0900 |
User-agent: |
Mutt/1.5.9i |
I also suggest moving the declaration of d and d_power to inside the
if ( value != SYSMIS ... ) { } scope.
J'
On Mon, Feb 05, 2007 at 01:33:48PM -0800, Ben Pfaff wrote:
When I looked at src/math/moments.c earlier, it seemed like we
were doing more multiplications than necessary. I'd like to
check in the following change. It passes "make check". Any
comments?
--- moments.c.~1.4.~ 2007-02-05 13:19:12.000000000 -0800
+++ moments.c 2007-02-05 13:25:17.000000000 -0800
@@ -166,23 +166,24 @@ moments_pass_two (struct moments *m, dou
{
m->w2 += weight;
- d = d_power = value - m->mean;
- m->d1 += d_power * weight;
+ d = value - m->mean;
+ d_power = d * weight;
+ m->d1 += d_power;
if (m->max_moment >= MOMENT_VARIANCE)
{
d_power *= d;
- m->d2 += d_power * weight;
+ m->d2 += d_power;
if (m->max_moment >= MOMENT_SKEWNESS)
{
d_power *= d;
- m->d3 += d_power * weight;
+ m->d3 += d_power;
if (m->max_moment >= MOMENT_KURTOSIS)
{
d_power *= d;
- m->d4 += d_power * weight;
+ m->d4 += d_power;
}
}
}
--
Ben Pfaff
address@hidden
http://benpfaff.org
_______________________________________________
pspp-dev mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/pspp-dev
--
PGP Public key ID: 1024D/2DE827B3
fingerprint = 8797 A26D 0854 2EAB 0285 A290 8A67 719C 2DE8 27B3
See http://pgp.mit.edu or any PGP keyserver for public key.
signature.asc
Description: Digital signature