Covariance matrix interface change.
[pspp] / src / math / covariance.h
1 /* PSPP - a program for statistical analysis.
2    Copyright (C) 2009 Free Software Foundation, Inc.
3
4    This program is free software: you can redistribute it and/or modify
5    it under the terms of the GNU General Public License as published by
6    the Free Software Foundation, either version 3 of the License, or
7    (at your option) any later version.
8
9    This program is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12    GNU General Public License for more details.
13
14    You should have received a copy of the GNU General Public License
15    along with this program.  If not, see <http://www.gnu.org/licenses/>. */
16
17
18 #ifndef COVARIANCE_H
19 #define COVARIANCE_H
20
21 #include <stddef.h>
22
23 #include <data/missing-values.h>
24 #include <gsl/gsl_matrix.h>
25
26 struct covariance;
27 struct variable;
28 struct ccase ;
29 struct categoricals;
30
31 struct covariance * covariance_1pass_create (size_t n_vars, const struct variable *const *vars, 
32                                              const struct variable *wv, enum mv_class excl);
33
34 struct covariance *
35 covariance_2pass_create (size_t n_vars, const struct variable *const *vars,
36                          struct categoricals *cats,
37                          const struct variable *wv, enum mv_class excl);
38
39 void covariance_accumulate (struct covariance *, const struct ccase *);
40 void covariance_accumulate_pass1 (struct covariance *, const struct ccase *);
41 void covariance_accumulate_pass2 (struct covariance *, const struct ccase *);
42
43 const gsl_matrix * covariance_calculate (struct covariance *cov);
44 const gsl_matrix * covariance_calculate_unnormalized (struct covariance *);
45
46 void covariance_destroy (struct covariance *cov);
47
48 const gsl_matrix *covariance_moments (const struct covariance *cov, int m);
49
50 const struct categoricals * covariance_get_categoricals (const struct covariance *cov);
51
52 #endif