Amesos Package Browser (Single Doxygen Collection)  Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
amesos_klu_decl.h
Go to the documentation of this file.
1 /* ========================================================================== */
2 /* === klu include file ===================================================== */
3 /* ========================================================================== */
4 
5 /* Include file for user programs that call klu_* routines */
6 
7 #ifndef AMESOS_KLU_DECL_H
8 #define AMESOS_KLU_DECL_H
9 
10 /* make it easy for C++ programs to include KLU */
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14 
15 #include "amesos_amd.h"
16 #include "amesos_colamd.h"
17 #include "amesos_btf_decl.h"
18 
19 /* -------------------------------------------------------------------------- */
20 /* Symbolic object - contains the pre-ordering computed by klu_analyze */
21 /* -------------------------------------------------------------------------- */
22 
23 typedef struct
24 {
25  /* A (P,Q) is in upper block triangular form. The kth block goes from
26  * row/col index R [k] to R [k+1]-1. The estimated number of nonzeros
27  * in the L factor of the kth block is Lnz [k].
28  */
29 
30  /* only computed if the AMD ordering is chosen: */
31  double symmetry ; /* symmetry of largest block */
32  double est_flops ; /* est. factorization flop count */
33  double lnz, unz ; /* estimated nz in L and U, including diagonals */
34  double *Lnz ; /* size n, but only Lnz [0..nblocks-1] is used */
35 
36  /* computed for all orderings: */
37  int
38  n, /* input matrix A is n-by-n */
39  nz, /* # entries in input matrix */
40  *P, /* size n */
41  *Q, /* size n */
42  *R, /* size n+1, but only R [0..nblocks] is used */
43  nzoff, /* nz in off-diagonal blocks */
44  nblocks, /* number of blocks */
45  maxblock, /* size of largest block */
46  ordering, /* ordering used (AMD, COLAMD, or GIVEN) */
47  do_btf ; /* whether or not BTF preordering was requested */
48 
49  /* only computed if BTF preordering requested */
50  int structural_rank ; /* 0 to n-1 if the matrix is structurally rank
51  * deficient. -1 if not computed. n if the matrix has
52  * full structural rank */
53 
54 } klu_symbolic ;
55 
56 typedef struct /* 64-bit version (otherwise same as above) */
57 {
58  double symmetry, est_flops, lnz, unz ;
59  double *Lnz ;
60  UF_long n, nz, *P, *Q, *R, nzoff, nblocks, maxblock, ordering, do_btf,
62 
64 
65 /* -------------------------------------------------------------------------- */
66 /* Numeric object - contains the factors computed by klu_factor */
67 /* -------------------------------------------------------------------------- */
68 
69 typedef struct
70 {
71  /* LU factors of each block, the pivot row permutation, and the
72  * entries in the off-diagonal blocks */
73 
74  int n ; /* A is n-by-n */
75  int nblocks ; /* number of diagonal blocks */
76  int lnz ; /* actual nz in L, including diagonal */
77  int unz ; /* actual nz in U, including diagonal */
78  int max_lnz_block ; /* max actual nz in L in any one block, incl. diag */
79  int max_unz_block ; /* max actual nz in U in any one block, incl. diag */
80  int *Pnum ; /* size n. final pivot permutation */
81  int *Pinv ; /* size n. inverse of final pivot permutation */
82 
83  /* LU factors of each block */
84  int *Lip ; /* size n. pointers into LUbx[block] for L */
85  int *Uip ; /* size n. pointers into LUbx[block] for U */
86  int *Llen ; /* size n. Llen [k] = # of entries in kth column of L */
87  int *Ulen ; /* size n. Ulen [k] = # of entries in kth column of U */
88  void **LUbx ; /* L and U indices and entries (excl. diagonal of U) */
89  size_t *LUsize ; /* size of each LUbx [block], in sizeof (Unit) */
90  void *Udiag ; /* diagonal of U */
91 
92  /* scale factors; can be NULL if no scaling */
93  double *Rs ; /* size n. Rs [i] is scale factor for row i */
94 
95  /* permanent workspace for factorization and solve */
96  size_t worksize ; /* size (in bytes) of Work */
97  void *Work ; /* workspace */
98  void *Xwork ; /* alias into Numeric->Work */
99  int *Iwork ; /* alias into Numeric->Work */
100 
101  /* off-diagonal entries in a conventional compressed-column sparse matrix */
102  int *Offp ; /* size n+1, column pointers */
103  int *Offi ; /* size nzoff, row indices */
104  void *Offx ; /* size nzoff, numerical values */
105  int nzoff ;
106 
107 } klu_numeric ;
108 
109 typedef struct /* 64-bit version (otherwise same as above) */
110 {
111  UF_long n, nblocks, lnz, unz, max_lnz_block, max_unz_block, *Pnum, *Pinv,
112  *Lip, *Uip, *Llen, *Ulen ;
113  void **LUbx ;
114  size_t *LUsize ;
115  void *Udiag ;
116  double *Rs ;
117  size_t worksize ;
118  void *Work, *Xwork ;
120  UF_long *Offp, *Offi ;
121  void *Offx ;
123 
124 } klu_l_numeric ;
125 
126 /* -------------------------------------------------------------------------- */
127 /* KLU control parameters and statistics */
128 /* -------------------------------------------------------------------------- */
129 
130 /* Common->status values */
131 #define KLU_OK 0
132 #define KLU_SINGULAR (1) /* status > 0 is a warning, not an error */
133 #define KLU_OUT_OF_MEMORY (-2)
134 #define KLU_INVALID (-3)
135 #define KLU_TOO_LARGE (-4) /* integer overflow has occured */
136 
137 typedef struct klu_common_struct
138 {
139 
140  /* ---------------------------------------------------------------------- */
141  /* parameters */
142  /* ---------------------------------------------------------------------- */
143 
144  double tol ; /* pivot tolerance for diagonal preference */
145  double memgrow ; /* realloc memory growth size for LU factors */
146  double initmem_amd ; /* init. memory size with AMD: c*nnz(L) + n */
147  double initmem ; /* init. memory size: c*nnz(A) + n */
148  double maxwork ; /* maxwork for BTF, <= 0 if no limit */
149 
150  int btf ; /* use BTF pre-ordering, or not */
151  int ordering ; /* 0: AMD, 1: COLAMD, 2: user P and Q,
152  * 3: user function */
153  int scale ; /* row scaling: -1: none (and no error check),
154  * 0: none, 1: sum, 2: max */
155 
156  /* memory management routines */
157  void *(*malloc_memory) (size_t) ; /* pointer to malloc */
158  void *(*realloc_memory) (void *, size_t) ; /* pointer to realloc */
159  void (*free_memory) (void *) ; /* pointer to free */
160  void *(*calloc_memory) (size_t, size_t) ; /* pointer to calloc */
161 
162  /* pointer to user ordering function */
163  int (*user_order) (int, int *, int *, int *, struct klu_common_struct *) ;
164 
165  /* pointer to user data, passed unchanged as the last parameter to the
166  * user ordering function (optional, the user function need not use this
167  * information). */
168  void *user_data ;
169 
170  int halt_if_singular ; /* how to handle a singular matrix:
171  * FALSE: keep going. Return a Numeric object with a zero U(k,k). A
172  * divide-by-zero may occur when computing L(:,k). The Numeric object
173  * can be passed to klu_solve (a divide-by-zero will occur). It can
174  * also be safely passed to klu_refactor.
175  * TRUE: stop quickly. klu_factor will free the partially-constructed
176  * Numeric object. klu_refactor will not free it, but will leave the
177  * numerical values only partially defined. This is the default. */
178 
179  /* ---------------------------------------------------------------------- */
180  /* statistics */
181  /* ---------------------------------------------------------------------- */
182 
183  int status ; /* KLU_OK if OK, < 0 if error */
184  int nrealloc ; /* # of reallocations of L and U */
185 
186  int structural_rank ; /* 0 to n-1 if the matrix is structurally rank
187  * deficient (as determined by maxtrans). -1 if not computed. n if the
188  * matrix has full structural rank. This is computed by klu_analyze
189  * if a BTF preordering is requested. */
190 
191  int numerical_rank ; /* First k for which a zero U(k,k) was found,
192  * if the matrix was singular (in the range 0 to n-1). n if the matrix
193  * has full rank. This is not a true rank-estimation. It just reports
194  * where the first zero pivot was found. -1 if not computed.
195  * Computed by klu_factor and klu_refactor. */
196 
197  int singular_col ; /* n if the matrix is not singular. If in the
198  * range 0 to n-1, this is the column index of the original matrix A that
199  * corresponds to the column of U that contains a zero diagonal entry.
200  * -1 if not computed. Computed by klu_factor and klu_refactor. */
201 
202  int noffdiag ; /* # of off-diagonal pivots, -1 if not computed */
203 
204  double flops ; /* actual factorization flop count, from klu_flops */
205  double rcond ; /* crude reciprocal condition est., from klu_rcond */
206  double condest ; /* accurate condition est., from klu_condest */
207  double rgrowth ; /* reciprocal pivot rgrowth, from klu_rgrowth */
208  double work ; /* actual work done in BTF, in klu_analyze */
209 
210  size_t memusage ; /* current memory usage, in bytes */
211  size_t mempeak ; /* peak memory usage, in bytes */
212 
213 } klu_common ;
214 
215 typedef struct klu_l_common_struct /* 64-bit version (otherwise same as above)*/
216 {
217 
220  void *(*malloc_memory) (size_t) ;
221  void *(*realloc_memory) (void *, size_t) ;
222  void (*free_memory) (void *) ;
223  void *(*calloc_memory) (size_t, size_t) ;
225  struct klu_l_common_struct *) ;
226  void *user_data ;
229  noffdiag ;
231  size_t memusage, mempeak ;
232 
233 } klu_l_common ;
234 
235 /* -------------------------------------------------------------------------- */
236 /* klu_defaults: sets default control parameters */
237 /* -------------------------------------------------------------------------- */
238 
240 (
241  klu_common *Common
242 ) ;
243 
245 
246 /* -------------------------------------------------------------------------- */
247 /* klu_analyze: orders and analyzes a matrix */
248 /* -------------------------------------------------------------------------- */
249 
250 /* Order the matrix with BTF (or not), then order each block with AMD, COLAMD,
251  * a natural ordering, or with a user-provided ordering function */
252 
254 (
255  /* inputs, not modified */
256  int n, /* A is n-by-n */
257  int Ap [ ], /* size n+1, column pointers */
258  int Ai [ ], /* size nz, row indices */
259  klu_common *Common
260 ) ;
261 
263  klu_l_common *Common) ;
264 
265 
266 /* -------------------------------------------------------------------------- */
267 /* klu_analyze_given: analyzes a matrix using given P and Q */
268 /* -------------------------------------------------------------------------- */
269 
270 /* Order the matrix with BTF (or not), then use natural or given ordering
271  * P and Q on the blocks. P and Q are interpretted as identity
272  * if NULL. */
273 
275 (
276  /* inputs, not modified */
277  int n, /* A is n-by-n */
278  int Ap [ ], /* size n+1, column pointers */
279  int Ai [ ], /* size nz, row indices */
280  int P [ ], /* size n, user's row permutation (may be NULL) */
281  int Q [ ], /* size n, user's column permutation (may be NULL) */
282  klu_common *Common
283 ) ;
284 
286  UF_long *, klu_l_common *) ;
287 
288 
289 /* -------------------------------------------------------------------------- */
290 /* klu_factor: factors a matrix using the klu_analyze results */
291 /* -------------------------------------------------------------------------- */
292 
293 klu_numeric *amesos_klu_factor /* returns KLU_OK if OK, < 0 if error */
294 (
295  /* inputs, not modified */
296  int Ap [ ], /* size n+1, column pointers */
297  int Ai [ ], /* size nz, row indices */
298  double Ax [ ], /* size nz, numerical values */
299  klu_symbolic *Symbolic,
300  klu_common *Common
301 ) ;
302 
303 klu_numeric *amesos_klu_z_factor /* returns KLU_OK if OK, < 0 if error */
304 (
305  /* inputs, not modified */
306  int Ap [ ], /* size n+1, column pointers */
307  int Ai [ ], /* size nz, row indices */
308  double Ax [ ], /* size 2*nz, numerical values (real,imag pairs) */
309  klu_symbolic *Symbolic,
310  klu_common *Common
311 ) ;
312 
313 /* long / real version */
315  klu_l_common *) ;
316 
317 /* long / complex version */
319  klu_l_common *) ;
320 
321 
322 /* -------------------------------------------------------------------------- */
323 /* klu_solve: solves Ax=b using the Symbolic and Numeric objects */
324 /* -------------------------------------------------------------------------- */
325 
327 (
328  /* inputs, not modified */
329  klu_symbolic *Symbolic,
330  klu_numeric *Numeric,
331  int ldim, /* leading dimension of B */
332  int nrhs, /* number of right-hand-sides */
333 
334  /* right-hand-side on input, overwritten with solution to Ax=b on output */
335  double B [ ], /* size ldim*nrhs */
336  klu_common *Common
337 ) ;
338 
340 (
341  /* inputs, not modified */
342  klu_symbolic *Symbolic,
343  klu_numeric *Numeric,
344  int ldim, /* leading dimension of B */
345  int nrhs, /* number of right-hand-sides */
346 
347  /* right-hand-side on input, overwritten with solution to Ax=b on output */
348  double B [ ], /* size 2*ldim*nrhs */
349  klu_common *Common
350 ) ;
351 
353  double *, klu_l_common *) ;
354 
356  double *, klu_l_common *) ;
357 
358 
359 /* -------------------------------------------------------------------------- */
360 /* klu_tsolve: solves A'x=b using the Symbolic and Numeric objects */
361 /* -------------------------------------------------------------------------- */
362 
364 (
365  /* inputs, not modified */
366  klu_symbolic *Symbolic,
367  klu_numeric *Numeric,
368  int ldim, /* leading dimension of B */
369  int nrhs, /* number of right-hand-sides */
370 
371  /* right-hand-side on input, overwritten with solution to Ax=b on output */
372  double B [ ], /* size ldim*nrhs */
373  klu_common *Common
374 ) ;
375 
377 (
378  /* inputs, not modified */
379  klu_symbolic *Symbolic,
380  klu_numeric *Numeric,
381  int ldim, /* leading dimension of B */
382  int nrhs, /* number of right-hand-sides */
383 
384  /* right-hand-side on input, overwritten with solution to Ax=b on output */
385  double B [ ], /* size 2*ldim*nrhs */
386  int conj_solve, /* TRUE: conjugate solve, FALSE: solve A.'x=b */
387  klu_common *Common
388 
389 ) ;
390 
392  double *, klu_l_common *) ;
393 
395  double *, UF_long, klu_l_common * ) ;
396 
397 
398 /* -------------------------------------------------------------------------- */
399 /* klu_refactor: refactorizes matrix with same ordering as klu_factor */
400 /* -------------------------------------------------------------------------- */
401 
402 int amesos_klu_refactor /* return TRUE if successful, FALSE otherwise */
403 (
404  /* inputs, not modified */
405  int Ap [ ], /* size n+1, column pointers */
406  int Ai [ ], /* size nz, row indices */
407  double Ax [ ], /* size nz, numerical values */
408  klu_symbolic *Symbolic,
409  /* input, and numerical values modified on output */
410  klu_numeric *Numeric,
411  klu_common *Common
412 ) ;
413 
414 int amesos_klu_z_refactor /* return TRUE if successful, FALSE otherwise */
415 (
416  /* inputs, not modified */
417  int Ap [ ], /* size n+1, column pointers */
418  int Ai [ ], /* size nz, row indices */
419  double Ax [ ], /* size 2*nz, numerical values */
420  klu_symbolic *Symbolic,
421  /* input, and numerical values modified on output */
422  klu_numeric *Numeric,
423  klu_common *Common
424 ) ;
425 
428 
431 
432 
433 /* -------------------------------------------------------------------------- */
434 /* klu_free_symbolic: destroys the Symbolic object */
435 /* -------------------------------------------------------------------------- */
436 
438 (
439  klu_symbolic **Symbolic,
440  klu_common *Common
441 ) ;
442 
444 
445 
446 /* -------------------------------------------------------------------------- */
447 /* klu_free_numeric: destroys the Numeric object */
448 /* -------------------------------------------------------------------------- */
449 
450 /* Note that klu_free_numeric and klu_z_free_numeric are identical; each can
451  * free both kinds of Numeric objects (real and complex) */
452 
454 (
455  klu_numeric **Numeric,
456  klu_common *Common
457 ) ;
458 
460 (
461  klu_numeric **Numeric,
462  klu_common *Common
463 ) ;
464 
467 
468 
469 /* -------------------------------------------------------------------------- */
470 /* klu_sort: sorts the columns of the LU factorization */
471 /* -------------------------------------------------------------------------- */
472 
473 /* this is not needed except for the MATLAB interface */
474 
475 int amesos_klu_sort
476 (
477  /* inputs, not modified */
478  klu_symbolic *Symbolic,
479  /* input/output */
480  klu_numeric *Numeric,
481  klu_common *Common
482 ) ;
483 
485 (
486  /* inputs, not modified */
487  klu_symbolic *Symbolic,
488  /* input/output */
489  klu_numeric *Numeric,
490  klu_common *Common
491 ) ;
492 
495 
496 
497 /* -------------------------------------------------------------------------- */
498 /* klu_flops: determines # of flops performed in numeric factorzation */
499 /* -------------------------------------------------------------------------- */
500 
502 (
503  /* inputs, not modified */
504  klu_symbolic *Symbolic,
505  klu_numeric *Numeric,
506  /* input/output */
507  klu_common *Common
508 ) ;
509 
511 (
512  /* inputs, not modified */
513  klu_symbolic *Symbolic,
514  klu_numeric *Numeric,
515  /* input/output */
516  klu_common *Common
517 ) ;
518 
521 
522 
523 
524 /* -------------------------------------------------------------------------- */
525 /* klu_rgrowth : compute the reciprocal pivot growth */
526 /* -------------------------------------------------------------------------- */
527 
528 /* Pivot growth is computed after the input matrix is permuted, scaled, and
529  * off-diagonal entries pruned. This is because the LU factorization of each
530  * block takes as input the scaled diagonal blocks of the BTF form. The
531  * reciprocal pivot growth in column j of an LU factorization of a matrix C
532  * is the largest entry in C divided by the largest entry in U; then the overall
533  * reciprocal pivot growth is the smallest such value for all columns j. Note
534  * that the off-diagonal entries are not scaled, since they do not take part in
535  * the LU factorization of the diagonal blocks.
536  *
537  * In MATLAB notation:
538  *
539  * rgrowth = min (max (abs ((R \ A(p,q)) - F)) ./ max (abs (U))) */
540 
542 (
543  int Ap [ ],
544  int Ai [ ],
545  double Ax [ ],
546  klu_symbolic *Symbolic,
547  klu_numeric *Numeric,
548  klu_common *Common /* Common->rgrowth = reciprocal pivot growth */
549 ) ;
550 
552 (
553  int Ap [ ],
554  int Ai [ ],
555  double Ax [ ],
556  klu_symbolic *Symbolic,
557  klu_numeric *Numeric,
558  klu_common *Common /* Common->rgrowth = reciprocal pivot growth */
559 ) ;
560 
563 
566 
567 
568 /* -------------------------------------------------------------------------- */
569 /* klu_condest */
570 /* -------------------------------------------------------------------------- */
571 
572 /* Computes a reasonably accurate estimate of the 1-norm condition number, using
573  * Hager's method, as modified by Higham and Tisseur (same method as used in
574  * MATLAB's condest */
575 
577 (
578  int Ap [ ], /* size n+1, column pointers, not modified */
579  double Ax [ ], /* size nz = Ap[n], numerical values, not modified*/
580  klu_symbolic *Symbolic, /* symbolic analysis, not modified */
581  klu_numeric *Numeric, /* numeric factorization, not modified */
582  klu_common *Common /* result returned in Common->condest */
583 ) ;
584 
586 (
587  int Ap [ ],
588  double Ax [ ], /* size 2*nz */
589  klu_symbolic *Symbolic,
590  klu_numeric *Numeric,
591  klu_common *Common /* result returned in Common->condest */
592 ) ;
593 
595  klu_l_common *) ;
596 
598  klu_l_common *) ;
599 
600 
601 /* -------------------------------------------------------------------------- */
602 /* klu_rcond: compute min(abs(diag(U))) / max(abs(diag(U))) */
603 /* -------------------------------------------------------------------------- */
604 
606 (
607  klu_symbolic *Symbolic, /* input, not modified */
608  klu_numeric *Numeric, /* input, not modified */
609  klu_common *Common /* result in Common->rcond */
610 ) ;
611 
613 (
614  klu_symbolic *Symbolic, /* input, not modified */
615  klu_numeric *Numeric, /* input, not modified */
616  klu_common *Common /* result in Common->rcond */
617 ) ;
618 
620 
622 
623 
624 
625 /* -------------------------------------------------------------------------- */
626 /* klu_scale */
627 /* -------------------------------------------------------------------------- */
628 
629 int amesos_klu_scale /* return TRUE if successful, FALSE otherwise */
630 (
631  /* inputs, not modified */
632  int scale, /* <0: none, no error check; 0: none, 1: sum, 2: max */
633  int n,
634  int Ap [ ], /* size n+1, column pointers */
635  int Ai [ ], /* size nz, row indices */
636  double Ax [ ],
637  /* outputs, not defined on input */
638  double Rs [ ],
639  /* workspace, not defined on input or output */
640  int W [ ], /* size n, can be NULL */
641  klu_common *Common
642 ) ;
643 
644 int amesos_klu_z_scale /* return TRUE if successful, FALSE otherwise */
645 (
646  /* inputs, not modified */
647  int scale, /* <0: none, no error check; 0: none, 1: sum, 2: max */
648  int n,
649  int Ap [ ], /* size n+1, column pointers */
650  int Ai [ ], /* size nz, row indices */
651  double Ax [ ],
652  /* outputs, not defined on input */
653  double Rs [ ],
654  /* workspace, not defined on input or output */
655  int W [ ], /* size n, can be NULL */
656  klu_common *Common
657 ) ;
658 
660  double *, UF_long *, klu_l_common *) ;
661 
663  double *, UF_long *, klu_l_common *) ;
664 
665 
666 /* -------------------------------------------------------------------------- */
667 /* klu_extract */
668 /* -------------------------------------------------------------------------- */
669 
670 int amesos_klu_extract /* returns TRUE if successful, FALSE otherwise */
671 (
672  /* inputs: */
673  klu_numeric *Numeric,
674  klu_symbolic *Symbolic,
675 
676  /* outputs, either allocated on input, or ignored otherwise */
677 
678  /* L */
679  int *Lp, /* size n+1 */
680  int *Li, /* size Numeric->lnz */
681  double *Lx, /* size Numeric->lnz */
682 
683  /* U */
684  int *Up, /* size n+1 */
685  int *Ui, /* size Numeric->unz */
686  double *Ux, /* size Numeric->unz */
687 
688  /* F */
689  int *Fp, /* size n+1 */
690  int *Fi, /* size Numeric->nzoff */
691  double *Fx, /* size Numeric->nzoff */
692 
693  /* P, row permutation */
694  int *P, /* size n */
695 
696  /* Q, column permutation */
697  int *Q, /* size n */
698 
699  /* Rs, scale factors */
700  double *Rs, /* size n */
701 
702  /* R, block boundaries */
703  int *R, /* size Symbolic->nblocks+1 (nblocks is at most n) */
704 
705  klu_common *Common
706 ) ;
707 
708 
709 int amesos_klu_z_extract /* returns TRUE if successful, FALSE otherwise */
710 (
711  /* inputs: */
712  klu_numeric *Numeric,
713  klu_symbolic *Symbolic,
714 
715  /* outputs, all of which must be allocated on input */
716 
717  /* L */
718  int *Lp, /* size n+1 */
719  int *Li, /* size nnz(L) */
720  double *Lx, /* size nnz(L) */
721  double *Lz, /* size nnz(L) for the complex case, ignored if real */
722 
723  /* U */
724  int *Up, /* size n+1 */
725  int *Ui, /* size nnz(U) */
726  double *Ux, /* size nnz(U) */
727  double *Uz, /* size nnz(U) for the complex case, ignored if real */
728 
729  /* F */
730  int *Fp, /* size n+1 */
731  int *Fi, /* size nnz(F) */
732  double *Fx, /* size nnz(F) */
733  double *Fz, /* size nnz(F) for the complex case, ignored if real */
734 
735  /* P, row permutation */
736  int *P, /* size n */
737 
738  /* Q, column permutation */
739  int *Q, /* size n */
740 
741  /* Rs, scale factors */
742  double *Rs, /* size n */
743 
744  /* R, block boundaries */
745  int *R, /* size Symbolic->nblocks+1 (nblocks is at most n) */
746 
747  klu_common *Common
748 ) ;
749 
751  UF_long *, UF_long *, double *,
752  UF_long *, UF_long *, double *,
753  UF_long *, UF_long *, double *,
754  UF_long *, UF_long *, double *, UF_long *, klu_l_common *) ;
755 
757  UF_long *, UF_long *, double *, double *,
758  UF_long *, UF_long *, double *, double *,
759  UF_long *, UF_long *, double *, double *,
760  UF_long *, UF_long *, double *, UF_long *, klu_l_common *) ;
761 
762 
763 /* -------------------------------------------------------------------------- */
764 /* KLU memory management routines */
765 /* -------------------------------------------------------------------------- */
766 
767 void *amesos_klu_malloc /* returns pointer to the newly malloc'd block */
768 (
769  /* ---- input ---- */
770  size_t n, /* number of items */
771  size_t size, /* size of each item */
772  /* --------------- */
773  klu_common *Common
774 ) ;
775 
776 void *amesos_klu_free /* always returns NULL */
777 (
778  /* ---- in/out --- */
779  void *p, /* block of memory to free */
780  size_t n, /* number of items */
781  size_t size, /* size of each item */
782  /* --------------- */
783  klu_common *Common
784 ) ;
785 
786 void *amesos_klu_realloc /* returns pointer to reallocated block */
787 (
788  /* ---- input ---- */
789  size_t nnew, /* requested # of items in reallocated block */
790  size_t nold, /* current size of block, in # of items */
791  size_t size, /* size of each item */
792  /* ---- in/out --- */
793  void *p, /* block of memory to realloc */
794  /* --------------- */
795  klu_common *Common
796 ) ;
797 
798 void *amesos_klu_l_malloc (size_t, size_t, klu_l_common *) ;
799 void *amesos_klu_l_free (void *, size_t, size_t, klu_l_common *) ;
800 void *amesos_klu_l_realloc (size_t, size_t, size_t, void *, klu_l_common *) ;
801 
802 
803 /* ========================================================================== */
804 /* === KLU version ========================================================== */
805 /* ========================================================================== */
806 
807 /* All versions of KLU include these definitions.
808  * As an example, to test if the version you are using is 1.2 or later:
809  *
810  * if (KLU_VERSION >= KLU_VERSION_CODE (1,2)) ...
811  *
812  * This also works during compile-time:
813  *
814  * #if (KLU >= KLU_VERSION_CODE (1,2))
815  * printf ("This is version 1.2 or later\n") ;
816  * #else
817  * printf ("This is an early version\n") ;
818  * #endif
819  */
820 
821 #define KLU_DATE "May 31, 2007"
822 #define KLU_VERSION_CODE(main,sub) ((main) * 1000 + (sub))
823 #define KLU_MAIN_VERSION 1
824 #define KLU_SUB_VERSION 0
825 #define KLU_SUBSUB_VERSION 0
826 #define KLU_VERSION KLU_VERSION_CODE(KLU_MAIN_VERSION,KLU_SUB_VERSION)
827 
828 #ifdef __cplusplus
829 }
830 #endif
831 #endif
int amesos_klu_z_condest(int Ap[], double Ax[], klu_symbolic *Symbolic, klu_numeric *Numeric, klu_common *Common)
UF_long amesos_klu_l_rcond(klu_l_symbolic *, klu_l_numeric *, klu_l_common *)
int amesos_klu_extract(klu_numeric *Numeric, klu_symbolic *Symbolic, int *Lp, int *Li, double *Lx, int *Up, int *Ui, double *Ux, int *Fp, int *Fi, double *Fx, int *P, int *Q, double *Rs, int *R, klu_common *Common)
int amesos_klu_z_scale(int scale, int n, int Ap[], int Ai[], double Ax[], double Rs[], int W[], klu_common *Common)
klu_numeric * amesos_klu_factor(int Ap[], int Ai[], double Ax[], klu_symbolic *Symbolic, klu_common *Common)
klu_numeric * amesos_klu_z_factor(int Ap[], int Ai[], double Ax[], klu_symbolic *Symbolic, klu_common *Common)
UF_long amesos_klu_l_extract(klu_l_numeric *, klu_l_symbolic *, UF_long *, UF_long *, double *, UF_long *, UF_long *, double *, UF_long *, UF_long *, double *, UF_long *, UF_long *, double *, UF_long *, klu_l_common *)
klu_symbolic * amesos_klu_analyze_given(int n, int Ap[], int Ai[], int P[], int Q[], klu_common *Common)
int amesos_klu_z_tsolve(klu_symbolic *Symbolic, klu_numeric *Numeric, int ldim, int nrhs, double B[], int conj_solve, klu_common *Common)
UF_long amesos_klu_l_condest(UF_long *, double *, klu_l_symbolic *, klu_l_numeric *, klu_l_common *)
void * amesos_klu_malloc(size_t n, size_t size, klu_common *Common)
int amesos_klu_rgrowth(int Ap[], int Ai[], double Ax[], klu_symbolic *Symbolic, klu_numeric *Numeric, klu_common *Common)
UF_long amesos_klu_zl_condest(UF_long *, double *, klu_l_symbolic *, klu_l_numeric *, klu_l_common *)
struct klu_common_struct klu_common
UF_long amesos_klu_l_flops(klu_l_symbolic *, klu_l_numeric *, klu_l_common *)
UF_long amesos_klu_l_tsolve(klu_l_symbolic *, klu_l_numeric *, UF_long, UF_long, double *, klu_l_common *)
int amesos_klu_scale(int scale, int n, int Ap[], int Ai[], double Ax[], double Rs[], int W[], klu_common *Common)
int amesos_klu_sort(klu_symbolic *Symbolic, klu_numeric *Numeric, klu_common *Common)
int amesos_klu_free_numeric(klu_numeric **Numeric, klu_common *Common)
#define P(k)
int amesos_klu_tsolve(klu_symbolic *Symbolic, klu_numeric *Numeric, int ldim, int nrhs, double B[], klu_common *Common)
UF_long amesos_klu_zl_flops(klu_l_symbolic *, klu_l_numeric *, klu_l_common *)
UF_long structural_rank
klu_l_symbolic * amesos_klu_l_analyze(UF_long, UF_long *, UF_long *, klu_l_common *Common)
int amesos_klu_refactor(int Ap[], int Ai[], double Ax[], klu_symbolic *Symbolic, klu_numeric *Numeric, klu_common *Common)
int amesos_klu_z_free_numeric(klu_numeric **Numeric, klu_common *Common)
UF_long amesos_klu_l_free_symbolic(klu_l_symbolic **, klu_l_common *)
UF_long amesos_klu_l_sort(klu_l_symbolic *, klu_l_numeric *, klu_l_common *)
UF_long amesos_klu_zl_rcond(klu_l_symbolic *, klu_l_numeric *, klu_l_common *)
klu_l_numeric * amesos_klu_zl_factor(UF_long *, UF_long *, double *, klu_l_symbolic *, klu_l_common *)
UF_long amesos_klu_zl_scale(UF_long, UF_long, UF_long *, UF_long *, double *, double *, UF_long *, klu_l_common *)
UF_long amesos_klu_zl_tsolve(klu_l_symbolic *, klu_l_numeric *, UF_long, UF_long, double *, UF_long, klu_l_common *)
void * amesos_klu_free(void *p, size_t n, size_t size, klu_common *Common)
UF_long amesos_klu_l_free_numeric(klu_l_numeric **, klu_l_common *)
size_t * LUsize
void * amesos_klu_l_free(void *, size_t, size_t, klu_l_common *)
UF_long amesos_klu_l_solve(klu_l_symbolic *, klu_l_numeric *, UF_long, UF_long, double *, klu_l_common *)
UF_long amesos_klu_zl_sort(klu_l_symbolic *, klu_l_numeric *, klu_l_common *)
int amesos_klu_z_refactor(int Ap[], int Ai[], double Ax[], klu_symbolic *Symbolic, klu_numeric *Numeric, klu_common *Common)
UF_long amesos_klu_zl_rgrowth(UF_long *, UF_long *, double *, klu_l_symbolic *, klu_l_numeric *, klu_l_common *)
UF_long amesos_klu_zl_extract(klu_l_numeric *, klu_l_symbolic *, UF_long *, UF_long *, double *, double *, UF_long *, UF_long *, double *, double *, UF_long *, UF_long *, double *, double *, UF_long *, UF_long *, double *, UF_long *, klu_l_common *)
UF_long amesos_klu_l_rgrowth(UF_long *, UF_long *, double *, klu_l_symbolic *, klu_l_numeric *, klu_l_common *)
UF_long amesos_klu_l_refactor(UF_long *, UF_long *, double *, klu_l_symbolic *, klu_l_numeric *, klu_l_common *)
int amesos_klu_z_rcond(klu_symbolic *Symbolic, klu_numeric *Numeric, klu_common *Common)
int amesos_klu_z_extract(klu_numeric *Numeric, klu_symbolic *Symbolic, int *Lp, int *Li, double *Lx, double *Lz, int *Up, int *Ui, double *Ux, double *Uz, int *Fp, int *Fi, double *Fx, double *Fz, int *P, int *Q, double *Rs, int *R, klu_common *Common)
void(* free_memory)(void *)
int amesos_klu_rcond(klu_symbolic *Symbolic, klu_numeric *Numeric, klu_common *Common)
int amesos_klu_defaults(klu_common *Common)
int amesos_klu_free_symbolic(klu_symbolic **Symbolic, klu_common *Common)
klu_symbolic * amesos_klu_analyze(int n, int Ap[], int Ai[], klu_common *Common)
UF_long amesos_klu_zl_solve(klu_l_symbolic *, klu_l_numeric *, UF_long, UF_long, double *, klu_l_common *)
void * amesos_klu_realloc(size_t nnew, size_t nold, size_t size, void *p, klu_common *Common)
int amesos_klu_solve(klu_symbolic *Symbolic, klu_numeric *Numeric, int ldim, int nrhs, double B[], klu_common *Common)
void * amesos_klu_l_realloc(size_t, size_t, size_t, void *, klu_l_common *)
klu_l_numeric * amesos_klu_l_factor(UF_long *, UF_long *, double *, klu_l_symbolic *, klu_l_common *)
int amesos_klu_condest(int Ap[], double Ax[], klu_symbolic *Symbolic, klu_numeric *Numeric, klu_common *Common)
int amesos_klu_z_solve(klu_symbolic *Symbolic, klu_numeric *Numeric, int ldim, int nrhs, double B[], klu_common *Common)
int amesos_klu_z_rgrowth(int Ap[], int Ai[], double Ax[], klu_symbolic *Symbolic, klu_numeric *Numeric, klu_common *Common)
UF_long amesos_klu_l_scale(UF_long, UF_long, UF_long *, UF_long *, double *, double *, UF_long *, klu_l_common *)
int amesos_klu_flops(klu_symbolic *Symbolic, klu_numeric *Numeric, klu_common *Common)
UF_long amesos_klu_l_defaults(klu_l_common *Common)
int amesos_klu_z_flops(klu_symbolic *Symbolic, klu_numeric *Numeric, klu_common *Common)
UF_long(* user_order)(UF_long, UF_long *, UF_long *, UF_long *, struct klu_l_common_struct *)
struct klu_l_common_struct klu_l_common
klu_l_symbolic * amesos_klu_l_analyze_given(UF_long, UF_long *, UF_long *, UF_long *, UF_long *, klu_l_common *)
void(* free_memory)(void *)
void * amesos_klu_l_malloc(size_t, size_t, klu_l_common *)
UF_long amesos_klu_zl_free_numeric(klu_l_numeric **, klu_l_common *)
#define UF_long
int(* user_order)(int, int *, int *, int *, struct klu_common_struct *)
int n
UF_long amesos_klu_zl_refactor(UF_long *, UF_long *, double *, klu_l_symbolic *, klu_l_numeric *, klu_l_common *)
int amesos_klu_z_sort(klu_symbolic *Symbolic, klu_numeric *Numeric, klu_common *Common)