projects
/
pspp-builds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
float-format: Don't translate test strings.
[pspp-builds.git]
/
src
/
language
/
stats
/
correlations.c
diff --git
a/src/language/stats/correlations.c
b/src/language/stats/correlations.c
index 995675e2cbf4b36cecab0e37ba7374df8e30c9a3..4f476433b3f73c3612261a51fb987a06bc0255ea 100644
(file)
--- a/
src/language/stats/correlations.c
+++ b/
src/language/stats/correlations.c
@@
-1,5
+1,5
@@
/* PSPP - a program for statistical analysis.
/* PSPP - a program for statistical analysis.
- Copyright (C) 2009 Free Software Foundation, Inc.
+ Copyright (C) 2009
, 2010
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
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
@@
-278,10
+278,10
@@
run_corr (struct casereader *r, const struct corr_opts *opts, const struct corr
{
struct ccase *c;
const gsl_matrix *var_matrix, *samples_matrix, *mean_matrix;
{
struct ccase *c;
const gsl_matrix *var_matrix, *samples_matrix, *mean_matrix;
-
const
gsl_matrix *cov_matrix;
+ gsl_matrix *cov_matrix;
gsl_matrix *corr_matrix;
struct covariance *cov = covariance_2pass_create (corr->n_vars_total, corr->vars,
gsl_matrix *corr_matrix;
struct covariance *cov = covariance_2pass_create (corr->n_vars_total, corr->vars,
-
0,
NULL,
+ NULL,
opts->wv, opts->exclude);
struct casereader *rc = casereader_clone (r);
opts->wv, opts->exclude);
struct casereader *rc = casereader_clone (r);
@@
-315,6
+315,7
@@
run_corr (struct casereader *r, const struct corr_opts *opts, const struct corr
covariance_destroy (cov);
gsl_matrix_free (corr_matrix);
covariance_destroy (cov);
gsl_matrix_free (corr_matrix);
+ gsl_matrix_free (cov_matrix);
}
int
}
int
@@
-341,13
+342,13
@@
cmd_correlation (struct lexer *lexer, struct dataset *ds)
opts.statistics = 0;
/* Parse CORRELATIONS. */
opts.statistics = 0;
/* Parse CORRELATIONS. */
- while (lex_token (lexer) !=
'.'
)
+ while (lex_token (lexer) !=
T_ENDCMD
)
{
{
- lex_match (lexer,
'/'
);
+ lex_match (lexer,
T_SLASH
);
if (lex_match_id (lexer, "MISSING"))
{
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, "PAIRWISE"))
opts.missing_type = CORR_PAIRWISE;
{
if (lex_match_id (lexer, "PAIRWISE"))
opts.missing_type = CORR_PAIRWISE;
@@
-363,13
+364,13
@@
cmd_correlation (struct lexer *lexer, struct dataset *ds)
lex_error (lexer, NULL);
goto error;
}
lex_error (lexer, NULL);
goto error;
}
- lex_match (lexer,
','
);
+ lex_match (lexer,
T_COMMA
);
}
}
else if (lex_match_id (lexer, "PRINT"))
{
}
}
else if (lex_match_id (lexer, "PRINT"))
{
- 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, "TWOTAIL"))
opts.tails = 2;
{
if ( lex_match_id (lexer, "TWOTAIL"))
opts.tails = 2;
@@
-385,13
+386,13
@@
cmd_correlation (struct lexer *lexer, struct dataset *ds)
goto error;
}
goto error;
}
- lex_match (lexer,
','
);
+ lex_match (lexer,
T_COMMA
);
}
}
else if (lex_match_id (lexer, "STATISTICS"))
{
}
}
else if (lex_match_id (lexer, "STATISTICS"))
{
- 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, "DESCRIPTIVES"))
opts.statistics = STATS_DESCRIPTIVES;
{
if ( lex_match_id (lexer, "DESCRIPTIVES"))
opts.statistics = STATS_DESCRIPTIVES;
@@
-408,14
+409,14
@@
cmd_correlation (struct lexer *lexer, struct dataset *ds)
goto error;
}
goto error;
}
- lex_match (lexer,
','
);
+ lex_match (lexer,
T_COMMA
);
}
}
else
{
if (lex_match_id (lexer, "VARIABLES"))
{
}
}
else
{
if (lex_match_id (lexer, "VARIABLES"))
{
- lex_match (lexer,
'='
);
+ lex_match (lexer,
T_EQUALS
);
}
corr = xrealloc (corr, sizeof (*corr) * (n_corrs + 1));
}
corr = xrealloc (corr, sizeof (*corr) * (n_corrs + 1));
@@
-498,10
+499,13
@@
cmd_correlation (struct lexer *lexer, struct dataset *ds)
/* Done. */
/* Done. */
+ free (corr->vars);
free (corr);
free (corr);
+
return ok ? CMD_SUCCESS : CMD_CASCADING_FAILURE;
error:
return ok ? CMD_SUCCESS : CMD_CASCADING_FAILURE;
error:
+ free (corr->vars);
free (corr);
return CMD_FAILURE;
}
free (corr);
return CMD_FAILURE;
}