/[ascend]/trunk/base/generic/linear/mtx_basic.c
ViewVC logotype

Diff of /trunk/base/generic/linear/mtx_basic.c

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

revision 1379 by jpye, Thu Mar 8 02:45:16 2007 UTC revision 1380 by jpye, Fri Apr 6 04:07:32 2007 UTC
# Line 53  int super_check_matrix( mtx_matrix_t mtx Line 53  int super_check_matrix( mtx_matrix_t mtx
53    /* Test consistency of permutation arrays */    /* Test consistency of permutation arrays */
54    for( ndx=ZERO ; ndx < mtx->capacity ; ++ndx ) {    for( ndx=ZERO ; ndx < mtx->capacity ; ++ndx ) {
55      if( mtx->perm.row.org_to_cur[mtx->perm.row.cur_to_org[ndx]] != ndx ) {      if( mtx->perm.row.org_to_cur[mtx->perm.row.cur_to_org[ndx]] != ndx ) {
56          
57        ERROR_REPORTER_HERE(ASC_PROG_ERR,"Permutation violation in row %d.\n", ndx);        ERROR_REPORTER_HERE(ASC_PROG_ERR,"Permutation violation in row %d.\n", ndx);
58          errcnt++;          errcnt++;
59      }      }
60      if( mtx->perm.col.org_to_cur[mtx->perm.col.cur_to_org[ndx]] != ndx ) {      if( mtx->perm.col.org_to_cur[mtx->perm.col.cur_to_org[ndx]] != ndx ) {
61          
62        ERROR_REPORTER_HERE(ASC_PROG_ERR,"Permutation violation in col %d.\n",ndx);        ERROR_REPORTER_HERE(ASC_PROG_ERR,"Permutation violation in col %d.\n",ndx);
63        errcnt++;        errcnt++;
64      }      }
65    }    }
66    
67    if( mtx->order > mtx->capacity ) {    if( mtx->order > mtx->capacity ) {
68        
69      ERROR_REPORTER_HERE(ASC_PROG_ERR,"Capacity %d is less than order %d\n",      ERROR_REPORTER_HERE(ASC_PROG_ERR,"Capacity %d is less than order %d\n",
70        mtx->capacity,mtx->order);        mtx->capacity,mtx->order);
71      errcnt++;      errcnt++;
# Line 77  int super_check_matrix( mtx_matrix_t mtx Line 77  int super_check_matrix( mtx_matrix_t mtx
77      org_row = mtx->perm.row.cur_to_org[ndx];      org_row = mtx->perm.row.cur_to_org[ndx];
78      org_col = mtx->perm.col.cur_to_org[ndx];      org_col = mtx->perm.col.cur_to_org[ndx];
79      if( NOTNULL(mtx->hdr.row[org_row]) ) {      if( NOTNULL(mtx->hdr.row[org_row]) ) {
80          
81        ERROR_REPORTER_HERE(ASC_PROG_ERR,"Non-zeros found in non-existent row %d.\n",ndx);        ERROR_REPORTER_HERE(ASC_PROG_ERR,"Non-zeros found in non-existent row %d.\n",ndx);
82        errcnt++;        errcnt++;
83      }      }
84      if( NOTNULL(mtx->hdr.col[org_col]) ) {      if( NOTNULL(mtx->hdr.col[org_col]) ) {
85          
86        ERROR_REPORTER_HERE(ASC_PROG_ERR,"Non-zeros found in non-existent col %d.\n",ndx);        ERROR_REPORTER_HERE(ASC_PROG_ERR,"Non-zeros found in non-existent col %d.\n",ndx);
87        errcnt++;        errcnt++;
88      }      }
# Line 98  int super_check_matrix( mtx_matrix_t mtx Line 98  int super_check_matrix( mtx_matrix_t mtx
98        if( elt->row != mtx_NONE ) {        if( elt->row != mtx_NONE ) {
99          ++rowc;          ++rowc;
100          if( elt->row != org_row ) {          if( elt->row != org_row ) {
101              
102            ERROR_REPORTER_HERE(ASC_PROG_ERR,"Element mismatch in row %d.\n", ndx);            ERROR_REPORTER_HERE(ASC_PROG_ERR,"Element mismatch in row %d.\n", ndx);
103            errcnt++;            errcnt++;
104          }          }
105        } else {        } else {
106            
107          ERROR_REPORTER_HERE(ASC_PROG_ERR,"Disclaimed element in row %d.\n", ndx);          ERROR_REPORTER_HERE(ASC_PROG_ERR,"Disclaimed element in row %d.\n", ndx);
108          errcnt++;          errcnt++;
109        }        }
# Line 112  int super_check_matrix( mtx_matrix_t mtx Line 112  int super_check_matrix( mtx_matrix_t mtx
112        if( elt->col != mtx_NONE ) {        if( elt->col != mtx_NONE ) {
113          ++colc;          ++colc;
114          if( elt->col != org_col ) {          if( elt->col != org_col ) {
115              
116            ERROR_REPORTER_HERE(ASC_PROG_ERR,"Element mismatch in col %d.\n", ndx);            ERROR_REPORTER_HERE(ASC_PROG_ERR,"Element mismatch in col %d.\n", ndx);
117            errcnt++;            errcnt++;
118          }          }
119        } else {        } else {
120            
121          ERROR_REPORTER_HERE(ASC_PROG_ERR,"Disclaimed element in col %d.\n", ndx);          ERROR_REPORTER_HERE(ASC_PROG_ERR,"Disclaimed element in col %d.\n", ndx);
122          errcnt++;          errcnt++;
123        }        }
124      }      }
125    }    }
126    if( rowc != colc ) {    if( rowc != colc ) {
127        
128      ERROR_REPORTER_HERE(ASC_PROG_ERR,"Non-zero discrepancy, %d by row, %d by col.\n",      ERROR_REPORTER_HERE(ASC_PROG_ERR,"Non-zero discrepancy, %d by row, %d by col.\n",
129        rowc, colc);        rowc, colc);
130      errcnt++;      errcnt++;
# Line 138  int super_check_matrix( mtx_matrix_t mtx Line 138  int super_check_matrix( mtx_matrix_t mtx
138  boolean check_matrix( mtx_matrix_t mtx, char *file, int line){  boolean check_matrix( mtx_matrix_t mtx, char *file, int line){
139    
140     if( ISNULL(mtx) ) {     if( ISNULL(mtx) ) {
141          
142        ERROR_REPORTER_HERE(ASC_PROG_ERR,"NULL matrix in %s line %d.\n",file,line);        ERROR_REPORTER_HERE(ASC_PROG_ERR,"NULL matrix in %s line %d.\n",file,line);
143        return 0;        return 0;
144     }     }
# Line 147  boolean check_matrix( mtx_matrix_t mtx, Line 147  boolean check_matrix( mtx_matrix_t mtx,
147        case OK:        case OK:
148           break;           break;
149        case DESTROYED:        case DESTROYED:
150            
151           FPRINTF(g_mtxerr,           FPRINTF(g_mtxerr,
152             "        Matrix deceased found in %s line %d.\n",file,line);             "        Matrix deceased found in %s line %d.\n",file,line);
153           return 0;           return 0;
154        default:        default:
155            
156           ERROR_REPORTER_HERE(ASC_PROG_ERR,"Matrix garbage found in %s line %d.\n",           ERROR_REPORTER_HERE(ASC_PROG_ERR,"Matrix garbage found in %s line %d.\n",
157             file,line);             file,line);
158           return 0;           return 0;
# Line 168  boolean check_matrix( mtx_matrix_t mtx, Line 168  boolean check_matrix( mtx_matrix_t mtx,
168     return 1;     return 1;
169  }  }
170    
171  /*  /*
172      this function checks the consistency of a sparse as best it can.      this function checks the consistency of a sparse as best it can.
173      @return FALSE if something wierd      @return FALSE if something wierd
174  */  */
# Line 1668  static int enlarge_sparse(mtx_sparse_t * Line 1668  static int enlarge_sparse(mtx_sparse_t *
1668      inew = (int32 *)ascrealloc(ret->idata,sizeof(int32)*len);      inew = (int32 *)ascrealloc(ret->idata,sizeof(int32)*len);
1669    }    }
1670    if (ISNULL(inew)) {    if (ISNULL(inew)) {
1671        
1672      ERROR_REPORTER_HERE(ASC_PROG_ERR,"          Insufficient memory.\n");      ERROR_REPORTER_HERE(ASC_PROG_ERR,"          Insufficient memory.\n");
1673      return 1;      return 1;
1674    }    }
# Line 1680  static int enlarge_sparse(mtx_sparse_t * Line 1680  static int enlarge_sparse(mtx_sparse_t *
1680      dnew = (real64 *)ascrealloc(ret->data,sizeof(real64)*len);      dnew = (real64 *)ascrealloc(ret->data,sizeof(real64)*len);
1681    }    }
1682    if (ISNULL(dnew)) {    if (ISNULL(dnew)) {
1683        
1684      ERROR_REPORTER_HERE(ASC_PROG_ERR,"          Insufficient memory.\n");      ERROR_REPORTER_HERE(ASC_PROG_ERR,"          Insufficient memory.\n");
1685      return 1;      return 1;
1686    }    }
# Line 3171  int mtx_write_region_mmio(FILE *fp,mtx_m Line 3171  int mtx_write_region_mmio(FILE *fp,mtx_m
3171      struct element_t Rewind, *elt;      struct element_t Rewind, *elt;
3172      mtx_coord_t nz;      mtx_coord_t nz;
3173    
3174        CONSOLE_DEBUG("ABOUT TO PRINT MATRIX");
3175    
3176      if(!mtx_check_matrix(mtx))return 1;      if(!mtx_check_matrix(mtx))return 1;
3177    
3178      mm_initialize_typecode(&matcode);      mm_initialize_typecode(&matcode);

Legend:
Removed from v.1379  
changed lines
  Added in v.1380

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