Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 6f7a562f authored by Mathieu Faverge's avatar Mathieu Faverge
Browse files

Fix printing

parent 5d0d5962
No related branches found
No related tags found
No related merge requests found
...@@ -32,14 +32,21 @@ z_spmCSCPrint( FILE *f, const pastix_spm_t *spm ) ...@@ -32,14 +32,21 @@ z_spmCSCPrint( FILE *f, const pastix_spm_t *spm )
pastix_complex64_t *valptr; pastix_complex64_t *valptr;
pastix_int_t *colptr, *rowptr, *dofs; pastix_int_t *colptr, *rowptr, *dofs;
assert( spm->fmttype == PastixCSC ); assert( (spm->fmttype == PastixCSC) || (spm->fmttype == PastixCSR) );
assert( spm->flttype == PastixComplex64 ); assert( spm->flttype == PastixComplex64 );
baseval = spmFindBase( spm ); baseval = spmFindBase( spm );
i = 0; j = 0; i = 0; j = 0;
colptr = spm->colptr; if ( spm->fmttype == PastixCSC ) {
rowptr = spm->rowptr; colptr = spm->colptr;
rowptr = spm->rowptr;
}
else {
colptr = spm->rowptr;
rowptr = spm->colptr;
}
valptr = (pastix_complex64_t*)(spm->values); valptr = (pastix_complex64_t*)(spm->values);
dofs = spm->dofs; dofs = spm->dofs;
...@@ -54,7 +61,7 @@ z_spmCSCPrint( FILE *f, const pastix_spm_t *spm ) ...@@ -54,7 +61,7 @@ z_spmCSCPrint( FILE *f, const pastix_spm_t *spm )
for(k=colptr[0]; k<colptr[1]; k++, rowptr++) for(k=colptr[0]; k<colptr[1]; k++, rowptr++)
{ {
i = (*rowptr - baseval); i = (*rowptr - baseval);
dofi = ( spm->dof > 0 ) ? spm->dof : dofs[i+1] - dofs[i]; dofi = ( spm->dof > 0 ) ? spm->dof : dofs[i+1] - dofs[i];
row = ( spm->dof > 0 ) ? spm->dof * i : dofs[i] - baseval; row = ( spm->dof > 0 ) ? spm->dof * i : dofs[i] - baseval;
if ( spm->layout == PastixColMajor ) { if ( spm->layout == PastixColMajor ) {
...@@ -62,12 +69,18 @@ z_spmCSCPrint( FILE *f, const pastix_spm_t *spm ) ...@@ -62,12 +69,18 @@ z_spmCSCPrint( FILE *f, const pastix_spm_t *spm )
{ {
for(ii=0; ii<dofi; ii++, valptr++) for(ii=0; ii<dofi; ii++, valptr++)
{ {
if (row+ii >= col+jj) { if ( row == col ) {
z_spmPrintElt( f, row + ii, col + jj, *valptr ); if (row+ii >= col+jj) {
if (row+ii > col+jj) { z_spmPrintElt( f, row + ii, col + jj, *valptr );
z_spmPrintElt( f, col + jj, row + ii, conj(*valptr) ); if (row+ii > col+jj) {
z_spmPrintElt( f, col + jj, row + ii, conj(*valptr) );
}
} }
} }
else {
z_spmPrintElt( f, row + ii, col + jj, *valptr );
z_spmPrintElt( f, col + jj, row + ii, conj(*valptr) );
}
} }
} }
} }
...@@ -76,12 +89,18 @@ z_spmCSCPrint( FILE *f, const pastix_spm_t *spm ) ...@@ -76,12 +89,18 @@ z_spmCSCPrint( FILE *f, const pastix_spm_t *spm )
{ {
for(jj=0; jj<dofj; jj++, valptr++) for(jj=0; jj<dofj; jj++, valptr++)
{ {
if (row+ii >= col+jj) { if ( row == col ) {
z_spmPrintElt( f, row + ii, col + jj, *valptr ); if (row+ii >= col+jj) {
if (row+ii > col+jj) { z_spmPrintElt( f, row + ii, col + jj, *valptr );
z_spmPrintElt( f, col + jj, row + ii, conj(*valptr) ); if (row+ii > col+jj) {
z_spmPrintElt( f, col + jj, row + ii, conj(*valptr) );
}
} }
} }
else {
z_spmPrintElt( f, row + ii, col + jj, *valptr );
z_spmPrintElt( f, col + jj, row + ii, conj(*valptr) );
}
} }
} }
} }
...@@ -106,12 +125,18 @@ z_spmCSCPrint( FILE *f, const pastix_spm_t *spm ) ...@@ -106,12 +125,18 @@ z_spmCSCPrint( FILE *f, const pastix_spm_t *spm )
{ {
for(ii=0; ii<dofi; ii++, valptr++) for(ii=0; ii<dofi; ii++, valptr++)
{ {
if (row+ii >= col+jj) { if ( row == col ) {
z_spmPrintElt( f, row + ii, col + jj, *valptr ); if (row+ii >= col+jj) {
if (row+ii > col+jj) { z_spmPrintElt( f, row + ii, col + jj, *valptr );
z_spmPrintElt( f, col + jj, row + ii, *valptr ); if (row+ii > col+jj) {
z_spmPrintElt( f, col + jj, row + ii, *valptr );
}
} }
} }
else {
z_spmPrintElt( f, row + ii, col + jj, *valptr );
z_spmPrintElt( f, col + jj, row + ii, *valptr );
}
} }
} }
} }
...@@ -120,12 +145,18 @@ z_spmCSCPrint( FILE *f, const pastix_spm_t *spm ) ...@@ -120,12 +145,18 @@ z_spmCSCPrint( FILE *f, const pastix_spm_t *spm )
{ {
for(jj=0; jj<dofj; jj++, valptr++) for(jj=0; jj<dofj; jj++, valptr++)
{ {
if (row+ii >= col+jj) { if ( row == col ) {
z_spmPrintElt( f, row + ii, col + jj, *valptr ); if (row+ii >= col+jj) {
if (row+ii > col+jj) { z_spmPrintElt( f, row + ii, col + jj, *valptr );
z_spmPrintElt( f, col + jj, row + ii, *valptr ); if (row+ii > col+jj) {
z_spmPrintElt( f, col + jj, row + ii, *valptr );
}
} }
} }
else {
z_spmPrintElt( f, row + ii, col + jj, *valptr );
z_spmPrintElt( f, col + jj, row + ii, *valptr );
}
} }
} }
} }
...@@ -207,12 +238,18 @@ z_spmCSRPrint( FILE *f, const pastix_spm_t *spm ) ...@@ -207,12 +238,18 @@ z_spmCSRPrint( FILE *f, const pastix_spm_t *spm )
{ {
for(ii=0; ii<dofi; ii++, valptr++) for(ii=0; ii<dofi; ii++, valptr++)
{ {
if (row+ii <= col+jj) { if ( row == col ) {
z_spmPrintElt( f, row + ii, col + jj, *valptr ); if (row+ii >= col+jj) {
if (row+ii < col+jj) { z_spmPrintElt( f, row + ii, col + jj, *valptr );
z_spmPrintElt( f, col + jj, row + ii, conj(*valptr) ); if (row+ii > col+jj) {
z_spmPrintElt( f, col + jj, row + ii, conj(*valptr) );
}
} }
} }
else {
z_spmPrintElt( f, row + ii, col + jj, *valptr );
z_spmPrintElt( f, col + jj, row + ii, conj(*valptr) );
}
} }
} }
} }
...@@ -221,12 +258,18 @@ z_spmCSRPrint( FILE *f, const pastix_spm_t *spm ) ...@@ -221,12 +258,18 @@ z_spmCSRPrint( FILE *f, const pastix_spm_t *spm )
{ {
for(jj=0; jj<dofj; jj++, valptr++) for(jj=0; jj<dofj; jj++, valptr++)
{ {
if (row+ii <= col+jj) { if ( row == col ) {
z_spmPrintElt( f, row + ii, col + jj, *valptr ); if (row+ii >= col+jj) {
if (row+ii < col+jj) { z_spmPrintElt( f, row + ii, col + jj, *valptr );
z_spmPrintElt( f, col + jj, row + ii, conj(*valptr) ); if (row+ii > col+jj) {
z_spmPrintElt( f, col + jj, row + ii, conj(*valptr) );
}
} }
} }
else {
z_spmPrintElt( f, row + ii, col + jj, *valptr );
z_spmPrintElt( f, col + jj, row + ii, conj(*valptr) );
}
} }
} }
} }
...@@ -251,12 +294,18 @@ z_spmCSRPrint( FILE *f, const pastix_spm_t *spm ) ...@@ -251,12 +294,18 @@ z_spmCSRPrint( FILE *f, const pastix_spm_t *spm )
{ {
for(ii=0; ii<dofi; ii++, valptr++) for(ii=0; ii<dofi; ii++, valptr++)
{ {
if (row+ii <= col+jj) { if ( row == col ) {
z_spmPrintElt( f, row + ii, col + jj, *valptr ); if (row+ii >= col+jj) {
if (row+ii < col+jj) { z_spmPrintElt( f, row + ii, col + jj, *valptr );
z_spmPrintElt( f, col + jj, row + ii, *valptr ); if (row+ii > col+jj) {
z_spmPrintElt( f, col + jj, row + ii, *valptr );
}
} }
} }
else {
z_spmPrintElt( f, row + ii, col + jj, *valptr );
z_spmPrintElt( f, col + jj, row + ii, *valptr );
}
} }
} }
} }
...@@ -265,12 +314,18 @@ z_spmCSRPrint( FILE *f, const pastix_spm_t *spm ) ...@@ -265,12 +314,18 @@ z_spmCSRPrint( FILE *f, const pastix_spm_t *spm )
{ {
for(jj=0; jj<dofj; jj++, valptr++) for(jj=0; jj<dofj; jj++, valptr++)
{ {
if (row+ii <= col+jj) { if ( row == col ) {
z_spmPrintElt( f, row + ii, col + jj, *valptr ); if (row+ii >= col+jj) {
if (row+ii < col+jj) { z_spmPrintElt( f, row + ii, col + jj, *valptr );
z_spmPrintElt( f, col + jj, row + ii, *valptr ); if (row+ii > col+jj) {
z_spmPrintElt( f, col + jj, row + ii, *valptr );
}
} }
} }
else {
z_spmPrintElt( f, row + ii, col + jj, *valptr );
z_spmPrintElt( f, col + jj, row + ii, *valptr );
}
} }
} }
} }
...@@ -359,12 +414,18 @@ z_spmIJVPrint( FILE *f, const pastix_spm_t *spm ) ...@@ -359,12 +414,18 @@ z_spmIJVPrint( FILE *f, const pastix_spm_t *spm )
{ {
for(ii=0; ii<dofi; ii++, valptr++) for(ii=0; ii<dofi; ii++, valptr++)
{ {
if (row+ii >= col+jj) { if ( row == col ) {
z_spmPrintElt( f, row + ii, col + jj, *valptr ); if (row+ii >= col+jj) {
if (row+ii > col+jj) { z_spmPrintElt( f, row + ii, col + jj, *valptr );
z_spmPrintElt( f, col + jj, row + ii, conj(*valptr) ); if (row+ii > col+jj) {
z_spmPrintElt( f, col + jj, row + ii, conj(*valptr) );
}
} }
} }
else {
z_spmPrintElt( f, row + ii, col + jj, *valptr );
z_spmPrintElt( f, col + jj, row + ii, conj(*valptr) );
}
} }
} }
} }
...@@ -373,12 +434,18 @@ z_spmIJVPrint( FILE *f, const pastix_spm_t *spm ) ...@@ -373,12 +434,18 @@ z_spmIJVPrint( FILE *f, const pastix_spm_t *spm )
{ {
for(jj=0; jj<dofj; jj++, valptr++) for(jj=0; jj<dofj; jj++, valptr++)
{ {
if (row+ii >= col+jj) { if ( row == col ) {
z_spmPrintElt( f, row + ii, col + jj, *valptr ); if (row+ii >= col+jj) {
if (row+ii > col+jj) { z_spmPrintElt( f, row + ii, col + jj, *valptr );
z_spmPrintElt( f, col + jj, row + ii, conj(*valptr) ); if (row+ii > col+jj) {
z_spmPrintElt( f, col + jj, row + ii, conj(*valptr) );
}
} }
} }
else {
z_spmPrintElt( f, row + ii, col + jj, *valptr );
z_spmPrintElt( f, col + jj, row + ii, conj(*valptr) );
}
} }
} }
} }
...@@ -409,12 +476,18 @@ z_spmIJVPrint( FILE *f, const pastix_spm_t *spm ) ...@@ -409,12 +476,18 @@ z_spmIJVPrint( FILE *f, const pastix_spm_t *spm )
{ {
for(ii=0; ii<dofi; ii++, valptr++) for(ii=0; ii<dofi; ii++, valptr++)
{ {
if (row+ii >= col+jj) { if ( row == col ) {
z_spmPrintElt( f, row + ii, col + jj, *valptr ); if (row+ii >= col+jj) {
if (row+ii > col+jj) { z_spmPrintElt( f, row + ii, col + jj, *valptr );
z_spmPrintElt( f, col + jj, row + ii, *valptr ); if (row+ii > col+jj) {
z_spmPrintElt( f, col + jj, row + ii, *valptr );
}
} }
} }
else {
z_spmPrintElt( f, row + ii, col + jj, *valptr );
z_spmPrintElt( f, col + jj, row + ii, *valptr );
}
} }
} }
} }
...@@ -423,12 +496,18 @@ z_spmIJVPrint( FILE *f, const pastix_spm_t *spm ) ...@@ -423,12 +496,18 @@ z_spmIJVPrint( FILE *f, const pastix_spm_t *spm )
{ {
for(jj=0; jj<dofj; jj++, valptr++) for(jj=0; jj<dofj; jj++, valptr++)
{ {
if (row+ii >= col+jj) { if ( row == col ) {
z_spmPrintElt( f, row + ii, col + jj, *valptr ); if (row+ii >= col+jj) {
if (row+ii > col+jj) { z_spmPrintElt( f, row + ii, col + jj, *valptr );
z_spmPrintElt( f, col + jj, row + ii, *valptr ); if (row+ii > col+jj) {
z_spmPrintElt( f, col + jj, row + ii, *valptr );
}
} }
} }
else {
z_spmPrintElt( f, row + ii, col + jj, *valptr );
z_spmPrintElt( f, col + jj, row + ii, *valptr );
}
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment