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
66e8f85f
Commit
66e8f85f
authored
8 years ago
by
PICHON Gregoire
Browse files
Options
Downloads
Patches
Plain Diff
add a function in spm to scal a matrix and obtain a norm of 1
parent
b781244e
No related branches found
No related tags found
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
CMakeLists.txt
+1
-0
1 addition, 0 deletions
CMakeLists.txt
spm.c
+35
-0
35 additions, 0 deletions
spm.c
spm.h
+2
-0
2 additions, 0 deletions
spm.h
z_spm.h
+2
-1
2 additions, 1 deletion
z_spm.h
z_spm_scal.c
+55
-0
55 additions, 0 deletions
z_spm_scal.c
with
95 additions
and
1 deletion
CMakeLists.txt
+
1
−
0
View file @
66e8f85f
...
@@ -20,6 +20,7 @@ set(SOURCES
...
@@ -20,6 +20,7 @@ set(SOURCES
z_spm_2dense.c
z_spm_2dense.c
z_spm_dof_extend.c
z_spm_dof_extend.c
z_spm_norm.c
z_spm_norm.c
z_spm_scal.c
z_spm_convert_to_csc.c
z_spm_convert_to_csc.c
z_spm_convert_to_csr.c
z_spm_convert_to_csr.c
...
...
This diff is collapsed.
Click to expand it.
spm.c
+
35
−
0
View file @
66e8f85f
...
@@ -1079,3 +1079,38 @@ spmCheckAxb( int nrhs,
...
@@ -1079,3 +1079,38 @@ spmCheckAxb( int nrhs,
return
ptrfunc
[
id
](
nrhs
,
spm
,
x0
,
ldx0
,
b
,
ldb
,
x
,
ldx
);
return
ptrfunc
[
id
](
nrhs
,
spm
,
x0
,
ldx0
,
b
,
ldb
,
x
,
ldx
);
}
}
}
}
/**
*******************************************************************************
*
* @ingroup pastix_spm
*
* @brief Scal a matrix with ||A||_2
*
*******************************************************************************
*
* @param[in,out] spm
* The sparse matrix to scal.
*
*******************************************************************************/
void
spmScal
(
pastix_spm_t
*
spm
)
{
switch
(
spm
->
flttype
)
{
case
PastixPattern
:
break
;
case
PastixFloat
:
s_spmScal
(
spm
);
break
;
case
PastixComplex32
:
c_spmScal
(
spm
);
break
;
case
PastixComplex64
:
z_spmScal
(
spm
);
break
;
case
PastixDouble
:
default:
d_spmScal
(
spm
);
}
}
This diff is collapsed.
Click to expand it.
spm.h
+
2
−
0
View file @
66e8f85f
...
@@ -150,6 +150,7 @@ void * spm2Dense( const pastix_spm_t *spm );
...
@@ -150,6 +150,7 @@ void * spm2Dense( const pastix_spm_t *spm );
pastix_int_t
spmFindBase
(
const
pastix_spm_t
*
spm
);
pastix_int_t
spmFindBase
(
const
pastix_spm_t
*
spm
);
double
spmNorm
(
int
ntype
,
const
pastix_spm_t
*
spm
);
double
spmNorm
(
int
ntype
,
const
pastix_spm_t
*
spm
);
int
spmMatVec
(
const
pastix_trans_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
);
void
spmScal
(
pastix_spm_t
*
spm
);
int
spmSort
(
pastix_spm_t
*
spm
);
int
spmSort
(
pastix_spm_t
*
spm
);
pastix_int_t
spmMergeDuplicate
(
pastix_spm_t
*
spm
);
pastix_int_t
spmMergeDuplicate
(
pastix_spm_t
*
spm
);
...
@@ -171,4 +172,5 @@ int spmReadDriver( pastix_driver_t driver,
...
@@ -171,4 +172,5 @@ int spmReadDriver( pastix_driver_t driver,
pastix_spm_t
*
spm
,
pastix_spm_t
*
spm
,
MPI_Comm
pastix_comm
);
MPI_Comm
pastix_comm
);
#endif
/* _SPM_H_ */
#endif
/* _SPM_H_ */
This diff is collapsed.
Click to expand it.
z_spm.h
+
2
−
1
View file @
66e8f85f
...
@@ -64,8 +64,9 @@ int z_spmCheckAxb( int nrhs, const pastix_spm_t *spm, void *x0, int ldx0, void *
...
@@ -64,8 +64,9 @@ int z_spmCheckAxb( int nrhs, const pastix_spm_t *spm, void *x0, int ldx0, void *
void
z_spmDensePrint
(
FILE
*
f
,
pastix_int_t
m
,
pastix_int_t
n
,
pastix_complex64_t
*
A
,
pastix_int_t
lda
);
void
z_spmDensePrint
(
FILE
*
f
,
pastix_int_t
m
,
pastix_int_t
n
,
pastix_complex64_t
*
A
,
pastix_int_t
lda
);
void
z_spmPrint
(
FILE
*
f
,
const
pastix_spm_t
*
spm
);
void
z_spmPrint
(
FILE
*
f
,
const
pastix_spm_t
*
spm
);
pastix_spm_t
*
z_spmExpand
(
const
pastix_spm_t
*
spm
);
pastix_spm_t
*
z_spmExpand
(
const
pastix_spm_t
*
spm
);
void
z_spmDofExtend
(
pastix_spm_t
*
spm
);
void
z_spmDofExtend
(
pastix_spm_t
*
spm
);
void
z_spmScal
(
pastix_spm_t
*
spm
);
#endif
/* _z_spm_H_ */
#endif
/* _z_spm_H_ */
This diff is collapsed.
Click to expand it.
z_spm_scal.c
0 → 100644
+
55
−
0
View file @
66e8f85f
/**
* @file z_spm_scal.c
*
* PaStiX spm computational routines.
*
* PaStiX is a software package provided by Inria Bordeaux - Sud-Ouest,
* LaBRI, University of Bordeaux 1 and IPB.
*
* @version 1.0.0
* @author Mathieu Faverge
* @author Pierre Ramet
* @author Xavier Lacoste
* @author Theophile Terraz
* @date 2015-06-01
* @precisions normal z -> c d s
*
**/
#include
"common.h"
#include
"spm.h"
#include
"z_spm.h"
/**
*******************************************************************************
*
* @ingroup pastix_spm_internal
*
* z_spmScal - Scal the matrix with ||A||_2
*
*******************************************************************************
*
* @param[in,out] spm
* The spm which needs to be scaled.
*
*******************************************************************************/
void
z_spmScal
(
pastix_spm_t
*
spm
)
{
double
norm
;
pastix_int_t
nnz
,
i
;
pastix_complex64_t
*
values
;
nnz
=
spm
->
nnz
;
values
=
spm
->
values
;
norm
=
z_spmNorm
(
PastixFrobeniusNorm
,
spm
);
printf
(
"NORM IN %.3g
\n
"
,
norm
);
for
(
i
=
0
;
i
<
nnz
;
i
++
){
values
[
i
]
/=
norm
;
}
norm
=
z_spmNorm
(
PastixFrobeniusNorm
,
spm
);
printf
(
"NORM OUT %.3g
\n
"
,
norm
);
}
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