From a81e29f83f7d2f339b0c3638fbdaefd86e56c197 Mon Sep 17 00:00:00 2001 From: Mathieu Faverge <mathieu.faverge@inria.fr> Date: Mon, 14 Nov 2016 14:59:37 -0500 Subject: [PATCH] Add spmPrint function --- spm.c | 39 +++++++++++++++++++++++++++++++++++++++ spm.h | 2 ++ z_spm_print.c | 2 +- 3 files changed, 42 insertions(+), 1 deletion(-) diff --git a/spm.c b/spm.c index 1f35b85e..483aea24 100644 --- a/spm.c +++ b/spm.c @@ -766,6 +766,45 @@ spmCopy( const pastix_spm_t *spm ) return newspm; } +/** + ******************************************************************************* + * + * @ingroup pastix_spm + * + * @brief Print an spm matrix into into a given file. + * + ******************************************************************************* + * + * @param[in] f + * File to print the spm matrix + * + * @param[in] spm + * The sparse matrix to copy. + * + *******************************************************************************/ +void +spmPrint(FILE *f, const pastix_spm_t* spm) +{ + switch(spm->flttype) + { + case PastixPattern: + //return p_f, spmPrint(f, spm); + break; + case PastixFloat: + s_spmPrint(f, spm); + break; + case PastixComplex32: + c_spmPrint(f, spm); + break; + case PastixComplex64: + z_spmPrint(f, spm); + break; + case PastixDouble: + default: + d_spmPrint(f, spm); + } +} + /** ******************************************************************************* * diff --git a/spm.h b/spm.h index d065d911..4851b549 100644 --- a/spm.h +++ b/spm.h @@ -136,6 +136,8 @@ static inline void s_spmPrintElt( FILE *f, pastix_int_t i, pastix_int_t j, float int spmLoad( pastix_spm_t *spm, FILE *infile ); int spmSave( pastix_spm_t *spm, FILE *outfile ); +void spmPrint( FILE *f, const pastix_spm_t *spm ); + int spmGenRHS(int type, int nrhs, const pastix_spm_t *spm, void *x, int ldx, void *b, int ldb ); int spmCheckAxb( int nrhs, const pastix_spm_t *spm, void *x0, int ldx0, void *b, int ldb, const void *x, int ldx ); diff --git a/z_spm_print.c b/z_spm_print.c index 5c4b3888..7f1ae291 100644 --- a/z_spm_print.c +++ b/z_spm_print.c @@ -32,7 +32,7 @@ z_spmCSCPrint( FILE *f, const pastix_spm_t *spm ) pastix_complex64_t *valptr; pastix_int_t *colptr, *rowptr, *dofs; - assert( (spm->fmttype == PastixCSC) || (spm->fmttype == PastixCSR) ); + assert( spm->fmttype == PastixCSC ); assert( spm->flttype == PastixComplex64 ); baseval = spmFindBase( spm ); -- GitLab