///////////////////////////////////////////////////////////////////////////////// //// //// Visualization of the nonzero pattern of JtJ in EPS format. //// This is part of the sba package, //// Copyright (C) 2004 Manolis Lourakis (lourakis@ics.forth.gr) //// Institute of Computer Science, Foundation for Research & Technology - Hellas //// Heraklion, Crete, Greece. //// //// This program is free software; you can redistribute it and/or modify //// it under the terms of the GNU General Public License as published by //// the Free Software Foundation; either version 2 of the License, or //// (at your option) any later version. //// //// This program is distributed in the hope that it will be useful, //// but WITHOUT ANY WARRANTY; without even the implied warranty of //// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //// GNU General Public License for more details. //// /////////////////////////////////////////////////////////////////////////////////// #include #include #include #include #include "sba.h" #if 0 #define HORZ_OFFSET 3 // horizontal offset from left edge of paper in PostScript points (~ 1 mm) #define VERT_OFFSET 6 // vertical offset from lower edge of paper in PostScript points (~ 2 mm) #else #define HORZ_OFFSET 0 #define VERT_OFFSET 0 #endif #define A4_WIDTH 595 // A4 paper width in PostScript points (210 mm, 1 pt = 25.4/72 mm) //#define A4_HEIGHT 842 // A4 paper height in PostScript points (297 mm) /* 1.1x1.1 looks better than 1.0x1.0 */ #define DOT_WIDTH 1.1 #define DOT_HEIGHT 1.1 /* saves the nonzero pattern of JtJ in EPS format. If mcon!=0, then all U_j and W_ij with j y * | * | * | * v x */ fprintf(fp, "%d %d translate\n-90 rotate\n", HORZ_OFFSET, A4_WIDTH+VERT_OFFSET); /* scale the coordinate system so that the hessian pattern fits in the narrowest page dimension */ fprintf(fp, "%.4lf %.4lf scale\n", ((double)(A4_WIDTH-HORZ_OFFSET))/nvars, ((double)(A4_WIDTH-HORZ_OFFSET))/nvars); /* define dot dimensions */ fprintf(fp, "/w %g def\n/h %g def\n", DOT_WIDTH, DOT_HEIGHT); /* define shorthand for rectfill */ fprintf(fp, "/R { rectfill } bind def\n\n"); /* process block row j: [0, ..., 0, U_j, 0, ..., 0, W1j, ..., Wnj] */ for(j=mcon; jval[rcidxs[i]]*Wsz; j0=mmcon*cnp+rcsubs[i]*pnp; for(jj=0; jjval[rcidxs[j]]*Wsz; j0=(rcsubs[j]-mcon)*cnp; for(jj=0; jj