pspp-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pspp-cvs] pspp/src/math/ts ChangeLog innovations.c


From: Jason H Stover
Subject: [Pspp-cvs] pspp/src/math/ts ChangeLog innovations.c
Date: Thu, 06 Jul 2006 23:58:05 +0000

CVSROOT:        /cvsroot/pspp
Module name:    pspp
Changes by:     Jason H Stover <jstover>        06/07/06 23:58:05

Modified files:
        src/math/ts    : ChangeLog innovations.c 

Log message:
        subscript fixes

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pspp/src/math/ts/ChangeLog?cvsroot=pspp&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/pspp/src/math/ts/innovations.c?cvsroot=pspp&r1=1.11&r2=1.12

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/pspp/pspp/src/math/ts/ChangeLog,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- ChangeLog   5 Jul 2006 23:55:02 -0000       1.10
+++ ChangeLog   6 Jul 2006 23:58:05 -0000       1.11
@@ -1,3 +1,8 @@
+2006-07-06  Jason Stover  <address@hidden>
+
+       * innovations.c (get_covariance): Fixed subscripts.
+       (innovations_update_scale): Added check for subscript.
+       
 2006-07-05  Jason Stover  <address@hidden>
 
        * innovations.c (innovations_struct_init): New function.

Index: innovations.c
===================================================================
RCS file: /cvsroot/pspp/pspp/src/math/ts/innovations.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- innovations.c       5 Jul 2006 23:54:36 -0000       1.11
+++ innovations.c       6 Jul 2006 23:58:05 -0000       1.12
@@ -114,7 +114,7 @@
     {
       for (j = 0; j < data->size2; j++)
        {
-         *(est[j]->cov + lag) /= (est[j]->n_obs - lag);
+         *(est[j]->cov + lag - 1) /= (est[j]->n_obs - lag);
        }
     }
   return rc;
@@ -140,7 +140,8 @@
   size_t j;
   size_t k;
 
-
+  if (i < (size_t) est->max_lag)
+    {
   result = est->variance;
   for (j = 0; j < i; j++)
     {
@@ -148,6 +149,7 @@
       result -= theta[k] * theta[k] * est->scale[j];
     }
   est->scale[i] = result;
+    }
 }
 static void
 init_theta (double **theta, size_t max_lag)
@@ -243,7 +245,7 @@
   est->mean = 0.0;
   est->variance = 0.0;
   est->cov = xnmalloc (lag, sizeof (*est->cov));
-  est->scale = xnmalloc (lag, sizeof (*est->scale));
+  est->scale = xnmalloc (lag + 1, sizeof (*est->scale));
   est->coeff = xnmalloc (lag, sizeof (*est->coeff));
   est->max_lag = (double) lag;
   /* COV does not the variance (i.e., the lag 0 covariance). So COV[0]
@@ -281,12 +283,13 @@
   size_t i;
 
   assert (est != NULL);
-  free (est->cov);
-  free (est->scale);
   for (i = 0; i < (size_t) est->max_lag; i++)
     {
       pspp_coeff_free (est->coeff[i]);
     }
+  free (est->scale);
+  free (est->cov);
+  free (est);
 }
 
 void pspp_innovations_free (struct innovations_estimate **est, size_t n)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]