Mentions légales du service

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

Remove pastix_csc_t and PASTIX_SUCESS

parent daf1b475
No related branches found
No related tags found
No related merge requests found
......@@ -23,7 +23,7 @@
/**
*******************************************************************************
*
* @ingroup pastix_csc_driver
* @ingroup pastix_spm_driver
*
* laplacian_usage - Print the usage information to generate correct Laplacian
* matrices.
......@@ -50,7 +50,7 @@ laplacian_usage(void)
/**
*******************************************************************************
*
* @ingroup pastix_csc_driver
* @ingroup pastix_spm_driver
*
* laplacian_parse_info - Parse information given through the filename string to
* configure the laplacian matrix to generate.
......@@ -61,10 +61,10 @@ laplacian_usage(void)
* Configuration string of the Laplacian. See laplacian_usage() for
* more information.
*
* @param[inout] csc
* At start, an allocated csc structure that will store the Lapalcian
* @param[inout] spm
* At start, an allocated spm structure that will store the Lapalcian
* matrix.
* At exit, the fields of the csc are initialized and especially the
* At exit, the fields of the spm are initialized and especially the
* type, symmetry and number of unknows are setup.
*
*******************************************************************************
......@@ -76,16 +76,16 @@ laplacian_usage(void)
*******************************************************************************/
static inline int
laplacian_parse_info( const char *filename,
pastix_csc_t *csc,
pastix_spm_t *spm,
pastix_int_t *dim1,
pastix_int_t *dim2,
pastix_int_t *dim3 )
{
long tmp1, tmp2, tmp3;
csc->colptr = NULL;
csc->rowptr = NULL;
csc->values = NULL;
csc->loc2glob = NULL;
spm->colptr = NULL;
spm->rowptr = NULL;
spm->values = NULL;
spm->loc2glob = NULL;
/* Look for the datatype */
{
......@@ -97,27 +97,27 @@ laplacian_parse_info( const char *filename,
switch( flt ){
case 'Z':
case 'z':
csc->flttype = PastixComplex64;
spm->flttype = PastixComplex64;
break;
case 'C':
case 'c':
csc->flttype = PastixComplex32;
spm->flttype = PastixComplex32;
break;
case 'D':
case 'd':
csc->flttype = PastixDouble;
spm->flttype = PastixDouble;
break;
case 'S':
case 's':
csc->flttype = PastixFloat;
spm->flttype = PastixFloat;
break;
case 'P':
case 'p':
csc->flttype = PastixPattern;
spm->flttype = PastixPattern;
break;
case '1':
......@@ -129,7 +129,7 @@ laplacian_parse_info( const char *filename,
case '7':
case '8':
case '9':
csc->flttype = PastixDouble;
spm->flttype = PastixDouble;
/*
* The first dimension is only one character long so we come
* back to the beginning of the string
......@@ -143,7 +143,7 @@ laplacian_parse_info( const char *filename,
}
}
else {
csc->flttype = PastixDouble;
spm->flttype = PastixDouble;
}
free(tmpf);
......@@ -156,16 +156,16 @@ laplacian_parse_info( const char *filename,
*dim1 = (pastix_int_t)tmp1;
*dim2 = (pastix_int_t)tmp2;
*dim3 = (pastix_int_t)tmp3;
csc->gN = (*dim1)*(*dim2)*(*dim3);
spm->gN = (*dim1)*(*dim2)*(*dim3);
}
else if ( sscanf( filename, "%ld:%ld", &tmp1, &tmp2 ) == 2 ) {
*dim1 = (pastix_int_t)tmp1;
*dim2 = (pastix_int_t)tmp2;
csc->gN = (*dim1)*(*dim2);
spm->gN = (*dim1)*(*dim2);
}
else if ( sscanf( filename, "%ld", &tmp1 ) == 1 ) {
*dim1 = (pastix_int_t)tmp1;
csc->gN = *dim1;
spm->gN = *dim1;
}
else {
laplacian_usage();
......@@ -173,16 +173,16 @@ laplacian_parse_info( const char *filename,
}
/* One of the dimension was set to 0 */
if ( csc->gN == 0 ) {
if ( spm->gN == 0 ) {
laplacian_usage();
return PASTIX_ERR_BADPARAMETER;
}
csc->n = csc->gN;
spm->n = spm->gN;
return PASTIX_SUCCESS;
}
static void (*laplacian_table1D[6])(pastix_csc_t*, pastix_int_t) =
static void (*laplacian_table1D[6])(pastix_spm_t *, pastix_int_t) =
{
p_spmLaplacian1D,
NULL,
......@@ -192,7 +192,7 @@ static void (*laplacian_table1D[6])(pastix_csc_t*, pastix_int_t) =
z_spmLaplacian1D
};
static void (*laplacian_table2D[6])(pastix_csc_t*, pastix_int_t, pastix_int_t) =
static void (*laplacian_table2D[6])(pastix_spm_t *, pastix_int_t, pastix_int_t) =
{
p_spmLaplacian2D,
NULL,
......@@ -202,7 +202,7 @@ static void (*laplacian_table2D[6])(pastix_csc_t*, pastix_int_t, pastix_int_t) =
z_spmLaplacian2D
};
static void (*laplacian_table3D[6])(pastix_csc_t*, pastix_int_t, pastix_int_t, pastix_int_t) =
static void (*laplacian_table3D[6])(pastix_spm_t *, pastix_int_t, pastix_int_t, pastix_int_t) =
{
p_spmLaplacian3D,
NULL,
......@@ -212,7 +212,7 @@ static void (*laplacian_table3D[6])(pastix_csc_t*, pastix_int_t, pastix_int_t, p
z_spmLaplacian3D
};
static void (*extended_laplacian_table2D[6])(pastix_csc_t*, pastix_int_t, pastix_int_t) =
static void (*extended_laplacian_table2D[6])(pastix_spm_t *, pastix_int_t, pastix_int_t) =
{
p_spmLaplacian2D,
NULL,
......@@ -222,7 +222,7 @@ static void (*extended_laplacian_table2D[6])(pastix_csc_t*, pastix_int_t, pastix
z_spmExtendedLaplacian2D
};
static void (*extended_laplacian_table3D[6])(pastix_csc_t*, pastix_int_t, pastix_int_t, pastix_int_t) =
static void (*extended_laplacian_table3D[6])(pastix_spm_t *, pastix_int_t, pastix_int_t, pastix_int_t) =
{
p_spmExtendedLaplacian3D,
NULL,
......@@ -235,9 +235,9 @@ static void (*extended_laplacian_table3D[6])(pastix_csc_t*, pastix_int_t, pastix
/**
*******************************************************************************
*
* @ingroup pastix_csc_driver
* @ingroup pastix_spm_driver
*
* genLaplacian - Generate a Laplacian of size csc->n
* genLaplacian - Generate a Laplacian of size spm->n
*
*******************************************************************************
*
......@@ -253,9 +253,9 @@ static void (*extended_laplacian_table3D[6])(pastix_csc_t*, pastix_int_t, pastix
* <dim2> size of the second dimension of the 2D|3D laplacian\n"
* <dim3> size of the third dimension of the 3D laplacian\n"
*
* @param[inout] csc
* At start, an allocated csc structure.
* At exit, contains a laplacian matrix in the csc format.
* @param[inout] spm
* At start, an allocated spm structure.
* At exit, contains a laplacian matrix in the spm format.
*
*******************************************************************************
*
......@@ -266,23 +266,23 @@ static void (*extended_laplacian_table3D[6])(pastix_csc_t*, pastix_int_t, pastix
*******************************************************************************/
int
genLaplacian( const char *filename,
pastix_csc_t *csc )
pastix_spm_t *spm )
{
pastix_int_t dim1, dim2, dim3;
int rc;
rc = laplacian_parse_info(filename, csc, &dim1, &dim2, &dim3);
rc = laplacian_parse_info(filename, spm, &dim1, &dim2, &dim3);
if (rc != PASTIX_SUCCESS)
return rc;
if( dim3 > 0 ) {
laplacian_table3D[csc->flttype](csc, dim1, dim2, dim3);
laplacian_table3D[spm->flttype](spm, dim1, dim2, dim3);
}
else if (dim2 > 0) {
laplacian_table2D[csc->flttype](csc, dim1, dim2);
laplacian_table2D[spm->flttype](spm, dim1, dim2);
}
else {
laplacian_table1D[csc->flttype](csc, dim1);
laplacian_table1D[spm->flttype](spm, dim1);
}
return PASTIX_SUCCESS;
......@@ -291,9 +291,9 @@ genLaplacian( const char *filename,
/**
*******************************************************************************
*
* @ingroup pastix_csc_driver
* @ingroup pastix_spm_driver
*
* genExtendedLaplacian - Generate a extended Laplacian of size csc->n
* genExtendedLaplacian - Generate a extended Laplacian of size spm->n
*
*******************************************************************************
*
......@@ -309,9 +309,9 @@ genLaplacian( const char *filename,
* <dim2> size of the second dimension of the 2D|3D laplacian
* <dim3> size of the third dimension of the 3D laplacian
*
* @param[inout] csc
* At start, an allocated csc structure.
* At exit, contains a laplacian matrix in the csc format.
* @param[inout] spm
* At start, an allocated spm structure.
* At exit, contains a laplacian matrix in the spm format.
*
*******************************************************************************
*
......@@ -322,23 +322,23 @@ genLaplacian( const char *filename,
*******************************************************************************/
int
genExtendedLaplacian( const char *filename,
pastix_csc_t *csc )
pastix_spm_t *spm )
{
pastix_int_t dim1, dim2, dim3;
int rc;
rc = laplacian_parse_info(filename, csc, &dim1, &dim2, &dim3);
rc = laplacian_parse_info(filename, spm, &dim1, &dim2, &dim3);
if (rc != PASTIX_SUCCESS)
return rc;
if( dim3 > 0 ) {
extended_laplacian_table3D[csc->flttype](csc, dim1, dim2, dim3);
extended_laplacian_table3D[spm->flttype](spm, dim1, dim2, dim3);
}
else if (dim2 > 0) {
extended_laplacian_table2D[csc->flttype](csc, dim1, dim2);
extended_laplacian_table2D[spm->flttype](spm, dim1, dim2);
}
else {
laplacian_table1D[csc->flttype](csc, dim1);
laplacian_table1D[spm->flttype](spm, dim1);
}
return PASTIX_SUCCESS;
......
......@@ -12,34 +12,34 @@
#ifndef _LAPLACIAN_H_
#define _LAPLACIAN_H_
void z_spmLaplacian1D( pastix_csc_t *csc, pastix_int_t dim1 );
void c_spmLaplacian1D( pastix_csc_t *csc, pastix_int_t dim1 );
void d_spmLaplacian1D( pastix_csc_t *csc, pastix_int_t dim1 );
void s_spmLaplacian1D( pastix_csc_t *csc, pastix_int_t dim1 );
void p_spmLaplacian1D( pastix_csc_t *csc, pastix_int_t dim1 );
void z_spmLaplacian1D( pastix_spm_t *spm, pastix_int_t dim1 );
void c_spmLaplacian1D( pastix_spm_t *spm, pastix_int_t dim1 );
void d_spmLaplacian1D( pastix_spm_t *spm, pastix_int_t dim1 );
void s_spmLaplacian1D( pastix_spm_t *spm, pastix_int_t dim1 );
void p_spmLaplacian1D( pastix_spm_t *spm, pastix_int_t dim1 );
void z_spmLaplacian2D( pastix_csc_t *csc, pastix_int_t dim1, pastix_int_t dim2 );
void c_spmLaplacian2D( pastix_csc_t *csc, pastix_int_t dim1, pastix_int_t dim2 );
void d_spmLaplacian2D( pastix_csc_t *csc, pastix_int_t dim1, pastix_int_t dim2 );
void s_spmLaplacian2D( pastix_csc_t *csc, pastix_int_t dim1, pastix_int_t dim2 );
void p_spmLaplacian2D( pastix_csc_t *csc, pastix_int_t dim1, pastix_int_t dim2 );
void z_spmLaplacian2D( pastix_spm_t *spm, pastix_int_t dim1, pastix_int_t dim2 );
void c_spmLaplacian2D( pastix_spm_t *spm, pastix_int_t dim1, pastix_int_t dim2 );
void d_spmLaplacian2D( pastix_spm_t *spm, pastix_int_t dim1, pastix_int_t dim2 );
void s_spmLaplacian2D( pastix_spm_t *spm, pastix_int_t dim1, pastix_int_t dim2 );
void p_spmLaplacian2D( pastix_spm_t *spm, pastix_int_t dim1, pastix_int_t dim2 );
void z_spmLaplacian3D( pastix_csc_t *csc, pastix_int_t dim1, pastix_int_t dim2, pastix_int_t dim3 );
void c_spmLaplacian3D( pastix_csc_t *csc, pastix_int_t dim1, pastix_int_t dim2, pastix_int_t dim3 );
void d_spmLaplacian3D( pastix_csc_t *csc, pastix_int_t dim1, pastix_int_t dim2, pastix_int_t dim3 );
void s_spmLaplacian3D( pastix_csc_t *csc, pastix_int_t dim1, pastix_int_t dim2, pastix_int_t dim3 );
void p_spmLaplacian3D( pastix_csc_t *csc, pastix_int_t dim1, pastix_int_t dim2, pastix_int_t dim3 );
void z_spmLaplacian3D( pastix_spm_t *spm, pastix_int_t dim1, pastix_int_t dim2, pastix_int_t dim3 );
void c_spmLaplacian3D( pastix_spm_t *spm, pastix_int_t dim1, pastix_int_t dim2, pastix_int_t dim3 );
void d_spmLaplacian3D( pastix_spm_t *spm, pastix_int_t dim1, pastix_int_t dim2, pastix_int_t dim3 );
void s_spmLaplacian3D( pastix_spm_t *spm, pastix_int_t dim1, pastix_int_t dim2, pastix_int_t dim3 );
void p_spmLaplacian3D( pastix_spm_t *spm, pastix_int_t dim1, pastix_int_t dim2, pastix_int_t dim3 );
void z_spmExtendedLaplacian2D( pastix_csc_t *csc, pastix_int_t dim1, pastix_int_t dim2 );
void c_spmExtendedLaplacian2D( pastix_csc_t *csc, pastix_int_t dim1, pastix_int_t dim2 );
void d_spmExtendedLaplacian2D( pastix_csc_t *csc, pastix_int_t dim1, pastix_int_t dim2 );
void s_spmExtendedLaplacian2D( pastix_csc_t *csc, pastix_int_t dim1, pastix_int_t dim2 );
void p_spmExtendedLaplacian2D( pastix_csc_t *csc, pastix_int_t dim1, pastix_int_t dim2 );
void z_spmExtendedLaplacian2D( pastix_spm_t *spm, pastix_int_t dim1, pastix_int_t dim2 );
void c_spmExtendedLaplacian2D( pastix_spm_t *spm, pastix_int_t dim1, pastix_int_t dim2 );
void d_spmExtendedLaplacian2D( pastix_spm_t *spm, pastix_int_t dim1, pastix_int_t dim2 );
void s_spmExtendedLaplacian2D( pastix_spm_t *spm, pastix_int_t dim1, pastix_int_t dim2 );
void p_spmExtendedLaplacian2D( pastix_spm_t *spm, pastix_int_t dim1, pastix_int_t dim2 );
void z_spmExtendedLaplacian3D( pastix_csc_t *csc, pastix_int_t dim1, pastix_int_t dim2, pastix_int_t dim3 );
void c_spmExtendedLaplacian3D( pastix_csc_t *csc, pastix_int_t dim1, pastix_int_t dim2, pastix_int_t dim3 );
void d_spmExtendedLaplacian3D( pastix_csc_t *csc, pastix_int_t dim1, pastix_int_t dim2, pastix_int_t dim3 );
void s_spmExtendedLaplacian3D( pastix_csc_t *csc, pastix_int_t dim1, pastix_int_t dim2, pastix_int_t dim3 );
void p_spmExtendedLaplacian3D( pastix_csc_t *csc, pastix_int_t dim1, pastix_int_t dim2, pastix_int_t dim3 );
void z_spmExtendedLaplacian3D( pastix_spm_t *spm, pastix_int_t dim1, pastix_int_t dim2, pastix_int_t dim3 );
void c_spmExtendedLaplacian3D( pastix_spm_t *spm, pastix_int_t dim1, pastix_int_t dim2, pastix_int_t dim3 );
void d_spmExtendedLaplacian3D( pastix_spm_t *spm, pastix_int_t dim1, pastix_int_t dim2, pastix_int_t dim3 );
void s_spmExtendedLaplacian3D( pastix_spm_t *spm, pastix_int_t dim1, pastix_int_t dim2, pastix_int_t dim3 );
void p_spmExtendedLaplacian3D( pastix_spm_t *spm, pastix_int_t dim1, pastix_int_t dim2, pastix_int_t dim3 );
#endif /* _LAPLACIAN_H_ */
......@@ -18,7 +18,7 @@
/**
* ******************************************************************************
*
* @ingroup pastix_csc_driver
* @ingroup pastix_spm_driver
*
* readHB - Interface to the Harwell-Boeing C driver (iohb.c)
*
......@@ -27,8 +27,8 @@
* @param[in] filename
* The file containing the matrix.
*
* @param[in] csc
* At exit, contains the matrix in csc format.
* @param[in] spm
* At exit, contains the matrix in spm format.
*
*******************************************************************************
*
......@@ -40,14 +40,14 @@
*******************************************************************************/
int
readHB( const char *filename,
pastix_csc_t *csc )
pastix_spm_t *spm )
{
int M, N, nz, nrhs;
/* Harwell Boeing is a variant of RSA */
csc->fmttype = PastixCSC;
csc->dof = 1;
csc->loc2glob= NULL;
spm->fmttype = PastixCSC;
spm->dof = 1;
spm->loc2glob= NULL;
/* Read header informations */
{
......@@ -62,24 +62,24 @@ readHB( const char *filename,
return PASTIX_ERR_BADPARAMETER;
}
csc->gN = M;
csc->n = M;
csc->gnnz = nz;
csc->nnz = nz;
spm->gN = M;
spm->n = M;
spm->gnnz = nz;
spm->nnz = nz;
/* Check float type */
switch( Type[0] ) {
case 'C':
case 'c':
csc->flttype = PastixComplex64;
spm->flttype = PastixComplex64;
break;
case 'R':
case 'r':
csc->flttype = PastixDouble;
spm->flttype = PastixDouble;
break;
case 'P':
case 'p':
csc->flttype = PastixPattern;
spm->flttype = PastixPattern;
break;
default:
fprintf(stderr, "readhb: Floating type unknown (%c)\n", Type[0]);
......@@ -90,17 +90,17 @@ readHB( const char *filename,
switch( Type[1] ) {
case 'S':
case 's':
csc->mtxtype = PastixSymmetric;
spm->mtxtype = PastixSymmetric;
break;
case 'H':
case 'h':
csc->mtxtype = PastixHermitian;
assert( csc->flttype == PastixDouble );
spm->mtxtype = PastixHermitian;
assert( spm->flttype == PastixDouble );
break;
case 'U':
case 'u':
default:
csc->mtxtype = PastixGeneral;
spm->mtxtype = PastixGeneral;
}
free(Type);
}
......@@ -111,7 +111,7 @@ readHB( const char *filename,
int rc;
rc = readHB_newmat_double( filename, &M, &N, &nz,
&colptr, &rowind, (double**)(&(csc->values)) );
&colptr, &rowind, (double**)(&(spm->values)) );
if (rc == 0) {
fprintf(stderr, "readhb: Error in reading the HB matrix values\n");
......@@ -119,8 +119,8 @@ readHB( const char *filename,
}
/* Move the colptr/rowind from int to pastix_int_t if different sizes */
csc->colptr = spmIntConvert(csc->n+1, colptr);
csc->rowptr = spmIntConvert(csc->nnz, rowind);
spm->colptr = spmIntConvert(spm->n+1, colptr);
spm->rowptr = spmIntConvert(spm->nnz, rowind);
}
return PASTIX_SUCCESS;
}
......@@ -18,7 +18,7 @@
/**
*******************************************************************************
*
* @ingroup pastix_csc_driver
* @ingroup pastix_spm_driver
*
* threeFilesReadHeader - Read header from three file IJV format.
*
......@@ -67,7 +67,7 @@ threeFilesReadHeader(FILE *infile,
/**
* ******************************************************************************
*
* @ingroup pastix_csc_driver
* @ingroup pastix_spm_driver
*
* readIJV - Read matrix from three files IJV
*
......@@ -81,7 +81,7 @@ threeFilesReadHeader(FILE *infile,
* @param[in] dirname
* Directory that contains the files.
*
* @param[out] csc
* @param[out] spm
* At exit, contains the matrix in ijv format.
*
*******************************************************************************
......@@ -95,7 +95,7 @@ threeFilesReadHeader(FILE *infile,
*******************************************************************************/
int
readIJV( const char *dirname,
pastix_csc_t *csc )
pastix_spm_t *spm )
{
FILE *iafile, *jafile, *rafile;
......@@ -108,11 +108,11 @@ readIJV( const char *dirname,
filename = malloc(strlen(dirname)+10);
csc->flttype = PastixDouble;
csc->mtxtype = PastixGeneral;
csc->fmttype = PastixIJV;
csc->dof = 1;
csc->loc2glob= NULL;
spm->flttype = PastixDouble;
spm->mtxtype = PastixGeneral;
spm->fmttype = PastixIJV;
spm->dof = 1;
spm->loc2glob= NULL;
/* Read the header information */
{
......@@ -127,13 +127,13 @@ readIJV( const char *dirname,
fclose(hdrfile);
}
csc->gN = Ncol;
csc->n = Ncol;
csc->gnnz = Nnzero;
csc->nnz = Nnzero;
csc->colptr = (pastix_int_t *) malloc(Nnzero*sizeof(pastix_int_t));
csc->rowptr = (pastix_int_t *) malloc(Nnzero*sizeof(pastix_int_t));
csc->values = (double *) malloc(Nnzero*sizeof(double));
spm->gN = Ncol;
spm->n = Ncol;
spm->gnnz = Nnzero;
spm->nnz = Nnzero;
spm->colptr = (pastix_int_t *) malloc(Nnzero*sizeof(pastix_int_t));
spm->rowptr = (pastix_int_t *) malloc(Nnzero*sizeof(pastix_int_t));
spm->values = (double *) malloc(Nnzero*sizeof(double));
/* Open the 3 files */
sprintf(filename,"%s/ia_threeFiles",dirname);
......@@ -164,9 +164,9 @@ readIJV( const char *dirname,
}
/* Read the files */
tempcol = csc->colptr;
temprow = csc->rowptr;
tempval = csc->values;
tempcol = spm->colptr;
temprow = spm->rowptr;
tempval = spm->values;
for (i=0; i<Nnzero; i++, tempcol++, temprow++, tempval++)
{
......
......@@ -18,7 +18,7 @@
/**
*******************************************************************************
*
* @ingroup pastix_csc_driver
* @ingroup pastix_spm_driver
*
* z_readMM - Read the data part of a complex matrix in Matrix Market file.
* For more information about matrix market format see mmio.c/mmio.h
......@@ -29,8 +29,8 @@
* The file opened in readMM which contains the matrix stored in Matrix
* Market format.
*
* @param[inout] csc
* At exit, the data of the matrix are stored in the csc structure.
* @param[inout] spm
* At exit, the data of the matrix are stored in the spm structure.
*
*******************************************************************************
*
......@@ -41,7 +41,7 @@
*******************************************************************************/
int
z_readMM( FILE *file,
pastix_csc_t *csc )
pastix_spm_t *spm )
{
pastix_complex64_t *valptr;
pastix_int_t *colptr;
......@@ -50,13 +50,13 @@ z_readMM( FILE *file,
long row, col;
double re, im;
csc->values = malloc( csc->nnz * sizeof(pastix_complex64_t) );
spm->values = malloc( spm->nnz * sizeof(pastix_complex64_t) );
colptr = csc->colptr;
rowptr = csc->rowptr;
valptr = (pastix_complex64_t*)(csc->values);
colptr = spm->colptr;
rowptr = spm->rowptr;
valptr = (pastix_complex64_t*)(spm->values);
for (i=0; i<csc->nnz; i++, colptr++, rowptr++, valptr++)
for (i=0; i<spm->nnz; i++, colptr++, rowptr++, valptr++)
{
if (4 != fscanf(file,"%ld %ld %lg %lg\n", &row, &col, &re, &im))
{
......@@ -75,7 +75,7 @@ z_readMM( FILE *file,
/**
*******************************************************************************
*
* @ingroup pastix_csc_driver
* @ingroup pastix_spm_driver
*
* d_readMM - Read the data part of a real matrix in Matrix Market file.
* For more information about matrix market format see mmio.c/mmio.h
......@@ -86,8 +86,8 @@ z_readMM( FILE *file,
* The file opened in readMM which contains the matrix stored in Matrix
* Market format.
*
* @param[inout] csc
* At exit, the data of the matrix are stored in the csc structure.
* @param[inout] spm
* At exit, the data of the matrix are stored in the spm structure.
*
*******************************************************************************
*
......@@ -98,7 +98,7 @@ z_readMM( FILE *file,
*******************************************************************************/
int
d_readMM( FILE *file,
pastix_csc_t *csc )
pastix_spm_t *spm )
{
double *valptr;
pastix_int_t *colptr;
......@@ -107,13 +107,13 @@ d_readMM( FILE *file,
long row, col;
double re;
csc->values = malloc( csc->nnz * sizeof(double) );
spm->values = malloc( spm->nnz * sizeof(double) );
colptr = csc->colptr;
rowptr = csc->rowptr;
valptr = (double*)(csc->values);
colptr = spm->colptr;
rowptr = spm->rowptr;
valptr = (double*)(spm->values);
for (i=0; i<csc->nnz; i++, colptr++, rowptr++, valptr++)
for (i=0; i<spm->nnz; i++, colptr++, rowptr++, valptr++)
{
if (3 != fscanf(file,"%ld %ld %lg\n", &row, &col, &re))
{
......@@ -132,7 +132,7 @@ d_readMM( FILE *file,
/**
*******************************************************************************
*
* @ingroup pastix_csc_driver
* @ingroup pastix_spm_driver
*
* p_readMM - Read the data part of a pattern matrix in Matrix Market file.
* For more information about matrix market format see mmio.c/mmio.h
......@@ -143,8 +143,8 @@ d_readMM( FILE *file,
* The file opened in readMM which contains the matrix stored in Matrix
* Market format.
*
* @param[inout] csc
* At exit, the data of the matrix are stored in the csc structure.
* @param[inout] spm
* At exit, the data of the matrix are stored in the spm structure.
*
*******************************************************************************
*
......@@ -155,19 +155,19 @@ d_readMM( FILE *file,
*******************************************************************************/
int
p_readMM( FILE *file,
pastix_csc_t *csc )
pastix_spm_t *spm )
{
pastix_int_t *colptr;
pastix_int_t *rowptr;
pastix_int_t i;
long row, col;
csc->values = NULL;
spm->values = NULL;
colptr = csc->colptr;
rowptr = csc->rowptr;
colptr = spm->colptr;
rowptr = spm->rowptr;
for (i=0; i<csc->nnz; i++, colptr++, rowptr++)
for (i=0; i<spm->nnz; i++, colptr++, rowptr++)
{
if (2 != fscanf(file,"%ld %ld\n", &row, &col))
{
......@@ -185,7 +185,7 @@ p_readMM( FILE *file,
/**
*******************************************************************************
*
* @ingroup pastix_csc_driver
* @ingroup pastix_spm_driver
*
* readMM - Read a matrix in Matrix Market fill. This corresponds to
* IJV format with (%d %d[ %lf[ %lf]]) format per line.
......@@ -196,8 +196,8 @@ p_readMM( FILE *file,
* @param[in] filename
* The filename that contains the matrix stored in Matrix Market format.
*
* @param[in] csc
* At exit, contains the matrix in csc format.
* @param[in] spm
* At exit, contains the matrix in spm format.
*
*******************************************************************************
*
......@@ -209,7 +209,7 @@ p_readMM( FILE *file,
*******************************************************************************/
int
readMM( const char *filename,
pastix_csc_t *csc )
pastix_spm_t *spm )
{
MM_typecode matcode;
FILE *file;
......@@ -229,14 +229,15 @@ readMM( const char *filename,
}
/* Float values type */
if (mm_is_complex(matcode)) {
csc->flttype = PastixComplex64;
spm->flttype = PastixComplex64;
}
else if (mm_is_real(matcode)) {
csc->flttype = PastixDouble;
spm->flttype = PastixDouble;
}
else if (mm_is_pattern(matcode)) {
csc->flttype = PastixPattern;
spm->flttype = PastixPattern;
}
else {
fprintf(stderr,"readmm: Unsupported type of matrix.\n");
......@@ -245,22 +246,22 @@ readMM( const char *filename,
/* Matrix structure */
if (mm_is_general(matcode)) {
csc->mtxtype = PastixGeneral;
spm->mtxtype = PastixGeneral;
}
else if (mm_is_symmetric(matcode)) {
csc->mtxtype = PastixSymmetric;
spm->mtxtype = PastixSymmetric;
}
else if (mm_is_hermitian(matcode)) {
csc->mtxtype = PastixHermitian;
spm->mtxtype = PastixHermitian;
}
else {
fprintf(stderr,"readmm: Unsupported type of matrix.\n");
return PASTIX_ERR_BADPARAMETER;
}
csc->fmttype = PastixIJV;
csc->dof = 1;
csc->loc2glob= NULL;
spm->fmttype = PastixIJV;
spm->dof = 1;
spm->loc2glob= NULL;
/* Read the size */
{
......@@ -270,27 +271,27 @@ readMM( const char *filename,
return PASTIX_ERR_IO;
}
csc->gN = n;
csc->n = n;
csc->gnnz = nnz;
csc->nnz = nnz;
spm->gN = n;
spm->n = n;
spm->gnnz = nnz;
spm->nnz = nnz;
}
csc->colptr = (pastix_int_t*)malloc(csc->nnz * sizeof(pastix_int_t));
csc->rowptr = (pastix_int_t*)malloc(csc->nnz * sizeof(pastix_int_t));
spm->colptr = (pastix_int_t*)malloc(spm->nnz * sizeof(pastix_int_t));
spm->rowptr = (pastix_int_t*)malloc(spm->nnz * sizeof(pastix_int_t));
switch( csc->flttype ) {
switch( spm->flttype ) {
case PastixComplex64:
rc = z_readMM(file,csc);
rc = z_readMM(file, spm);
break;
case PastixDouble:
rc = d_readMM(file,csc);
rc = d_readMM(file, spm);
break;
case PastixPattern:
default:
rc = p_readMM(file,csc);
rc = p_readMM(file, spm);
}
fclose(file);
......
......@@ -63,7 +63,7 @@ FC_GLOBAL(wreadmtc,WREADMTC)(int *tmp1,
/**
*******************************************************************************
*
* @ingroup pastix_csc_driver
* @ingroup pastix_spm_driver
*
* readRSAHeader - Read the header structure of a RSA file
*
......@@ -129,7 +129,7 @@ readRSAHeader( const char *filename,
/**
*******************************************************************************
*
* @ingroup pastix_csc_driver
* @ingroup pastix_spm_driver
*
* readRSA - Read a RSA matrix file. This driver reads only real matrices, and
* does not support complex matrices.
......@@ -142,8 +142,8 @@ readRSAHeader( const char *filename,
* an interface to the wreadmtx fortran function provided within
* SparseKit.
*
* @param[in] csc
* At exit, contains the matrix in csc format.
* @param[in] spm
* At exit, contains the matrix in spm format.
*
*******************************************************************************
*
......@@ -155,7 +155,7 @@ readRSAHeader( const char *filename,
*******************************************************************************/
int
readRSA( const char *filename,
pastix_csc_t *csc )
pastix_spm_t *spm )
{
char Type[4];
char RhsType[4];
......@@ -175,11 +175,11 @@ readRSA( const char *filename,
switch( Type[1] ){
case 'S':
case 's':
csc->mtxtype = PastixSymmetric;
spm->mtxtype = PastixSymmetric;
break;
case 'H':
case 'h':
csc->mtxtype = PastixHermitian;
spm->mtxtype = PastixHermitian;
/**
* We should not arrive here, since the fortran driver is not able to
* read complex matrices
......@@ -188,21 +188,21 @@ readRSA( const char *filename,
return PASTIX_ERR_BADPARAMETER;
case 'U':
case 'u':
csc->mtxtype = PastixGeneral;
spm->mtxtype = PastixGeneral;
break;
default:
fprintf(stderr,"readrsa: Unsupported type of matrix.\n");
return PASTIX_ERR_BADPARAMETER;
}
csc->flttype = PastixDouble;
csc->fmttype = PastixCSC;
csc->gN = N;
csc->n = N;
csc->gnnz = Nnz;
csc->nnz = Nnz;
csc->dof = 1;
csc->loc2glob= NULL;
spm->flttype = PastixDouble;
spm->fmttype = PastixCSC;
spm->gN = N;
spm->n = N;
spm->gnnz = Nnz;
spm->nnz = Nnz;
spm->dof = 1;
spm->loc2glob= NULL;
tmpcolptr = (int*) malloc( (N+1) * sizeof(int) );
assert( tmpcolptr );
......@@ -211,21 +211,21 @@ readRSA( const char *filename,
assert( tmprows );
/* RSA reads only double */
csc->values = (double*) malloc( Nnz * sizeof(double) );
assert( csc->values );
spm->values = (double*) malloc( Nnz * sizeof(double) );
assert( spm->values );
len = strlen(filename);
tmp = 2;
nrhs = 0;
FC_GLOBAL(wreadmtc,WREADMTC)
(&N, &Nnz, &tmp, filename, &len, csc->values, tmprows, tmpcolptr, crhs,
(&N, &Nnz, &tmp, filename, &len, spm->values, tmprows, tmpcolptr, crhs,
&nrhs, RhsType, &M, &N, &Nnz, title, key, Type, &ierr );
assert( (tmpcolptr[N]-tmpcolptr[0]) == Nnz );
csc->colptr = spmIntConvert( N+1, tmpcolptr );
csc->rowptr = spmIntConvert( Nnz, tmprows );
spm->colptr = spmIntConvert( N+1, tmpcolptr );
spm->rowptr = spmIntConvert( Nnz, tmprows );
RhsType[0] = '\0';
if(ierr != 0) {
......
......@@ -26,7 +26,7 @@
* @brief compute the matrix-vector product:
* y = alpha * op( A ) * x + beta * y
*
* A is a PastixGeneral csc, where op( X ) is one of
* A is a PastixGeneral spm, where op( X ) is one of
*
* op( X ) = X or op( X ) = X' or op( X ) = conjg( X' )
*
......@@ -44,8 +44,8 @@
* @param[in] alpha
* alpha specifies the scalar alpha
*
* @param[in] csc
* The PastixGeneral csc.
* @param[in] spm
* The PastixGeneral spm.
*
* @param[in] x
* The vector x.
......@@ -65,34 +65,34 @@
int
z_spmGeCSCv(const pastix_trans_t trans,
pastix_complex64_t alpha,
const pastix_spm_t *csc,
const pastix_spm_t *spm,
const pastix_complex64_t *x,
pastix_complex64_t beta,
pastix_complex64_t *y )
{
const pastix_complex64_t *valptr = (pastix_complex64_t*)(csc->values);
const pastix_complex64_t *valptr = (pastix_complex64_t*)(spm->values);
const pastix_complex64_t *xptr = (const pastix_complex64_t*)x;
pastix_complex64_t *yptr = (pastix_complex64_t*)y;
pastix_int_t col, row, i, baseval;
if ( (csc == NULL) || (x == NULL) || (y == NULL ) )
if ( (spm == NULL) || (x == NULL) || (y == NULL ) )
{
return PASTIX_ERR_BADPARAMETER;
}
if( csc->mtxtype != PastixGeneral )
if( spm->mtxtype != PastixGeneral )
{
return PASTIX_ERR_BADPARAMETER;
}
baseval = spmFindBase( csc );
baseval = spmFindBase( spm );
/* first, y = beta*y */
if( beta == 0. ) {
memset( yptr, 0, csc->gN * sizeof(pastix_complex64_t) );
memset( yptr, 0, spm->gN * sizeof(pastix_complex64_t) );
}
else {
for( i=0; i<csc->gN; i++, yptr++ ) {
for( i=0; i<spm->gN; i++, yptr++ ) {
(*yptr) *= beta;
}
yptr = y;
......@@ -104,11 +104,11 @@ z_spmGeCSCv(const pastix_trans_t trans,
*/
if( trans == PastixNoTrans )
{
for( col=0; col < csc->gN; col++ )
for( col=0; col < spm->gN; col++ )
{
for( i=csc->colptr[col]; i<csc->colptr[col+1]; i++ )
for( i=spm->colptr[col]; i<spm->colptr[col+1]; i++ )
{
row = csc->rowptr[i-baseval]-baseval;
row = spm->rowptr[i-baseval]-baseval;
yptr[row] += alpha * valptr[i-baseval] * xptr[col];
}
}
......@@ -118,11 +118,11 @@ z_spmGeCSCv(const pastix_trans_t trans,
*/
else if( trans == PastixTrans )
{
for( col=0; col < csc->gN; col++ )
for( col=0; col < spm->gN; col++ )
{
for( i=csc->colptr[col]; i<csc->colptr[col+1]; i++ )
for( i=spm->colptr[col]; i<spm->colptr[col+1]; i++ )
{
row = csc->rowptr[i-baseval]-baseval;
row = spm->rowptr[i-baseval]-baseval;
yptr[col] += alpha * valptr[i-baseval] * xptr[row];
}
}
......@@ -130,11 +130,11 @@ z_spmGeCSCv(const pastix_trans_t trans,
#if defined(PRECISION_c) || defined(PRECISION_z)
else if( trans == PastixConjTrans )
{
for( col=0; col < csc->gN; col++ )
for( col=0; col < spm->gN; col++ )
{
for( i=csc->colptr[col]; i<csc->colptr[col+1]; i++ )
for( i=spm->colptr[col]; i<spm->colptr[col+1]; i++ )
{
row = csc->rowptr[i-baseval]-baseval;
row = spm->rowptr[i-baseval]-baseval;
yptr[col] += alpha * conj( valptr[i-baseval] ) * xptr[row];
}
}
......@@ -157,7 +157,7 @@ z_spmGeCSCv(const pastix_trans_t trans,
* @brief compute the matrix-vector product:
* y = alpha * A + beta * y
*
* A is a PastixSymmetric csc, alpha and beta are scalars, and x and y are
* A is a PastixSymmetric spm, alpha and beta are scalars, and x and y are
* vectors, and A a symm.
*
*******************************************************************************
......@@ -165,8 +165,8 @@ z_spmGeCSCv(const pastix_trans_t trans,
* @param[in] alpha
* alpha specifies the scalar alpha
*
* @param[in] csc
* The PastixSymmetric csc.
* @param[in] spm
* The PastixSymmetric spm.
*
* @param[in] x
* The vector x.
......@@ -185,45 +185,45 @@ z_spmGeCSCv(const pastix_trans_t trans,
*******************************************************************************/
int
z_spmSyCSCv( pastix_complex64_t alpha,
const pastix_spm_t *csc,
const pastix_spm_t *spm,
const pastix_complex64_t *x,
pastix_complex64_t beta,
pastix_complex64_t *y )
{
const pastix_complex64_t *valptr = (pastix_complex64_t*)csc->values;
const pastix_complex64_t *valptr = (pastix_complex64_t*)spm->values;
const pastix_complex64_t *xptr = x;
pastix_complex64_t *yptr = y;
pastix_int_t col, row, i, baseval;
if ( (csc == NULL) || (x == NULL) || (y == NULL ) )
if ( (spm == NULL) || (x == NULL) || (y == NULL ) )
{
return PASTIX_ERR_BADPARAMETER;
}
if( csc->mtxtype != PastixSymmetric )
if( spm->mtxtype != PastixSymmetric )
{
return PASTIX_ERR_BADPARAMETER;
}
baseval = spmFindBase( csc );
baseval = spmFindBase( spm );
/* First, y = beta*y */
if( beta == 0. ) {
memset( yptr, 0, csc->gN * sizeof(pastix_complex64_t) );
memset( yptr, 0, spm->gN * sizeof(pastix_complex64_t) );
}
else {
for( i=0; i<csc->gN; i++, yptr++ ) {
for( i=0; i<spm->gN; i++, yptr++ ) {
(*yptr) *= beta;
}
yptr = y;
}
if( alpha != 0. ) {
for( col=0; col < csc->gN; col++ )
for( col=0; col < spm->gN; col++ )
{
for( i=csc->colptr[col]; i < csc->colptr[col+1]; i++ )
for( i=spm->colptr[col]; i < spm->colptr[col+1]; i++ )
{
row = csc->rowptr[i-baseval]-baseval;
row = spm->rowptr[i-baseval]-baseval;
yptr[row] += alpha * valptr[i-baseval] * xptr[col];
if( col != row )
{
......@@ -245,7 +245,7 @@ z_spmSyCSCv( pastix_complex64_t alpha,
* @brief compute the matrix-vector product:
* y = alpha * A + beta * y
*
* A is a PastixHermitian csc, alpha and beta are scalars, and x and y are
* A is a PastixHermitian spm, alpha and beta are scalars, and x and y are
* vectors, and A a symm.
*
*******************************************************************************
......@@ -253,8 +253,8 @@ z_spmSyCSCv( pastix_complex64_t alpha,
* @param[in] alpha
* alpha specifies the scalar alpha
*
* @param[in] csc
* The PastixHermitian csc.
* @param[in] spm
* The PastixHermitian spm.
*
* @param[in] x
* The vector x.
......@@ -273,45 +273,45 @@ z_spmSyCSCv( pastix_complex64_t alpha,
*******************************************************************************/
int
z_spmHeCSCv( pastix_complex64_t alpha,
const pastix_spm_t *csc,
const pastix_spm_t *spm,
const pastix_complex64_t *x,
pastix_complex64_t beta,
pastix_complex64_t *y )
{
const pastix_complex64_t *valptr = (pastix_complex64_t*)csc->values;
const pastix_complex64_t *valptr = (pastix_complex64_t*)spm->values;
const pastix_complex64_t *xptr = x;
pastix_complex64_t *yptr = y;
pastix_int_t col, row, i, baseval;
if ( (csc == NULL) || (x == NULL) || (y == NULL ) )
if ( (spm == NULL) || (x == NULL) || (y == NULL ) )
{
return PASTIX_ERR_BADPARAMETER;
}
if( csc->mtxtype != PastixHermitian )
if( spm->mtxtype != PastixHermitian )
{
return PASTIX_ERR_BADPARAMETER;
}
/* First, y = beta*y */
if( beta == 0. ) {
memset( yptr, 0, csc->gN * sizeof(pastix_complex64_t) );
memset( yptr, 0, spm->gN * sizeof(pastix_complex64_t) );
}
else {
for( i=0; i<csc->gN; i++, yptr++ ) {
for( i=0; i<spm->gN; i++, yptr++ ) {
(*yptr) *= beta;
}
yptr = y;
}
baseval = spmFindBase( csc );
baseval = spmFindBase( spm );
if( alpha != 0. ) {
for( col=0; col < csc->gN; col++ )
for( col=0; col < spm->gN; col++ )
{
for( i=csc->colptr[col]; i < csc->colptr[col+1]; i++ )
for( i=spm->colptr[col]; i < spm->colptr[col+1]; i++ )
{
row=csc->rowptr[i-baseval]-baseval;
row=spm->rowptr[i-baseval]-baseval;
if( col != row ) {
yptr[row] += alpha * valptr[i-baseval] * xptr[col];
yptr[col] += alpha * conj( valptr[i-baseval] ) * xptr[row];
......@@ -335,7 +335,7 @@ z_spmHeCSCv( pastix_complex64_t alpha,
* @brief compute the matrix-vector product:
* y = alpha * A + beta * y
*
* A is a PastixHermitian csc, alpha and beta are scalars, and x and y are
* A is a PastixHermitian spm, alpha and beta are scalars, and x and y are
* vectors, and A a symm.
*
*******************************************************************************
......@@ -346,8 +346,8 @@ z_spmHeCSCv( pastix_complex64_t alpha,
* @param[in] alphaptr
* alpha specifies the scalar alpha
*
* @param[in] csc
* The PastixHermitian csc.
* @param[in] spm
* The PastixHermitian spm.
*
* @param[in] xptr
* The vector x.
......@@ -367,7 +367,7 @@ z_spmHeCSCv( pastix_complex64_t alpha,
int
z_spmCSCMatVec(const pastix_trans_t trans,
const void *alphaptr,
const pastix_spm_t *csc,
const pastix_spm_t *spm,
const void *xptr,
const void *betaptr,
void *yptr )
......@@ -379,15 +379,15 @@ z_spmCSCMatVec(const pastix_trans_t trans,
alpha = *((const pastix_complex64_t *)alphaptr);
beta = *((const pastix_complex64_t *)betaptr);
switch (csc->mtxtype) {
switch (spm->mtxtype) {
#if defined(PRECISION_z) || defined(PRECISION_c)
case PastixHermitian:
return z_spmHeCSCv( alpha, csc, x, beta, y );
return z_spmHeCSCv( alpha, spm, x, beta, y );
#endif
case PastixSymmetric:
return z_spmSyCSCv( alpha, csc, x, beta, y );
return z_spmSyCSCv( alpha, spm, x, beta, y );
case PastixGeneral:
default:
return z_spmGeCSCv( trans, alpha, csc, x, beta, y );
return z_spmGeCSCv( trans, alpha, spm, x, beta, y );
}
}
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