pspp-cvs
[Top][All Lists]
Advanced

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

[Pspp-cvs] pspp/src regression_export.h


From: Jason H Stover
Subject: [Pspp-cvs] pspp/src regression_export.h
Date: Sun, 01 Jan 2006 00:04:04 +0000

CVSROOT:        /sources/pspp
Module name:    pspp
Branch:         
Changes by:     Jason H Stover <address@hidden> 06/01/01 00:04:04

Modified files:
        src            : regression_export.h 

Log message:
        Categorical dependent variables for EXPORTed models

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/regression_export.h.diff?tr1=1.2&tr2=1.3&r1=text&r2=text

Patches:
Index: pspp/src/regression_export.h
diff -u pspp/src/regression_export.h:1.2 pspp/src/regression_export.h:1.3
--- pspp/src/regression_export.h:1.2    Fri Dec 30 05:00:04 2005
+++ pspp/src/regression_export.h        Sun Jan  1 00:04:03 2006
@@ -127,10 +127,21 @@
   a vector which does not match its categorical value in the model.
  */
 const char reg_export_categorical_encode_1[] = "struct 
pspp_reg_categorical_variable\n"
-"{\n\tchar * name;\n\tsize_t n_vals;\n\tchar *[] values;\n};\n\n"
-"static\ndouble * get_value_vector (char *v)\n{\n\tdouble *result;\n\t";
-
-const char reg_export_categorical_encode_2[] = "; i++)\n\t{\n\t\tif (strcmp 
(v, values[i]) == 0)"
-"\n\t\t{\n\t\t\tresult[i] = 1.0;\n\t\t}\n\t}\n\treturn result;\n}\n";
+"{\n\tchar * name;\n\tsize_t n_vals;\n\tchar *values[1024];\n};\n\n"
+"/*\n   This function returns the binary vector which corresponds to the 
value\n"
+"   of the categorical variable stored in 'value'. The name of the variable 
is\n"
+"   stored in the 'var' argument. Notice the values stored in the\n"
+"   pspp_categorical_variable structures all end with a space character.\n"
+"   That means the values of the categorical variables you pass to any 
function\n"
+"   in this program should also end with a space character.\n*/\n"
+"static\ndouble * pspp_reg_get_value_vector (char *var, char 
*value)\n{\n\tdouble *result;\n\t"
+"int i;\n\t";
 
+const char reg_export_categorical_encode_2[] = "int v_index = 0;\n\t"
+"while (v_index < n_vars && strcmp (var, varlist[i]->name) != 0)\n\t{\n\t\t"
+"v_index++;\n\t}\n\tresult = (double *) malloc (varlist[v_index]->n_vals * 
sizeof (*result));\n\t"
+"for (i = 0; i < varlist[v_index]->n_vals; i++)\n\t{\n\t\t"
+"if (strcmp ( (varlist[v_index]->values)[i], value) == 0)\n\t\t{\n\t\t\t"
+"result[i] = 1.0;\n\t\t}\n\t\telse result[i] = 0.0;\n\t}\n\n\t"
+"return result;\n}\n\n";
 #endif




reply via email to

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