Skip to content

Commit

Permalink
use a less confusing option flag for mplsq()
Browse files Browse the repository at this point in the history
  • Loading branch information
AllinCottrell committed Jan 14, 2025
1 parent cf4bd00 commit 2020ee3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
14 changes: 7 additions & 7 deletions lib/src/estimate.c
Original file line number Diff line number Diff line change
Expand Up @@ -4317,20 +4317,20 @@ MODEL garch (const int *list, DATASET *dset, gretlopt opt,
/**
* mp_ols:
* @list: specification of variables to use.
* @dset: dataset struct.
* @opt: maye include OPT_Q for quiet operation.
* @dset: pointer to dataset struct.
* @opt: may include OPT_Q for quiet operation, OPT_S for
* simple output.
*
* Estimate an OLS model using multiple-precision arithmetic
* via the GMP library.
*
* Returns: a #MODEL struct, containing the estimates.
* Returns: a #MODEL struct containing the estimates.
*/

MODEL mp_ols (const int *list, DATASET *dset, gretlopt opt)
{
int (*mplsq)(const int *, const int *, const int *,
DATASET *, MODEL *,
gretlopt);
DATASET *, MODEL *, gretlopt);
MODEL mpmod;

gretl_model_init(&mpmod, dset);
Expand All @@ -4350,13 +4350,13 @@ MODEL mp_ols (const int *list, DATASET *dset, gretlopt opt)
mpmod.errcode = E_ARGS;
} else {
mpmod.errcode = (*mplsq)(base, poly, NULL, dset,
&mpmod, OPT_S);
&mpmod, OPT_X);
}
free(base);
free(poly);
} else {
mpmod.errcode = (*mplsq)(list, NULL, NULL, dset,
&mpmod, OPT_S);
&mpmod, OPT_X);
}

set_model_id(&mpmod, opt);
Expand Down
8 changes: 4 additions & 4 deletions plugin/mp_ols.c
Original file line number Diff line number Diff line change
Expand Up @@ -1007,8 +1007,8 @@ static int copy_mp_results (MPMODEL *mpmod, MODEL *pmod,
pmod->fstt = mpf_get_d(mpmod->fstt);
pmod->chisq = NADBL;

if (opt & OPT_S) {
/* saving additional results */
if (opt & OPT_X) {
/* saving extra results */
pmod->t1 = mpmod->t1;
pmod->t2 = mpmod->t2;
pmod->nobs = mpmod->nobs;
Expand Down Expand Up @@ -1579,7 +1579,7 @@ static int add_missvals_mask (MPMODEL *mpmod, const int *list,
* (or %NULL).
* @dset: dataset struct.
* @pmod: MODEL pointer to hold results.
* @opt: if contains %OPT_S, save additional model
* @opt: if contains %OPT_X, save extra model
* information (including the names of parameters in
* @pmod, if required).
*
Expand Down Expand Up @@ -1662,7 +1662,7 @@ int mplsq (const int *list, const int *polylist, const int *zdigits,
}

/* enable names for polynomial terms? */
if (polylist != NULL && (opt & OPT_S)) {
if (polylist != NULL && (opt & OPT_X)) {
xnames = allocate_xnames(mpmod.list);
if (xnames == NULL) {
err = E_ALLOC;
Expand Down

0 comments on commit 2020ee3

Please sign in to comment.