Mentions légales du service

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

Add printInfo function

parent e863a1b7
Branches
Tags
No related merge requests found
...@@ -804,6 +804,67 @@ spmCopy( const pastix_spm_t *spm ) ...@@ -804,6 +804,67 @@ spmCopy( const pastix_spm_t *spm )
return newspm; return newspm;
} }
/**
*******************************************************************************
*
* @brief Print basic informations about the spm matrix into a given stream.
*
*******************************************************************************
*
* @param[in] spm
* The sparse matrix to print.
*
* @param[inout] stream
* Stream to print the spm matrix. stdout is used if stream == NULL.
*
*******************************************************************************/
void
spmPrintInfo( const pastix_spm_t* spm, FILE *stream )
{
char *mtxtypestr[4] = { "General", "Symmetry", "Hermitian", "Incorrect" };
char *flttypestr[7] = { "Pattern", "", "Float", "Double", "Complex32", "Complex64", "Incorrect" };
char *fmttypestr[4] = { "CSC", "CSR", "IJV", "Incorrect" };
int mtxtype = spm->mtxtype - PastixGeneral;
int flttype = spm->flttype - PastixPattern;
int fmttype = spm->fmttype - PastixCSC;
if (stream == NULL) {
stream = stdout;
}
mtxtype = (mtxtype > 2 || mtxtype < 0) ? 3 : mtxtype;
flttype = (flttype > 5 || flttype < 0) ? 6 : flttype;
fmttype = (fmttype > 2 || fmttype < 0) ? 3 : fmttype;
fprintf(stream,
" Matrix type: %s\n"
" Arithmetic: %s\n"
" Format: %s\n"
" N: %ld\n"
" nnz: %ld\n",
mtxtypestr[mtxtype],
flttypestr[flttype],
fmttypestr[fmttype],
spm->gN, spm->gnnz );
if ( spm->dof != 1 ) {
if ( spm->dof > 1 ) {
fprintf(stream,
" Dof: %ld\n",
spm->dof );
}
else {
fprintf(stream,
" Dof: Variadic\n" );
}
fprintf(stream,
" N expanded: %ld\n"
" NNZ expanded: %ld\n",
spm->gNexp, spm->gnnzexp );
}
}
/** /**
******************************************************************************* *******************************************************************************
* *
......
...@@ -168,6 +168,7 @@ int spmReadDriver( pastix_driver_t driver, ...@@ -168,6 +168,7 @@ int spmReadDriver( pastix_driver_t driver,
*/ */
void * spm2Dense ( const pastix_spm_t *spm ); void * spm2Dense ( const pastix_spm_t *spm );
void spmPrint ( const pastix_spm_t *spm, FILE *f ); void spmPrint ( const pastix_spm_t *spm, FILE *f );
void spmPrintInfo( const pastix_spm_t* spm, FILE *f );
pastix_spm_t *spmExpand ( const pastix_spm_t* spm ); pastix_spm_t *spmExpand ( const pastix_spm_t* spm );
pastix_spm_t *spmDofExtend( const pastix_spm_t *spm, const int type, const int dof ); pastix_spm_t *spmDofExtend( const pastix_spm_t *spm, const int type, const int dof );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment