projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
intern: Use UP_CAST macro instad of open-coding it.
[pspp]
/
src
/
math
/
ts
/
innovations.c
diff --git
a/src/math/ts/innovations.c
b/src/math/ts/innovations.c
index 3e3be2024711a727e8a382d48841213106c8f03e..ba2120fb4e6bc735f41d300b5aef406be5c2828d 100644
(file)
--- a/
src/math/ts/innovations.c
+++ b/
src/math/ts/innovations.c
@@
-1,5
+1,5
@@
/* PSPP - a program for statistical analysis.
/* 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
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,15
+26,19
@@
*/
#include <config.h>
*/
#include <config.h>
+
+#include "math/ts/innovations.h"
+
#include <gsl/gsl_matrix.h>
#include <gsl/gsl_vector.h>
#include <gsl/gsl_matrix.h>
#include <gsl/gsl_vector.h>
-#include <
gsl/gsl_
math.h>
+#include <math.h>
#include <stdlib.h>
#include <stdlib.h>
-#include <libpspp/compiler.h>
-#include <math/coefficient.h>
-#include <math/ts/innovations.h>
-#include "xalloc.h"
+#include "libpspp/compiler.h"
+#include "libpspp/misc.h"
+#include "math/coefficient.h"
+
+#include "gl/xalloc.h"
static void
get_mean (const gsl_matrix *data,
static void
get_mean (const gsl_matrix *data,
@@
-56,7
+60,7
@@
get_mean (const gsl_matrix *data,
for (n = 0; n < data->size2; n++)
{
tmp = gsl_matrix_get (data, i, n);
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;
{
est[n]->n_obs += 1.0;
d = (tmp - est[n]->mean) / est[n]->n_obs;
@@
-77,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);
{
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;
{
xj -= est[j]->mean;
yj -= est[j]->mean;
@@
-161,7
+165,7
@@
innovations_update_scale (struct innovations_estimate *est, double *theta,
for (j = 0; j < i; j++)
{
k = i - j - 1;
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;
}
}
est->scale[i] = result;
}