7a651d7866e2a320ee74a1203d9e5bef88687cf4
[pspp] / src / language / data-io / matrix-reader.h
1 /* PSPP - a program for statistical analysis.
2    Copyright (C) 2017 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 #ifndef MATRIX_READER_H
18 #define MATRIX_READER_H
19
20 #include <gsl/gsl_matrix.h>
21 #include <stdbool.h>
22
23 struct matrix_material
24 {
25   gsl_matrix *corr ;  /* The correlation matrix */
26   gsl_matrix *cov ;   /* The covariance matrix */
27
28   /* Moment matrices */
29   const gsl_matrix *n ;           /* MOMENT 0 */
30   const gsl_matrix *mean_matrix;  /* MOMENT 1 */
31   const gsl_matrix *var_matrix;   /* MOMENT 2 */
32 };
33
34 struct dictionary;
35 struct variable;
36 struct casereader;
37
38
39 struct matrix_reader;
40
41 struct matrix_reader *create_matrix_reader_from_case_reader (const struct dictionary *dict,
42                                                              struct casereader *in_reader,
43                                                              const struct variable ***vars, size_t *n_vars);
44
45 bool destroy_matrix_reader (struct matrix_reader *mr);
46
47 bool next_matrix_from_reader (struct matrix_material *mm,
48                               struct matrix_reader *mr,
49                               const struct variable **vars, int n_vars);
50
51
52 #endif