X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fmath%2Fts%2Finnovations.c;h=ba2120fb4e6bc735f41d300b5aef406be5c2828d;hb=ceaae3cf35172d773f6621f44b3c08e812a2167f;hp=f69cf89874c530564f7a2182d46915939dd6a19a;hpb=43b1296aafe7582e7dbe6c2b6a8b478d7d9b0fcf;p=pspp diff --git a/src/math/ts/innovations.c b/src/math/ts/innovations.c index f69cf89874..ba2120fb4e 100644 --- a/src/math/ts/innovations.c +++ b/src/math/ts/innovations.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 2006 Free Software Foundation, Inc. + Copyright (C) 2006, 2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -26,14 +26,19 @@ */ #include + +#include "math/ts/innovations.h" + #include #include -#include +#include #include -#include -#include -#include -#include + +#include "libpspp/compiler.h" +#include "libpspp/misc.h" +#include "math/coefficient.h" + +#include "gl/xalloc.h" static void get_mean (const gsl_matrix *data, @@ -55,7 +60,7 @@ get_mean (const gsl_matrix *data, for (n = 0; n < data->size2; n++) { tmp = gsl_matrix_get (data, i, n); - if (!gsl_isnan (tmp)) + if (!isnan (tmp)) { est[n]->n_obs += 1.0; d = (tmp - est[n]->mean) / est[n]->n_obs; @@ -76,9 +81,9 @@ update_cov (struct innovations_estimate **est, gsl_vector_const_view x, { xj = gsl_vector_get (&x.vector, j); yj = gsl_vector_get (&y.vector, j); - if (!gsl_isnan (xj)) + if (!isnan (xj)) { - if (!gsl_isnan (yj)) + if (!isnan (yj)) { xj -= est[j]->mean; yj -= est[j]->mean; @@ -160,7 +165,7 @@ innovations_update_scale (struct innovations_estimate *est, double *theta, for (j = 0; j < i; j++) { k = i - j - 1; - result -= theta[k] * theta[k] * est->scale[j]; + result -= pow2 (theta[k]) * est->scale[j]; } est->scale[i] = result; }