Mentions légales du service

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

Rename colmajor field in layout

parent 4dd71a09
No related branches found
No related tags found
No related merge requests found
......@@ -18,7 +18,6 @@ precisions_rules_py(generated_headers
set(SOURCES
z_spm.c
z_spm_2dense.c
z_spm_convert_col_row_major.c
z_spm_convert_to_csc.c
z_spm_convert_to_csr.c
z_spm_convert_to_ijv.c
......
......@@ -98,9 +98,9 @@ spmInit( pastix_spm_t *spm )
spm->gnnzexp = 0;
spm->nnzexp = 0;
spm->dof = 1;
spm->dofs = NULL;
spm->colmajor = 1;
spm->dof = 1;
spm->dofs = NULL;
spm->layout = PastixColMajor;
spm->colptr = NULL;
spm->rowptr = NULL;
......@@ -334,30 +334,36 @@ double
spmNorm( int ntype,
const pastix_spm_t *spm )
{
double tmp;
pastix_spm_t *spmtmp;
double norm = -1.;
if ( spm->dof != 1 ) {
fprintf(stderr, "WARNING: spm expanded due to non implemented norm for non-expanded spm\n");
spm = spmExpand( spm );
spmtmp = spmExpand( spm );
}
switch (spm->flttype) {
case PastixFloat:
tmp = (double)s_spmNorm( ntype, spm );
return tmp;
norm = (double)s_spmNorm( ntype, spmtmp );
break;
case PastixDouble:
return d_spmNorm( ntype, spm );
norm = d_spmNorm( ntype, spmtmp );
break;
case PastixComplex32:
tmp = (double)c_spmNorm( ntype, spm );
return tmp;
norm = (double)c_spmNorm( ntype, spmtmp );
break;
case PastixComplex64:
return z_spmNorm( ntype, spm );
norm = z_spmNorm( ntype, spmtmp );
break;
case PastixPattern:
default:
return -1.;
;
}
return norm;
}
/**
......@@ -688,24 +694,26 @@ spmCopy( const pastix_spm_t *spm )
* The copy of the sparse matrix.
*
*******************************************************************************/
void
spmExpand(pastix_spm_t* spm)
pastix_spm_t *
spmExpand(const pastix_spm_t* spm)
{
switch(spm->flttype)
{
case PastixPattern:
return p_spmExpand(spm);
break;
case PastixFloat:
s_spmExpand(spm);
return s_spmExpand(spm);
break;
case PastixComplex32:
c_spmExpand(spm);
return c_spmExpand(spm);
break;
case PastixComplex64:
z_spmExpand(spm);
return z_spmExpand(spm);
break;
case PastixDouble:
default:
d_spmExpand(spm);
break;
return d_spmExpand(spm);
}
}
......
......@@ -60,33 +60,32 @@ typedef enum pastix_driver_e {
*
*/
struct pastix_spm_s {
int mtxtype; /**< Matrix structure: PastixGeneral, PastixSymmetric
or PastixHermitian. */
int flttype; /**< avals datatype: PastixPattern, PastixFloat, PastixDouble,
PastixComplex32 or PastixComplex64 */
int fmttype; /**< Matrix storage format: PastixCSC, PastixCSR, PastixIJV */
pastix_int_t gN; /**< Global number of vertices in the compressed graph */
pastix_int_t n; /**< Local number of vertices in the compressed graph */
pastix_int_t gnnz; /**< Global number of non zeroes in the compressed graph */
pastix_int_t nnz; /**< Local number of non zeroes in the compressed graph */
pastix_int_t gNexp; /**< Global number of vertices in the compressed graph */
pastix_int_t nexp; /**< Local number of vertices in the compressed graph */
pastix_int_t gnnzexp; /**< Global number of non zeroes in the compressed graph */
pastix_int_t nnzexp; /**< Local number of non zeroes in the compressed graph */
pastix_int_t dof; /**< Number of degrees of freedom per unknown,
if > 0, constant degree of freedom
otherwise, irregular degree of freedom (refer to dofs) */
pastix_int_t *dofs; /**< Number of degrees of freedom per unknown (NULL, if dof > 0) */
int colmajor; /**< If > 0, column major with dofs
otherwise, row major */
pastix_int_t *colptr; /**< List of indirections to rows for each vertex */
pastix_int_t *rowptr; /**< List of edges for each vertex */
pastix_int_t *loc2glob; /**< Corresponding numbering from local to global */
void *values; /**< Values stored in the matrix */
int mtxtype;/**< Matrix structure: PastixGeneral, PastixSymmetric
or PastixHermitian. */
pastix_coeftype_t flttype; /**< avals datatype: PastixPattern, PastixFloat, PastixDouble,
PastixComplex32 or PastixComplex64 */
pastix_fmttype_t fmttype; /**< Matrix storage format: PastixCSC, PastixCSR, PastixIJV */
pastix_int_t gN; /**< Global number of vertices in the compressed graph */
pastix_int_t n; /**< Local number of vertices in the compressed graph */
pastix_int_t gnnz; /**< Global number of non zeroes in the compressed graph */
pastix_int_t nnz; /**< Local number of non zeroes in the compressed graph */
pastix_int_t gNexp; /**< Global number of vertices in the compressed graph */
pastix_int_t nexp; /**< Local number of vertices in the compressed graph */
pastix_int_t gnnzexp; /**< Global number of non zeroes in the compressed graph */
pastix_int_t nnzexp; /**< Local number of non zeroes in the compressed graph */
pastix_int_t dof; /**< Number of degrees of freedom per unknown,
if > 0, constant degree of freedom
otherwise, irregular degree of freedom (refer to dofs) */
pastix_int_t *dofs; /**< Number of degrees of freedom per unknown (NULL, if dof > 0) */
pastix_order_t layout; /**< PastixColMajor, or PastixRowMajor */
pastix_int_t *colptr; /**< List of indirections to rows for each vertex */
pastix_int_t *rowptr; /**< List of edges for each vertex */
pastix_int_t *loc2glob;/**< Corresponding numbering from local to global */
void *values; /**< Values stored in the matrix */
};
int
......@@ -136,7 +135,7 @@ pastix_int_t spmSymmetrize( pastix_spm_t *spm );
pastix_spm_t *spmCheckAndCorrect( pastix_spm_t *spm );
void spmExpand(pastix_spm_t* spm);
pastix_spm_t *spmExpand(const pastix_spm_t* spm);
int spmReadDriver( pastix_driver_t driver,
char *filename,
......
......@@ -63,7 +63,7 @@ void z_spmDensePrint( pastix_int_t m, pastix_int_t n, pastix_complex64_t *A, pas
void z_spmPrint( const pastix_spm_t *spm );
int z_spmExpand(pastix_spm_t *spm);
void z_spmDofs2Flat(pastix_spm_t *spm);
pastix_spm_t *z_spmExpand(const pastix_spm_t *spm);
void z_spmDofs2Flat(pastix_spm_t *spm);
#endif /* _z_spm_H_ */
......@@ -119,9 +119,9 @@ z_spmDofs2Flat(pastix_spm_t *spm)
spm->gnnz = spm->gnnzexp;
spm->nnz = spm->nnzexp;
spm->dof = 1;
spm->dofs = NULL;
spm->colmajor = 1;
spm->dof = 1;
spm->dofs = NULL;
spm->layout = PastixColMajor;
spm->colptr = new_col;
spm->rowptr = new_row;
......@@ -218,9 +218,9 @@ z_spmDofs2Flat(pastix_spm_t *spm)
spm->gnnzexp = nnz;
spm->nnzexp = nnz;
spm->dof = 1;
spm->dofs = NULL;
spm->colmajor = 1;
spm->dof = 1;
spm->dofs = NULL;
spm->layout = PastixColMajor;
spm->colptr = new_col;
spm->rowptr = new_row;
......
......@@ -20,46 +20,60 @@
/**
* TODO: This function is incorrect
*/
int
z_spmExpand(pastix_spm_t *spm)
pastix_spm_t *
z_spmExpand(const pastix_spm_t *spm)
{
pastix_spm_t *newspm;
pastix_int_t i, col, row, cpt, dofj, dofi, baseval;
#if !defined(PRECISION_p)
pastix_complex64_t *oldvalptr;
pastix_complex64_t *newvalptr;
#endif
if (spm->dof == 1) {
return spm;
}
if (1) {
return PASTIX_ERR_NOTIMPLEMENTED;
return NULL;
}
baseval = spmFindBase( spm );
/* baseval = spmFindBase( spm ); */
oldvalptr = (pastix_complex64_t*)spm->values;
spm->values = malloc( spm->nnzexp * sizeof(pastix_complex64_t) );
newvalptr = (pastix_complex64_t*)spm->values;
/* #if !defined(PRECISION_p) */
/* oldvalptr = (pastix_complex64_t*)spm->values; */
/* spm->values = malloc( spm->nnzexp * sizeof(pastix_complex64_t) ); */
/* newvalptr = (pastix_complex64_t*)spm->values; */
/* #endif */
cpt = 0;
dofi = spm->dof;
dofj = spm->dof;
/* cpt = 0; */
/* dofi = spm->dof; */
/* dofj = spm->dof; */
for( col=0; col<spm->n; col++)
{
if ( spm->dof <= 0 ) {
dofi = spm->dofs[col+1] - spm->dofs[col];
}
/* for( col=0; col<spm->n; col++) */
/* { */
/* if ( spm->dof <= 0 ) { */
/* dofi = spm->dofs[col+1] - spm->dofs[col]; */
/* } */
for( row=spm->colptr[col]-baseval; row<spm->colptr[col+1]-baseval; row++)
{
if ( spm->dof <= 0 ) {
dofj = spm->dofs[spm->rowptr[row]-baseval+1] - spm->dofs[spm->rowptr[row]-baseval];
}
/* for( row=spm->colptr[col]-baseval; row<spm->colptr[col+1]-baseval; row++) */
/* { */
/* if ( spm->dof <= 0 ) { */
/* dofj = spm->dofs[spm->rowptr[row]-baseval+1] - spm->dofs[spm->rowptr[row]-baseval]; */
/* } */
for( i=0; i<dofi*dofj; i++)
{
newvalptr[cpt] = oldvalptr[row] / ((i/dofj) + (i%dofj) + 2); // Col major
cpt++;
}
}
}
/* for( i=0; i<dofi*dofj; i++) */
/* { */
/* #if !defined(PRECISION_p) */
/* newvalptr[cpt] = oldvalptr[row] / ((i/dofj) + (i%dofj) + 2); // Col major */
/* cpt++; */
/* #endif */
/* } */
/* } */
/* } */
free( oldvalptr );
/* #if !defined(PRECISION_p) */
/* free( oldvalptr ); */
/* #endif */
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment