/************************************************************ * * * Permission is hereby granted to any individual or * * institution for use, copying, or redistribution of * * this code and associated documentation, provided * * that such code and documentation are not sold for * * profit and the following copyright notice is retained * * in the code and documentation: * * Copyright (c) held by Dianne Cook * * All Rights Reserved. * * * * Questions and comments are welcome, and I request * * that you share any modifications with me. * * * * Dianne Cook * * dicook@iastate.edu * * * ************************************************************/ /* gt.c */ #define _GT_C #define WINDOWSIZE 1.0 #include #include #include #include #include #include "defs_and_types.h" #include "util.h" #include "gt.h" #include "gt_util.h" /* local variables */ static float **gt_world; static float **gt_proj; static float **gt_plot; static float *shift; static float **xi, **xi0, **xi1; float **u, **u_init; static float **u0, **u1; static float **v0, **v1; static float **b; static float **w, **w0, **w1; static lims *lim; int *tour_vars, *active; int ntour_vars; static float **tv, **tmat; static float s[PROJ_DIM], coss[PROJ_DIM], sins[PROJ_DIM]; static float *tau, *tinc; static float step, dv, delta; static int spandim; static int ds; static int generate_new_path = 0; int got_new_target_plane; static int count=0; int stepscale; int pdim; int tourlength; /* external variables */ extern int ncols, ncols_used, nrows; extern char **collab; extern char **color_name; extern float **raw_data; extern int *vgroup_ids; void *gt_malloc(size_t our_size) { void *rpt=NULL; if((rpt=malloc(our_size))==NULL) { fprintf(stderr, "Could not allocate memory (gt_malloc in gt.c)\n"); exit(1); } return(rpt); } /* * This only gives the correct result if the * vgroups vector is of the form {0,1,2,...,ngroups-1} */ int numvargroups() { int j, nvgroups = 0; for (j=0; j nvgroups) nvgroups = vgroup_ids[j]; nvgroups++; return(nvgroups); } /* * Find the minimum and maximum values of each column or variable * group scaling by mean and std_width standard deviations. */ void mean_lgdist(float **data, float *min, float *max) { int i, j, k, n; double dx; double sumxi; double sumdist = 0.0; double *mean, lgdist = 0.0; int nvgroups = numvargroups(); mean = (double *) gt_malloc((unsigned int) ncols * sizeof(double)); for (j=0; j lgdist) lgdist = sumdist; } lgdist = sqrt(lgdist); for (j=0; j the * projection dimension. */ { for (i=0; i ncols) { printf("The projection dimension exceeds the number of variables in the data.\n"); exit(1); } read_config(data_in);/* first projection and active variables */ u0_gets_current_pos(u, u_init, ncols, ntour_vars, pdim); /* set tour_vars vector */ ntour_vars = 0; for (j=0; j pdim) { path(u0, u1, v0, v1, b, w0, w1, ncols, ntour_vars, tour_vars, pdim, tau, tv, &dv, &delta, &step, &spandim, &ds); preproject_data(); } for (i=0; i