Merge commit 'origin/stable'
[pspp-builds.git] / src / math / design-matrix.h
index 2b6bae508a2522e2dad22d2030b1da35096e4340..b1cda5a9068d38be49ed45dd53a5016f78368056 100644 (file)
@@ -1,20 +1,18 @@
-/* PSPP - Creates design matrices.
+/* PSPP - a program for statistical analysis.
    Copyright (C) 2005 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 the Free Software Foundation; either version 2 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 3 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, write to the Free Software
-   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-   02110-1301, USA. */
+   along with this program.  If not, see <http://www.gnu.org/licenses/>. */
 
 /*
   Create design matrices for procedures that need them.
@@ -60,6 +58,9 @@ struct design_matrix
                                           design_matrix_var
                                           structure.
                                         */
+  size_t *n_cases; /* Element i is the number of valid cases for this
+                     variable.
+                   */
   size_t n_vars;
 };
 
@@ -77,10 +78,23 @@ void design_matrix_set_numeric (struct design_matrix *, size_t,
                                    const struct variable *,
                                    const union value *);
 
+struct design_matrix *design_matrix_clone (const struct design_matrix *);
+
 size_t design_matrix_var_to_column (const struct design_matrix *,
                                    const struct variable *);
 
 const struct variable *design_matrix_col_to_var (const struct design_matrix *,
                                           size_t);
+void design_matrix_increment_case_count (struct design_matrix *, const struct variable *);
+
+void design_matrix_set_case_count (struct design_matrix *, const struct variable *, size_t);
+
+size_t design_matrix_get_case_count (const struct design_matrix *, const struct variable *);
+size_t design_matrix_get_n_cols (const struct design_matrix *);
+size_t design_matrix_get_n_rows (const struct design_matrix *);
+double design_matrix_get_element (const struct design_matrix *, size_t, size_t);
+void design_matrix_set_element (const struct design_matrix *, size_t, size_t, double);
+size_t dm_get_exact_subscript (const struct design_matrix *, const struct variable *,
+                                  const union value *);
 
 #endif