[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


From: Jason Stover
Subject: dict_var_resized
Date: Fri, 1 May 2009 17:29:46 -0400
User-agent: Mutt/1.5.18 (2008-05-17)

I was just testing the code in covariance-matrix.c and interaction.c.
A pointer to a dictionary is null somewhere "down there" in
dictionary.c, so I have a question about how dictionaries are created
and populated.

For completeness, below is a summary of the execution path. Everything
looks OK to me until the code in dictionary.c. If you want to just
skip to the problem, see the line marked PROBLEM below.

The path of execution starts here, in a modified version of glm.q
( to see the whole file):

      size_t n_inter = 2;
      interaction_vars = xnmalloc (n_inter, sizeof (*interaction_vars));
      interaction_vars[0] = all_vars[0];
      interaction_vars[1] = all_vars[1];
      interactions[0] = interaction_variable_create (interaction_vars, n_inter);

Then in interaction_variable_create (interaction_vars, n_inter) in

struct interaction_variable *
interaction_variable_create (const struct variable **vars, int n_vars)
  struct interaction_variable *result = NULL;
  size_t i;

  if (n_vars > 0)
      result = xmalloc (sizeof (*result));
      result->n_alpha = 0;
      result->members = xnmalloc (n_vars, sizeof (*result->members));
      result->intr = var_create_internal (0);
      result->n_vars = n_vars;
      for (i = 0; i < n_vars; i++)
        result->members[i] = vars[i];
          if (var_is_alpha (vars[i]))
    VAR_SET_WIDTH sets the type of the variable.
  var_set_width (result->intr, MAX_SHORT_STRING * result->n_alpha + 1);

...then to var_set_width:

      dict_var_resized (v, new_val_count - old_val_count);

...then to dict_var_resized, line 1050 of dictionary.c:

     for (i = 0; i < d->var_cnt; ++i)

PROBLEM: d is null.

My questions:

1. Is d null because I haven't called some function that creates it
yet? Or some other reason?  (Notice this all happens before passing
through the data.)

2. Where can I learn more about the relevant issue here?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]