1 /*
2    ARPACK++ v1.2 2/20/2000
3    c++ interface to ARPACK code.
4 
5    MODULE ARLSpDef.h.
6    ALTERED version of slu_sdefs.h slu_ddefs.h slu_cdefs.h slu_zdefs.h
7    (from SuperLU 3.0 package).
8 */
9 
10 
11 #ifndef __SUPERLU_SP_DEFS /* allow multiple inclusions */
12 #define __SUPERLU_SP_DEFS
13 
14 /*
15  * File name:		sp_defs.h
16  * Purpose:             Sparse matrix types and function prototypes
17  * History:
18  */
19 #include "arlnames.h"
20 #include "arlsupm.h"
21 #include "arlcomp.h"
22 #include "arlutil.h"
23 #ifdef _CRAY
24 #include <fortran.h>
25 #include <string.h>
26 #endif
27 
28 /* Define my integer type int_t */
29 typedef int int_t; /* default */
30 
31 // /* No of marker arrays used in the symbolic factorization,
32 //    each of size n */
33 // #define NO_MARKER     3
34 // #define NUM_TEMPV(m,w,t,b)  ( MAX(m, (t + b)*w) )
35 //
36 // typedef enum {LUSUP, UCOL, LSUB, USUB} MemType;
37 // typedef enum {HEAD, TAIL}              stack_end_t;
38 // typedef enum {SYSTEM, USER}            LU_space_t;
39 
40 /*
41  * Global data structures used in LU factorization -
42  *
43  *   nsuper: #supernodes = nsuper + 1, numbered [0, nsuper].
44  *   (xsup,supno): supno[i] is the supernode no to which i belongs;
45  *	xsup(s) points to the beginning of the s-th supernode.
46  *	e.g.   supno 0 1 2 2 3 3 3 4 4 4 4 4   (n=12)
47  *	        xsup 0 1 2 4 7 12
48  *	Note: dfs will be performed on supernode rep. relative to the new
49  *	      row pivoting ordering
50  *
51  *   (xlsub,lsub): lsub[*] contains the compressed subscript of
52  *	rectangular supernodes; xlsub[j] points to the starting
53  *	location of the j-th column in lsub[*]. Note that xlsub
54  *	is indexed by column.
55  *	Storage: original row subscripts
56  *
57  *      During the course of sparse LU factorization, we also use
58  *	(xlsub,lsub) for the purpose of symmetric pruning. For each
59  *	supernode {s,s+1,...,t=s+r} with first column s and last
60  *	column t, the subscript set
61  *		lsub[j], j=xlsub[s], .., xlsub[s+1]-1
62  *	is the structure of column s (i.e. structure of this supernode).
63  *	It is used for the storage of numerical values.
64  *	Furthermore,
65  *		lsub[j], j=xlsub[t], .., xlsub[t+1]-1
66  *	is the structure of the last column t of this supernode.
67  *	It is for the purpose of symmetric pruning. Therefore, the
68  *	structural subscripts can be rearranged without making physical
69  *	interchanges among the numerical values.
70  *
71  *	However, if the supernode has only one column, then we
72  *	only keep one set of subscripts. For any subscript interchange
73  *	performed, similar interchange must be done on the numerical
74  *	values.
75  *
76  *	The last column structures (for pruning) will be removed
77  *	after the numercial LU factorization phase.
78  *
79  *   (xlusup,lusup): lusup[*] contains the numerical values of the
80  *	rectangular supernodes; xlusup[j] points to the starting
81  *	location of the j-th column in storage vector lusup[*]
82  *	Note: xlusup is indexed by column.
83  *	Each rectangular supernode is stored by column-major
84  *	scheme, consistent with Fortran 2-dim array storage.
85  *
86  *   (xusub,ucol,usub): ucol[*] stores the numerical values of
87  *	U-columns outside the rectangular supernodes. The row
88  *	subscript of nonzero ucol[k] is stored in usub[k].
89  *	xusub[i] points to the starting location of column i in ucol.
90  *	Storage: new row subscripts; that is subscripts of PA.
91  */
92 
93 typedef struct {
94     int     *xsup;    /* supernode and column mapping */
95     int     *supno;
96     int     *lsub;    /* compressed L subscripts */
97     int	    *xlsub;
98     float  *lusup;   /* L supernodes */
99     int     *xlusup;
100     float  *ucol;    /* U columns */
101     int     *usub;
102     int	    *xusub;
103     int     nzlmax;   /* current max size of lsub */
104     int     nzumax;   /*    "    "    "      ucol */
105     int     nzlumax;  /*    "    "    "     lusup */
106     int     n;        /* number of columns in the matrix */
107     LU_space_t MemModel; /* 0 - system malloc'd; 1 - user provided */
108     int     num_expansions;
109     ExpHeader *expanders; /* Array of pointers to 4 types of memory */
110     LU_stack_t stack;     /* use user supplied memory */
111 } sGlobalLU_t;
112 
113 typedef struct {
114     int     *xsup;    /* supernode and column mapping */
115     int     *supno;
116     int     *lsub;    /* compressed L subscripts */
117     int	    *xlsub;
118     double  *lusup;   /* L supernodes */
119     int     *xlusup;
120     double  *ucol;    /* U columns */
121     int     *usub;
122     int	    *xusub;
123     int     nzlmax;   /* current max size of lsub */
124     int     nzumax;   /*    "    "    "      ucol */
125     int     nzlumax;  /*    "    "    "     lusup */
126     int     n;        /* number of columns in the matrix */
127     LU_space_t MemModel; /* 0 - system malloc'd; 1 - user provided */
128     int     num_expansions;
129     ExpHeader *expanders; /* Array of pointers to 4 types of memory */
130     LU_stack_t stack;     /* use user supplied memory */
131 } dGlobalLU_t;
132 
133 typedef struct {
134     int     *xsup;    /* supernode and column mapping */
135     int     *supno;
136     int     *lsub;    /* compressed L subscripts */
137     int	    *xlsub;
138     lscomplex  *lusup;   /* L supernodes */
139     int     *xlusup;
140     lscomplex  *ucol;    /* U columns */
141     int     *usub;
142     int	    *xusub;
143     int     nzlmax;   /* current max size of lsub */
144     int     nzumax;   /*    "    "    "      ucol */
145     int     nzlumax;  /*    "    "    "     lusup */
146     int     n;        /* number of columns in the matrix */
147     LU_space_t MemModel; /* 0 - system malloc'd; 1 - user provided */
148     int     num_expansions;
149     ExpHeader *expanders; /* Array of pointers to 4 types of memory */
150     LU_stack_t stack;     /* use user supplied memory */
151 } cGlobalLU_t;
152 
153 typedef struct {
154     int     *xsup;    /* supernode and column mapping */
155     int     *supno;
156     int     *lsub;    /* compressed L subscripts */
157     int	    *xlsub;
158     ldcomplex  *lusup;   /* L supernodes */
159     int     *xlusup;
160     ldcomplex  *ucol;    /* U columns */
161     int     *usub;
162     int	    *xusub;
163     int     nzlmax;   /* current max size of lsub */
164     int     nzumax;   /*    "    "    "      ucol */
165     int     nzlumax;  /*    "    "    "     lusup */
166     int     n;        /* number of columns in the matrix */
167     LU_space_t MemModel; /* 0 - system malloc'd; 1 - user provided */
168     int     num_expansions;
169     ExpHeader *expanders; /* Array of pointers to 4 types of memory */
170     LU_stack_t stack;     /* use user supplied memory */
171 } zGlobalLU_t;
172 
173 // typedef struct {
174 //     int panel_size;
175 //     int relax;
176 //     float diag_pivot_thresh;
177 //     float drop_tol;
178 // } sfactor_param_t;
179 //
180 // typedef struct {
181 //     int panel_size;
182 //     int relax;
183 //     double diag_pivot_thresh;
184 //     double drop_tol;
185 // } dfactor_param_t;
186 //
187 //typedef struct {
188 //    float for_lu;
189 //    float total_needed;
190 //    int   expansions;
191 //} mem_usage_t;
192 
193 #ifdef __cplusplus
194 extern "C" {
195 #endif
196 
197 /* Driver routines */
198 extern void
199 sgssv(superlu_options_t *, SuperMatrix *, int *, int *, SuperMatrix *,
200       SuperMatrix *, SuperMatrix *, SuperLUStat_t *, int *);
201 extern void
202 dgssv(superlu_options_t *, SuperMatrix *, int *, int *, SuperMatrix *,
203       SuperMatrix *, SuperMatrix *, SuperLUStat_t *, int *);
204 extern void
205 cgssv(superlu_options_t *, SuperMatrix *, int *, int *, SuperMatrix *,
206       SuperMatrix *, SuperMatrix *, SuperLUStat_t *, int *);
207 extern void
208 zgssv(superlu_options_t *, SuperMatrix *, int *, int *, SuperMatrix *,
209       SuperMatrix *, SuperMatrix *, SuperLUStat_t *, int *);
210 extern void
211 sgssvx(superlu_options_t *, SuperMatrix *, int *, int *, int *,
212        char *, float *, float *, SuperMatrix *, SuperMatrix *,
213        void *, int, SuperMatrix *, SuperMatrix *,
214        float *, float *, float *, float *,
215        sGlobalLU_t *, mem_usage_t *, SuperLUStat_t *, int *);
216 extern void
217 dgssvx(superlu_options_t *, SuperMatrix *, int *, int *, int *,
218        char *, double *, double *, SuperMatrix *, SuperMatrix *,
219        void *, int, SuperMatrix *, SuperMatrix *,
220        double *, double *, double *, double *,
221        dGlobalLU_t *, mem_usage_t *, SuperLUStat_t *, int *);
222 extern void
223 cgssvx(superlu_options_t *, SuperMatrix *, int *, int *, int *,
224        char *, float *, float *, SuperMatrix *, SuperMatrix *,
225        void *, int, SuperMatrix *, SuperMatrix *,
226        float *, float *, float *, float *,
227        cGlobalLU_t *, mem_usage_t *, SuperLUStat_t *, int *);
228 extern void
229 zgssvx(superlu_options_t *, SuperMatrix *, int *, int *, int *,
230        char *, double *, double *, SuperMatrix *, SuperMatrix *,
231        void *, int, SuperMatrix *, SuperMatrix *,
232        double *, double *, double *, double *,
233        zGlobalLU_t *, mem_usage_t *, SuperLUStat_t *, int *);
234 
235 /* Supernodal LU factor related */
236 extern void
237 sCreate_CompCol_Matrix(SuperMatrix *, int, int, int, float *,
238 		       int *, int *, Stype_t, Dtype_t, Mtype_t);
239 extern void
240 dCreate_CompCol_Matrix(SuperMatrix *, int, int, int, double *,
241 		       int *, int *, Stype_t, Dtype_t, Mtype_t);
242 extern void
243 cCreate_CompCol_Matrix(SuperMatrix *, int, int, int, lscomplex *,
244 		       int *, int *, Stype_t, Dtype_t, Mtype_t);
245 extern void
246 zCreate_CompCol_Matrix(SuperMatrix *, int, int, int, ldcomplex *,
247 		       int *, int *, Stype_t, Dtype_t, Mtype_t);
248 extern void
249 sCreate_CompRow_Matrix(SuperMatrix *, int, int, int, float *,
250 		       int *, int *, Stype_t, Dtype_t, Mtype_t);
251 extern void
252 dCreate_CompRow_Matrix(SuperMatrix *, int, int, int, double *,
253 		       int *, int *, Stype_t, Dtype_t, Mtype_t);
254 extern void
255 cCreate_CompRow_Matrix(SuperMatrix *, int, int, int, lscomplex *,
256 		       int *, int *, Stype_t, Dtype_t, Mtype_t);
257 extern void
258 zCreate_CompRow_Matrix(SuperMatrix *, int, int, int, ldcomplex *,
259 		       int *, int *, Stype_t, Dtype_t, Mtype_t);
260 extern void
261 sCopy_CompCol_Matrix(SuperMatrix *, SuperMatrix *);
262 extern void
263 dCopy_CompCol_Matrix(SuperMatrix *, SuperMatrix *);
264 extern void
265 cCopy_CompCol_Matrix(SuperMatrix *, SuperMatrix *);
266 extern void
267 zCopy_CompCol_Matrix(SuperMatrix *, SuperMatrix *);
268 extern void
269 sCreate_Dense_Matrix(SuperMatrix *, int, int, float *, int,
270 		     Stype_t, Dtype_t, Mtype_t);
271 extern void
272 dCreate_Dense_Matrix(SuperMatrix *, int, int, double *, int,
273 		     Stype_t, Dtype_t, Mtype_t);
274 extern void
275 cCreate_Dense_Matrix(SuperMatrix *, int, int, lscomplex *, int,
276 		     Stype_t, Dtype_t, Mtype_t);
277 extern void
278 zCreate_Dense_Matrix(SuperMatrix *, int, int, ldcomplex *, int,
279 		     Stype_t, Dtype_t, Mtype_t);
280 extern void
281 sCreate_SuperNode_Matrix(SuperMatrix *, int, int, int, float *,
282 		         int *, int *, int *, int *, int *,
283 			 Stype_t, Dtype_t, Mtype_t);
284 extern void
285 dCreate_SuperNode_Matrix(SuperMatrix *, int, int, int, double *,
286 		         int *, int *, int *, int *, int *,
287 			 Stype_t, Dtype_t, Mtype_t);
288 extern void
289 cCreate_SuperNode_Matrix(SuperMatrix *, int, int, int, lscomplex *,
290 		         int *, int *, int *, int *, int *,
291 			 Stype_t, Dtype_t, Mtype_t);
292 extern void
293 zCreate_SuperNode_Matrix(SuperMatrix *, int, int, int, ldcomplex *,
294 		         int *, int *, int *, int *, int *,
295 			 Stype_t, Dtype_t, Mtype_t);
296 extern void
297 sCopy_Dense_Matrix(int, int, float *, int, float *, int);
298 extern void
299 dCopy_Dense_Matrix(int, int, double *, int, double *, int);
300 extern void
301 cCopy_Dense_Matrix(int, int, lscomplex *, int, lscomplex *, int);
302 extern void
303 zCopy_Dense_Matrix(int, int, ldcomplex *, int, ldcomplex *, int);
304 
305 // extern void    Destroy_SuperMatrix_Store(SuperMatrix *);
306 // extern void    Destroy_CompCol_Matrix(SuperMatrix *);
307 // extern void    Destroy_SuperNode_Matrix(SuperMatrix *);
308 // extern void    Destroy_CompCol_Permuted(SuperMatrix *);
309 // extern void    Destroy_Dense_Matrix(SuperMatrix *);
310 // extern void    get_perm_c(int, SuperMatrix *, int *);
311 // extern void    sp_preorder (char*, SuperMatrix*, int*, int*, SuperMatrix*);
312 // //  extern void    countnz (const int, int *, int *, int *, sGlobalLU_t *);
313 // //  extern void    fixupL (const int, const int *, sGlobalLU_t *);
314 
315 extern void    sallocateA (int, int, float **, int **, int **);
316 extern void    dallocateA (int, int, double **, int **, int **);
317 extern void    callocateA (int, int, lscomplex **, int **, int **);
318 extern void    zallocateA (int, int, ldcomplex **, int **, int **);
319 extern void    sgstrf (superlu_options_t*, SuperMatrix*,
320                        int, int, int*, void *, int, int *, int *,
321                        SuperMatrix *, SuperMatrix *, sGlobalLU_t *, SuperLUStat_t*, int *);
322 extern void    dgstrf (superlu_options_t*, SuperMatrix*,
323                        int, int, int*, void *, int, int *, int *,
324                        SuperMatrix *, SuperMatrix *, dGlobalLU_t *, SuperLUStat_t*, int *);
325 extern void    cgstrf (superlu_options_t*, SuperMatrix*,
326                        int, int, int*, void *, int, int *, int *,
327                        SuperMatrix *, SuperMatrix *, cGlobalLU_t *, SuperLUStat_t*, int *);
328 extern void    zgstrf (superlu_options_t*, SuperMatrix*,
329                        int, int, int*, void *, int, int *, int *,
330                        SuperMatrix *, SuperMatrix *, zGlobalLU_t *, SuperLUStat_t*, int *);
331 extern int     ssnode_dfs (const int, const int, const int *, const int *,
332 			     const int *, int *, int *, sGlobalLU_t *);
333 extern int     dsnode_dfs (const int, const int, const int *, const int *,
334 			     const int *, int *, int *, dGlobalLU_t *);
335 extern int     csnode_dfs (const int, const int, const int *, const int *,
336 			     const int *, int *, int *, cGlobalLU_t *);
337 extern int     zsnode_dfs (const int, const int, const int *, const int *,
338 			     const int *, int *, int *, zGlobalLU_t *);
339 extern int     ssnode_bmod (const int, const int, const int, float *,
340                               float *, sGlobalLU_t *, SuperLUStat_t*);
341 extern int     dsnode_bmod (const int, const int, const int, double *,
342                               double *, dGlobalLU_t *, SuperLUStat_t*);
343 extern int     csnode_bmod (const int, const int, const int, lscomplex *,
344                               lscomplex *, cGlobalLU_t *, SuperLUStat_t*);
345 extern int     zsnode_bmod (const int, const int, const int, ldcomplex *,
346                               ldcomplex *, zGlobalLU_t *, SuperLUStat_t*);
347 extern void    spanel_dfs (const int, const int, const int, SuperMatrix *,
348 			   int *, int *, float *, int *, int *, int *,
349 			   int *, int *, int *, int *, sGlobalLU_t *);
350 extern void    dpanel_dfs (const int, const int, const int, SuperMatrix *,
351 			   int *, int *, double *, int *, int *, int *,
352 			   int *, int *, int *, int *, dGlobalLU_t *);
353 extern void    cpanel_dfs (const int, const int, const int, SuperMatrix *,
354 			   int *, int *, lscomplex *, int *, int *, int *,
355 			   int *, int *, int *, int *, cGlobalLU_t *);
356 extern void    zpanel_dfs (const int, const int, const int, SuperMatrix *,
357 			   int *, int *, ldcomplex *, int *, int *, int *,
358 			   int *, int *, int *, int *, zGlobalLU_t *);
359 extern void    spanel_bmod (const int, const int, const int, const int,
360                            float *, float *, int *, int *,
361 			   sGlobalLU_t *, SuperLUStat_t*);
362 extern void    dpanel_bmod (const int, const int, const int, const int,
363                            double *, double *, int *, int *,
364 			   dGlobalLU_t *, SuperLUStat_t*);
365 extern void    cpanel_bmod (const int, const int, const int, const int,
366                            lscomplex *, lscomplex *, int *, int *,
367 			   cGlobalLU_t *, SuperLUStat_t*);
368 extern void    zpanel_bmod (const int, const int, const int, const int,
369                            ldcomplex *, ldcomplex *, int *, int *,
370 			   zGlobalLU_t *, SuperLUStat_t*);
371 extern int     scolumn_dfs (const int, const int, int *, int *, int *, int *,
372 			   int *, int *, int *, int *, int *, sGlobalLU_t *);
373 extern int     dcolumn_dfs (const int, const int, int *, int *, int *, int *,
374 			   int *, int *, int *, int *, int *, dGlobalLU_t *);
375 extern int     ccolumn_dfs (const int, const int, int *, int *, int *, int *,
376 			   int *, int *, int *, int *, int *, cGlobalLU_t *);
377 extern int     zcolumn_dfs (const int, const int, int *, int *, int *, int *,
378 			   int *, int *, int *, int *, int *, zGlobalLU_t *);
379 extern int     scolumn_bmod (const int, const int, float *,
380 			   float *, int *, int *, int, sGlobalLU_t *, SuperLUStat_t*);
381 extern int     dcolumn_bmod (const int, const int, double *,
382 			   double *, int *, int *, int, dGlobalLU_t *, SuperLUStat_t*);
383 extern int     ccolumn_bmod (const int, const int, lscomplex *,
384 			   lscomplex *, int *, int *, int, cGlobalLU_t *, SuperLUStat_t*);
385 extern int     zcolumn_bmod (const int, const int, ldcomplex *,
386 			   ldcomplex *, int *, int *, int, zGlobalLU_t *, SuperLUStat_t*);
387 extern int     scopy_to_ucol (int, int, int *, int *, int *,
388                               float *, sGlobalLU_t *);
389 extern int     dcopy_to_ucol (int, int, int *, int *, int *,
390                               double *, dGlobalLU_t *);
391 extern int     ccopy_to_ucol (int, int, int *, int *, int *,
392                               lscomplex *, cGlobalLU_t *);
393 extern int     zcopy_to_ucol (int, int, int *, int *, int *,
394                               ldcomplex *, zGlobalLU_t *);
395 extern int     spivotL (const int, const float, int *, int *,
396                               int *, int *, int *, sGlobalLU_t *, SuperLUStat_t*);
397 extern int     dpivotL (const int, const double, int *, int *,
398                               int *, int *, int *, dGlobalLU_t *, SuperLUStat_t*);
399 extern int     cpivotL (const int, const float, int *, int *,
400                               int *, int *, int *, cGlobalLU_t *, SuperLUStat_t*);
401 extern int     zpivotL (const int, const double, int *, int *,
402                               int *, int *, int *, zGlobalLU_t *, SuperLUStat_t*);
403 extern void    spruneL (const int, const int *, const int, const int,
404 			     const int *, const int *, int *, sGlobalLU_t *);
405 extern void    dpruneL (const int, const int *, const int, const int,
406 			     const int *, const int *, int *, dGlobalLU_t *);
407 extern void    cpruneL (const int, const int *, const int, const int,
408 			     const int *, const int *, int *, cGlobalLU_t *);
409 extern void    zpruneL (const int, const int *, const int, const int,
410 			     const int *, const int *, int *, zGlobalLU_t *);
411 extern void    sreadmt (int *, int *, int *, float **, int **, int **);
412 extern void    dreadmt (int *, int *, int *, double **, int **, int **);
413 extern void    creadmt (int *, int *, int *, lscomplex **, int **, int **);
414 extern void    zreadmt (int *, int *, int *, ldcomplex **, int **, int **);
415 extern void    sGenXtrue (int, int, float *, int);
416 extern void    dGenXtrue (int, int, double *, int);
417 extern void    cGenXtrue (int, int, lscomplex *, int);
418 extern void    zGenXtrue (int, int, ldcomplex *, int);
419 extern void    sFillRHS (trans_t, int, float *, int, SuperMatrix *,
420 			SuperMatrix *);
421 extern void    dFillRHS (trans_t, int, double *, int, SuperMatrix *,
422 			SuperMatrix *);
423 extern void    cFillRHS (trans_t, int, lscomplex *, int, SuperMatrix *,
424 			SuperMatrix *);
425 extern void    zFillRHS (trans_t, int, ldcomplex *, int, SuperMatrix *,
426 			SuperMatrix *);
427 extern void    sgstrs (trans_t, SuperMatrix *, SuperMatrix *, int *, int *,
428                         SuperMatrix *, SuperLUStat_t*, int *);
429 extern void    dgstrs (trans_t, SuperMatrix *, SuperMatrix *, int *, int *,
430                         SuperMatrix *, SuperLUStat_t*, int *);
431 extern void    cgstrs (trans_t, SuperMatrix *, SuperMatrix *, int *, int *,
432                         SuperMatrix *, SuperLUStat_t*, int *);
433 extern void    zgstrs (trans_t, SuperMatrix *, SuperMatrix *, int *, int *,
434                         SuperMatrix *, SuperLUStat_t*, int *);
435 
436 
437 /* Driver related */
438 
439 extern void    sgsequ (SuperMatrix *, float *, float *, float *,
440 			     float *, float *, int *);
441 extern void    dgsequ (SuperMatrix *, double *, double *, double *,
442 			     double *, double *, int *);
443 extern void    cgsequ (SuperMatrix *, float *, float *, float *,
444 			     float *, float *, int *);
445 extern void    zgsequ (SuperMatrix *, double *, double *, double *,
446 			     double *, double *, int *);
447 extern void    slaqgs (SuperMatrix *, float *, float *, float,
448                              float, float, char *);
449 extern void    dlaqgs (SuperMatrix *, double *, double *, double,
450                              double, double, char *);
451 extern void    claqgs (SuperMatrix *, float *, float *, float,
452                              float, float, char *);
453 extern void    zlaqgs (SuperMatrix *, double *, double *, double,
454                              double, double, char *);
455 extern void    sgscon (char *, SuperMatrix *, SuperMatrix *,
456 		         float, float *, SuperLUStat_t*, int *);
457 extern void    dgscon (char *, SuperMatrix *, SuperMatrix *,
458 		         double, double *, SuperLUStat_t*, int *);
459 extern void    cgscon (char *, SuperMatrix *, SuperMatrix *,
460 		         float, float *, SuperLUStat_t*, int *);
461 extern void    zgscon (char *, SuperMatrix *, SuperMatrix *,
462 		         double, double *, SuperLUStat_t*, int *);
463 
464 extern float   sPivotGrowth(int, SuperMatrix *, int *,
465                             SuperMatrix *, SuperMatrix *);
466 extern double  dPivotGrowth(int, SuperMatrix *, int *,
467                             SuperMatrix *, SuperMatrix *);
468 extern float   cPivotGrowth(int, SuperMatrix *, int *,
469                             SuperMatrix *, SuperMatrix *);
470 extern double  zPivotGrowth(int, SuperMatrix *, int *,
471                             SuperMatrix *, SuperMatrix *);
472 extern void    sgsrfs (trans_t, SuperMatrix *, SuperMatrix *,
473                        SuperMatrix *, int *, int *, char *, float *,
474                        float *, SuperMatrix *, SuperMatrix *,
475                        float *, float *, SuperLUStat_t*, int *);
476 extern void    dgsrfs (trans_t, SuperMatrix *, SuperMatrix *,
477                        SuperMatrix *, int *, int *, char *, double *,
478                        double *, SuperMatrix *, SuperMatrix *,
479                        double *, double *, SuperLUStat_t*, int *);
480 extern void    cgsrfs (trans_t, SuperMatrix *, SuperMatrix *,
481                        SuperMatrix *, int *, int *, char *, float *,
482                        float *, SuperMatrix *, SuperMatrix *,
483                        float *, float *, SuperLUStat_t*, int *);
484 extern void    zgsrfs (trans_t, SuperMatrix *, SuperMatrix *,
485                        SuperMatrix *, int *, int *, char *, double *,
486                        double *, SuperMatrix *, SuperMatrix *,
487                        double *, double *, SuperLUStat_t*, int *);
488 
489 extern int     sp_strsv (char *, char *, char *, SuperMatrix *,
490 			SuperMatrix *, float *, SuperLUStat_t*, int *);
491 extern int     sp_dtrsv (char *, char *, char *, SuperMatrix *,
492 			SuperMatrix *, double *, SuperLUStat_t*, int *);
493 extern int     sp_ctrsv (char *, char *, char *, SuperMatrix *,
494 			SuperMatrix *, lscomplex *, SuperLUStat_t*, int *);
495 extern int     sp_ztrsv (char *, char *, char *, SuperMatrix *,
496 			SuperMatrix *, ldcomplex *, SuperLUStat_t*, int *);
497 extern int     sp_sgemv (char *, float, SuperMatrix *, float *,
498 			int, float, float *, int);
499 extern int     sp_dgemv (char *, double, SuperMatrix *, double *,
500 			int, double, double *, int);
501 extern int     sp_cgemv (char *, lscomplex, SuperMatrix *, lscomplex *,
502 			int, lscomplex, lscomplex *, int);
503 extern int     sp_zgemv (char *, ldcomplex, SuperMatrix *, ldcomplex *,
504 			int, ldcomplex, ldcomplex *, int);
505 
506 extern int     sp_sgemm (char *, char *, int, int, int, float,
507 			SuperMatrix *, float *, int, float,
508 			float *, int);
509 extern int     sp_dgemm (char *, char *, int, int, int, double,
510 			SuperMatrix *, double *, int, double,
511 			double *, int);
512 extern int     sp_cgemm (char *, char *, int, int, int, lscomplex,
513 			SuperMatrix *, lscomplex *, int, lscomplex,
514 			lscomplex *, int);
515 extern int     sp_zgemm (char *, char *, int, int, int, ldcomplex,
516 			SuperMatrix *, ldcomplex *, int, ldcomplex,
517 			ldcomplex *, int);
518 
519 /* Memory-related */
520 extern int     sLUMemInit (fact_t, void *, int, int, int, int, int,
521 			     float, SuperMatrix *, SuperMatrix *,
522 			     sGlobalLU_t *, int **, float **);
523 extern int     dLUMemInit (fact_t, void *, int, int, int, int, int,
524 			     double, SuperMatrix *, SuperMatrix *,
525 			     dGlobalLU_t *, int **, double **);
526 extern int     cLUMemInit (fact_t, void *, int, int, int, int, int,
527 			     float, SuperMatrix *, SuperMatrix *,
528 			     cGlobalLU_t *, int **, lscomplex **);
529 extern int     zLUMemInit (fact_t, void *, int, int, int, int, int,
530 			     double, SuperMatrix *, SuperMatrix *,
531 			     zGlobalLU_t *, int **, ldcomplex **);
532 extern void    sSetRWork (int, int, float *, float **, float **);
533 extern void    dSetRWork (int, int, double *, double **, double **);
534 extern void    cSetRWork (int, int, lscomplex *, lscomplex **, lscomplex **);
535 extern void    zSetRWork (int, int, ldcomplex *, ldcomplex **, ldcomplex **);
536 extern void    sLUWorkFree (int *, float *, sGlobalLU_t *);
537 extern void    dLUWorkFree (int *, double *, dGlobalLU_t *);
538 extern void    cLUWorkFree (int *, lscomplex *, cGlobalLU_t *);
539 extern void    zLUWorkFree (int *, ldcomplex *, zGlobalLU_t *);
540 extern int     sLUMemXpand (int, int, MemType, int *, sGlobalLU_t *);
541 extern int     dLUMemXpand (int, int, MemType, int *, dGlobalLU_t *);
542 extern int     cLUMemXpand (int, int, MemType, int *, cGlobalLU_t *);
543 extern int     zLUMemXpand (int, int, MemType, int *, zGlobalLU_t *);
544 
545 extern float  *floatMalloc(int);
546 extern double  *doubleMalloc(int);
547 extern lscomplex  *complexMalloc(int);
548 extern ldcomplex  *doublecomplexMalloc(int);
549 extern float  *floatCalloc(int);
550 extern double  *doubleCalloc(int);
551 extern lscomplex  *complexCalloc(int);
552 extern ldcomplex  *doublecomplexCalloc(int);
553 extern int     smemory_usage(const int, const int, const int, const int);
554 extern int     dmemory_usage(const int, const int, const int, const int);
555 extern int     cmemory_usage(const int, const int, const int, const int);
556 extern int     zmemory_usage(const int, const int, const int, const int);
557 extern int     sQuerySpace (SuperMatrix *, SuperMatrix *, mem_usage_t *);
558 extern int     dQuerySpace (SuperMatrix *, SuperMatrix *, mem_usage_t *);
559 extern int     cQuerySpace (SuperMatrix *, SuperMatrix *, mem_usage_t *);
560 extern int     zQuerySpace (SuperMatrix *, SuperMatrix *, mem_usage_t *);
561 
562 /* Auxiliary routines */
563 extern void    sreadhb(FILE *, int *, int *, int *, float **, int **, int **);
564 extern void    dreadhb(FILE *, int *, int *, int *, double **, int **, int **);
565 extern void    creadhb(FILE *, int *, int *, int *, lscomplex **, int **, int **);
566 extern void    zreadhb(FILE *, int *, int *, int *, ldcomplex **, int **, int **);
567 extern void    sCompRow_to_CompCol(int, int, int, float*, int*, int*,
568 		                   float **, int **, int **);
569 extern void    dCompRow_to_CompCol(int, int, int, double*, int*, int*,
570 		                   double **, int **, int **);
571 extern void    cCompRow_to_CompCol(int, int, int, lscomplex*, int*, int*,
572 		                   lscomplex **, int **, int **);
573 extern void    zCompRow_to_CompCol(int, int, int, ldcomplex*, int*, int*,
574 		                   ldcomplex **, int **, int **);
575 extern void    sfill (float *, int, float);
576 extern void    dfill (double *, int, double);
577 extern void    cfill (lscomplex *, int, lscomplex);
578 extern void    zfill (ldcomplex *, int, ldcomplex);
579 extern void    sinf_norm_error (int, SuperMatrix *, float *);
580 extern void    dinf_norm_error (int, SuperMatrix *, double *);
581 extern void    cinf_norm_error (int, SuperMatrix *, lscomplex *);
582 extern void    zinf_norm_error (int, SuperMatrix *, ldcomplex *);
583 //  extern void    PrintPerf (SuperMatrix *, SuperMatrix *, mem_usage_t *,
584 //                           float, float, float *, float *, char *);
585 
586 /* Routines for debugging */
587 extern void    sPrint_CompCol_Matrix(char *, SuperMatrix *);
588 extern void    dPrint_CompCol_Matrix(char *, SuperMatrix *);
589 extern void    cPrint_CompCol_Matrix(char *, SuperMatrix *);
590 extern void    zPrint_CompCol_Matrix(char *, SuperMatrix *);
591 extern void    sPrint_SuperNode_Matrix(char *, SuperMatrix *);
592 extern void    dPrint_SuperNode_Matrix(char *, SuperMatrix *);
593 extern void    cPrint_SuperNode_Matrix(char *, SuperMatrix *);
594 extern void    zPrint_SuperNode_Matrix(char *, SuperMatrix *);
595 extern void    sPrint_Dense_Matrix(char *, SuperMatrix *);
596 extern void    dPrint_Dense_Matrix(char *, SuperMatrix *);
597 extern void    cPrint_Dense_Matrix(char *, SuperMatrix *);
598 extern void    zPrint_Dense_Matrix(char *, SuperMatrix *);
599 //     extern void    print_lu_col(char *, int, int, int *, sGlobalLU_t *);
600 //     extern void    check_tempv(int, float *);
601 
602 /* Reordering routine */
603 
604 
605 #ifdef __cplusplus
606   }
607 #endif
608 
609 #endif /* __SUPERLU_SP_DEFS */
610 
611