[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: moments optimization
From: |
Jason Stover |
Subject: |
Re: moments optimization |
Date: |
Mon, 5 Feb 2007 18:33:39 -0500 |
User-agent: |
Mutt/1.5.10i |
Looks okay to me.
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