From 9691cf6bbc6cef26778a2a9eda07abcc639ff2d6 Mon Sep 17 00:00:00 2001 From: Mathieu Faverge <mathieu.faverge@inria.fr> Date: Wed, 16 Nov 2016 00:35:05 -0700 Subject: [PATCH] Fix norm computations --- z_spm_norm.c | 40 +++++++++++++++++----------------------- 1 file changed, 17 insertions(+), 23 deletions(-) diff --git a/z_spm_norm.c b/z_spm_norm.c index 7ce9d3e3..f6d4d17b 100644 --- a/z_spm_norm.c +++ b/z_spm_norm.c @@ -188,16 +188,11 @@ z_spmInfNorm( const pastix_spm_t *spm ) { row = spm->rowptr[i] - baseval; sumrow[row] += cabs( valptr[i] ); - } - } - /* Add the symmetric/hermitian part */ - if ( (spm->mtxtype == PastixHermitian) || - (spm->mtxtype == PastixSymmetric) ) - { - for( col=0; col < spm->gN; col++ ) - { - for( i=spm->colptr[col]-baseval+1; i<spm->colptr[col+1]-baseval; i++ ) + /* Add the symmetric/hermitian part */ + if ( ((spm->mtxtype == PastixHermitian) || + (spm->mtxtype == PastixSymmetric)) && + ( row != col ) ) { sumrow[col] += cabs( valptr[i] ); } @@ -220,10 +215,12 @@ z_spmInfNorm( const pastix_spm_t *spm ) { for( row=0; row < spm->gN; row++ ) { - for( i=spm->rowptr[row]-baseval+1; i<spm->rowptr[row+1]-baseval; i++ ) + for( i=spm->rowptr[row]-baseval; i<spm->rowptr[row+1]-baseval; i++ ) { col = spm->colptr[i] - baseval; - sumrow[col] += cabs( valptr[i] ); + if ( row != col ) { + sumrow[col] += cabs( valptr[i] ); + } } } } @@ -303,7 +300,7 @@ z_spmOneNorm( const pastix_spm_t *spm ) switch( spm->fmttype ){ case PastixCSC: - for( col=0; col < spm->gN; col++ ) + for( col=0; col<spm->gN; col++ ) { for( i=spm->colptr[col]-baseval; i<spm->colptr[col+1]-baseval; i++ ) { @@ -317,10 +314,12 @@ z_spmOneNorm( const pastix_spm_t *spm ) { for( col=0; col < spm->gN; col++ ) { - for( i=spm->colptr[col]-baseval+1; i<spm->colptr[col+1]-baseval; i++ ) + for( i=spm->colptr[col]-baseval; i<spm->colptr[col+1]-baseval; i++ ) { row = spm->rowptr[i] - baseval; - sumcol[row] += cabs( valptr[i] ); + if (row != col) { + sumcol[row] += cabs( valptr[i] ); + } } } } @@ -333,16 +332,11 @@ z_spmOneNorm( const pastix_spm_t *spm ) { col = spm->colptr[i] - baseval; sumcol[col] += cabs( valptr[i] ); - } - } - /* Add the symmetric/hermitian part */ - if ( (spm->mtxtype == PastixHermitian) || - (spm->mtxtype == PastixSymmetric) ) - { - for( row=0; row < spm->gN; row++ ) - { - for( i=spm->rowptr[row]-baseval+1; i<spm->rowptr[row+1]-baseval; i++ ) + /* Add the symmetric/hermitian part */ + if ( ((spm->mtxtype == PastixHermitian) || + (spm->mtxtype == PastixSymmetric)) && + ( row != col ) ) { sumcol[row] += cabs( valptr[i] ); } -- GitLab