1 /*@ BSsparse.h - Include fle for the sparse solver package.
2     This is the include file for public use.
3  @*/
4 
5 /* ****************************************************************** */
6 /* NOTICE:  BlockSolve95 is copyrighted.  See the file ../COPYRIGHT   */
7 /*          for details.                                              */
8 /*                                                                    */
9 /* Authors: Mark Jones and Paul Plassmann                             */
10 /*                                                                    */
11 /* Version: 3.0                                                       */
12 /*                                                                    */
13 /* Last Modified: 1/96                                                */
14 /*                                                                    */
15 /* ****************************************************************** */
16 
17 #ifndef __BSsparseh
18 #define __BSsparseh
19 
20 /* The following is a global definition of the variable for error handling. */
21 /* It is statically defined in BScontext.c and initialized to 0 there */
22 extern	int	__BSERROR_STATUS;
23 
24 /* include the "system" dependent routines */
25 #include "BSdepend.h"
26 
27 /* include the special message passing stuff that I wrote */
28 #include "BMmsg.h"
29 
30 /* the usual system stuff */
31 #include <stdio.h>
32 #include <limits.h>
33 #include <math.h>
34 
35 /* ****************************************************************** */
36 /* Definitions of double/single precision stuff */
37 /* ****************************************************************** */
38 #if defined(PARCH_cray) || defined(PARCH_t3d)
39 #define dgemm_ SGEMM
40 #define dtrmm_ STRMM
41 #define dcopy_ SCOPY
42 #define daxpy_ SAXPY
43 #define dgemv_ SGEMV
44 #define dtrmv_ STRMV
45 #define dpotrf_ SPOTRF
46 #define dtrtri_ STRTRI
47 #define dlamch_ SLAMCH
48 #define dgetrf_ SGETRF
49 #define dgetri_ SGETRI
50 #define sdot_ SDOT
51 #define sgemm_ SGEMM
52 #define strmm_ STRMM
53 #define scopy_ SCOPY
54 #define saxpy_ SAXPY
55 #define sgemv_ SGEMV
56 #define strmv_ STRMV
57 #define spotrf_ SPOTRF
58 #define strtri_ STRTRI
59 #define slamch_ SLAMCH
60 #define sgetrf_ SGETRF
61 #define sgetri_ SGETRI
62 #elif defined(FORTRANCAPS)
63 #define dgemm_ DGEMM
64 #define dtrmm_ DTRMM
65 #define dcopy_ DCOPY
66 #define daxpy_ DAXPY
67 #define dgemv_ DGEMV
68 #define dtrmv_ DTRMV
69 #define dpotrf_ DPOTRF
70 #define dtrtri_ DTRTRI
71 #define dlamch_ DLAMCH
72 #define dgetrf_ DGETRF
73 #define dgetri_ DGETRI
74 #define sdot_ SDOT
75 #define sgemm_ SGEMM
76 #define strmm_ STRMM
77 #define scopy_ SCOPY
78 #define saxpy_ SAXPY
79 #define sgemv_ SGEMV
80 #define strmv_ STRMV
81 #define spotrf_ SPOTRF
82 #define strtri_ STRTRI
83 #define slamch_ SLAMCH
84 #define sgetrf_ SGETRF
85 #define sgetri_ SGETRI
86 #elif !defined(FORTRANUNDERSCORE)
87 #define dgemm_ dgemm
88 #define dtrmm_ dtrmm
89 #define dcopy_ dcopy
90 #define daxpy_ daxpy
91 #define dgemv_ dgemv
92 #define dtrmv_ dtrmv
93 #define dpotrf_ dpotrf
94 #define dtrtri_ dtrtri
95 #define dlamch_ dlamch
96 #define dgetrf_ dgetrf
97 #define dgetri_ dgetri
98 #define sdot_ sdot
99 #define sgemm_ sgemm
100 #define strmm_ strmm
101 #define scopy_ scopy
102 #define saxpy_ saxpy
103 #define sgemv_ sgemv
104 #define strmv_ strmv
105 #define spotrf_ spotrf
106 #define strtri_ strtri
107 #define slamch_ slamch
108 #define slamch_ slamch
109 #define sgetrf_ sgetrf
110 #define sgetri_ sgetri
111 #endif
112 
113 /* turn on compilation of the double precision version if */
114 /* BSDOUBLE is defined, otherwise single precision */
115 #if defined(PARCH_cray) || defined(PARCH_t3d)
116 #else
117 #define BSDOUBLE
118 #endif
119 
120 #if defined(PARCH_t3d)
121 #include <fortran.h>
122 #define	MY_MPI_FLT	MPI_DOUBLE
123 #define FLOAT double
124 #define DLAMCH(a) SLAMCH(_cptofcd((a),1))
125 #define DGEMM(a,b,c,d,e,f,g,h,i,j,k,l,m) SGEMM(_cptofcd((a),1),_cptofcd((b),1),\
126         (c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m))
127 #define DTRMM(a,b,c,d,e,f,g,h,i,j,k)  STRMM(_cptofcd((a),1),_cptofcd((b),1),\
128         _cptofcd((c),1),_cptofcd((d),1),(e),(f),(g),(h),(i),(j),(k))
129 #define DCOPY SCOPY
130 #define DAXPY SAXPY
131 #define DGEMV(a,b,c,d,e,f,g,h,i,j,k) SGEMV(_cptofcd((a),1),(b),(c),(d),(e),\
132                                  (f),(g),(h),(i),(j),(k))
133 #define DTRMV(a,b,c,d,e,f,g,h)  STRMV(_cptofcd((a),1),\
134              _cptofcd((b),1),_cptofcd((c),1),(d),(e),(f),(g),(h))
135 #define DPOTRF(a,b,c,d,e)  SPOTRF(_cptofcd((a),1),(b),(c),(d),(e))
136 #define DTRTRI(a,b,c,d,e,f)  STRTRI(_cptofcd((a),1),_cptofcd((b),1),\
137                                   (c),(d),(e),(f))
138 #define GFLSUM GDSUM
139 #define DGETRF SGETRF
140 #define DGETRI SGETRI
141 #elif defined(BSDOUBLE)
142 #define	MY_MPI_FLT	MPI_DOUBLE
143 #define FLOAT double
144 #define DGEMM dgemm_
145 #define DTRMM dtrmm_
146 #define DCOPY dcopy_
147 #define DAXPY daxpy_
148 #define DGEMV dgemv_
149 #define DTRMV dtrmv_
150 #define DPOTRF dpotrf_
151 #define DTRTRI dtrtri_
152 #define DLAMCH dlamch_
153 #define GFLSUM GDSUM
154 #define DGETRF dgetrf_
155 #define DGETRI dgetri_
156 #else
157 #define	MY_MPI_FLT	MPI_FLOAT
158 #define FLOAT float
159 #define DGEMM sgemm_
160 #define DTRMM strmm_
161 #define DCOPY scopy_
162 #define DAXPY saxpy_
163 #define DGEMV sgemv_
164 #define DTRMV strmv_
165 #define DPOTRF spotrf_
166 #define DTRTRI strtri_
167 #define DLAMCH slamch_
168 #define GFLSUM GFSUM
169 #define DGETRF sgetrf_
170 #define DGETRI sgetri_
171 #endif
172 
173 #if defined(__cplusplus)
174 extern "C" {
175 #endif
176 
177 /* note that BLdot cannot be used with COMPLEX because it cannot
178    handle returing a double complex!!
179 */
180 extern void   DCOPY(int*,FLOAT*,int*,FLOAT*,int*);
181 extern void   DAXPY(int*,FLOAT*,FLOAT*,int*,FLOAT*,int*);
182 extern void   DGETRF(int*,int*,FLOAT*,int*,int*,int*);
183 extern void   DGETRI(int*,FLOAT*,int*,int*,FLOAT *,int*,int*);
184 
185 #if defined(PARCH_t3d)
186 extern FLOAT  SLAMCH(_fcd);
187 extern void   STRMM(_fcd,_fcd,_fcd,_fcd,int*,int*,
188 				 FLOAT*,FLOAT*,int*,FLOAT*,int*);
189 extern void   SPOTRF(_fcd,int*,FLOAT*,int*,int*);
190 extern void   STRTRI(_fcd,_fcd,int*,FLOAT*,int*,int*);
191 extern void   SGEMV(_fcd,int*,int*,FLOAT*,FLOAT*,int*,FLOAT *,int*,
192                     FLOAT*,FLOAT*,int*);
193 extern void   STRMV(_fcd,_fcd,_fcd,int*,FLOAT*,int*,FLOAT *,int*);
194 extern void   SGEMM(_fcd,_fcd,int*,int*,int*,FLOAT*,FLOAT*,int*,
195 					FLOAT *,int*,FLOAT*,FLOAT*,int*);
196 #else
197 extern FLOAT  DLAMCH(char*);
198 extern void   DTRMM(char*,char*,char*,char*,int*,int*,
199 				 FLOAT*,FLOAT*,int*,FLOAT*,int*);
200 extern void   DPOTRF(char*,int*,FLOAT*,int*,int*);
201 extern void   DTRTRI(char*,char*,int*,FLOAT*,int*,int*);
202 extern void   DGEMV(char*,int*,int*,FLOAT*,FLOAT*,int*,FLOAT *,int*,
203                     FLOAT*,FLOAT*,int*);
204 extern void   DTRMV(char*,char*,char*,int*,FLOAT*,int*,FLOAT *,int*);
205 extern void   DGEMM(char*,char*,int*,int*,int*,FLOAT*,FLOAT*,int*,
206 					FLOAT *,int*,FLOAT*,FLOAT*,int*);
207 #endif
208 
209 #if defined(__cplusplus)
210 }
211 #endif
212 
213 /* include special blas stuff */
214 #include "BSmy_blas.h"
215 
216 /* ****************************************************************** */
217 /* End of Definitions */
218 /* ****************************************************************** */
219 
220 /* ****************************************************************** */
221 /* Definitions of misc. constants */
222 /* ****************************************************************** */
223 
224 #define	MEM_ERROR -25
225 #define	FILE_ERROR -26
226 #define	BB_ERROR -27
227 #define	COLOR1_ERROR -28
228 #define	COLOR2_ERROR -29
229 #define	INODE_ERROR -30
230 #define	MSG_ERROR -30
231 #define CG_NEG_ERROR -31
232 #define	COLOR_ERROR -32
233 #define	FACTOR_ERROR -33
234 #define	MATRIX_ERROR0 -50
235 #define	MATRIX_ERROR1 -51
236 #define	MATRIX_ERROR2 -52
237 #define	MATRIX_ERROR3 -53
238 #define	MATRIX_ERROR4 -54
239 #define	MATRIX_ERROR5 -55
240 #define	MATRIX_ERROR6 -56
241 #define	MATRIX_ERROR7 -57
242 #define	MATRIX_ERROR8 -58
243 #define	MATRIX_ERROR9 -59
244 #define	MATRIX_ERROR10 -60
245 #define	MATRIX_ERROR11 -61
246 #define	MATRIX_ERROR12 -62
247 #define	MATRIX_ERROR13 -63
248 #define	MATRIX_ERROR14 -64
249 #define	MATRIX_ERROR15 -65
250 #define	MATRIX_ERROR16 -66
251 #define	MATRIX_ERROR17 -67
252 #define	REPERM_ERROR -68
253 #define	SYM_ERROR -69
254 #define	TRI_SOLVE_ERROR -70
255 #define	PAR_SOLVE_ERROR -71
256 #define	SCALING_ERROR -72
257 #define	MLOG_ERROR -73
258 
259 /* type of coloring */
260 #define IDO 10
261 #define SDO 20
262 
263 /* kinds of preconditioners */
264 #define PRE_DIAG 0
265 #define PRE_ICC 1
266 #define PRE_ILU 2
267 #define PRE_SSOR 3
268 #define PRE_BJACOBI 3
269 
270 /* kinds of iterative methods */
271 #define CG    100
272 #define SSOR  200
273 #define GMRES 300
274 #define SYMMLQ 400
275 
276 /* ****************************************************************** */
277 /* End of section */
278 /* ****************************************************************** */
279 
280 
281 /* ****************************************************************** */
282 /* Definitions of data structures */
283 /* ****************************************************************** */
284 
285 /* store a local dense matrix */
286 typedef struct __BSdense {
287 	int	size;          /* size of the dense matrix */
288 	int	local_ind;     /* local index of first element of dense matrix */
289 	FLOAT	*matrix;   /* the matrix itself */
290 } BSdense;
291 
292 /* shows which inodes belong to each clique */
293 /* the arrays are one element longer than num_cols for ease of use */
294 typedef struct __BScl_2_inode {
295 	int	num_cols;      /* number of columns */
296 	int	*g_offset;     /* global number of beginning of each clique */
297 	int	*proc;         /* processor who owns clique */
298 	int	*inode_index;  /* index into inode structure */
299 	BSdense *d_mats;   /* array of pointers to dense matrices */
300 } BScl_2_inode;
301 
302 /* i_node structure keeps several identical rows/cols in place */
303 /* we are storing on the half of the symmetric matrix, in addition */
304 /* the diagonal portions are stored with the clique structure */
305 typedef struct __BSinode {
306 	int	num_cols;    /* number of cols in i_node */
307 	int	gcol_num;    /* global column number of first row of i_node */
308 	                 /* global column numbers are consecutive */
309 	int	*o_gcol_num; /* original global column number of each row of i_node */
310 	                 /* original global column numbers are NOT consecutive */
311 	int	length;      /* the length of each col */
312 	int	below_diag;	 /* a pointer to where row entries below the diag start (ILU only) */
313 	int	*row_num;    /* the row numbers (we store local, not global #'s */
314 	FLOAT	*nz;     /* the nz values */
315 } BSinode;
316 
317 /* list of inodes */
318 /* the array is one element longer than length for ease of use */
319 typedef struct __BSinode_list {
320 	int	 length; /* the number of i_nodes */
321 	BSinode	*list; /* array of i_nodes */
322 } BSinode_list;
323 
324 /* permutation of rows/cols of a matrix */
325 typedef	struct __BSpermutation {
326 	int	length;
327 	int	*perm;
328 } BSpermutation;
329 
330 /* distribution of a numbering */
331 /* i.e. how many 0's, how many 1's, etc. */
332 typedef struct __BSdistribution {
333 	int	max;
334 	int	*distribution;
335 } BSdistribution;
336 
337 /* numbering of rows/cols of a matrix */
338 typedef	struct __BSnumbering {
339 	int	length;
340 	int	*numbers;
341 } BSnumbering;
342 
343 /* processor information and execution time information */
344 typedef struct __BSprocinfo {
345 	int	my_id;			/* processor id */
346 	int	nprocs;			/* number of processors */
347 	MPI_Comm procset;	/* set of processors to operate on */
348 	int	max_clique_size; /* the maximum clique size to allow */
349 	int	max_inode_size; /* the maximum i-node size to allow */
350 	int	coloring_type;  /* the type of coloring to do */
351 	int	error_check;    /* if TRUE, then do error checking */
352 	int	retain;         /* if TRUE, then keep around some extra */
353 	                    /* information to allow for fast permutation */
354 	                    /* for a matrix with the same structure */
355 	int	print;			/* if TRUE, then print reordering information */
356 	int	print_log;		/* if TRUE, then print logging information when requested */
357 	int	single;			/* if TRUE, the no cliques or i-nodes are found */
358 	int	preconditioner;	/* type of preconditioner to be used */
359 	int	method;         /* iterative method to be used */
360 	int	scaling;        /* if true, scale linear systems for solution */
361 	int	num_rhs;        /* number of RHSs to be solved for */
362 	int	num_rhs_comm;   /* number of RHSs for which the communication */
363 	                    /* data structure is set up */
364 	int	max_iterations; /* the max number of iterations allowed solver */
365 	int	guess;          /* if TRUE, use x-values as starting vector for solver */
366 	int	restart;        /* GMRES restart parameter */
367 	FLOAT residual_tol; /* residual error tolerance requested from solver */
368 } BSprocinfo;
369 
370 /* global/local mapping */
371 #if defined(__cplusplus)
372 typedef struct __BSmapping {
373 	/* not all of these members may be present, some may be NULL */
374 	/* we are trying to define a flexible structure */
375 	void	*vlocal2global; /* data for mapping local to global */
376 	/* a function for mapping local to global */
377 	void (*flocal2global)(int,int *,int *,BSprocinfo *,__BSmapping *);
378 	void (*free_l2g)(void *); /* a function for free'ing the l2g data */
379 	void	*vglobal2local; /* data for mapping global to local */
380 	/* a function mapping global to local */
381 	void (*fglobal2local)(int,int *,int *,BSprocinfo *,__BSmapping *);
382 	void (*free_g2l)(void *); /* a function for free'ing the g2l data */
383 	void	*vglobal2proc; /* data for mapping global to proc */
384 	/* a function mapping global to proc */
385 	void (*fglobal2proc)(int,int *,int *,BSprocinfo *,__BSmapping *);
386 	void (*free_g2p)(void *); /* a function for free'ing the g2p data */
387 } BSmapping;
388 #else
389 typedef struct __BSmapping {
390 	/* not all of these members may be present, some may be NULL */
391 	/* we are trying to define a flexible structure */
392 	void	*vlocal2global; /* data for mapping local to global */
393 	void (*flocal2global)(); /* a function for mapping local to global */
394 	void (*free_l2g)(); /* a function for free'ing the l2g data */
395 	void	*vglobal2local; /* data for mapping global to local */
396 	void (*fglobal2local)(); /* a function mapping global to local */
397 	void (*free_g2l)(); /* a function for free'ing the g2l data */
398 	void	*vglobal2proc; /* data for mapping global to proc */
399 	void (*fglobal2proc)(); /* a function mapping global to proc */
400 	void (*free_g2p)(); /* a function for free'ing the g2p data */
401 } BSmapping;
402 #endif
403 
404 /* row of a sparse matrix */
405 typedef struct __BSsprow {
406 	int	diag_ind;	/* index of diagonal in row */
407 	int	length;		/* num. of nz in row */
408 	int	*col;		/* col numbers */
409 	FLOAT	*nz;	/* nz values */
410 } BSsprow;
411 
412 /* sparse matrix */
413 typedef struct __BSspmat {
414 	int	num_rows;		/* number of local rows */
415 	int	global_num_rows;/* number of global rows */
416 	int	symmetric;      /* if TRUE, the matrix should be symmetric */
417 	int	icc_storage;    /* if TRUE, storage scheme used for ICC preconditioner */
418 	                    /* if FALSE, ILU storage scheme used */
419 	BSmapping	*map;	/* mapping from local to global, etc */
420 	BSsprow	**rows;		/* the sparse rows */
421 } BSspmat;
422 
423 /* offset mapping structure (keep track of who has what row, etc. */
424 typedef struct __BSoff_map {
425 	int	length;		/* length of the map (number of processors, usually) */
426 	int	my_ind;		/* my index into the map */
427 	int	*proc_id;	/* processor id's (sorted by offset) */
428 	int	*offset;	/* sorted list of offsets */
429 } BSoff_map;
430 
431 /* information for quickly permuting a matrix with the same structure */
432 typedef struct __BSreperm {
433 	BSpermutation *inode_perm;    /* the original inode permutation */
434 	BSdistribution *inode_distr;  /* the original inode distribution */
435 } BSreperm;
436 
437 /* Here is a very important data structure, this is the structure     */
438 /* returned by BSmain_perm.  It contains everything needed for        */
439 /* parallel matrix multiply, back solve, etc.  It also may or may not */
440 /* contain the information for quickly permuting a matrix with the    */
441 /* exact same structure again                                         */
442 /* IMPORTANT: the map pointer is only a copy, do not destroy          */
443 /* if the original is destroyed, we are in trouble                    */
444 typedef struct __BSpar_mat {
445 	int	num_rows;                /* number of local rows */
446 	int	global_num_rows;         /* number of global rows */
447 	int	local_nnz;               /* number of nonzeroes on this processor */
448 	int	local_num_inodes;        /* number of i-nodes on this processor */
449 	int	global_num_inodes;       /* number of global i-nodes */
450 	int	local_num_cliques;       /* number of cliques on this processor */
451 	int	global_num_cliques;      /* number of global cliques */
452 	int	num_colors;              /* number of colors used */
453 	int	max_local_row_length;    /* max length row on this processor */
454 	int	symmetric;               /* if TRUE, matrix should be symmetric */
455 	int	icc_storage;             /* if TRUE, storage scheme used for ICC preconditioner */
456 	                             /* if FALSE, ILU storage scheme used */
457 	BSpermutation *perm;         /* the local permutation of the columns */
458 	BSpermutation *inv_perm;     /* the inverse of perm */
459 	BSnumbering *global_row_num; /* the global numbers of the rows */
460 	BSnumbering *color2clique;   /* map from colors to cliques */
461 	BScl_2_inode *clique2inode;  /* map from cliques to inodes */
462 	BSinode_list *inodes;        /* the array of inodes */
463 	FLOAT	*diag;               /* a copy of the original permuted diagonal */
464 	FLOAT	*save_diag;          /* a copy of the current (scaled) diagonal */
465 	                             /* this is useful if we share cliques */
466 	                             /* it can be NULL (which means the diagonal */
467 	                             /* is all 1's */
468 	                             /* can legally be equal to diag */
469 	FLOAT	*scale_diag;         /* the diagonal the matrix was scaled by */
470 	                             /* if NULL, then no scaling was done */
471 	                             /* can legally be equal to diag */
472 	BSmapping *map;              /* a POINTER to the original mapping */
473 	BSreperm *reperm;            /* information for quick permutation (opt) */
474 } BSpar_mat;
475 
476 /* data structure used to contain communication information */
477 typedef struct __BScomm {
478 	int         num_rhs;    /* number of RHSs BScomm set up to solve */
479 	BMcomp_msg *to_msg;		/* compiled message structure */
480 	BMcomp_msg *from_msg;	/* compiled message structure */
481 } BScomm;
482 
483 /* ****************************************************************** */
484 /* End of section */
485 /* ****************************************************************** */
486 
487 /* ****************************************************************** */
488 /* Declarations of my functions */
489 /* ****************************************************************** */
490 
491 /* BSsparse functions */
492 extern BSpar_mat *BSmain_perm(BSprocinfo *,BSspmat *);
493 extern BSoff_map	*BSmake_off_map(int,BSprocinfo *,int);
494 extern void BSglob2loc(int,int *,int *,BSprocinfo *,BSmapping *);
495 extern void BSglob2proc(int,int *,int *,BSprocinfo *,BSmapping *);
496 extern void BSloc2glob(int,int *,int *,BSprocinfo *,BSmapping *);
497 extern void BSfree_spmat(BSspmat *);
498 extern void BSfree_easymat(BSspmat *);
499 extern void BSfree_off_map(BSoff_map *);
500 extern void BSfreel2g(void *data);
501 extern void BSfreeg2l(void *data);
502 extern void BSfree_par_mat(BSpar_mat *);
503 extern void BSfree_copy_par_mat(BSpar_mat *);
504 extern void BSmain_reperm(BSprocinfo *,BSspmat *,BSpar_mat *);
505 extern void BSget_diag(BSpar_mat *,FLOAT *,BSprocinfo *);
506 extern void BSscale_diag(BSpar_mat *,FLOAT *,BSprocinfo *);
507 extern BSpar_mat *BScopy_par_mat(BSpar_mat *);
508 extern void BScopy_nz(BSpar_mat *,BSpar_mat *);
509 extern void BSset_diag(BSpar_mat *,FLOAT,BSprocinfo *);
510 extern void BSset_diagv(BSpar_mat *,FLOAT *,BSprocinfo *);
511 extern void BSsetup_block(BSpar_mat *,BScomm *,int,BSprocinfo *);
512 extern BScomm *BSsetup_forward(BSpar_mat *,BSprocinfo *);
513 extern void BSforward(BSpar_mat *,FLOAT *,FLOAT *,BScomm *,BSprocinfo *);
514 extern void BSforward1(BSpar_mat *,FLOAT *,FLOAT *,BScomm *,BSprocinfo *);
515 extern void BSbackward(BSpar_mat *,FLOAT *,FLOAT *,BScomm *, BSprocinfo *);
516 extern void BSbackward1(BSpar_mat *,FLOAT *,FLOAT *,BScomm *, BSprocinfo *);
517 extern void BSb_forward(BSpar_mat *,FLOAT *,FLOAT *,BScomm *,int,BSprocinfo *);
518 extern void BSb_backward(BSpar_mat *,FLOAT *,FLOAT *,BScomm *,int,BSprocinfo *);
519 extern void BSfree_comm(BScomm *);
520 extern void BSfree_comm_data(int *);
521 extern int	BSpar_solve(BSpar_mat *,BSpar_mat *,BScomm *,FLOAT *,FLOAT *,
522 	FLOAT *,BSprocinfo *);
523 extern int	BSpar_sym_solve(int,BSpar_mat *,BSpar_mat *,BScomm *,FLOAT *,FLOAT *,
524 	int,FLOAT,int,FLOAT *,int,BSprocinfo *);
525 extern int BSpar_gmres(int,BSpar_mat *,BSpar_mat *,BScomm *,FLOAT *,
526 	FLOAT *,int,int,FLOAT,int,FLOAT *,int,BSprocinfo *);
527 extern int	BSpar_isolve(BSpar_mat *,BSpar_mat *,BScomm *,BSpar_mat *,BScomm *,
528 	FLOAT *,FLOAT *,FLOAT,FLOAT *,BSprocinfo *);
529 extern void BSinv_diag_block(BSpar_mat *,BSprocinfo *);
530 extern int  BSinit(int *,char ***);
531 extern int  BSfinalize();
532 extern int  BSprint_log(BSprocinfo *);
533 extern void BSfor_solve1(BSpar_mat *,FLOAT *,BScomm *,BSprocinfo *);
534 extern void BSfor_solve(BSpar_mat *,FLOAT *,BScomm *,BSprocinfo *);
535 extern void BSb_for_solve(BSpar_mat *,FLOAT *,BScomm *,int,BSprocinfo *);
536 extern void BSback_solve1(BSpar_mat *,FLOAT *,BScomm *,BSprocinfo *);
537 extern void BSback_solve(BSpar_mat *,FLOAT *,BScomm *,BSprocinfo *);
538 extern void BSb_back_solve(BSpar_mat *,FLOAT *,BScomm *,int,BSprocinfo *);
539 extern int	BSfactor(BSpar_mat *,BScomm *,BSprocinfo *);
540 extern BScomm *BSsetup_factor(BSpar_mat *,BSprocinfo *);
541 extern void BStri_solve(BSpar_mat *,BSpar_mat *,BScomm *,FLOAT *,int,int,BSprocinfo *);
542 extern void BStri_mult(BSpar_mat *,BScomm *,BSpar_mat *,BScomm *,FLOAT *,FLOAT *,
543 	FLOAT *,FLOAT *,FLOAT,int,BSprocinfo *);
544 extern void BSsave_diag(BSpar_mat *,BSprocinfo *);
545 extern void BSbjacobi(BSpar_mat *,FLOAT *,BScomm *,BSprocinfo *);
546 extern void BSmat_subtract(BSspmat *,BSspmat *,FLOAT);
547 extern BSprocinfo *BScreate_ctx();
548 extern void BSctx_set_id(BSprocinfo *,int);
549 extern void BSctx_set_np(BSprocinfo *,int);
550 extern void BSctx_set_ps(BSprocinfo *,MPI_Comm);
551 extern void BSctx_set_cs(BSprocinfo *,int);
552 extern void BSctx_set_is(BSprocinfo *,int);
553 extern void BSctx_set_ct(BSprocinfo *,int);
554 extern void BSctx_set_err(BSprocinfo *,int);
555 extern void BSctx_set_rt(BSprocinfo *,int);
556 extern void BSctx_set_pr(BSprocinfo *,int);
557 extern void BSctx_set_print_log(BSprocinfo *,int);
558 extern void BSctx_set_si(BSprocinfo *,int);
559 extern void BSctx_set_sym(BSprocinfo *,int);
560 extern void BSctx_set_max_it(BSprocinfo *,int);
561 extern void BSctx_set_scaling(BSprocinfo *,int);
562 extern void BSctx_set_restart(BSprocinfo *,int);
563 extern void BSctx_set_guess(BSprocinfo *,int);
564 extern void BSctx_set_tol(BSprocinfo *,FLOAT);
565 extern void BSctx_set_num_rhs(BSprocinfo *,int);
566 extern void BSctx_set_bs_comm(BSprocinfo *,int);
567 extern void BSctx_set_pre(BSprocinfo *, int);
568 extern void BSctx_set_method(BSprocinfo *, int);
569 extern void BSctx_print(BSprocinfo *);
570 extern void BSfree_ctx(BSprocinfo *);
571 extern void BSset_mat_symmetric(BSspmat *,int);
572 extern void BSset_mat_icc_storage(BSspmat *,int);
573 extern double BSlocal_flops();
574 extern double BSglobal_flops(BSprocinfo *);
575 extern int BSlocal_nnz(BSpar_mat *);
576 extern int BSglobal_nnz(BSpar_mat *,BSprocinfo *);
577 extern int BSlocal_num_inodes(BSpar_mat *);
578 extern int BSglobal_num_inodes(BSpar_mat *);
579 extern int BSlocal_num_cliques(BSpar_mat *);
580 extern int BSglobal_num_cliques(BSpar_mat *);
581 extern int BSnum_colors(BSpar_mat *);
582 extern int	BSoffset(int,int *,int **,BSprocinfo *);
583 extern BSspmat	*BSeasy_A(int,int,int *,int *,FLOAT *,BSprocinfo *);
584 
585 /* ****************************************************************** */
586 /* End of section */
587 /* ****************************************************************** */
588 #endif
589