| compressedrow.c (ff43f1e103ddab29b3fc9057bf2bd17400f32d46) | compressedrow.c (09f3b4e5628a00a1eaf17d80982cfbcc515cc9c1) |
|---|---|
| 1#define PETSCMAT_DLL 2 3#include "src/mat/matimpl.h" /*I "petscmat.h" I*/ 4 5#undef __FUNCT__ 6#define __FUNCT__ "Mat_CheckCompressedRow" 7/*@C 8 Mat_CheckCompressedRow - Determines whether the compressed row matrix format should be used. --- 18 unchanged lines hidden (view full) --- 27 PetscInt nrows,*cpi=PETSC_NULL,*ridx=PETSC_NULL,nz,i,row; 28 29 PetscFunctionBegin; 30 if (!compressedrow->use) PetscFunctionReturn(0); 31 if (compressedrow->checked){ 32 if (!A->same_nonzero){ 33 ierr = PetscFree(compressedrow->i);CHKERRQ(ierr); 34 compressedrow->rindex = PETSC_NULL; | 1#define PETSCMAT_DLL 2 3#include "src/mat/matimpl.h" /*I "petscmat.h" I*/ 4 5#undef __FUNCT__ 6#define __FUNCT__ "Mat_CheckCompressedRow" 7/*@C 8 Mat_CheckCompressedRow - Determines whether the compressed row matrix format should be used. --- 18 unchanged lines hidden (view full) --- 27 PetscInt nrows,*cpi=PETSC_NULL,*ridx=PETSC_NULL,nz,i,row; 28 29 PetscFunctionBegin; 30 if (!compressedrow->use) PetscFunctionReturn(0); 31 if (compressedrow->checked){ 32 if (!A->same_nonzero){ 33 ierr = PetscFree(compressedrow->i);CHKERRQ(ierr); 34 compressedrow->rindex = PETSC_NULL; |
| 35 ierr = PetscLogInfo((A,"Mat_CheckCompressedRow: Mat structure might be changed. Free memory and recheck.\n"));CHKERRQ(ierr); | 35 ierr = PetscVerboseInfo((A,"Mat_CheckCompressedRow: Mat structure might be changed. Free memory and recheck.\n"));CHKERRQ(ierr); |
| 36 } else if (compressedrow->i == PETSC_NULL) { 37 /* Don't know why this occures. For safe, recheck. */ | 36 } else if (compressedrow->i == PETSC_NULL) { 37 /* Don't know why this occures. For safe, recheck. */ |
| 38 ierr = PetscLogInfo((A,"Mat_CheckCompressedRow: compressedrow.checked, but compressedrow.i==null. Recheck.\n"));CHKERRQ(ierr); | 38 ierr = PetscVerboseInfo((A,"Mat_CheckCompressedRow: compressedrow.checked, but compressedrow.i==null. Recheck.\n"));CHKERRQ(ierr); |
| 39 } else { /* use compressedrow, checked, A->same_nonzero = PETSC_TRUE. Skip check */ | 39 } else { /* use compressedrow, checked, A->same_nonzero = PETSC_TRUE. Skip check */ |
| 40 ierr = PetscLogInfo((A,"Mat_CheckCompressedRow: Skip check. m: %d, n: %d,M: %d, N: %d,nrows: %d, ii: %p, type: %s\n",A->m,A->n,A->M,A->N,compressedrow->nrows,compressedrow->i,A->type_name));CHKERRQ(ierr); | 40 ierr = PetscVerboseInfo((A,"Mat_CheckCompressedRow: Skip check. m: %d, n: %d,M: %d, N: %d,nrows: %d, ii: %p, type: %s\n",A->m,A->n,A->M,A->N,compressedrow->nrows,compressedrow->i,A->type_name));CHKERRQ(ierr); |
| 41 PetscFunctionReturn(0); 42 } 43 } 44 compressedrow->checked = PETSC_TRUE; 45 46 /* compute number of zero rows */ 47 nrows = 0; 48 for (i=0; i<mbs; i++){ /* for each row */ 49 nz = ai[i+1] - ai[i]; /* number of nonzeros */ 50 if (nz == 0) nrows++; 51 } 52 /* if a large number of zero rows is found, use compressedrow data structure */ 53 if (nrows < ratio*mbs) { 54 compressedrow->use = PETSC_FALSE; | 41 PetscFunctionReturn(0); 42 } 43 } 44 compressedrow->checked = PETSC_TRUE; 45 46 /* compute number of zero rows */ 47 nrows = 0; 48 for (i=0; i<mbs; i++){ /* for each row */ 49 nz = ai[i+1] - ai[i]; /* number of nonzeros */ 50 if (nz == 0) nrows++; 51 } 52 /* if a large number of zero rows is found, use compressedrow data structure */ 53 if (nrows < ratio*mbs) { 54 compressedrow->use = PETSC_FALSE; |
| 55 ierr = PetscLogInfo((A,"Mat_CheckCompressedRow: Found the ratio (num_zerorows %d)/(num_localrows %d) < %g. Do not use CompressedRow routines.\n",nrows,mbs,ratio));CHKERRQ(ierr); | 55 ierr = PetscVerboseInfo((A,"Mat_CheckCompressedRow: Found the ratio (num_zerorows %d)/(num_localrows %d) < %g. Do not use CompressedRow routines.\n",nrows,mbs,ratio));CHKERRQ(ierr); |
| 56 } else { 57 compressedrow->use = PETSC_TRUE; | 56 } else { 57 compressedrow->use = PETSC_TRUE; |
| 58 ierr = PetscLogInfo((A,"Mat_CheckCompressedRow: Found the ratio (num_zerorows %d)/(num_localrows %d) > %g. Use CompressedRow routines.\n",nrows,mbs,ratio));CHKERRQ(ierr); | 58 ierr = PetscVerboseInfo((A,"Mat_CheckCompressedRow: Found the ratio (num_zerorows %d)/(num_localrows %d) > %g. Use CompressedRow routines.\n",nrows,mbs,ratio));CHKERRQ(ierr); |
| 59 60 /* set compressed row format */ 61 nrows = mbs - nrows; /* num of non-zero rows */ 62 ierr = PetscMalloc((2*nrows+1)*sizeof(PetscInt),&cpi);CHKERRQ(ierr); 63 ridx = cpi + nrows + 1; 64 row = 0; 65 cpi[0] = 0; 66 for (i=0; i<mbs; i++){ --- 12 unchanged lines hidden --- | 59 60 /* set compressed row format */ 61 nrows = mbs - nrows; /* num of non-zero rows */ 62 ierr = PetscMalloc((2*nrows+1)*sizeof(PetscInt),&cpi);CHKERRQ(ierr); 63 ridx = cpi + nrows + 1; 64 row = 0; 65 cpi[0] = 0; 66 for (i=0; i<mbs; i++){ --- 12 unchanged lines hidden --- |