Fixed crash on quit
[pspp-builds.git] / src / math / design-matrix.c
index e3743228e6ab30e1bcf9117e9de14cb8b6720c3b..b81859aa5a539099f6e7a437ab053f31ce5fa202 100644 (file)
@@ -247,8 +247,8 @@ design_matrix_set_case_count (struct design_matrix *dm, const struct variable *v
 /*
   Get the number of cases for V.
  */
-void 
-design_matrix_get_case_count (struct design_matrix *dm, const struct variable *v)
+size_t 
+design_matrix_get_case_count (const struct design_matrix *dm, const struct variable *v)
 {
   size_t i;
   assert (dm != NULL);
@@ -258,4 +258,26 @@ design_matrix_get_case_count (struct design_matrix *dm, const struct variable *v
   return dm->n_cases[i];
 }
 
-  
+size_t
+design_matrix_get_n_cols (const struct design_matrix *d)
+{
+  return d->m->size2;
+}
+
+size_t
+design_matrix_get_n_rows (const struct design_matrix *d)
+{
+  return d->m->size1;
+}
+
+double
+design_matrix_get_element (const struct design_matrix *d, size_t row, size_t col)
+{
+  return (gsl_matrix_get (d->m, row, col));
+}
+
+void
+design_matrix_set_element (const struct design_matrix *d, size_t row, size_t col, double x)
+{
+  gsl_matrix_set (d->m, row, col, x);
+}