Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
spm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
solverstack
spm
Commits
1fd19691
Commit
1fd19691
authored
6 years ago
by
Mathieu Faverge
Browse files
Options
Downloads
Patches
Plain Diff
Factorize code in norm tests
parent
22a1ecd6
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/spm_tests.h
+14
-0
14 additions, 0 deletions
tests/spm_tests.h
tests/z_spm_tests.c
+4
-40
4 additions, 40 deletions
tests/z_spm_tests.c
with
18 additions
and
40 deletions
tests/spm_tests.h
+
14
−
0
View file @
1fd19691
...
...
@@ -87,4 +87,18 @@ void s_spm_print_check( char *filename, const spmatrix_t *spm );
int
s_spm_matvec_check
(
int
trans
,
const
spmatrix_t
*
spm
);
int
s_spm_norm_check
(
const
spmatrix_t
*
spm
);
static
inline
void
spm_norm_print_result
(
double
norms
,
double
normd
,
double
result
)
{
if
(
(
result
>=
0
.)
&&
(
result
<
1
.)
)
{
printf
(
"SUCCESS !
\n
"
);
}
else
{
printf
(
"FAILED !
\n
"
);
ret
++
;
}
printf
(
" Nsparse = %e, Ndense = %e
\n
"
,
norms
,
normd
);
printf
(
" | Nsparse - Ndense | / Ndense = %e
\n
"
,
result
);
}
#endif
/* _spm_tests_h_ */
This diff is collapsed.
Click to expand it.
tests/z_spm_tests.c
+
4
−
40
View file @
1fd19691
...
...
@@ -204,16 +204,7 @@ z_spm_norm_check( const spmatrix_t *spm )
norms
=
spmNorm
(
SpmMaxNorm
,
spm
);
normd
=
LAPACKE_zlange
(
LAPACK_COL_MAJOR
,
'M'
,
spm
->
gNexp
,
spm
->
gNexp
,
A
,
spm
->
gNexp
);
result
=
fabs
(
norms
-
normd
)
/
(
normd
*
eps
);
if
(
(
result
>=
0
.)
&&
(
result
<
1
.)
)
{
printf
(
"SUCCESS !
\n
"
);
}
else
{
printf
(
"FAILED !
\n
"
);
ret
++
;
}
printf
(
" Nsparse = %e, Ndense = %e
\n
"
,
norms
,
normd
);
printf
(
" | Nsparse - Ndense | / Ndense = %e
\n
"
,
result
);
spm_norm_print_result
(
norms
,
normd
,
result
);
/**
* Test Norm Inf
...
...
@@ -223,16 +214,7 @@ z_spm_norm_check( const spmatrix_t *spm )
normd
=
LAPACKE_zlange
(
LAPACK_COL_MAJOR
,
'I'
,
spm
->
gNexp
,
spm
->
gNexp
,
A
,
spm
->
gNexp
);
result
=
fabs
(
norms
-
normd
)
/
(
normd
*
eps
);
result
=
result
*
((
double
)(
spm
->
gNexp
))
/
((
double
)(
spm
->
gnnzexp
));
if
(
(
result
>=
0
.)
&&
(
result
<
1
.)
)
{
printf
(
"SUCCESS !
\n
"
);
}
else
{
printf
(
"FAILED !
\n
"
);
ret
++
;
}
printf
(
" Nsparse = %e, Ndense = %e
\n
"
,
norms
,
normd
);
printf
(
" | Nsparse - Ndense | / Ndense = %e
\n
"
,
result
);
spm_norm_print_result
(
norms
,
normd
,
result
);
/**
* Test Norm One
...
...
@@ -242,16 +224,7 @@ z_spm_norm_check( const spmatrix_t *spm )
normd
=
LAPACKE_zlange
(
LAPACK_COL_MAJOR
,
'O'
,
spm
->
gNexp
,
spm
->
gNexp
,
A
,
spm
->
gNexp
);
result
=
fabs
(
norms
-
normd
)
/
(
normd
*
eps
);
result
=
result
*
((
double
)(
spm
->
gNexp
))
/
((
double
)(
spm
->
gnnzexp
));
if
(
(
result
>=
0
.)
&&
(
result
<
1
.)
)
{
printf
(
"SUCCESS !
\n
"
);
}
else
{
printf
(
"FAILED !
\n
"
);
ret
++
;
}
printf
(
" Nsparse = %e, Ndense = %e
\n
"
,
norms
,
normd
);
printf
(
" | Nsparse - Ndense | / Ndense = %e
\n
"
,
result
);
spm_norm_print_result
(
norms
,
normd
,
result
);
/**
* Test Norm Frobenius
...
...
@@ -261,16 +234,7 @@ z_spm_norm_check( const spmatrix_t *spm )
normd
=
LAPACKE_zlange
(
LAPACK_COL_MAJOR
,
'F'
,
spm
->
gNexp
,
spm
->
gNexp
,
A
,
spm
->
gNexp
);
result
=
fabs
(
norms
-
normd
)
/
(
normd
*
eps
);
result
=
result
/
((
double
)
spm
->
gnnzexp
);
if
(
(
result
>=
0
.)
&&
(
result
<
1
.)
)
{
printf
(
"SUCCESS !
\n
"
);
}
else
{
printf
(
"FAILED !
\n
"
);
ret
++
;
}
printf
(
" Nsparse = %e, Ndense = %e
\n
"
,
norms
,
normd
);
printf
(
" | Nsparse - Ndense | / Ndense = %e
\n
"
,
result
);
spm_norm_print_result
(
norms
,
normd
,
result
);
free
(
A
);
return
ret
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment