projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Parameter estimate matched with appropriate variable in linreg cache
[pspp]
/
src
/
matrix-data.c
diff --git
a/src/matrix-data.c
b/src/matrix-data.c
index d3cde3e68a9896076afa9b1b9b3c8c1271c0553a..ee43d82f2ba2df94bc8cc94b9cd4119e5d8213ad 100644
(file)
--- a/
src/matrix-data.c
+++ b/
src/matrix-data.c
@@
-38,6
+38,9
@@
#include "var.h"
#include "vfm.h"
#include "var.h"
#include "vfm.h"
+#include "gettext.h"
+#define _(msgid) gettext (msgid)
+
#include "debug-print.h"
/* FIXME: /N subcommand not implemented. It should be pretty simple,
#include "debug-print.h"
/* FIXME: /N subcommand not implemented. It should be pretty simple,
@@
-129,7
+132,7
@@
struct matrix_data_pgm
struct variable *single_split; /* Single SPLIT FILE variable. */
/* Factor variables. */
struct variable *single_split; /* Single SPLIT FILE variable. */
/* Factor variables. */
-
int n_factors;
/* Number of factor variables. */
+
size_t n_factors;
/* Number of factor variables. */
struct variable **factors; /* Factor variables. */
int is_per_factor[PROX + 1]; /* Is there per-factor data? */
struct variable **factors; /* Factor variables. */
int is_per_factor[PROX + 1]; /* Is there per-factor data? */
@@
-201,7
+204,7
@@
cmd_matrix_data (void)
if (lex_match_id ("VARIABLES"))
{
char **v;
if (lex_match_id ("VARIABLES"))
{
char **v;
-
in
t nv;
+
size_
t nv;
if (seen & 1)
{
if (seen & 1)
{
@@
-215,7
+218,7
@@
cmd_matrix_data (void)
goto lossage;
{
goto lossage;
{
-
in
t i;
+
size_
t i;
for (i = 0; i < nv; i++)
if (!strcasecmp (v[i], "VARNAME_"))
for (i = 0; i < nv; i++)
if (!strcasecmp (v[i], "VARNAME_"))
@@
-230,7
+233,7
@@
cmd_matrix_data (void)
}
{
}
{
-
in
t i;
+
size_
t i;
for (i = 0; i < nv; i++)
{
for (i = 0; i < nv; i++)
{
@@
-324,7
+327,7
@@
cmd_matrix_data (void)
else
{
struct variable **split;
else
{
struct variable **split;
-
in
t n;
+
size_
t n;
if (!parse_variables (default_dict, &split, &n, PV_NO_DUPLICATE))
goto lossage;
if (!parse_variables (default_dict, &split, &n, PV_NO_DUPLICATE))
goto lossage;
@@
-363,11
+366,12
@@
cmd_matrix_data (void)
}
seen |= 4;
}
seen |= 4;
- if (!parse_variables (default_dict, &mx->factors, &mx->n_factors, PV_NONE))
+ if (!parse_variables (default_dict, &mx->factors, &mx->n_factors,
+ PV_NONE))
goto lossage;
{
goto lossage;
{
-
in
t i;
+
size_
t i;
for (i = 0; i < mx->n_factors; i++)
{
for (i = 0; i < mx->n_factors; i++)
{
@@
-957,10
+961,11
@@
read_matrices_without_rowtype (struct matrix_data_pgm *mx)
nr.mx = mx;
nr.data = NULL;
nr.mx = mx;
nr.data = NULL;
- nr.factor_values = xmalloc (sizeof *nr.factor_values * mx->n_factors * mx->cells);
+ nr.factor_values = xnmalloc (mx->n_factors * mx->cells,
+ sizeof *nr.factor_values);
nr.max_cell_idx = 0;
nr.max_cell_idx = 0;
- nr.split_values = x
malloc (sizeof *nr.split_values
-
* dict_get_split_cnt (default_dict)
);
+ nr.split_values = x
nmalloc (dict_get_split_cnt (default_dict),
+
sizeof *nr.split_values
);
vfm_source = create_case_source (&matrix_data_without_rowtype_source_class, &nr);
vfm_source = create_case_source (&matrix_data_without_rowtype_source_class, &nr);
@@
-1138,7
+1143,7
@@
matrix_data_read_without_rowtype (struct case_source *source,
{
int *cp;
{
int *cp;
- nr->data = pool_
alloc (mx->container, (PROX + 1) *
sizeof *nr->data);
+ nr->data = pool_
nalloc (mx->container, PROX + 1,
sizeof *nr->data);
{
int i;
{
int i;
@@
-1161,12
+1166,12
@@
matrix_data_read_without_rowtype (struct case_source *source,
int n_vectors = per_factor ? mx->cells : 1;
int i;
int n_vectors = per_factor ? mx->cells : 1;
int i;
- nr->data[*cp] = pool_alloc (mx->container,
-
n_vectors *
sizeof **nr->data);
+ nr->data[*cp] = pool_
n
alloc (mx->container,
+
n_vectors,
sizeof **nr->data);
for (i = 0; i < n_vectors; i++)
for (i = 0; i < n_vectors; i++)
- nr->data[*cp][i] = pool_alloc (mx->container,
-
n_entries *
sizeof ***nr->data);
+ nr->data[*cp][i] = pool_
n
alloc (mx->container,
+
n_entries,
sizeof ***nr->data);
}
}
}
}
}
}
@@
-1306,7
+1311,7
@@
nr_read_factors (struct nr_aux_data *nr, int cell)
}
{
}
{
-
in
t i;
+
size_
t i;
for (i = 0; i < mx->n_factors; i++)
{
for (i = 0; i < mx->n_factors; i++)
{
@@
-1400,7
+1405,7
@@
nr_output_data (struct nr_aux_data *nr, struct ccase *c,
for (cell = 0; cell < mx->cells; cell++)
{
{
for (cell = 0; cell < mx->cells; cell++)
{
{
-
in
t factor;
+
size_
t factor;
for (factor = 0; factor < mx->n_factors; factor++)
{
for (factor = 0; factor < mx->n_factors; factor++)
{
@@
-1430,7
+1435,7
@@
nr_output_data (struct nr_aux_data *nr, struct ccase *c,
int content;
{
int content;
{
-
in
t factor;
+
size_
t factor;
for (factor = 0; factor < mx->n_factors; factor++)
case_data_rw (c, mx->factors[factor]->fv)->f = SYSMIS;
for (factor = 0; factor < mx->n_factors; factor++)
case_data_rw (c, mx->factors[factor]->fv)->f = SYSMIS;
@@
-1544,7
+1549,7
@@
wr_read_splits (struct wr_aux_data *wr,
else
{
compare = 0;
else
{
compare = 0;
- wr->split_values = x
malloc (split_cnt *
sizeof *wr->split_values);
+ wr->split_values = x
nmalloc (split_cnt,
sizeof *wr->split_values);
}
{
}
{
@@
-1639,7
+1644,7
@@
wr_output_data (struct wr_aux_data *wr,
struct factor_data *iter;
int i;
struct factor_data *iter;
int i;
- factors = x
malloc (sizeof *factors * mx->cell
s);
+ factors = x
nmalloc (mx->cells, sizeof *factor
s);
for (i = 0, iter = wr->data; iter; iter = iter->next, i++)
factors[i] = iter;
for (i = 0, iter = wr->data; iter; iter = iter->next, i++)
factors[i] = iter;
@@
-1661,7
+1666,7
@@
wr_output_data (struct wr_aux_data *wr,
for (iter = wr->data; iter; iter = iter->next)
{
{
for (iter = wr->data; iter; iter = iter->next)
{
{
-
in
t factor;
+
size_
t factor;
for (factor = 0; factor < mx->n_factors; factor++)
case_data_rw (c, mx->factors[factor]->fv)->f
for (factor = 0; factor < mx->n_factors; factor++)
case_data_rw (c, mx->factors[factor]->fv)->f
@@
-1762,7
+1767,7
@@
wr_read_factors (struct wr_aux_data *wr)
wr->content = -1;
{
wr->content = -1;
{
-
in
t i;
+
size_
t i;
for (i = 0; i < mx->n_factors; i++)
{
for (i = 0; i < mx->n_factors; i++)
{
@@
-1799,7
+1804,7
@@
wr_read_factors (struct wr_aux_data *wr)
mechanism. */
if (wr->current)
{
mechanism. */
if (wr->current)
{
-
in
t i;
+
size_
t i;
for (i = 0; i < mx->n_factors; i++)
if (factor_values[i] != wr->current->factors[i])
for (i = 0; i < mx->n_factors; i++)
if (factor_values[i] != wr->current->factors[i])
@@
-1814,7
+1819,7
@@
cache_miss:
for (iter = wr->data; iter; iter = iter->next)
{
for (iter = wr->data; iter; iter = iter->next)
{
-
in
t i;
+
size_
t i;
for (i = 0; i < mx->n_factors; i++)
if (factor_values[i] != iter->factors[i])
for (i = 0; i < mx->n_factors; i++)
if (factor_values[i] != iter->factors[i])
@@
-1831,10
+1836,11
@@
cache_miss:
{
struct factor_data *new = pool_alloc (mx->container, sizeof *new);
{
struct factor_data *new = pool_alloc (mx->container, sizeof *new);
- new->factors = pool_alloc (mx->container, sizeof *new->factors * mx->n_factors);
+ new->factors = pool_nalloc (mx->container,
+ mx->n_factors, sizeof *new->factors);
{
{
-
in
t i;
+
size_
t i;
for (i = 0; i < mx->n_factors; i++)
new->factors[i] = factor_values[i];
for (i = 0; i < mx->n_factors; i++)
new->factors[i] = factor_values[i];
@@
-1882,8
+1888,8
@@
wr_read_indeps (struct wr_aux_data *wr)
if (type == 1)
n_items *= mx->n_continuous;
if (type == 1)
n_items *= mx->n_continuous;
- c->data[wr->content] = pool_alloc (mx->container,
-
sizeof **c->data * n_items
);
+ c->data[wr->content] = pool_
n
alloc (mx->container,
+
n_items, sizeof **c->data
);
}
cp = &c->data[wr->content][n_rows * mx->n_continuous];
}
cp = &c->data[wr->content][n_rows * mx->n_continuous];