diff --git a/drivers/iohb.c b/drivers/iohb.c index e4afcb9f9b41a2fc82fab9423834707131180c81..c4aec8d7207987ee541cd40180e041b61eb6a215 100644 --- a/drivers/iohb.c +++ b/drivers/iohb.c @@ -592,12 +592,14 @@ int readHB_aux_double(const char* filename, const char AuxType, double b[]) if (Nrhs <= 0) { fprintf(stderr, "Warn: Attempt to read auxillary vector(s) when none are present.\n"); + fclose(in_file); return 0; } if (Rhstype[0] != 'F' ) { fprintf(stderr,"Warn: Attempt to read auxillary vector(s) which are not stored in Full form.\n"); fprintf(stderr," Rhs must be specified as full. \n"); + fclose(in_file); return 0; } @@ -615,10 +617,12 @@ int readHB_aux_double(const char* filename, const char AuxType, double b[]) if ( AuxType == 'G' && Rhstype[1] != 'G' ) { fprintf(stderr, "Warn: Attempt to read auxillary Guess vector(s) when none are present.\n"); + fclose(in_file); return 0; } if ( AuxType == 'X' && Rhstype[2] != 'X' ) { fprintf(stderr, "Warn: Attempt to read auxillary eXact solution vector(s) when none are present.\n"); + fclose(in_file); return 0; } @@ -1344,7 +1348,7 @@ int writeHB_mat_char(const char* filename, int M, int N, int Ptrperline, Ptrwidth, Indperline, Indwidth; int Rhsperline, Rhswidth, Rhsprec; char Rhsflag; - int Valperline=0, Valwidth, Valprec; + int Valperline=1, Valwidth, Valprec; char Valflag; /* Indicates 'E','D', or 'F' float format */ char pformat[16],iformat[16],vformat[19],rformat[19]; diff --git a/drivers/readijv.c b/drivers/readijv.c index 65a6c8bc4fe817c61ebcaad8cea9a1f32ffb1a12..0e619fdba861c7f27ec046c50f00cfd835661ba1 100644 --- a/drivers/readijv.c +++ b/drivers/readijv.c @@ -141,6 +141,7 @@ readIJV( const char *dirname, if (iafile == NULL) { fprintf(stderr,"readijv: Cannot open the ia file (%s)\n", filename); + free(filename); return PASTIX_ERR_BADPARAMETER; } @@ -150,6 +151,7 @@ readIJV( const char *dirname, { fprintf(stderr,"readijv: Cannot open the ja file (%s)\n", filename); fclose(iafile); + free(filename); return PASTIX_ERR_BADPARAMETER; } @@ -160,6 +162,7 @@ readIJV( const char *dirname, fprintf(stderr,"readijv: Cannot open the ra file (%s)\n", filename); fclose(iafile); fclose(jafile); + free(filename); return PASTIX_ERR_BADPARAMETER; } @@ -178,6 +181,10 @@ readIJV( const char *dirname, ( 1 != fscanf(rafile,"%le\n", &temp3)) ) { fprintf(stderr, "ERROR: reading matrix\n"); + fclose(iafile); + fclose(jafile); + fclose(rafile); + free(filename); return PASTIX_ERR_IO; } *temprow = (pastix_int_t)temp1; @@ -187,6 +194,6 @@ readIJV( const char *dirname, fclose(iafile); fclose(jafile); fclose(rafile); - + free(filename); return PASTIX_SUCCESS; } diff --git a/z_spm_norm.c b/z_spm_norm.c index 50419ded08a0bce6f42f9cd381fe9e7f7f954572..72ed90759727f790b2df89b2b727a9a766b88b96 100644 --- a/z_spm_norm.c +++ b/z_spm_norm.c @@ -184,8 +184,7 @@ z_spmInfNorm( const pastix_spm_t *spm ) sumrow[row] += cabs( valptr[i] ); /* Add the symmetric/hermitian part */ - if ( ((spm->mtxtype == PastixHermitian) || - (spm->mtxtype == PastixSymmetric)) && + if ( ( spm->mtxtype != PastixGeneral ) && ( row != col ) ) { sumrow[col] += cabs( valptr[i] ); @@ -204,8 +203,7 @@ z_spmInfNorm( const pastix_spm_t *spm ) } /* Add the symmetric/hermitian part */ - if ( (spm->mtxtype == PastixHermitian) || - (spm->mtxtype == PastixSymmetric) ) + if ( spm->mtxtype != PastixGeneral ) { for( row=0; row < spm->gN; row++ ) { @@ -228,8 +226,7 @@ z_spmInfNorm( const pastix_spm_t *spm ) } /* Add the symmetric/hermitian part */ - if ( (spm->mtxtype == PastixHermitian) || - (spm->mtxtype == PastixSymmetric) ) + if ( spm->mtxtype != PastixGeneral ) { for(i=0; i < spm->nnz; i++) { @@ -300,8 +297,7 @@ z_spmOneNorm( const pastix_spm_t *spm ) } /* Add the symmetric/hermitian part */ - if ( (spm->mtxtype == PastixHermitian) || - (spm->mtxtype == PastixSymmetric) ) + if ( spm->mtxtype != PastixGeneral ) { for( col=0; col < spm->gN; col++ ) { @@ -325,8 +321,7 @@ z_spmOneNorm( const pastix_spm_t *spm ) sumcol[col] += cabs( valptr[i] ); /* Add the symmetric/hermitian part */ - if ( ((spm->mtxtype == PastixHermitian) || - (spm->mtxtype == PastixSymmetric)) && + if ( ( spm->mtxtype != PastixGeneral ) && ( row != col ) ) { sumcol[row] += cabs( valptr[i] ); @@ -342,8 +337,7 @@ z_spmOneNorm( const pastix_spm_t *spm ) } /* Add the symmetric/hermitian part */ - if ( (spm->mtxtype == PastixHermitian) || - (spm->mtxtype == PastixSymmetric) ) + if ( spm->mtxtype != PastixGeneral ) { for(i=0; i < spm->nnz; i++) {