From: John Darrington Date: Sun, 8 Aug 2010 11:20:46 +0000 (+0200) Subject: Constness X-Git-Tag: sav-api~83 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?p=pspp;a=commitdiff_plain;h=b4a1fe2442a0b6fc8716e92574d33726d7170fe8 Constness --- diff --git a/src/math/categoricals.c b/src/math/categoricals.c index c544f97e98..df26c1602e 100644 --- a/src/math/categoricals.c +++ b/src/math/categoricals.c @@ -181,7 +181,7 @@ lookup_value (const struct hmap *map, const struct variable *var, const union va struct categoricals * -categoricals_create (const struct variable **v, size_t n_vars, +categoricals_create (const struct variable *const *v, size_t n_vars, const struct variable *wv, enum mv_class exclude) { size_t i; diff --git a/src/math/categoricals.h b/src/math/categoricals.h index 2f86ce1df9..67be020463 100644 --- a/src/math/categoricals.h +++ b/src/math/categoricals.h @@ -27,7 +27,7 @@ struct ccase; union value ; -struct categoricals *categoricals_create (const struct variable **v, size_t n_vars, +struct categoricals *categoricals_create (const struct variable *const *v, size_t n_vars, const struct variable *wv, enum mv_class exclude); void categoricals_destroy (struct categoricals *); diff --git a/src/math/covariance.c b/src/math/covariance.c index b5a4166dfa..f0161a54c5 100644 --- a/src/math/covariance.c +++ b/src/math/covariance.c @@ -68,7 +68,7 @@ struct covariance { /* The variables for which the covariance matrix is to be calculated. */ size_t n_vars; - const struct variable **vars; + const struct variable *const *vars; /* Categorical variables. */ struct categoricals *categoricals; @@ -131,7 +131,7 @@ covariance_moments (const struct covariance *cov, int m) /* Create a covariance struct. */ struct covariance * -covariance_1pass_create (size_t n_vars, const struct variable **vars, +covariance_1pass_create (size_t n_vars, const struct variable *const *vars, const struct variable *weight, enum mv_class exclude) { size_t i; @@ -170,8 +170,8 @@ covariance_1pass_create (size_t n_vars, const struct variable **vars, until then. */ struct covariance * -covariance_2pass_create (size_t n_vars, const struct variable **vars, - size_t n_catvars, const struct variable **catvars, +covariance_2pass_create (size_t n_vars, const struct variable *const *vars, + size_t n_catvars, const struct variable *const *catvars, const struct variable *wv, enum mv_class exclude) { size_t i; @@ -698,6 +698,14 @@ covariance_calculate_unnormalized (struct covariance *cov) } } +/* Function to access the categoricals used by COV + The return value is owned by the COV +*/ +const struct categoricals * +covariance_get_categoricals (const struct covariance *cov) +{ + return cov->categoricals; +} /* Destroy the COV object */ diff --git a/src/math/covariance.h b/src/math/covariance.h index 3d29dcea8b..fb59535718 100644 --- a/src/math/covariance.h +++ b/src/math/covariance.h @@ -27,12 +27,12 @@ struct covariance; struct variable; struct ccase ; -struct covariance * covariance_1pass_create (size_t n_vars, const struct variable **vars, +struct covariance * covariance_1pass_create (size_t n_vars, const struct variable *const *vars, const struct variable *wv, enum mv_class excl); struct covariance * -covariance_2pass_create (size_t n_vars, const struct variable **vars, - size_t n_catvars, const struct variable **catvars, +covariance_2pass_create (size_t n_vars, const struct variable *const *vars, + size_t n_catvars, const struct variable *const *catvars, const struct variable *wv, enum mv_class excl); void covariance_accumulate (struct covariance *, const struct ccase *); @@ -46,4 +46,6 @@ void covariance_destroy (struct covariance *cov); const gsl_matrix *covariance_moments (const struct covariance *cov, int m); +const struct categoricals * covariance_get_categoricals (const struct covariance *cov); + #endif