[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: dict_var_resized
From: |
John Darrington |
Subject: |
Re: dict_var_resized |
Date: |
Tue, 5 May 2009 09:49:24 +0800 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
On Mon, May 04, 2009 at 10:56:02AM -0400, Jason Stover wrote:
> Incidently, the code I posted in my previous email was possibly
> confusing because var_create_internal is supposed to take the
> casereader index as its argument, not the width of the variable as I
> had implied. We'd need to create a new function in variable.c to do
> what Jason wants.
I thought I needed to call var_set_width to store enough characters
for the variable's values. Should I stop worrying about the size of
the variable, and instead call value_resize on union values if
necessary?
Are these union values contained by any casereader? or are they just
lying around on the heap? If they're part of a casereader, then it's
not safe to resize them (without special precautions). If they're on
the heap (in which case let's hope there's not too many of them),
then resizing them is ok.
I just used solution 1 by dropping var_set_width, and it ran. Given
the discussion, there seems to be no reason for me to call
var_set_width, as John suggested. It's simpler code, too.
There's a number of things I'm not sure about in the
interactions/covariance-matrix/glm code.
interaction_variable_create creates this internal variable. But
the only place it seems to be used is in interaction_case_data, and
there, the only use it has is to compare its dict_index
with that of another variable. For internal variables, the
dict_index is merely a serial number, so comparing the dict_indexes is
probably doing nothing more than comparing the variable pointers
themselves.
The following points might help you:
0. The concept of "internal" variables is a convenience, but not one
that has been particularly well thought out (IMO).
1. Are you sure this internal variable needs to be a string
variable? In the past, internal variables have always been
numeric and used for storing some temporary value. If you can use
a numeric variable I think it'll make a lot of things simpler.
2. You need to understand that "internal" variables are nothing more
than a convenience to allow the programmer to write
case_data (&c, var) instead of case_data_idx (&c, index). The
internal variable must be associated with a particular
casereader, otherwise it serves no purpose (that I can envisage).
3. Calling var_create_internal (0) implies that you are going
to be creating a new casereader with new data in its first position.
--
PGP Public key ID: 1024D/2DE827B3
fingerprint = 8797 A26D 0854 2EAB 0285 A290 8A67 719C 2DE8 27B3
See http://pgp.mit.edu or any PGP keyserver for public key.
signature.asc
Description: Digital signature
- dict_var_resized, Jason Stover, 2009/05/01
- Re: dict_var_resized, John Darrington, 2009/05/01
- Re: dict_var_resized, Ben Pfaff, 2009/05/01
- Re: dict_var_resized, John Darrington, 2009/05/03
- Re: dict_var_resized, Jason Stover, 2009/05/04
- Re: dict_var_resized,
John Darrington <=
- Re: dict_var_resized, Jason Stover, 2009/05/05
- Re: dict_var_resized, John Darrington, 2009/05/05
- Re: dict_var_resized, Jason Stover, 2009/05/06
- Re: dict_var_resized, John Darrington, 2009/05/07