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
8a3e00ef
Commit
8a3e00ef
authored
8 years ago
by
Mathieu Faverge
Browse files
Options
Downloads
Patches
Plain Diff
Simplify code for matvec
parent
41e1c9c4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
spm.c
+19
-43
19 additions, 43 deletions
spm.c
spm.h
+1
-1
1 addition, 1 deletion
spm.h
z_spm.h
+5
-3
5 additions, 3 deletions
z_spm.h
z_spm_genrhs.c
+5
-15
5 additions, 15 deletions
z_spm_genrhs.c
z_spm_matrixvector.c
+33
-4
33 additions, 4 deletions
z_spm_matrixvector.c
with
63 additions
and
66 deletions
spm.c
+
19
−
43
View file @
8a3e00ef
...
...
@@ -768,51 +768,27 @@ spmExpand(const pastix_spm_t* spm)
* functions, and simplify this one to have identical calls to all subfunction
*/
int
spmMatVec
(
int
trans
,
const
void
*
alpha
,
const
pastix_spm_t
*
spm
,
const
void
*
x
,
const
void
*
beta
,
void
*
y
)
spmMatVec
(
const
pastix_trans_t
trans
,
const
void
*
alpha
,
const
pastix_spm_t
*
spm
,
const
void
*
x
,
const
void
*
beta
,
void
*
y
)
{
switch
(
spm
->
mtxtype
)
{
case
PastixHermitian
:
switch
(
spm
->
flttype
)
{
case
PastixFloat
:
return
s_spmSyCSCv
(
*
((
const
float
*
)
alpha
),
spm
,
(
const
float
*
)
x
,
*
((
const
float
*
)
beta
),
(
float
*
)
y
);
case
PastixComplex32
:
return
c_spmHeCSCv
(
*
((
const
pastix_complex32_t
*
)
alpha
),
spm
,
(
const
pastix_complex32_t
*
)
x
,
*
((
const
pastix_complex32_t
*
)
beta
),
(
pastix_complex32_t
*
)
y
);
case
PastixComplex64
:
return
z_spmHeCSCv
(
*
((
const
pastix_complex64_t
*
)
alpha
),
spm
,
(
const
pastix_complex64_t
*
)
x
,
*
((
const
pastix_complex64_t
*
)
beta
),
(
pastix_complex64_t
*
)
y
);
case
PastixDouble
:
default:
return
d_spmSyCSCv
(
*
((
const
double
*
)
alpha
),
spm
,
(
const
double
*
)
x
,
*
((
const
double
*
)
beta
),
(
double
*
)
y
);
}
case
PastixSymmetric
:
switch
(
spm
->
flttype
)
{
case
PastixFloat
:
return
s_spmSyCSCv
(
*
((
const
float
*
)
alpha
),
spm
,
(
const
float
*
)
x
,
*
((
const
float
*
)
beta
),
(
float
*
)
y
);
case
PastixComplex32
:
return
c_spmSyCSCv
(
*
((
const
pastix_complex32_t
*
)
alpha
),
spm
,
(
const
pastix_complex32_t
*
)
x
,
*
((
const
pastix_complex32_t
*
)
beta
),
(
pastix_complex32_t
*
)
y
);
case
PastixComplex64
:
return
z_spmSyCSCv
(
*
((
const
pastix_complex64_t
*
)
alpha
),
spm
,
(
const
pastix_complex64_t
*
)
x
,
*
((
const
pastix_complex64_t
*
)
beta
),
(
pastix_complex64_t
*
)
y
);
case
PastixDouble
:
default:
return
d_spmSyCSCv
(
*
((
const
double
*
)
alpha
),
spm
,
(
const
double
*
)
x
,
*
((
const
double
*
)
beta
),
(
double
*
)
y
);
}
case
PastixGeneral
:
if
(
spm
->
fmttype
!=
PastixCSC
)
{
return
PASTIX_ERR_BADPARAMETER
;
}
switch
(
spm
->
flttype
)
{
case
PastixFloat
:
return
s_spmCSCMatVec
(
trans
,
alpha
,
spm
,
x
,
beta
,
y
);
case
PastixComplex32
:
return
c_spmCSCMatVec
(
trans
,
alpha
,
spm
,
x
,
beta
,
y
);
case
PastixComplex64
:
return
z_spmCSCMatVec
(
trans
,
alpha
,
spm
,
x
,
beta
,
y
);
case
PastixDouble
:
default:
switch
(
spm
->
flttype
)
{
case
PastixFloat
:
return
s_spmGeCSCv
(
trans
,
*
((
const
float
*
)
alpha
),
spm
,
(
const
float
*
)
x
,
*
((
const
float
*
)
beta
),
(
float
*
)
y
);
case
PastixComplex32
:
return
c_spmGeCSCv
(
trans
,
*
((
const
pastix_complex32_t
*
)
alpha
),
spm
,
(
const
pastix_complex32_t
*
)
x
,
*
((
const
pastix_complex32_t
*
)
beta
),
(
pastix_complex32_t
*
)
y
);
case
PastixComplex64
:
return
z_spmGeCSCv
(
trans
,
*
((
const
pastix_complex64_t
*
)
alpha
),
spm
,
(
const
pastix_complex64_t
*
)
x
,
*
((
const
pastix_complex64_t
*
)
beta
),
(
pastix_complex64_t
*
)
y
);
case
PastixDouble
:
default:
return
d_spmGeCSCv
(
trans
,
*
((
const
double
*
)
alpha
),
spm
,
(
const
double
*
)
x
,
*
((
const
double
*
)
beta
),
(
double
*
)
y
);
}
return
d_spmCSCMatVec
(
trans
,
alpha
,
spm
,
x
,
beta
,
y
);
}
}
...
...
This diff is collapsed.
Click to expand it.
spm.h
+
1
−
1
View file @
8a3e00ef
...
...
@@ -127,7 +127,7 @@ void spmBase( pastix_spm_t *spm, int baseval );
int
spmConvert
(
int
ofmttype
,
pastix_spm_t
*
ospm
);
pastix_int_t
spmFindBase
(
const
pastix_spm_t
*
spm
);
double
spmNorm
(
int
ntype
,
const
pastix_spm_t
*
spm
);
int
spmMatVec
(
in
t
trans
,
const
void
*
alpha
,
const
pastix_spm_t
*
spm
,
const
void
*
x
,
const
void
*
beta
,
void
*
y
);
int
spmMatVec
(
const
pastix_trans_
t
trans
,
const
void
*
alpha
,
const
pastix_spm_t
*
spm
,
const
void
*
x
,
const
void
*
beta
,
void
*
y
);
int
spmSort
(
pastix_spm_t
*
spm
);
pastix_int_t
spmMergeDuplicate
(
pastix_spm_t
*
spm
);
...
...
This diff is collapsed.
Click to expand it.
z_spm.h
+
5
−
3
View file @
8a3e00ef
...
...
@@ -41,9 +41,11 @@ pastix_complex64_t *z_spm2dense( const pastix_spm_t *spm );
/**
* Matrix-Vector product routines
*/
int
z_spmGeCSCv
(
int
trans
,
pastix_complex64_t
alpha
,
const
pastix_spm_t
*
csc
,
const
pastix_complex64_t
*
x
,
pastix_complex64_t
beta
,
pastix_complex64_t
*
y
);
int
z_spmSyCSCv
(
pastix_complex64_t
alpha
,
const
pastix_spm_t
*
csc
,
const
pastix_complex64_t
*
x
,
pastix_complex64_t
beta
,
pastix_complex64_t
*
y
);
int
z_spmHeCSCv
(
pastix_complex64_t
alpha
,
const
pastix_spm_t
*
csc
,
const
pastix_complex64_t
*
x
,
pastix_complex64_t
beta
,
pastix_complex64_t
*
y
);
int
z_spmGeCSCv
(
const
pastix_trans_t
trans
,
pastix_complex64_t
alpha
,
const
pastix_spm_t
*
csc
,
const
pastix_complex64_t
*
x
,
pastix_complex64_t
beta
,
pastix_complex64_t
*
y
);
int
z_spmSyCSCv
(
pastix_complex64_t
alpha
,
const
pastix_spm_t
*
csc
,
const
pastix_complex64_t
*
x
,
pastix_complex64_t
beta
,
pastix_complex64_t
*
y
);
int
z_spmHeCSCv
(
pastix_complex64_t
alpha
,
const
pastix_spm_t
*
csc
,
const
pastix_complex64_t
*
x
,
pastix_complex64_t
beta
,
pastix_complex64_t
*
y
);
int
z_spmCSCMatVec
(
const
pastix_trans_t
trans
,
const
void
*
alpha
,
const
pastix_spm_t
*
csc
,
const
void
*
x
,
const
void
*
beta
,
void
*
y
);
/**
* Extra routines
...
...
This diff is collapsed.
Click to expand it.
z_spm_genrhs.c
+
5
−
15
View file @
8a3e00ef
...
...
@@ -26,6 +26,10 @@
#define RndF_Mul 5.4210108624275222e-20f
#define RndD_Mul 5.4210108624275222e-20
static
pastix_complex64_t
mzone
=
(
pastix_complex64_t
)
-
1
.;
static
pastix_complex64_t
zone
=
(
pastix_complex64_t
)
1
.;
static
pastix_complex64_t
zzero
=
(
pastix_complex64_t
)
0
.;
static
inline
unsigned
long
long
int
Rnd64_jump
(
unsigned
long
long
int
n
,
unsigned
long
long
int
seed
)
{
unsigned
long
long
int
a_k
,
c_k
,
ran
;
...
...
@@ -260,19 +264,7 @@ z_spmGenRHS( int type, int nrhs,
spm
->
gN
,
0
,
0
,
24356
);
}
switch
(
spm
->
mtxtype
)
{
#if defined(PRECISION_z) || defined(PRECISION_c)
case
PastixHermitian
:
rc
=
z_spmHeCSCv
(
1
.,
spm
,
xptr
,
0
.,
bptr
);
break
;
#endif
case
PastixSymmetric
:
rc
=
z_spmSyCSCv
(
1
.,
spm
,
xptr
,
0
.,
bptr
);
break
;
case
PastixGeneral
:
default:
rc
=
z_spmGeCSCv
(
PastixNoTrans
,
1
.,
spm
,
xptr
,
0
.,
bptr
);
}
rc
=
z_spmCSCMatVec
(
PastixNoTrans
,
&
zone
,
spm
,
xptr
,
&
zzero
,
bptr
);
if
(
x
==
NULL
)
{
memFree_null
(
xptr
);
...
...
@@ -339,8 +331,6 @@ z_spmCheckAxb( int nrhs,
void
*
b
,
int
ldb
,
const
void
*
x
,
int
ldx
)
{
static
pastix_complex64_t
mzone
=
(
pastix_complex64_t
)
-
1
.;
static
pastix_complex64_t
zone
=
(
pastix_complex64_t
)
1
.;
double
normA
,
normB
,
normX
,
normX0
,
normR
;
double
backward
,
forward
,
eps
;
int
failure
=
0
;
...
...
This diff is collapsed.
Click to expand it.
z_spm_matrixvector.c
+
33
−
4
View file @
8a3e00ef
...
...
@@ -63,16 +63,16 @@
*
*******************************************************************************/
int
z_spmGeCSCv
(
int
trans
,
z_spmGeCSCv
(
const
pastix_trans_t
trans
,
pastix_complex64_t
alpha
,
const
pastix_spm_t
*
csc
,
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
*
xptr
=
x
;
pastix_complex64_t
*
yptr
=
y
;
const
pastix_complex64_t
*
valptr
=
(
pastix_complex64_t
*
)
(
csc
->
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
)
)
...
...
@@ -328,3 +328,32 @@ z_spmHeCSCv( pastix_complex64_t alpha,
return
PASTIX_SUCCESS
;
}
#endif
int
z_spmCSCMatVec
(
const
pastix_trans_t
trans
,
const
void
*
alphaptr
,
const
pastix_spm_t
*
csc
,
const
void
*
xptr
,
const
void
*
betaptr
,
void
*
yptr
)
{
const
pastix_complex64_t
*
x
=
(
const
pastix_complex64_t
*
)
xptr
;
pastix_complex64_t
*
y
=
(
pastix_complex64_t
*
)
yptr
;
pastix_complex64_t
alpha
,
beta
;
alpha
=
*
((
const
pastix_complex64_t
*
)
alphaptr
);
beta
=
*
((
const
pastix_complex64_t
*
)
betaptr
);
switch
(
csc
->
mtxtype
)
{
#if defined(PRECISION_z) || defined(PRECISION_c)
case
PastixHermitian
:
return
z_spmHeCSCv
(
alpha
,
csc
,
x
,
beta
,
y
);
#endif
case
PastixSymmetric
:
return
z_spmSyCSCv
(
alpha
,
csc
,
x
,
beta
,
y
);
case
PastixGeneral
:
default:
return
z_spmGeCSCv
(
trans
,
alpha
,
csc
,
x
,
beta
,
y
);
}
}
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