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
d26b835a
Commit
d26b835a
authored
8 years ago
by
Mathieu Faverge
Browse files
Options
Downloads
Patches
Plain Diff
Rename colmajor field in layout
parent
4dd71a09
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
CMakeLists.txt
+0
-1
0 additions, 1 deletion
CMakeLists.txt
spm.c
+27
-19
27 additions, 19 deletions
spm.c
spm.h
+27
-28
27 additions, 28 deletions
spm.h
z_spm.h
+2
-2
2 additions, 2 deletions
z_spm.h
z_spm_dofs2flat.c
+6
-6
6 additions, 6 deletions
z_spm_dofs2flat.c
z_spm_expand.c
+42
-28
42 additions, 28 deletions
z_spm_expand.c
with
104 additions
and
84 deletions
CMakeLists.txt
+
0
−
1
View file @
d26b835a
...
...
@@ -18,7 +18,6 @@ precisions_rules_py(generated_headers
set
(
SOURCES
z_spm.c
z_spm_2dense.c
z_spm_convert_col_row_major.c
z_spm_convert_to_csc.c
z_spm_convert_to_csr.c
z_spm_convert_to_ijv.c
...
...
This diff is collapsed.
Click to expand it.
spm.c
+
27
−
19
View file @
d26b835a
...
...
@@ -98,9 +98,9 @@ spmInit( pastix_spm_t *spm )
spm
->
gnnzexp
=
0
;
spm
->
nnzexp
=
0
;
spm
->
dof
=
1
;
spm
->
dofs
=
NULL
;
spm
->
colmajor
=
1
;
spm
->
dof
=
1
;
spm
->
dofs
=
NULL
;
spm
->
layout
=
PastixColMajor
;
spm
->
colptr
=
NULL
;
spm
->
rowptr
=
NULL
;
...
...
@@ -334,30 +334,36 @@ double
spmNorm
(
int
ntype
,
const
pastix_spm_t
*
spm
)
{
double
tmp
;
pastix_spm_t
*
spmtmp
;
double
norm
=
-
1
.;
if
(
spm
->
dof
!=
1
)
{
fprintf
(
stderr
,
"WARNING: spm expanded due to non implemented norm for non-expanded spm
\n
"
);
spm
=
spmExpand
(
spm
);
spm
tmp
=
spmExpand
(
spm
);
}
switch
(
spm
->
flttype
)
{
case
PastixFloat
:
tmp
=
(
double
)
s_spmNorm
(
ntype
,
spm
);
re
turn
tmp
;
norm
=
(
double
)
s_spmNorm
(
ntype
,
spm
tmp
);
b
re
ak
;
case
PastixDouble
:
return
d_spmNorm
(
ntype
,
spm
);
norm
=
d_spmNorm
(
ntype
,
spmtmp
);
break
;
case
PastixComplex32
:
tmp
=
(
double
)
c_spmNorm
(
ntype
,
spm
);
re
turn
tmp
;
norm
=
(
double
)
c_spmNorm
(
ntype
,
spm
tmp
);
b
re
ak
;
case
PastixComplex64
:
return
z_spmNorm
(
ntype
,
spm
);
norm
=
z_spmNorm
(
ntype
,
spmtmp
);
break
;
case
PastixPattern
:
default:
return
-
1
.
;
;
}
return
norm
;
}
/**
...
...
@@ -688,24 +694,26 @@ spmCopy( const pastix_spm_t *spm )
* The copy of the sparse matrix.
*
*******************************************************************************/
void
spmExpand
(
pastix_spm_t
*
spm
)
pastix_spm_t
*
spmExpand
(
const
pastix_spm_t
*
spm
)
{
switch
(
spm
->
flttype
)
{
case
PastixPattern
:
return
p_spmExpand
(
spm
);
break
;
case
PastixFloat
:
s_spmExpand
(
spm
);
return
s_spmExpand
(
spm
);
break
;
case
PastixComplex32
:
c_spmExpand
(
spm
);
return
c_spmExpand
(
spm
);
break
;
case
PastixComplex64
:
z_spmExpand
(
spm
);
return
z_spmExpand
(
spm
);
break
;
case
PastixDouble
:
default:
d_spmExpand
(
spm
);
break
;
return
d_spmExpand
(
spm
);
}
}
...
...
This diff is collapsed.
Click to expand it.
spm.h
+
27
−
28
View file @
d26b835a
...
...
@@ -60,33 +60,32 @@ typedef enum pastix_driver_e {
*
*/
struct
pastix_spm_s
{
int
mtxtype
;
/**< Matrix structure: PastixGeneral, PastixSymmetric
or PastixHermitian. */
int
flttype
;
/**< avals datatype: PastixPattern, PastixFloat, PastixDouble,
PastixComplex32 or PastixComplex64 */
int
fmttype
;
/**< Matrix storage format: PastixCSC, PastixCSR, PastixIJV */
pastix_int_t
gN
;
/**< Global number of vertices in the compressed graph */
pastix_int_t
n
;
/**< Local number of vertices in the compressed graph */
pastix_int_t
gnnz
;
/**< Global number of non zeroes in the compressed graph */
pastix_int_t
nnz
;
/**< Local number of non zeroes in the compressed graph */
pastix_int_t
gNexp
;
/**< Global number of vertices in the compressed graph */
pastix_int_t
nexp
;
/**< Local number of vertices in the compressed graph */
pastix_int_t
gnnzexp
;
/**< Global number of non zeroes in the compressed graph */
pastix_int_t
nnzexp
;
/**< Local number of non zeroes in the compressed graph */
pastix_int_t
dof
;
/**< Number of degrees of freedom per unknown,
if > 0, constant degree of freedom
otherwise, irregular degree of freedom (refer to dofs) */
pastix_int_t
*
dofs
;
/**< Number of degrees of freedom per unknown (NULL, if dof > 0) */
int
colmajor
;
/**< If > 0, column major with dofs
otherwise, row major */
pastix_int_t
*
colptr
;
/**< List of indirections to rows for each vertex */
pastix_int_t
*
rowptr
;
/**< List of edges for each vertex */
pastix_int_t
*
loc2glob
;
/**< Corresponding numbering from local to global */
void
*
values
;
/**< Values stored in the matrix */
int
mtxtype
;
/**< Matrix structure: PastixGeneral, PastixSymmetric
or PastixHermitian. */
pastix_coeftype_t
flttype
;
/**< avals datatype: PastixPattern, PastixFloat, PastixDouble,
PastixComplex32 or PastixComplex64 */
pastix_fmttype_t
fmttype
;
/**< Matrix storage format: PastixCSC, PastixCSR, PastixIJV */
pastix_int_t
gN
;
/**< Global number of vertices in the compressed graph */
pastix_int_t
n
;
/**< Local number of vertices in the compressed graph */
pastix_int_t
gnnz
;
/**< Global number of non zeroes in the compressed graph */
pastix_int_t
nnz
;
/**< Local number of non zeroes in the compressed graph */
pastix_int_t
gNexp
;
/**< Global number of vertices in the compressed graph */
pastix_int_t
nexp
;
/**< Local number of vertices in the compressed graph */
pastix_int_t
gnnzexp
;
/**< Global number of non zeroes in the compressed graph */
pastix_int_t
nnzexp
;
/**< Local number of non zeroes in the compressed graph */
pastix_int_t
dof
;
/**< Number of degrees of freedom per unknown,
if > 0, constant degree of freedom
otherwise, irregular degree of freedom (refer to dofs) */
pastix_int_t
*
dofs
;
/**< Number of degrees of freedom per unknown (NULL, if dof > 0) */
pastix_order_t
layout
;
/**< PastixColMajor, or PastixRowMajor */
pastix_int_t
*
colptr
;
/**< List of indirections to rows for each vertex */
pastix_int_t
*
rowptr
;
/**< List of edges for each vertex */
pastix_int_t
*
loc2glob
;
/**< Corresponding numbering from local to global */
void
*
values
;
/**< Values stored in the matrix */
};
int
...
...
@@ -136,7 +135,7 @@ pastix_int_t spmSymmetrize( pastix_spm_t *spm );
pastix_spm_t
*
spmCheckAndCorrect
(
pastix_spm_t
*
spm
);
void
spmExpand
(
pastix_spm_t
*
spm
);
pastix_spm_t
*
spmExpand
(
const
pastix_spm_t
*
spm
);
int
spmReadDriver
(
pastix_driver_t
driver
,
char
*
filename
,
...
...
This diff is collapsed.
Click to expand it.
z_spm.h
+
2
−
2
View file @
d26b835a
...
...
@@ -63,7 +63,7 @@ void z_spmDensePrint( pastix_int_t m, pastix_int_t n, pastix_complex64_t *A, pas
void
z_spmPrint
(
const
pastix_spm_t
*
spm
);
in
t
z_spmExpand
(
pastix_spm_t
*
spm
);
void
z_spmDofs2Flat
(
pastix_spm_t
*
spm
);
pastix_spm_
t
*
z_spmExpand
(
const
pastix_spm_t
*
spm
);
void
z_spmDofs2Flat
(
pastix_spm_t
*
spm
);
#endif
/* _z_spm_H_ */
This diff is collapsed.
Click to expand it.
z_spm_dofs2flat.c
+
6
−
6
View file @
d26b835a
...
...
@@ -119,9 +119,9 @@ z_spmDofs2Flat(pastix_spm_t *spm)
spm
->
gnnz
=
spm
->
gnnzexp
;
spm
->
nnz
=
spm
->
nnzexp
;
spm
->
dof
=
1
;
spm
->
dofs
=
NULL
;
spm
->
colmajor
=
1
;
spm
->
dof
=
1
;
spm
->
dofs
=
NULL
;
spm
->
layout
=
PastixColMajor
;
spm
->
colptr
=
new_col
;
spm
->
rowptr
=
new_row
;
...
...
@@ -218,9 +218,9 @@ z_spmDofs2Flat(pastix_spm_t *spm)
spm
->
gnnzexp
=
nnz
;
spm
->
nnzexp
=
nnz
;
spm
->
dof
=
1
;
spm
->
dofs
=
NULL
;
spm
->
colmajor
=
1
;
spm
->
dof
=
1
;
spm
->
dofs
=
NULL
;
spm
->
layout
=
PastixColMajor
;
spm
->
colptr
=
new_col
;
spm
->
rowptr
=
new_row
;
...
...
This diff is collapsed.
Click to expand it.
z_spm_expand.c
+
42
−
28
View file @
d26b835a
...
...
@@ -20,46 +20,60 @@
/**
* TODO: This function is incorrect
*/
int
z_spmExpand
(
pastix_spm_t
*
spm
)
pastix_spm_t
*
z_spmExpand
(
const
pastix_spm_t
*
spm
)
{
pastix_spm_t
*
newspm
;
pastix_int_t
i
,
col
,
row
,
cpt
,
dofj
,
dofi
,
baseval
;
#if !defined(PRECISION_p)
pastix_complex64_t
*
oldvalptr
;
pastix_complex64_t
*
newvalptr
;
#endif
if
(
spm
->
dof
==
1
)
{
return
spm
;
}
if
(
1
)
{
return
PASTIX_ERR_NOTIMPLEMENTED
;
return
NULL
;
}
baseval
=
spmFindBase
(
spm
);
/* baseval = spmFindBase( spm ); */
oldvalptr
=
(
pastix_complex64_t
*
)
spm
->
values
;
spm
->
values
=
malloc
(
spm
->
nnzexp
*
sizeof
(
pastix_complex64_t
)
);
newvalptr
=
(
pastix_complex64_t
*
)
spm
->
values
;
/* #if !defined(PRECISION_p) */
/* oldvalptr = (pastix_complex64_t*)spm->values; */
/* spm->values = malloc( spm->nnzexp * sizeof(pastix_complex64_t) ); */
/* newvalptr = (pastix_complex64_t*)spm->values; */
/* #endif */
cpt
=
0
;
dofi
=
spm
->
dof
;
dofj
=
spm
->
dof
;
/*
cpt = 0;
*/
/*
dofi = spm->dof;
*/
/*
dofj = spm->dof;
*/
for
(
col
=
0
;
col
<
spm
->
n
;
col
++
)
{
if
(
spm
->
dof
<=
0
)
{
dofi
=
spm
->
dofs
[
col
+
1
]
-
spm
->
dofs
[
col
];
}
/*
for( col=0; col<spm->n; col++)
*/
/*
{
*/
/*
if ( spm->dof <= 0 ) {
*/
/*
dofi = spm->dofs[col+1] - spm->dofs[col];
*/
/*
}
*/
for
(
row
=
spm
->
colptr
[
col
]
-
baseval
;
row
<
spm
->
colptr
[
col
+
1
]
-
baseval
;
row
++
)
{
if
(
spm
->
dof
<=
0
)
{
dofj
=
spm
->
dofs
[
spm
->
rowptr
[
row
]
-
baseval
+
1
]
-
spm
->
dofs
[
spm
->
rowptr
[
row
]
-
baseval
];
}
/*
for( row=spm->colptr[col]-baseval; row<spm->colptr[col+1]-baseval; row++)
*/
/*
{
*/
/*
if ( spm->dof <= 0 ) {
*/
/*
dofj = spm->dofs[spm->rowptr[row]-baseval+1] - spm->dofs[spm->rowptr[row]-baseval];
*/
/*
}
*/
for
(
i
=
0
;
i
<
dofi
*
dofj
;
i
++
)
{
newvalptr
[
cpt
]
=
oldvalptr
[
row
]
/
((
i
/
dofj
)
+
(
i
%
dofj
)
+
2
);
// Col major
cpt
++
;
}
}
}
/* for( i=0; i<dofi*dofj; i++) */
/* { */
/* #if !defined(PRECISION_p) */
/* newvalptr[cpt] = oldvalptr[row] / ((i/dofj) + (i%dofj) + 2); // Col major */
/* cpt++; */
/* #endif */
/* } */
/* } */
/* } */
free
(
oldvalptr
);
/* #if !defined(PRECISION_p) */
/* free( oldvalptr ); */
/* #endif */
}
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