Newer
Older

Mathieu Faverge
committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
/**
* PaStiX CSC management 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
* @date 2011-11-11
* @precisions normal z -> c d s
*
**/
#ifndef CSC_UTILS_H
#define CSC_UTILS_H
/**
*
* @ingroup csc_utils
*
* Modify the CSC to a symetric graph one.
* Don't use it on a lower symetric CSC
* it would give you all the CSC upper + lower.
*
* @param[in] n Number of columns/vertices
* @param[in] ia Starting index of each column in *ja* and *a*
* @param[in] ja Row index of each element
* @param[in] a Value of each element,can be NULL
* @param[out] newn New number of column
* @param[out] newia Starting index of each column in *ja* and *a*
* @param[out] newja Row index of each element
* @param[out] newa Value of each element,can be NULL
**/
int z_csc_symgraph ( pastix_int_t n,
const pastix_int_t *ia,
const pastix_int_t *ja,
const pastix_complex64_t *a,
pastix_int_t *newn,
pastix_int_t **newia,
pastix_int_t **newja,
pastix_complex64_t **newa);
/**
*
* @ingroup csc_utils
*
* Modify the CSC to a symetric graph one.
* Don't use it on a lower symetric CSC
* it would give you all the CSC upper + lower.
*
* Internal function.
*
* @param[in] n Number of columns/vertices
* @param[in] ia Starting index of each column in *ja* and *a*
* @param[in] ja Row index of each element
* @param[in] a Value of each element,can be NULL
* @param[out] newn New number of column
* @param[out] newia Starting index of each column in *ja* and *a*
* @param[out] newja Row index of each element
* @param[out] newa Value of each element,can be NULL
* @param[in] malloc_flag flag to indicate if function call is intern to pastix
* or extern.
**/
int z_csc_symgraph_int ( pastix_int_t n,
const pastix_int_t *ia,
const pastix_int_t *ja,
const pastix_complex64_t *a,
pastix_int_t *newn,
pastix_int_t **newia,
pastix_int_t **newja,
pastix_complex64_t **newa,
int malloc_flag);
/**
*
* @ingroup csc_utils
*
* Supress diagonal term.
* After this call, *ja* can be reallocated to *ia[n] -1*.
*
* @param[in] baseval Initial numbering value (0 or 1).
* @param[in] n Number of columns/vertices
* @param[in,out] ia Starting index of each column in *ja* and *a*
* @param[in,out] ja Row index of each element
* @param[in,out] a Value of each element,can be NULL
**/
void z_csc_noDiag( pastix_int_t baseval,
pastix_int_t n,
pastix_int_t *ia,
pastix_int_t *ja,
pastix_complex64_t *a);
/**
*
* @ingroup csc_utils
*
* Check if the csc contains doubles and if correct if asked
*
* Assumes that the CSC is sorted.
*
* Assumes that the CSC is Fortran numeroted (base 1)
*
* @param[in] n Size of the matrix.
* @param[in,out] colptr Index in *rows* and *values* of the first element
* of each column
* @param[in,out] rows row of each element
* @param[in,out] values value of each element
* @param[in] dof Number of degrees of freedom
* @param[in] flag Indicate if user wants correction (<API_BOOLEAN>)
* @param[in] flagalloc indicate if allocation on CSC uses internal malloc.
*
*
* @Returns:
* API_YES - If the matrix contained no double or was successfully corrected.
* API_NO - Otherwise.
*/
int z_csc_check_doubles(pastix_int_t n,
pastix_int_t *colptr,
pastix_int_t **rows,
pastix_complex64_t **values,
int dof,
int flag,
int flagalloc);
/**
*
* @ingroup csc_utils
*
* Check if the CSC graph is symetric.
*
* For all local column C,
*
* For all row R in the column C,
*
* We look in column R if we have the row number C.
*
* If we can correct we had missing non zeros.
*
* Assumes that the CSC is Fortran numbered (1 based).
*
* Assumes that the matrix is sorted.
*
* @param[in] n Number of local columns
* @param[in,out] colptr Starting index of each columns in *ja*
* @param[in,out] rows Row of each element.
* @param[in,out] values Value of each element.
* @param[in] correct Flag indicating if we can correct the symmetry.
* @param[in] alloc indicate if allocation on CSC uses internal malloc.
* @param[in] dof Number of degrees of freedom.
*/
int z_csc_checksym(pastix_int_t n,
pastix_int_t *colptr,
pastix_int_t **rows,
pastix_complex64_t **values,
int correct,
int alloc,
int dof);
void z_csc_colPerm(pastix_int_t n, pastix_int_t *ia, pastix_int_t *ja, pastix_complex64_t *a, pastix_int_t *cperm);
void z_csc_colScale(pastix_int_t n, pastix_int_t *ia, pastix_int_t *ja, pastix_complex64_t *a, pastix_complex64_t *dcol);
void z_csc_rowScale(pastix_int_t n, pastix_int_t *ia, pastix_int_t *ja, pastix_complex64_t *a, pastix_complex64_t *drow);
void z_csc_sort(pastix_int_t n, pastix_int_t *ia, pastix_int_t *ja, pastix_complex64_t *a, pastix_int_t ndof);
void z_csc_Fnum2Cnum(pastix_int_t *ja, pastix_int_t *ia, pastix_int_t n);
void z_csc_Cnum2Fnum(pastix_int_t *ja, pastix_int_t *ia, pastix_int_t n);
/*
Function: CSC_buildZerosAndNonZerosGraphs
Separate a graph in two graphs, following
wether the diagonal term of a column is null or not.
Parameters:
n, colptr, rows, values - The initial CSC
n_nz, colptr_nz, rows_nz - The graph of the non-null diagonal part.
n_z, colptr_z, rows_z - The graph of the null diagonal part.
perm - Permutation to go from the first graph to
the one composed of the two graph concatenated.
revperm - Reverse permutation tabular.
criteria - Value beside which a number is said null.
*/
int z_csc_buildZerosAndNonZerosGraphs(pastix_int_t n,
pastix_int_t *colptr,
pastix_int_t *rows,
pastix_complex64_t *values,
pastix_int_t *n_nz,
pastix_int_t **colptr_nz,
pastix_int_t **rows_nz,
pastix_int_t *n_z,
pastix_int_t **colptr_z,
pastix_int_t **rows_z,
pastix_int_t *perm,
pastix_int_t *revperm,
double criteria);
/*
Function: CSC_isolate
Isolate a list of unknowns at the end of the CSC.
Parameters:
n - Number of columns.
colptr - Index of first element of each column in *ia*.
rows - Rows of each non zeros.
n_isolate - Number of unknow to isolate.
isolate_list - List of unknown to isolate.
*/
int z_csc_isolate(pastix_int_t n,
pastix_int_t *colptr,
pastix_int_t *rows,
pastix_int_t n_isolate,
pastix_int_t *isolate_list,
pastix_int_t *perm,
pastix_int_t *revperm);
/*
Function: csc_save
Save a csc on disk.
Parameters:
n - number of columns
colptr - First cscd starting index of each column in *ja* and *a*
rows - Row of each element in first CSCD
values - value of each cscd in first CSCD (can be NULL)
dof - Number of degrees of freedom
outfile - Output stream.
Return:
NO_ERR
*/
int z_csc_save(pastix_int_t n,
pastix_int_t * colptr,
pastix_int_t * rows,
pastix_complex64_t * values,
int dof,
FILE * outfile);
/*
Function: csc_load
Load a csc from disk.
Fill *n*, *colptr*, *rows*, *values* and *dof* from *infile*.
Parameters:
n - number of columns
colptr - First cscd starting index of each column in *ja* and *a*
rows - Row of each element in first CSCD
values - value of each cscd in first CSCD (can be NULL)
dof - Number of degrees of freedom
outfile - Output stream.
Return:
NO_ERR
*/
int z_csc_load(pastix_int_t * n,
pastix_int_t ** colptr,
pastix_int_t ** rows,
pastix_complex64_t ** values,
int * dof,
FILE * infile);
#endif /* CSC_UTILS_H */