/[ascend]/trunk/base/generic/solver/block.c
ViewVC logotype

Diff of /trunk/base/generic/solver/block.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1270 by johnpye, Fri Jan 26 22:24:56 2007 UTC revision 1271 by johnpye, Sun Feb 4 02:00:01 2007 UTC
# Line 33  Line 33 
33  #include "slv_stdcalls.h"  #include "slv_stdcalls.h"
34  #include "model_reorder.h"  #include "model_reorder.h"
35    
36  #define RIDEBUG 0 /* reindex debugging */  /* #define REINDEX_DEBUG */
37  #define SBPDEBUG 0 /* slv_block_partition_real debugging */  /* #define BLOCKPARTITION_DEBUG */
38    /* #define CUT_DEBUG */
39    
40  /* global to get around the mr header (for tear_subreorder) */  /* global to get around the mr header (for tear_subreorder) */
41  static  static
# Line 110  static int reindex_rels_from_mtx(slv_sys Line 111  static int reindex_rels_from_mtx(slv_sys
111     * do this only in the row range of interest. */     * do this only in the row range of interest. */
112    for (c=lo;c<=hi;c++) {    for (c=lo;c<=hi;c++) {
113      v = mtx_row_to_org(mtx,c);      v = mtx_row_to_org(mtx,c);
114  #if RIDEBUG  #ifdef REINDEX_DEBUG
115      if(c!=v){      if(c!=v){
116        CONSOLE_DEBUG("Old rel sindex (org) %d becoming sindex (cur) %d\n",v,c);        CONSOLE_DEBUG("Old rel sindex (org) %d becoming sindex (cur) %d\n",v,c);
117      }      }
# Line 138  static int reindex_rels_from_mtx(slv_sys Line 139  static int reindex_rels_from_mtx(slv_sys
139      @callergraph      @callergraph
140  */  */
141  int slv_block_partition_real(slv_system_t sys,int uppertriangular){  int slv_block_partition_real(slv_system_t sys,int uppertriangular){
142  #if SBPDEBUG  #ifdef BLOCKPARTITION_DEBUG
143    FILE *fp;    FILE *fp;
144  #endif  #endif
145    struct rel_relation **rp;    struct rel_relation **rp;
# Line 256  int slv_block_partition_real(slv_system_ Line 257  int slv_block_partition_real(slv_system_
257    d->reorder.basis_selection = 0;   /* none yet */    d->reorder.basis_selection = 0;   /* none yet */
258    d->reorder.block_reordering = 0;  /* none */    d->reorder.block_reordering = 0;  /* none */
259    
260  #if SBPDEBUG  #ifdef BLOCKPARTITION_DEBUG
261    fp = fopen("/tmp/sbp1.plot","w+");    fp = fopen("/tmp/sbp1.plot","w+");
262    if (fp !=NULL) {    if (fp !=NULL) {
263      mtx_write_region_plot(fp,mtx,mtx_ENTIRE_MATRIX);      mtx_write_region_plot(fp,mtx,mtx_ENTIRE_MATRIX);
# Line 321  int slv_block_partition_real(slv_system_ Line 322  int slv_block_partition_real(slv_system_
322  #endif  #endif
323    
324    
325  #if SBPDEBUG  #ifdef BLOCKPARTITION_DEBUG
326    fp = fopen("/tmp/sbp2.plot","w+");    fp = fopen("/tmp/sbp2.plot","w+");
327    if (fp !=NULL) {    if (fp !=NULL) {
328      mtx_write_region_plot(fp,mtx,mtx_ENTIRE_MATRIX);      mtx_write_region_plot(fp,mtx,mtx_ENTIRE_MATRIX);
# Line 360  extern void mc13emod(); Line 361  extern void mc13emod();
361   * doesn't grok inequalities.   * doesn't grok inequalities.
362   * CURRENTLY DOESN'T DO WELL WHEN NCOL<NROW   * CURRENTLY DOESN'T DO WELL WHEN NCOL<NROW
363   */   */
364  #define SBPDEBUG 0  #define BLOCKPARTITION_DEBUG 0
365  int slv_block_partition_harwell(slv_system_t sys)  int slv_block_partition_harwell(slv_system_t sys)
366  {  {
367  #\if SBPDEBUG  #\if BLOCKPARTITION_DEBUG
368    FILE *fp;    FILE *fp;
369  #\endif  #\endif
370    struct rel_relation **rp;    struct rel_relation **rp;
# Line 1026  extern int system_block_debug(slv_system Line 1027  extern int system_block_debug(slv_system
1027  */  */
1028    
1029  /**  /**
1030      This macro will generate 'var_list_debug(sys)' and 'rel_list_debug(sys)'      This macro will generate 'system_var_list_debug(sys)' and 'system_rel_list_debug(sys)'
1031      and maybe other useful things if you're lucky.      and maybe other useful things if you're lucky.
1032  */  */
1033  #define LIST_DEBUG(TYPE,FULLTYPE) \  #define LIST_DEBUG(TYPE,FULLTYPE) \
# Line 1049  extern int system_block_debug(slv_system Line 1050  extern int system_block_debug(slv_system
1050  LIST_DEBUG(var,var_variable)  LIST_DEBUG(var,var_variable)
1051  LIST_DEBUG(rel,rel_relation)  LIST_DEBUG(rel,rel_relation)
1052    
1053    #ifdef CUT_DEBUG
1054    # define MAYBE_WRITE_LIST(TYPE) system_##TYPE##_list_debug(sys)
1055    # define MAYBE_CONSOLE_DEBUG(MSG,...) CONSOLE_DEBUG(MSG,#ARGS)
1056    #else
1057    # define MAYBE_WRITE_LIST(TYPE)
1058    # define MAYBE_CONSOLE_DEBUG(MSG,...)
1059    #endif
1060    
1061  /**  /**
1062      This is a big durtie macro to perform cuts on our solvers_*_lists.      This is a big durtie macro to perform cuts on our solvers_*_lists.
1063      The function will start at position 'begin' and move through all elements      The function will start at position 'begin' and move through all elements
# Line 1066  LIST_DEBUG(rel,rel_relation) Line 1075  LIST_DEBUG(rel,rel_relation)
1075       \       \
1076          asc_assert(filt); \          asc_assert(filt); \
1077       \       \
1078          system_##TYPE##_list_debug(sys); \          MAYBE_WRITE_LIST(TYPE); \
1079       \       \
1080          list = slv_get_solvers_##TYPE##_list(sys); \          list = slv_get_solvers_##TYPE##_list(sys); \
1081          len = slv_get_num_solvers_##TYPE##s(sys); \          len = slv_get_num_solvers_##TYPE##s(sys); \
# Line 1075  LIST_DEBUG(rel,rel_relation) Line 1084  LIST_DEBUG(rel,rel_relation)
1084              return 1; \              return 1; \
1085          } \          } \
1086       \       \
1087          CONSOLE_DEBUG("SORTING"); \          MAYBE_CONSOLE_DEBUG("SORTING"); \
1088       \       \
1089          start = list + begin; \          start = list + begin; \
1090          end = list + len; \          end = list + len; \
# Line 1090  LIST_DEBUG(rel,rel_relation) Line 1099  LIST_DEBUG(rel,rel_relation)
1099              start++; \              start++; \
1100          } \          } \
1101       \       \
1102          system_##TYPE##_list_debug(sys); \          MAYBE_WRITE_LIST(TYPE); \
1103       \       \
1104          CONSOLE_DEBUG("UPDATING"); \          MAYBE_CONSOLE_DEBUG("UPDATING"); \
1105       \       \
1106          /* update the sindex for each after start */ \          /* update the sindex for each after start */ \
1107          *numgood = 0; \          *numgood = 0; \
1108          for(i=begin;i<len;++i){ \          for(i=begin;i<len;++i){ \
1109              name = TYPE##_make_name(sys,list[i]); \              name = TYPE##_make_name(sys,list[i]); \
1110              if(TYPE##_apply_filter(list[i],filt)){ \              if(TYPE##_apply_filter(list[i],filt)){ \
1111                  CONSOLE_DEBUG("%s: good",name); \                  MAYBE_CONSOLE_DEBUG("%s: good",name); \
1112                  (*numgood)++; \                  (*numgood)++; \
1113              }else{ \              }else{ \
1114                  CONSOLE_DEBUG("%s: bad",name); \                  MAYBE_CONSOLE_DEBUG("%s: bad",name); \
1115              } \              } \
1116              ASC_FREE(name); \              ASC_FREE(name); \
1117              TYPE##_set_sindex(list[i],i); \              TYPE##_set_sindex(list[i],i); \
1118          } \          } \
1119          CONSOLE_DEBUG("numgood = %d",*numgood); \          MAYBE_CONSOLE_DEBUG("numgood = %d",*numgood); \
1120           \           \
1121          return 0; \          return 0; \
1122      }      }

Legend:
Removed from v.1270  
changed lines
  Added in v.1271

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22