projects
/
pspp-builds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
lexer: Fix GCC warning for unhandled TOKEN_N_TYPES in lex_token_name().
[pspp-builds.git]
/
src
/
language
/
stats
/
factor.c
diff --git
a/src/language/stats/factor.c
b/src/language/stats/factor.c
index 93358373df3eee57684e7d0abdcdefd7f050662c..eae6840f3b2f66716a61582e8863ee9746c673bb 100644
(file)
--- a/
src/language/stats/factor.c
+++ b/
src/language/stats/factor.c
@@
-175,7
+175,7
@@
struct idata
/* Intermediate values used in calculation */
const gsl_matrix *corr ; /* The correlation matrix */
/* Intermediate values used in calculation */
const gsl_matrix *corr ; /* The correlation matrix */
-
const gsl_matrix *cov ;
/* The covariance matrix */
+
gsl_matrix *cov ;
/* The covariance matrix */
const gsl_matrix *n ; /* Matrix of number of samples */
gsl_vector *eval ; /* The eigenvalues */
const gsl_matrix *n ; /* Matrix of number of samples */
gsl_vector *eval ; /* The eigenvalues */
@@
-206,6
+206,8
@@
idata_free (struct idata *id)
gsl_vector_free (id->msr);
gsl_vector_free (id->eval);
gsl_matrix_free (id->evec);
gsl_vector_free (id->msr);
gsl_vector_free (id->eval);
gsl_matrix_free (id->evec);
+ if (id->cov != NULL)
+ gsl_matrix_free (id->cov);
free (id);
}
free (id);
}
@@
-788,14
+790,14
@@
cmd_factor (struct lexer *lexer, struct dataset *ds)
factor.wv = dict_get_weight (dict);
factor.wv = dict_get_weight (dict);
- lex_match (lexer,
'/'
);
+ lex_match (lexer,
T_SLASH
);
if (!lex_force_match_id (lexer, "VARIABLES"))
{
goto error;
}
if (!lex_force_match_id (lexer, "VARIABLES"))
{
goto error;
}
- lex_match (lexer,
'='
);
+ lex_match (lexer,
T_EQUALS
);
if (!parse_variables_const (lexer, dict, &factor.vars, &factor.n_vars,
PV_NO_DUPLICATE | PV_NUMERIC))
if (!parse_variables_const (lexer, dict, &factor.vars, &factor.n_vars,
PV_NO_DUPLICATE | PV_NUMERIC))
@@
-804,14
+806,14
@@
cmd_factor (struct lexer *lexer, struct dataset *ds)
if (factor.n_vars < 2)
msg (MW, _("Factor analysis on a single variable is not useful."));
if (factor.n_vars < 2)
msg (MW, _("Factor analysis on a single variable is not useful."));
- while (lex_token (lexer) !=
'.'
)
+ while (lex_token (lexer) !=
T_ENDCMD
)
{
{
- lex_match (lexer,
'/'
);
+ lex_match (lexer,
T_SLASH
);
if (lex_match_id (lexer, "PLOT"))
{
if (lex_match_id (lexer, "PLOT"))
{
- lex_match (lexer,
'='
);
- while (lex_token (lexer) !=
'.' && lex_token (lexer) != '/'
)
+ lex_match (lexer,
T_EQUALS
);
+ while (lex_token (lexer) !=
T_ENDCMD && lex_token (lexer) != T_SLASH
)
{
if (lex_match_id (lexer, "EIGEN"))
{
{
if (lex_match_id (lexer, "EIGEN"))
{
@@
-831,8
+833,8
@@
cmd_factor (struct lexer *lexer, struct dataset *ds)
}
else if (lex_match_id (lexer, "METHOD"))
{
}
else if (lex_match_id (lexer, "METHOD"))
{
- lex_match (lexer,
'='
);
- while (lex_token (lexer) !=
'.' && lex_token (lexer) != '/'
)
+ lex_match (lexer,
T_EQUALS
);
+ while (lex_token (lexer) !=
T_ENDCMD && lex_token (lexer) != T_SLASH
)
{
if (lex_match_id (lexer, "COVARIANCE"))
{
{
if (lex_match_id (lexer, "COVARIANCE"))
{
@@
-851,8
+853,8
@@
cmd_factor (struct lexer *lexer, struct dataset *ds)
}
else if (lex_match_id (lexer, "ROTATION"))
{
}
else if (lex_match_id (lexer, "ROTATION"))
{
- lex_match (lexer,
'='
);
- while (lex_token (lexer) !=
'.' && lex_token (lexer) != '/'
)
+ lex_match (lexer,
T_EQUALS
);
+ while (lex_token (lexer) !=
T_ENDCMD && lex_token (lexer) != T_SLASH
)
{
/* VARIMAX and DEFAULT are defaults */
if (lex_match_id (lexer, "VARIMAX") || lex_match_id (lexer, "DEFAULT"))
{
/* VARIMAX and DEFAULT are defaults */
if (lex_match_id (lexer, "VARIMAX") || lex_match_id (lexer, "DEFAULT"))
@@
-880,57
+882,57
@@
cmd_factor (struct lexer *lexer, struct dataset *ds)
}
else if (lex_match_id (lexer, "CRITERIA"))
{
}
else if (lex_match_id (lexer, "CRITERIA"))
{
- lex_match (lexer,
'='
);
- while (lex_token (lexer) !=
'.' && lex_token (lexer) != '/'
)
+ lex_match (lexer,
T_EQUALS
);
+ while (lex_token (lexer) !=
T_ENDCMD && lex_token (lexer) != T_SLASH
)
{
if (lex_match_id (lexer, "FACTORS"))
{
{
if (lex_match_id (lexer, "FACTORS"))
{
- if ( lex_force_match (lexer,
'('
))
+ if ( lex_force_match (lexer,
T_LPAREN
))
{
lex_force_int (lexer);
factor.n_factors = lex_integer (lexer);
lex_get (lexer);
{
lex_force_int (lexer);
factor.n_factors = lex_integer (lexer);
lex_get (lexer);
- lex_force_match (lexer,
')'
);
+ lex_force_match (lexer,
T_RPAREN
);
}
}
else if (lex_match_id (lexer, "MINEIGEN"))
{
}
}
else if (lex_match_id (lexer, "MINEIGEN"))
{
- if ( lex_force_match (lexer,
'('
))
+ if ( lex_force_match (lexer,
T_LPAREN
))
{
lex_force_num (lexer);
factor.min_eigen = lex_number (lexer);
lex_get (lexer);
{
lex_force_num (lexer);
factor.min_eigen = lex_number (lexer);
lex_get (lexer);
- lex_force_match (lexer,
')'
);
+ lex_force_match (lexer,
T_RPAREN
);
}
}
else if (lex_match_id (lexer, "ECONVERGE"))
{
}
}
else if (lex_match_id (lexer, "ECONVERGE"))
{
- if ( lex_force_match (lexer,
'('
))
+ if ( lex_force_match (lexer,
T_LPAREN
))
{
lex_force_num (lexer);
factor.econverge = lex_number (lexer);
lex_get (lexer);
{
lex_force_num (lexer);
factor.econverge = lex_number (lexer);
lex_get (lexer);
- lex_force_match (lexer,
')'
);
+ lex_force_match (lexer,
T_RPAREN
);
}
}
else if (lex_match_id (lexer, "RCONVERGE"))
{
}
}
else if (lex_match_id (lexer, "RCONVERGE"))
{
- if ( lex_force_match (lexer,
'('
))
+ if ( lex_force_match (lexer,
T_LPAREN
))
{
lex_force_num (lexer);
factor.rconverge = lex_number (lexer);
lex_get (lexer);
{
lex_force_num (lexer);
factor.rconverge = lex_number (lexer);
lex_get (lexer);
- lex_force_match (lexer,
')'
);
+ lex_force_match (lexer,
T_RPAREN
);
}
}
else if (lex_match_id (lexer, "ITERATE"))
{
}
}
else if (lex_match_id (lexer, "ITERATE"))
{
- if ( lex_force_match (lexer,
'('
))
+ if ( lex_force_match (lexer,
T_LPAREN
))
{
lex_force_int (lexer);
factor.iterations = lex_integer (lexer);
lex_get (lexer);
{
lex_force_int (lexer);
factor.iterations = lex_integer (lexer);
lex_get (lexer);
- lex_force_match (lexer,
')'
);
+ lex_force_match (lexer,
T_RPAREN
);
}
}
else if (lex_match_id (lexer, "DEFAULT"))
}
}
else if (lex_match_id (lexer, "DEFAULT"))
@@
-949,8
+951,8
@@
cmd_factor (struct lexer *lexer, struct dataset *ds)
else if (lex_match_id (lexer, "EXTRACTION"))
{
extraction_seen = true;
else if (lex_match_id (lexer, "EXTRACTION"))
{
extraction_seen = true;
- lex_match (lexer,
'='
);
- while (lex_token (lexer) !=
'.' && lex_token (lexer) != '/'
)
+ lex_match (lexer,
T_EQUALS
);
+ while (lex_token (lexer) !=
T_ENDCMD && lex_token (lexer) != T_SLASH
)
{
if (lex_match_id (lexer, "PAF"))
{
{
if (lex_match_id (lexer, "PAF"))
{
@@
-977,8
+979,8
@@
cmd_factor (struct lexer *lexer, struct dataset *ds)
}
else if (lex_match_id (lexer, "FORMAT"))
{
}
else if (lex_match_id (lexer, "FORMAT"))
{
- lex_match (lexer,
'='
);
- while (lex_token (lexer) !=
'.' && lex_token (lexer) != '/'
)
+ lex_match (lexer,
T_EQUALS
);
+ while (lex_token (lexer) !=
T_ENDCMD && lex_token (lexer) != T_SLASH
)
{
if (lex_match_id (lexer, "SORT"))
{
{
if (lex_match_id (lexer, "SORT"))
{
@@
-986,12
+988,12
@@
cmd_factor (struct lexer *lexer, struct dataset *ds)
}
else if (lex_match_id (lexer, "BLANK"))
{
}
else if (lex_match_id (lexer, "BLANK"))
{
- if ( lex_force_match (lexer,
'('
))
+ if ( lex_force_match (lexer,
T_LPAREN
))
{
lex_force_num (lexer);
factor.blank = lex_number (lexer);
lex_get (lexer);
{
lex_force_num (lexer);
factor.blank = lex_number (lexer);
lex_get (lexer);
- lex_force_match (lexer,
')'
);
+ lex_force_match (lexer,
T_RPAREN
);
}
}
else if (lex_match_id (lexer, "DEFAULT"))
}
}
else if (lex_match_id (lexer, "DEFAULT"))
@@
-1009,8
+1011,8
@@
cmd_factor (struct lexer *lexer, struct dataset *ds)
else if (lex_match_id (lexer, "PRINT"))
{
factor.print = 0;
else if (lex_match_id (lexer, "PRINT"))
{
factor.print = 0;
- lex_match (lexer,
'='
);
- while (lex_token (lexer) !=
'.' && lex_token (lexer) != '/'
)
+ lex_match (lexer,
T_EQUALS
);
+ while (lex_token (lexer) !=
T_ENDCMD && lex_token (lexer) != T_SLASH
)
{
if (lex_match_id (lexer, "UNIVARIATE"))
{
{
if (lex_match_id (lexer, "UNIVARIATE"))
{
@@
-1083,8
+1085,8
@@
cmd_factor (struct lexer *lexer, struct dataset *ds)
}
else if (lex_match_id (lexer, "MISSING"))
{
}
else if (lex_match_id (lexer, "MISSING"))
{
- lex_match (lexer,
'='
);
- while (lex_token (lexer) !=
'.' && lex_token (lexer) != '/'
)
+ lex_match (lexer,
T_EQUALS
);
+ while (lex_token (lexer) !=
T_ENDCMD && lex_token (lexer) != T_SLASH
)
{
if (lex_match_id (lexer, "INCLUDE"))
{
{
if (lex_match_id (lexer, "INCLUDE"))
{