Mentions légales du service

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

Add epsilon to the check function to test accordingly to the elvel of precision wanted

parent 67a282f2
No related branches found
No related tags found
No related merge requests found
...@@ -1205,6 +1205,10 @@ spmGenRHS( pastix_rhstype_t type, pastix_int_t nrhs, ...@@ -1205,6 +1205,10 @@ spmGenRHS( pastix_rhstype_t type, pastix_int_t nrhs,
* *
******************************************************************************* *******************************************************************************
* *
* @param[in] eps
* The epsilon threshold used for the refinement step. -1. to use the
* machine precision.
*
* @param[in] nrhs * @param[in] nrhs
* Defines the number of right hand side that must be generated. * Defines the number of right hand side that must be generated.
* *
...@@ -1243,14 +1247,14 @@ spmGenRHS( pastix_rhstype_t type, pastix_int_t nrhs, ...@@ -1243,14 +1247,14 @@ spmGenRHS( pastix_rhstype_t type, pastix_int_t nrhs,
* *
*******************************************************************************/ *******************************************************************************/
int int
spmCheckAxb( pastix_int_t nrhs, spmCheckAxb( double eps, pastix_int_t nrhs,
const pastix_spm_t *spm, const pastix_spm_t *spm,
void *x0, pastix_int_t ldx0, void *x0, pastix_int_t ldx0,
void *b, pastix_int_t ldb, void *b, pastix_int_t ldb,
const void *x, pastix_int_t ldx ) const void *x, pastix_int_t ldx )
{ {
static int (*ptrfunc[4])(int, const pastix_spm_t *, static int (*ptrfunc[4])( double, int, const pastix_spm_t *,
void *, int, void *, int, const void *, int) = void *, int, void *, int, const void *, int ) =
{ {
s_spmCheckAxb, d_spmCheckAxb, c_spmCheckAxb, z_spmCheckAxb s_spmCheckAxb, d_spmCheckAxb, c_spmCheckAxb, z_spmCheckAxb
}; };
...@@ -1260,7 +1264,7 @@ spmCheckAxb( pastix_int_t nrhs, ...@@ -1260,7 +1264,7 @@ spmCheckAxb( pastix_int_t nrhs,
return PASTIX_ERR_BADPARAMETER; return PASTIX_ERR_BADPARAMETER;
} }
else { else {
return ptrfunc[id](nrhs, spm, x0, ldx0, b, ldb, x, ldx ); return ptrfunc[id]( eps, nrhs, spm, x0, ldx0, b, ldb, x, ldx );
} }
} }
......
...@@ -115,7 +115,7 @@ pastix_spm_t *spmCheckAndCorrect( pastix_spm_t *spm ); ...@@ -115,7 +115,7 @@ pastix_spm_t *spmCheckAndCorrect( pastix_spm_t *spm );
* @{ * @{
*/ */
int spmGenRHS( pastix_rhstype_t type, pastix_int_t nrhs, const pastix_spm_t *spm, void *x, pastix_int_t ldx, void *b, pastix_int_t ldb ); int spmGenRHS( pastix_rhstype_t type, pastix_int_t nrhs, const pastix_spm_t *spm, void *x, pastix_int_t ldx, void *b, pastix_int_t ldb );
int spmCheckAxb( pastix_int_t nrhs, const pastix_spm_t *spm, void *x0, pastix_int_t ldx0, void *b, pastix_int_t ldb, const void *x, pastix_int_t ldx ); int spmCheckAxb( double eps, pastix_int_t nrhs, const pastix_spm_t *spm, void *x0, pastix_int_t ldx0, void *b, pastix_int_t ldb, const void *x, pastix_int_t ldx );
/** /**
* @} * @}
......
...@@ -56,7 +56,7 @@ pastix_int_t z_spmMergeDuplicate( pastix_spm_t *spm ); ...@@ -56,7 +56,7 @@ pastix_int_t z_spmMergeDuplicate( pastix_spm_t *spm );
pastix_int_t z_spmSymmetrize( pastix_spm_t *spm ); pastix_int_t z_spmSymmetrize( pastix_spm_t *spm );
int z_spmGenRHS(pastix_rhstype_t type, int nrhs, const pastix_spm_t *spm, void *x, int ldx, void *b, int ldb ); int z_spmGenRHS(pastix_rhstype_t type, int nrhs, const pastix_spm_t *spm, void *x, int ldx, void *b, int ldb );
int z_spmCheckAxb( int nrhs, const pastix_spm_t *spm, void *x0, int ldx0, void *b, int ldb, const void *x, int ldx ); int z_spmCheckAxb( pastix_fixdbl_t eps, int nrhs, const pastix_spm_t *spm, void *x0, int ldx0, void *b, int ldb, const void *x, int ldx );
/** /**
* Output routines * Output routines
......
...@@ -321,6 +321,10 @@ z_spmGenRHS( pastix_rhstype_t type, int nrhs, ...@@ -321,6 +321,10 @@ z_spmGenRHS( pastix_rhstype_t type, int nrhs,
* *
******************************************************************************* *******************************************************************************
* *
* @param[in] eps
* The epsilon threshold used for the refinement step. -1. to use the
* machine precision.
*
* @param[in] nrhs * @param[in] nrhs
* Defines the number of right hand side that must be generated. * Defines the number of right hand side that must be generated.
* *
...@@ -358,7 +362,7 @@ z_spmGenRHS( pastix_rhstype_t type, int nrhs, ...@@ -358,7 +362,7 @@ z_spmGenRHS( pastix_rhstype_t type, int nrhs,
* *
*******************************************************************************/ *******************************************************************************/
int int
z_spmCheckAxb( int nrhs, z_spmCheckAxb( pastix_fixdbl_t eps, int nrhs,
const pastix_spm_t *spm, const pastix_spm_t *spm,
void *x0, int ldx0, void *x0, int ldx0,
void *b, int ldb, void *b, int ldb,
...@@ -368,14 +372,16 @@ z_spmCheckAxb( int nrhs, ...@@ -368,14 +372,16 @@ z_spmCheckAxb( int nrhs,
pastix_complex64_t *zx0 = (pastix_complex64_t *)x0; pastix_complex64_t *zx0 = (pastix_complex64_t *)x0;
pastix_complex64_t *zb = (pastix_complex64_t *)b; pastix_complex64_t *zb = (pastix_complex64_t *)b;
double normA, normB, normX, normX0, normR; double normA, normB, normX, normX0, normR;
double backward, forward, eps; double backward, forward;
int failure = 0; int failure = 0;
int i; int i;
assert( spm->nexp == spm->n ); assert( spm->nexp == spm->n );
assert( spm->dof == 1 ); assert( spm->dof == 1 );
eps = LAPACKE_dlamch('e'); if ( eps == -1. ) {
eps = LAPACKE_dlamch('e');
}
/** /**
* Compute the starting norms * Compute the starting norms
...@@ -415,7 +421,7 @@ z_spmCheckAxb( int nrhs, ...@@ -415,7 +421,7 @@ z_spmCheckAxb( int nrhs,
normR = (nr > normR ) ? nr : normR; normR = (nr > normR ) ? nr : normR;
backward = (back > backward) ? back : backward; backward = (back > backward) ? back : backward;
fail = isnan(nr) || isinf(nr) || isnan(back) || isinf(back) || (back > 1.e3); fail = isnan(nr) || isinf(nr) || isnan(back) || isinf(back) || (back > 1.e2);
if ( fail ) { if ( fail ) {
printf( " || b_%d - A x_%d ||_1 %e\n" printf( " || b_%d - A x_%d ||_1 %e\n"
" || b_%d - A x_%d ||_1 / (||A||_1 * ||x_%d||_oo * eps) %e (%s)\n", " || b_%d - A x_%d ||_1 / (||A||_1 * ||x_%d||_oo * eps) %e (%s)\n",
...@@ -459,7 +465,7 @@ z_spmCheckAxb( int nrhs, ...@@ -459,7 +465,7 @@ z_spmCheckAxb( int nrhs,
normR = ( nr > normR ) ? nr : normR; normR = ( nr > normR ) ? nr : normR;
forward = ( forw > forward ) ? forw : forward; forward = ( forw > forward ) ? forw : forward;
fail = isnan(nx) || isinf(nx) || isnan(forw) || isinf(forw) || (forw > 1.e3); fail = isnan(nx) || isinf(nx) || isnan(forw) || isinf(forw) || (forw > 1.e2);
if ( fail ) { if ( fail ) {
printf( " || x0_%d ||_oo %e\n" printf( " || x0_%d ||_oo %e\n"
" || x0_%d - x_%d ||_oo / (||x0_%d||_oo * eps) %e (%s)\n", " || x0_%d - x_%d ||_oo / (||x0_%d||_oo * eps) %e (%s)\n",
......
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