/* tour_util.c */ /************************************************************ * * * Permission is hereby granted to any individual or * * institution for use, copying, or redistribution of * * the xgobi 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) 1990, ..., 1996 Bellcore * * * * We welcome your questions and comments, and request * * that you share any modifications with us. * * * * Deborah F. Swayne Dianne Cook * * dfs@research.att.com dicook@iastate.edu * * (973) 360-8423 www.public.iastate.edu/~dicook/ * * * * Andreas Buja * * andreas@research.att.com * * www.research.att.com/~andreas/ * * * ************************************************************/ #include #include #include #include #include "xincludes.h" #include "xgobitypes.h" #include "xgobivars.h" #include "xgobiexterns.h" void copy_basis(float **source, float **target, int n) { int i, j; for (i=0; i<2; i++) for (j=0; j tmpf1) tmpf1 = x1[i]; return(tmpf1); } float sq_inner_prod(float *x1, float *x2, int n) { float xip; int j; xip = 0; for (j=0; jfl == NULL) { xg->curr = (hist_rec *) XtMalloc( (unsigned int) sizeof(hist_rec)); xg->curr->hist[0] = (float *) XtMalloc( (unsigned int) xg->ncols * sizeof(float)); xg->curr->hist[1] = (float *) XtMalloc( (unsigned int) xg->ncols * sizeof(float)); } else { xg->curr = xg->fl; xg->fl = xg->fl->prev; } } void check_deselection(int varno, xgobidata *xg) { int i, done; if (xg->u0[0][varno] == 1.0) { done = 0; i = 0; while (!done && (i <= xg->numvars_t)) { if ((xg->u0[1][xg->tour_vars[i]] != 1.0) && (xg->tour_vars[i] != varno)) { xg->u0[0][varno] = 0.0; xg->u0[0][xg->tour_vars[i]] = 1.0; copy_u0_to_pd0(xg); change_first_projection(0, i, xg); done = 1; } i++; } } else if (xg->u0[1][varno] == 1.0) { done = 0; i = 0; while (!done && (i <= xg->numvars_t)) { if ((xg->u0[0][xg->tour_vars[i]] != 1.0) && (xg->tour_vars[i] != varno)) { xg->u0[1][varno] = 0.0; xg->u0[1][xg->tour_vars[i]] = 1.0; copy_u0_to_pd0(xg); change_first_projection(1, i, xg); done = 1; } i++; } } copy_basis(xg->u0, xg->u, xg->ncols_used); copy_basis(xg->u0, xg->u1, xg->ncols_used); copy_u1_to_pd1(xg); world_to_plane(xg); plane_to_screen(xg); plot_once(xg); tour_var_lines(xg); } void copy_matrix(float **M1, float **M2, int n, int p) { int i, j; for (i=0; i