pspp-dev
[Top][All Lists]
Advanced

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

variable structure modification


From: Jason Stover
Subject: variable structure modification
Date: Tue, 22 Nov 2005 15:47:26 +0000
User-agent: Mutt/1.4.2.1i

I thought I should run this by everyone before
checking anything in.

I have added the following two pieces of information
to the variable structure:

    /* Values of a categorical variable which are in the active
       file. Procedures need vectors with binary entries, so any
       variable of type ALPHA will have its values stored here. */
    struct cat_vals *obs_vals;
    bool values_stored; /* True if a variables' values are encoded in
                           obs_vals.  A procedure may create
                           obs_vals, then another procedure may
                           destroy it. If values_stored is true, the
                           procedure that needs the encoding does not
                           need to pass the data again to find the
                           encoding. If values_stored is false, the
                           procedure must make an extra data pass.
                        */

This makes the binary encoding MUCH easier for
any modeling procedure. It allowed me to simplify cat.c. I was
going to keep a more complicated data structure inside the
variable struct, as described in earlier email, but that seems
to be overly complex overkill at this time. 

In addition to adding the above information to a variable 
structure in var.h, I need to add two lines like this:

        v->obs_vals = NULL;
        v->values_stored = false;

anywhere a variable struct * v is created. Where are the variables
allocated, and may I add such information without stepping an anyone's
toes?

Those two modifications (the first to var.h, the second to the place
where variables are allocated) are the only changes I need to make.

Transformations that alter categorical variables can drop this info
by just setting v->values_stored to false and destroying v->obs_vals.

-Jason

-- 
address@hidden
SDF Public Access UNIX System - http://sdf.lonestar.org




reply via email to

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