From 8602897f74acf41fcb62ed450eb7e7e73a0de6c8 Mon Sep 17 00:00:00 2001
From: Mathieu Faverge <mathieu.faverge@inria.fr>
Date: Sat, 6 May 2017 00:43:22 +0200
Subject: [PATCH] Add a missing const, and define stream to stdout by default
 in spmPrint

---
 spm.c                | 14 +++++++++-----
 z_spm.h              |  2 +-
 z_spm_2dense.c       |  2 +-
 z_spm_matrixvector.c |  1 -
 4 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/spm.c b/spm.c
index 65858659..8614efac 100644
--- a/spm.c
+++ b/spm.c
@@ -880,25 +880,29 @@ spmPrintInfo( const pastix_spm_t* spm, FILE *stream )
  *
  *******************************************************************************/
 void
-spmPrint( const pastix_spm_t* spm, FILE *f )
+spmPrint( const pastix_spm_t* spm, FILE *stream )
 {
+    if (stream == NULL) {
+        stream = stdout;
+    }
+
     switch(spm->flttype)
     {
     case PastixPattern:
         //return p_f, spmPrint(f, spm);
         break;
     case PastixFloat:
-        s_spmPrint(f, spm);
+        s_spmPrint(stream, spm);
         break;
     case PastixComplex32:
-        c_spmPrint(f, spm);
+        c_spmPrint(stream, spm);
         break;
     case PastixComplex64:
-        z_spmPrint(f, spm);
+        z_spmPrint(stream, spm);
         break;
     case PastixDouble:
     default:
-        d_spmPrint(f, spm);
+        d_spmPrint(stream, spm);
     }
 }
 
diff --git a/z_spm.h b/z_spm.h
index 5a86b778..caa7cf9a 100644
--- a/z_spm.h
+++ b/z_spm.h
@@ -63,7 +63,7 @@ int z_spmCheckAxb( int nrhs, const pastix_spm_t *spm, void *x0, int ldx0, void *
 /**
  * Output routines
  */
-void z_spmDensePrint( FILE *f, pastix_int_t m, pastix_int_t n, pastix_complex64_t *A, pastix_int_t lda );
+void z_spmDensePrint( FILE *f, pastix_int_t m, pastix_int_t n, const pastix_complex64_t *A, pastix_int_t lda );
 void z_spmPrint( FILE *f, const pastix_spm_t *spm );
 
 pastix_spm_t *z_spmExpand(const pastix_spm_t *spm);
diff --git a/z_spm_2dense.c b/z_spm_2dense.c
index 0c1da2d7..cbca5947 100644
--- a/z_spm_2dense.c
+++ b/z_spm_2dense.c
@@ -639,7 +639,7 @@ z_spm2dense( const pastix_spm_t *spm )
  *
  *******************************************************************************/
 void
-z_spmDensePrint( FILE *f, pastix_int_t m, pastix_int_t n, pastix_complex64_t *A, pastix_int_t lda )
+z_spmDensePrint( FILE *f, pastix_int_t m, pastix_int_t n, const pastix_complex64_t *A, pastix_int_t lda )
 {
     pastix_int_t i, j;
 
diff --git a/z_spm_matrixvector.c b/z_spm_matrixvector.c
index 7f7ea7e5..af4e322c 100644
--- a/z_spm_matrixvector.c
+++ b/z_spm_matrixvector.c
@@ -225,7 +225,6 @@ z_spmSyCSCv(      pastix_complex64_t  alpha,
             {
                 row = spm->rowptr[i-baseval]-baseval;
                 yptr[row] += alpha * valptr[i-baseval] * xptr[col];
-                if( col != row )
                 {
                     yptr[col] += alpha * valptr[i-baseval] * xptr[row];
                 }
-- 
GitLab