X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fmath%2Fts%2Finnovations.c;h=3ab2f3edce165ed0a709688e711867986683eee3;hb=refs%2Ftags%2Ffc11-i386-build58;hp=44fa09816568b17d84b604a25390a946686c1dd9;hpb=f5c108becd49d78f4898cab11352291f5689d24e;p=pspp-builds.git diff --git a/src/math/ts/innovations.c b/src/math/ts/innovations.c index 44fa0981..3ab2f3ed 100644 --- a/src/math/ts/innovations.c +++ b/src/math/ts/innovations.c @@ -1,22 +1,19 @@ -/* - src/math/ts/innovations.c +/* PSPP - a program for statistical analysis. + Copyright (C) 2006 Free Software Foundation, Inc. - Copyright (C) 2006 Free Software Foundation, Inc. Written by Jason H. Stover. + 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 + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. - 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 the Free - Software Foundation; either version 2 of the License, or (at your option) - any later version. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ - You should have received a copy of the GNU General Public License along with - this program; if not, write to the Free Software Foundation, Inc., 51 - Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA. - */ /* Find preliminary ARMA coefficients via the innovations algorithm. Also compute the sample mean and covariance matrix for each series. @@ -29,15 +26,19 @@ */ #include + +#include +#include + #include #include -#include -#include -#include #include +#include #include #include +#include "xalloc.h" + static void get_mean (const gsl_matrix *data, struct innovations_estimate **est) @@ -58,7 +59,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; @@ -79,9 +80,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; @@ -163,7 +164,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; }