Amesos Package Browser (Single Doxygen Collection)  Development
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
amesos_cholmod_core.h
Go to the documentation of this file.
1 /* ========================================================================== */
2 /* === Include/cholmod_core.h =============================================== */
3 /* ========================================================================== */
4 
5 /* -----------------------------------------------------------------------------
6  * CHOLMOD/Include/cholmod_core.h.
7  * Copyright (C) 2005-2006, Univ. of Florida. Author: Timothy A. Davis
8  * CHOLMOD/Include/cholmod_core.h is licensed under Version 2.1 of the GNU
9  * Lesser General Public License. See lesser.txt for a text of the license.
10  * CHOLMOD is also available under other licenses; contact authors for details.
11  * http://www.cise.ufl.edu/research/sparse
12  * -------------------------------------------------------------------------- */
13 
14 /* CHOLMOD Core module: basic CHOLMOD objects and routines.
15  * Required by all CHOLMOD modules. Requires no other module or package.
16  *
17  * The CHOLMOD modules are:
18  *
19  * Core basic data structures and definitions
20  * Check check/print the 5 CHOLMOD objects, & 3 types of integer vectors
21  * Cholesky sparse Cholesky factorization
22  * Modify sparse Cholesky update/downdate/row-add/row-delete
23  * MatrixOps sparse matrix functions (add, multiply, norm, ...)
24  * Supernodal supernodal sparse Cholesky factorization
25  * Partition graph-partitioning based orderings
26  *
27  * The CHOLMOD objects:
28  * --------------------
29  *
30  * cholmod_common parameters, statistics, and workspace
31  * cholmod_sparse a sparse matrix in compressed column form
32  * cholmod_factor an LL' or LDL' factorization
33  * cholmod_dense a dense matrix
34  * cholmod_triplet a sparse matrix in "triplet" form
35  *
36  * The Core module described here defines the CHOLMOD data structures, and
37  * basic operations on them. To create and solve a sparse linear system Ax=b,
38  * the user must create A and b, populate them with values, and then pass them
39  * to the routines in the CHOLMOD Cholesky module. There are two primary
40  * methods for creating A: (1) allocate space for a column-oriented sparse
41  * matrix and fill it with pattern and values, or (2) create a triplet form
42  * matrix and convert it to a sparse matrix. The latter option is simpler.
43  *
44  * The matrices b and x are typically dense matrices, but can also be sparse.
45  * You can allocate and free them as dense matrices with the
46  * cholmod_allocate_dense and cholmod_free_dense routines.
47  *
48  * The cholmod_factor object contains the symbolic and numeric LL' or LDL'
49  * factorization of sparse symmetric matrix. The matrix must be positive
50  * definite for an LL' factorization. It need only be symmetric and have well-
51  * conditioned leading submatrices for it to have an LDL' factorization
52  * (CHOLMOD does not pivot for numerical stability). It is typically created
53  * with the cholmod_factorize routine in the Cholesky module, but can also
54  * be initialized to L=D=I in the Core module and then modified by the Modify
55  * module. It must be freed with cholmod_free_factor, defined below.
56  *
57  * The Core routines for each object are described below. Each list is split
58  * into two parts: the primary routines and secondary routines.
59  *
60  * ============================================================================
61  * === cholmod_common =========================================================
62  * ============================================================================
63  *
64  * The Common object contains control parameters, statistics, and
65  * You must call cholmod_start before calling any other CHOLMOD routine, and
66  * must call cholmod_finish as your last call to CHOLMOD, with two exceptions:
67  * you may call cholmod_print_common and cholmod_check_common in the Check
68  * module after calling cholmod_finish.
69  *
70  * cholmod_start first call to CHOLMOD
71  * cholmod_finish last call to CHOLMOD
72  * -----------------------------
73  * cholmod_defaults restore default parameters
74  * cholmod_maxrank maximum rank for update/downdate
75  * cholmod_allocate_work allocate workspace in Common
76  * cholmod_free_work free workspace in Common
77  * cholmod_clear_flag clear Flag workspace in Common
78  * cholmod_error called when CHOLMOD encounters an error
79  * cholmod_dbound for internal use in CHOLMOD only
80  * cholmod_hypot compute sqrt (x*x + y*y) accurately
81  * cholmod_divcomplex complex division, c = a/b
82  *
83  * ============================================================================
84  * === cholmod_sparse =========================================================
85  * ============================================================================
86  *
87  * A sparse matrix is held in compressed column form. In the basic type
88  * ("packed", which corresponds to a MATLAB sparse matrix), an n-by-n matrix
89  * with nz entries is held in three arrays: p of size n+1, i of size nz, and x
90  * of size nz. Row indices of column j are held in i [p [j] ... p [j+1]-1] and
91  * in the same locations in x. There may be no duplicate entries in a column.
92  * Row indices in each column may be sorted or unsorted (CHOLMOD keeps track).
93  * A->stype determines the storage mode: 0 if both upper/lower parts are stored,
94  * -1 if A is symmetric and just tril(A) is stored, +1 if symmetric and triu(A)
95  * is stored.
96  *
97  * cholmod_allocate_sparse allocate a sparse matrix
98  * cholmod_free_sparse free a sparse matrix
99  * -----------------------------
100  * cholmod_reallocate_sparse change the size (# entries) of sparse matrix
101  * cholmod_nnz number of nonzeros in a sparse matrix
102  * cholmod_speye sparse identity matrix
103  * cholmod_spzeros sparse zero matrix
104  * cholmod_transpose transpose a sparse matrix
105  * cholmod_ptranspose transpose/permute a sparse matrix
106  * cholmod_transpose_unsym transpose/permute an unsymmetric sparse matrix
107  * cholmod_transpose_sym transpose/permute a symmetric sparse matrix
108  * cholmod_sort sort row indices in each column of sparse matrix
109  * cholmod_band C = tril (triu (A,k1), k2)
110  * cholmod_band_inplace A = tril (triu (A,k1), k2)
111  * cholmod_aat C = A*A'
112  * cholmod_copy_sparse C = A, create an exact copy of a sparse matrix
113  * cholmod_copy C = A, with possible change of stype
114  * cholmod_add C = alpha*A + beta*B
115  * cholmod_sparse_xtype change the xtype of a sparse matrix
116  *
117  * ============================================================================
118  * === cholmod_factor =========================================================
119  * ============================================================================
120  *
121  * The data structure for an LL' or LDL' factorization is too complex to
122  * describe in one sentence. This object can hold the symbolic analysis alone,
123  * or in combination with a "simplicial" (similar to a sparse matrix) or
124  * "supernodal" form of the numerical factorization. Only the routine to free
125  * a factor is primary, since a factor object is created by the factorization
126  * routine (cholmod_factorize). It must be freed with cholmod_free_factor.
127  *
128  * cholmod_free_factor free a factor
129  * -----------------------------
130  * cholmod_allocate_factor allocate a factor (LL' or LDL')
131  * cholmod_reallocate_factor change the # entries in a factor
132  * cholmod_change_factor change the type of factor (e.g., LDL' to LL')
133  * cholmod_pack_factor pack the columns of a factor
134  * cholmod_reallocate_column resize a single column of a factor
135  * cholmod_factor_to_sparse create a sparse matrix copy of a factor
136  * cholmod_copy_factor create a copy of a factor
137  * cholmod_factor_xtype change the xtype of a factor
138  *
139  * Note that there is no cholmod_sparse_to_factor routine to create a factor
140  * as a copy of a sparse matrix. It could be done, after a fashion, but a
141  * lower triangular sparse matrix would not necessarily have a chordal graph,
142  * which would break the many CHOLMOD routines that rely on this property.
143  *
144  * ============================================================================
145  * === cholmod_dense ==========================================================
146  * ============================================================================
147  *
148  * The solve routines and some of the MatrixOps and Modify routines use dense
149  * matrices as inputs. These are held in column-major order. With a leading
150  * dimension of d, the entry in row i and column j is held in x [i+j*d].
151  *
152  * cholmod_allocate_dense allocate a dense matrix
153  * cholmod_free_dense free a dense matrix
154  * -----------------------------
155  * cholmod_zeros allocate a dense matrix of all zeros
156  * cholmod_ones allocate a dense matrix of all ones
157  * cholmod_eye allocate a dense identity matrix
158  * cholmod_sparse_to_dense create a dense matrix copy of a sparse matrix
159  * cholmod_dense_to_sparse create a sparse matrix copy of a dense matrix
160  * cholmod_copy_dense create a copy of a dense matrix
161  * cholmod_copy_dense2 copy a dense matrix (pre-allocated)
162  * cholmod_dense_xtype change the xtype of a dense matrix
163  *
164  * ============================================================================
165  * === cholmod_triplet ========================================================
166  * ============================================================================
167  *
168  * A sparse matrix held in triplet form is the simplest one for a user to
169  * create. It consists of a list of nz entries in arbitrary order, held in
170  * three arrays: i, j, and x, each of length nk. The kth entry is in row i[k],
171  * column j[k], with value x[k]. There may be duplicate values; if A(i,j)
172  * appears more than once, its value is the sum of the entries with those row
173  * and column indices.
174  *
175  * cholmod_allocate_triplet allocate a triplet matrix
176  * cholmod_triplet_to_sparse create a sparse matrix copy of a triplet matrix
177  * cholmod_free_triplet free a triplet matrix
178  * -----------------------------
179  * cholmod_reallocate_triplet change the # of entries in a triplet matrix
180  * cholmod_sparse_to_triplet create a triplet matrix copy of a sparse matrix
181  * cholmod_copy_triplet create a copy of a triplet matrix
182  * cholmod_triplet_xtype change the xtype of a triplet matrix
183  *
184  * ============================================================================
185  * === memory management ======================================================
186  * ============================================================================
187  *
188  * cholmod_malloc malloc wrapper
189  * cholmod_calloc calloc wrapper
190  * cholmod_free free wrapper
191  * cholmod_realloc realloc wrapper
192  * cholmod_realloc_multiple realloc wrapper for multiple objects
193  *
194  * ============================================================================
195  * === Core CHOLMOD prototypes ================================================
196  * ============================================================================
197  *
198  * All CHOLMOD routines (in all modules) use the following protocol for return
199  * values, with one exception:
200  *
201  * int TRUE (1) if successful, or FALSE (0) otherwise.
202  * (exception: cholmod_divcomplex)
203  * UF_long a value >= 0 if successful, or -1 otherwise.
204  * double a value >= 0 if successful, or -1 otherwise.
205  * size_t a value > 0 if successful, or 0 otherwise.
206  * void * a non-NULL pointer to newly allocated memory if
207  * successful, or NULL otherwise.
208  * cholmod_sparse * a non-NULL pointer to a newly allocated matrix
209  * if successful, or NULL otherwise.
210  * cholmod_factor * a non-NULL pointer to a newly allocated factor
211  * if successful, or NULL otherwise.
212  * cholmod_triplet * a non-NULL pointer to a newly allocated triplet
213  * matrix if successful, or NULL otherwise.
214  * cholmod_dense * a non-NULL pointer to a newly allocated triplet
215  * matrix if successful, or NULL otherwise.
216  *
217  * The last parameter to all routines is always a pointer to the CHOLMOD
218  * Common object.
219  *
220  * TRUE and FALSE are not defined here, since they may conflict with the user
221  * program. A routine that described here returning TRUE or FALSE returns 1
222  * or 0, respectively. Any TRUE/FALSE parameter is true if nonzero, false if
223  * zero.
224  */
225 
226 #ifndef AMESOS_CHOLMOD_CORE_H
227 #define AMESOS_CHOLMOD_CORE_H
228 
229 /* ========================================================================== */
230 /* === CHOLMOD version ====================================================== */
231 /* ========================================================================== */
232 
233 /* All versions of CHOLMOD will include the following definitions.
234  * As an example, to test if the version you are using is 1.3 or later:
235  *
236  * if (CHOLMOD_VERSION >= CHOLMOD_VER_CODE (1,3)) ...
237  *
238  * This also works during compile-time:
239  *
240  * #if CHOLMOD_VERSION >= CHOLMOD_VER_CODE (1,3)
241  * printf ("This is version 1.3 or later\n") ;
242  * #else
243  * printf ("This is version is earlier than 1.3\n") ;
244  * #endif
245  */
246 
247 #define CHOLMOD_DATE "May 31, 2007"
248 #define CHOLMOD_VER_CODE(main,sub) ((main) * 1000 + (sub))
249 #define CHOLMOD_MAIN_VERSION 1
250 #define CHOLMOD_SUB_VERSION 5
251 #define CHOLMOD_SUBSUB_VERSION 0
252 #define CHOLMOD_VERSION \
253  CHOLMOD_VER_CODE(CHOLMOD_MAIN_VERSION,CHOLMOD_SUB_VERSION)
254 
255 
256 /* ========================================================================== */
257 /* === non-CHOLMOD include files ============================================ */
258 /* ========================================================================== */
259 
260 /* This is the only non-CHOLMOD include file imposed on the user program.
261  * It required for size_t definition used here. CHOLMOD itself includes other
262  * ANSI C89 standard #include files, but does not expose them to the user.
263  *
264  * CHOLMOD assumes that your C compiler is ANSI C89 compliant. It does not make
265  * use of ANSI C99 features.
266  */
267 
268 #include <stddef.h>
269 #include <stdlib.h>
270 
271 /* ========================================================================== */
272 /* === CHOLMOD objects ====================================================== */
273 /* ========================================================================== */
274 
275 /* Each CHOLMOD object has its own type code. */
276 
277 #define CHOLMOD_COMMON 0
278 #define CHOLMOD_SPARSE 1
279 #define CHOLMOD_FACTOR 2
280 #define CHOLMOD_DENSE 3
281 #define CHOLMOD_TRIPLET 4
282 
283 /* ========================================================================== */
284 /* === CHOLMOD Common ======================================================= */
285 /* ========================================================================== */
286 
287 /* itype defines the types of integer used: */
288 #define CHOLMOD_INT 0 /* all integer arrays are int */
289 #define CHOLMOD_INTLONG 1 /* most are int, some are UF_long */
290 #define CHOLMOD_LONG 2 /* all integer arrays are UF_long */
291 
292 /* The itype of all parameters for all CHOLMOD routines must match.
293  * FUTURE WORK: CHOLMOD_INTLONG is not yet supported.
294  */
295 
296 /* dtype defines what the numerical type is (double or float): */
297 #define CHOLMOD_DOUBLE 0 /* all numerical values are double */
298 #define CHOLMOD_SINGLE 1 /* all numerical values are float */
299 
300 /* The dtype of all parameters for all CHOLMOD routines must match.
301  *
302  * Scalar floating-point values are always passed as double arrays of size 2
303  * (for the real and imaginary parts). They are typecast to float as needed.
304  * FUTURE WORK: the float case is not supported yet.
305  */
306 
307 /* xtype defines the kind of numerical values used: */
308 #define CHOLMOD_PATTERN 0 /* pattern only, no numerical values */
309 #define CHOLMOD_REAL 1 /* a real matrix */
310 #define CHOLMOD_COMPLEX 2 /* a complex matrix (ANSI C99 compatible) */
311 #define CHOLMOD_ZOMPLEX 3 /* a complex matrix (MATLAB compatible) */
312 
313 /* The xtype of all parameters for all CHOLMOD routines must match.
314  *
315  * CHOLMOD_PATTERN: x and z are ignored.
316  * CHOLMOD_DOUBLE: x is non-null of size nzmax, z is ignored.
317  * CHOLMOD_COMPLEX: x is non-null of size 2*nzmax doubles, z is ignored.
318  * CHOLMOD_ZOMPLEX: x and z are non-null of size nzmax
319  *
320  * In the real case, z is ignored. The kth entry in the matrix is x [k].
321  * There are two methods for the complex case. In the ANSI C99-compatible
322  * CHOLMOD_COMPLEX case, the real and imaginary parts of the kth entry
323  * are in x [2*k] and x [2*k+1], respectively. z is ignored. In the
324  * MATLAB-compatible CHOLMOD_ZOMPLEX case, the real and imaginary
325  * parts of the kth entry are in x [k] and z [k].
326  *
327  * Scalar floating-point values are always passed as double arrays of size 2
328  * (real and imaginary parts). The imaginary part of a scalar is ignored if
329  * the routine operates on a real matrix.
330  *
331  * These Modules support complex and zomplex matrices, with a few exceptions:
332  *
333  * Check all routines
334  * Cholesky all routines
335  * Core all except cholmod_aat, add, band, copy
336  * Demo all routines
337  * Partition all routines
338  * Supernodal all routines support any real, complex, or zomplex input.
339  * There will never be a supernodal zomplex L; a complex
340  * supernodal L is created if A is zomplex.
341  * Tcov all routines
342  * Valgrind all routines
343  *
344  * These Modules provide partial support for complex and zomplex matrices:
345  *
346  * MATLAB all routines support real and zomplex only, not complex,
347  * with the exception of ldlupdate, which supports
348  * real matrices only. This is a minor constraint since
349  * MATLAB's matrices are all real or zomplex.
350  * MatrixOps only norm_dense, norm_sparse, and sdmult support complex
351  * and zomplex
352  *
353  * These Modules do not support complex and zomplex matrices at all:
354  *
355  * Modify all routines support real matrices only
356  */
357 
358 /* Definitions for cholmod_common: */
359 #define CHOLMOD_MAXMETHODS 9 /* maximum number of different methods that
360  * cholmod_analyze can try. Must be >= 9. */
361 
362 /* Common->status values. zero means success, negative means a fatal error,
363  * positive is a warning. */
364 #define CHOLMOD_OK 0 /* success */
365 #define CHOLMOD_NOT_INSTALLED (-1) /* failure: method not installed */
366 #define CHOLMOD_OUT_OF_MEMORY (-2) /* failure: out of memory */
367 #define CHOLMOD_TOO_LARGE (-3) /* failure: integer overflow occured */
368 #define CHOLMOD_INVALID (-4) /* failure: invalid input */
369 #define CHOLMOD_NOT_POSDEF (1) /* warning: matrix not pos. def. */
370 #define CHOLMOD_DSMALL (2) /* warning: D for LDL' or diag(L) or
371  * LL' has tiny absolute value */
372 
373 /* ordering method (also used for L->ordering) */
374 #define CHOLMOD_NATURAL 0 /* use natural ordering */
375 #define CHOLMOD_GIVEN 1 /* use given permutation */
376 #define CHOLMOD_AMD 2 /* use minimum degree (AMD) */
377 #define CHOLMOD_METIS 3 /* use METIS' nested dissection */
378 #define CHOLMOD_NESDIS 4 /* use CHOLMOD's version of nested dissection:
379  * node bisector applied recursively, followed
380  * by constrained minimum degree (CSYMAMD or
381  * CCOLAMD) */
382 #define CHOLMOD_COLAMD 5 /* use AMD for A, COLAMD for A*A' */
383 
384 /* POSTORDERED is not a method, but a result of natural ordering followed by a
385  * weighted postorder. It is used for L->ordering, not method [ ].ordering. */
386 #define CHOLMOD_POSTORDERED 6 /* natural ordering, postordered. */
387 
388 /* supernodal strategy (for Common->supernodal) */
389 #define CHOLMOD_SIMPLICIAL 0 /* always do simplicial */
390 #define CHOLMOD_AUTO 1 /* select simpl/super depending on matrix */
391 #define CHOLMOD_SUPERNODAL 2 /* always do supernodal */
392 
393 typedef struct cholmod_common_struct
394 {
395  /* ---------------------------------------------------------------------- */
396  /* parameters for symbolic/numeric factorization and update/downdate */
397  /* ---------------------------------------------------------------------- */
398 
399  double dbound ; /* Smallest absolute value of diagonal entries of D
400  * for LDL' factorization and update/downdate/rowadd/
401  * rowdel, or the diagonal of L for an LL' factorization.
402  * Entries in the range 0 to dbound are replaced with dbound.
403  * Entries in the range -dbound to 0 are replaced with -dbound. No
404  * changes are made to the diagonal if dbound <= 0. Default: zero */
405 
406  double grow0 ; /* For a simplicial factorization, L->i and L->x can
407  * grow if necessary. grow0 is the factor by which
408  * it grows. For the initial space, L is of size MAX (1,grow0) times
409  * the required space. If L runs out of space, the new size of L is
410  * MAX(1.2,grow0) times the new required space. If you do not plan on
411  * modifying the LDL' factorization in the Modify module, set grow0 to
412  * zero (or set grow2 to 0, see below). Default: 1.2 */
413 
414  double grow1 ;
415 
416  size_t grow2 ; /* For a simplicial factorization, each column j of L
417  * is initialized with space equal to
418  * grow1*L->ColCount[j] + grow2. If grow0 < 1, grow1 < 1, or grow2 == 0,
419  * then the space allocated is exactly equal to L->ColCount[j]. If the
420  * column j runs out of space, it increases to grow1*need + grow2 in
421  * size, where need is the total # of nonzeros in that column. If you do
422  * not plan on modifying the factorization in the Modify module, set
423  * grow2 to zero. Default: grow1 = 1.2, grow2 = 5. */
424 
425  size_t maxrank ; /* rank of maximum update/downdate. Valid values:
426  * 2, 4, or 8. A value < 2 is set to 2, and a
427  * value > 8 is set to 8. It is then rounded up to the next highest
428  * power of 2, if not already a power of 2. Workspace (Xwork, below) of
429  * size nrow-by-maxrank double's is allocated for the update/downdate.
430  * If an update/downdate of rank-k is requested, with k > maxrank,
431  * it is done in steps of maxrank. Default: 8, which is fastest.
432  * Memory usage can be reduced by setting maxrank to 2 or 4.
433  */
434 
435  double supernodal_switch ; /* supernodal vs simplicial factorization */
436  int supernodal ; /* If Common->supernodal <= CHOLMOD_SIMPLICIAL
437  * (0) then cholmod_analyze performs a
438  * simplicial analysis. If >= CHOLMOD_SUPERNODAL (2), then a supernodal
439  * analysis is performed. If == CHOLMOD_AUTO (1) and
440  * flop/nnz(L) < Common->supernodal_switch, then a simplicial analysis
441  * is done. A supernodal analysis done otherwise.
442  * Default: CHOLMOD_AUTO. Default supernodal_switch = 40 */
443 
444  int final_asis ; /* If TRUE, then ignore the other final_* parameters
445  * (except for final_pack).
446  * The factor is left as-is when done. Default: TRUE.*/
447 
448  int final_super ; /* If TRUE, leave a factor in supernodal form when
449  * supernodal factorization is finished. If FALSE,
450  * then convert to a simplicial factor when done.
451  * Default: TRUE */
452 
453  int final_ll ; /* If TRUE, leave factor in LL' form when done.
454  * Otherwise, leave in LDL' form. Default: FALSE */
455 
456  int final_pack ; /* If TRUE, pack the columns when done. If TRUE, and
457  * cholmod_factorize is called with a symbolic L, L is
458  * allocated with exactly the space required, using L->ColCount. If you
459  * plan on modifying the factorization, set Common->final_pack to FALSE,
460  * and each column will be given a little extra slack space for future
461  * growth in fill-in due to updates. Default: TRUE */
462 
463  int final_monotonic ; /* If TRUE, ensure columns are monotonic when done.
464  * Default: TRUE */
465 
466  int final_resymbol ;/* if cholmod_factorize performed a supernodal
467  * factorization, final_resymbol is true, and
468  * final_super is FALSE (convert a simplicial numeric factorization),
469  * then numerically zero entries that resulted from relaxed supernodal
470  * amalgamation are removed. This does not remove entries that are zero
471  * due to exact numeric cancellation, since doing so would break the
472  * update/downdate rowadd/rowdel routines. Default: FALSE. */
473 
474  /* supernodal relaxed amalgamation parameters: */
475  double zrelax [3] ;
476  size_t nrelax [3] ;
477 
478  /* Let ns be the total number of columns in two adjacent supernodes.
479  * Let z be the fraction of zero entries in the two supernodes if they
480  * are merged (z includes zero entries from prior amalgamations). The
481  * two supernodes are merged if:
482  * (ns <= nrelax [0]) || (no new zero entries added) ||
483  * (ns <= nrelax [1] && z < zrelax [0]) ||
484  * (ns <= nrelax [2] && z < zrelax [1]) || (z < zrelax [2])
485  *
486  * Default parameters result in the following rule:
487  * (ns <= 4) || (no new zero entries added) ||
488  * (ns <= 16 && z < 0.8) || (ns <= 48 && z < 0.1) || (z < 0.05)
489  */
490 
491  int prefer_zomplex ; /* X = cholmod_solve (sys, L, B, Common) computes
492  * x=A\b or solves a related system. If L and B are
493  * both real, then X is real. Otherwise, X is returned as
494  * CHOLMOD_COMPLEX if Common->prefer_zomplex is FALSE, or
495  * CHOLMOD_ZOMPLEX if Common->prefer_zomplex is TRUE. This parameter
496  * is needed because there is no supernodal zomplex L. Suppose the
497  * caller wants all complex matrices to be stored in zomplex form
498  * (MATLAB, for example). A supernodal L is returned in complex form
499  * if A is zomplex. B can be real, and thus X = cholmod_solve (L,B)
500  * should return X as zomplex. This cannot be inferred from the input
501  * arguments L and B. Default: FALSE, since all data types are
502  * supported in CHOLMOD_COMPLEX form and since this is the native type
503  * of LAPACK and the BLAS. Note that the MATLAB/cholmod.c mexFunction
504  * sets this parameter to TRUE, since MATLAB matrices are in
505  * CHOLMOD_ZOMPLEX form.
506  */
507 
508  int prefer_upper ; /* cholmod_analyze and cholmod_factorize work
509  * fastest when a symmetric matrix is stored in
510  * upper triangular form when a fill-reducing ordering is used. In
511  * MATLAB, this corresponds to how x=A\b works. When the matrix is
512  * ordered as-is, they work fastest when a symmetric matrix is in lower
513  * triangular form. In MATLAB, R=chol(A) does the opposite. This
514  * parameter affects only how cholmod_read returns a symmetric matrix.
515  * If TRUE (the default case), a symmetric matrix is always returned in
516  * upper-triangular form (A->stype = 1). */
517 
518  int quick_return_if_not_posdef ; /* if TRUE, the supernodal numeric
519  * factorization will return quickly if
520  * the matrix is not positive definite. Default: FALSE. */
521 
522  /* ---------------------------------------------------------------------- */
523  /* printing and error handling options */
524  /* ---------------------------------------------------------------------- */
525 
526  int print ; /* print level. Default: 3 */
527  int precise ; /* if TRUE, print 16 digits. Otherwise print 5 */
528  int (*print_function) (const char *, ...) ; /* pointer to printf */
529 
530  int try_catch ; /* if TRUE, then ignore errors; CHOLMOD is in the middle
531  * of a try/catch block. No error message is printed
532  * and the Common->error_handler function is not called. */
533 
534  void (*error_handler) (int status, char *file, int line, char *message) ;
535 
536  /* Common->error_handler is the user's error handling routine. If not
537  * NULL, this routine is called if an error occurs in CHOLMOD. status
538  * can be CHOLMOD_OK (0), negative for a fatal error, and positive for
539  * a warning. file is a string containing the name of the source code
540  * file where the error occured, and line is the line number in that
541  * file. message is a string describing the error in more detail. */
542 
543  /* ---------------------------------------------------------------------- */
544  /* ordering options */
545  /* ---------------------------------------------------------------------- */
546 
547  /* The cholmod_analyze routine can try many different orderings and select
548  * the best one. It can also try one ordering method multiple times, with
549  * different parameter settings. The default is to use three orderings,
550  * the user's permutation (if provided), AMD which is the fastest ordering
551  * and generally gives good fill-in, and METIS. CHOLMOD's nested dissection
552  * (METIS with a constrained AMD) usually gives a better ordering than METIS
553  * alone (by about 5% to 10%) but it takes more time.
554  *
555  * If you know the method that is best for your matrix, set Common->nmethods
556  * to 1 and set Common->method [0] to the set of parameters for that method.
557  * If you set it to 1 and do not provide a permutation, then only AMD will
558  * be called.
559  *
560  * If METIS is not available, the default # of methods tried is 2 (the user
561  * permutation, if any, and AMD).
562  *
563  * To try other methods, set Common->nmethods to the number of methods you
564  * want to try. The suite of default methods and their parameters is
565  * described in the cholmod_defaults routine, and summarized here:
566  *
567  * Common->method [i]:
568  * i = 0: user-provided ordering (cholmod_analyze_p only)
569  * i = 1: AMD (for both A and A*A')
570  * i = 2: METIS
571  * i = 3: CHOLMOD's nested dissection (NESDIS), default parameters
572  * i = 4: natural
573  * i = 5: NESDIS with nd_small = 20000
574  * i = 6: NESDIS with nd_small = 4, no constrained minimum degree
575  * i = 7: NESDIS with no dense node removal
576  * i = 8: AMD for A, COLAMD for A*A'
577  *
578  * You can modify the suite of methods you wish to try by modifying
579  * Common.method [...] after calling cholmod_start or cholmod_defaults.
580  *
581  * For example, to use AMD, followed by a weighted postordering:
582  *
583  * Common->nmethods = 1 ;
584  * Common->method [0].ordering = CHOLMOD_AMD ;
585  * Common->postorder = TRUE ;
586  *
587  * To use the natural ordering (with no postordering):
588  *
589  * Common->nmethods = 1 ;
590  * Common->method [0].ordering = CHOLMOD_NATURAL ;
591  * Common->postorder = FALSE ;
592  *
593  * If you are going to factorize hundreds or more matrices with the same
594  * nonzero pattern, you may wish to spend a great deal of time finding a
595  * good permutation. In this case, try setting Common->nmethods to 9.
596  * The time spent in cholmod_analysis will be very high, but you need to
597  * call it only once.
598  *
599  * cholmod_analyze sets Common->current to a value between 0 and nmethods-1.
600  * Each ordering method uses the set of options defined by this parameter.
601  */
602 
603  int nmethods ; /* The number of ordering methods to try. Default: 0.
604  * nmethods = 0 is a special case. cholmod_analyze
605  * will try the user-provided ordering (if given) and AMD. Let fl and
606  * lnz be the flop count and nonzeros in L from AMD's ordering. Let
607  * anz be the number of nonzeros in the upper or lower triangular part
608  * of the symmetric matrix A. If fl/lnz < 500 or lnz/anz < 5, then this
609  * is a good ordering, and METIS is not attempted. Otherwise, METIS is
610  * tried. The best ordering found is used. If nmethods > 0, the
611  * methods used are given in the method[ ] array, below. The first
612  * three methods in the default suite of orderings is (1) use the given
613  * permutation (if provided), (2) use AMD, and (3) use METIS. Maximum
614  * allowed value is CHOLMOD_MAXMETHODS. */
615 
616  int current ; /* The current method being tried. Default: 0. Valid
617  * range is 0 to nmethods-1. */
618 
619  int selected ; /* The best method found. */
620 
621  /* The suite of ordering methods and parameters: */
622 
624  {
625  /* statistics for this method */
626  double lnz ; /* nnz(L) excl. zeros from supernodal amalgamation,
627  * for a "pure" L */
628 
629  double fl ; /* flop count for a "pure", real simplicial LL'
630  * factorization, with no extra work due to
631  * amalgamation. Subtract n to get the LDL' flop count. Multiply
632  * by about 4 if the matrix is complex or zomplex. */
633 
634  /* ordering method parameters */
635  double prune_dense ;/* dense row/col control for AMD, SYMAMD, CSYMAMD,
636  * and NESDIS (cholmod_nested_dissection). For a
637  * symmetric n-by-n matrix, rows/columns with more than
638  * MAX (16, prune_dense * sqrt (n)) entries are removed prior to
639  * ordering. They appear at the end of the re-ordered matrix.
640  *
641  * If prune_dense < 0, only completely dense rows/cols are removed.
642  *
643  * This paramater is also the dense column control for COLAMD and
644  * CCOLAMD. For an m-by-n matrix, columns with more than
645  * MAX (16, prune_dense * sqrt (MIN (m,n))) entries are removed prior
646  * to ordering. They appear at the end of the re-ordered matrix.
647  * CHOLMOD factorizes A*A', so it calls COLAMD and CCOLAMD with A',
648  * not A. Thus, this parameter affects the dense *row* control for
649  * CHOLMOD's matrix, and the dense *column* control for COLAMD and
650  * CCOLAMD.
651  *
652  * Removing dense rows and columns improves the run-time of the
653  * ordering methods. It has some impact on ordering quality
654  * (usually minimal, sometimes good, sometimes bad).
655  *
656  * Default: 10. */
657 
658  double prune_dense2 ;/* dense row control for COLAMD and CCOLAMD.
659  * Rows with more than MAX (16, dense2 * sqrt (n))
660  * for an m-by-n matrix are removed prior to ordering. CHOLMOD's
661  * matrix is transposed before ordering it with COLAMD or CCOLAMD,
662  * so this controls the dense *columns* of CHOLMOD's matrix, and
663  * the dense *rows* of COLAMD's or CCOLAMD's matrix.
664  *
665  * If prune_dense2 < 0, only completely dense rows/cols are removed.
666  *
667  * Default: -1. Note that this is not the default for COLAMD and
668  * CCOLAMD. -1 is best for Cholesky. 10 is best for LU. */
669 
670  double nd_oksep ; /* in NESDIS, when a node separator is computed, it
671  * discarded if nsep >= nd_oksep*n, where nsep is
672  * the number of nodes in the separator, and n is the size of the
673  * graph being cut. Valid range is 0 to 1. If 1 or greater, the
674  * separator is discarded if it consists of the entire graph.
675  * Default: 1 */
676 
677  double other1 [4] ; /* future expansion */
678 
679  size_t nd_small ; /* do not partition graphs with fewer nodes than
680  * nd_small, in NESDIS. Default: 200 (same as
681  * METIS) */
682 
683  size_t other2 [4] ; /* future expansion */
684 
685  int aggressive ; /* Aggresive absorption in AMD, COLAMD, SYMAMD,
686  * CCOLAMD, and CSYMAMD. Default: TRUE */
687 
688  int order_for_lu ; /* CCOLAMD can be optimized to produce an ordering
689  * for LU or Cholesky factorization. CHOLMOD only
690  * performs a Cholesky factorization. However, you may wish to use
691  * CHOLMOD as an interface for CCOLAMD but use it for your own LU
692  * factorization. In this case, order_for_lu should be set to FALSE.
693  * When factorizing in CHOLMOD itself, you should *** NEVER *** set
694  * this parameter FALSE. Default: TRUE. */
695 
696  int nd_compress ; /* If TRUE, compress the graph and subgraphs before
697  * partitioning them in NESDIS. Default: TRUE */
698 
699  int nd_camd ; /* If 1, follow the nested dissection ordering
700  * with a constrained minimum degree ordering that
701  * respects the partitioning just found (using CAMD). If 2, use
702  * CSYMAMD instead. If you set nd_small very small, you may not need
703  * this ordering, and can save time by setting it to zero (no
704  * constrained minimum degree ordering). Default: 1. */
705 
706  int nd_components ; /* The nested dissection ordering finds a node
707  * separator that splits the graph into two parts,
708  * which may be unconnected. If nd_components is TRUE, each of
709  * these connected components is split independently. If FALSE,
710  * each part is split as a whole, even if it consists of more than
711  * one connected component. Default: FALSE */
712 
713  /* fill-reducing ordering to use */
714  int ordering ;
715 
716  size_t other3 [4] ; /* future expansion */
717 
718  } method [CHOLMOD_MAXMETHODS + 1] ;
719 
720  int postorder ; /* If TRUE, cholmod_analyze follows the ordering with a
721  * weighted postorder of the elimination tree. Improves
722  * supernode amalgamation. Does not affect fundamental nnz(L) and
723  * flop count. Default: TRUE. */
724 
725  /* ---------------------------------------------------------------------- */
726  /* memory management routines */
727  /* ---------------------------------------------------------------------- */
728 
729  void *(*malloc_memory) (size_t) ; /* pointer to malloc */
730  void *(*realloc_memory) (void *, size_t) ; /* pointer to realloc */
731  void (*free_memory) (void *) ; /* pointer to free */
732  void *(*calloc_memory) (size_t, size_t) ; /* pointer to calloc */
733 
734  /* ---------------------------------------------------------------------- */
735  /* routines for complex arithmetic */
736  /* ---------------------------------------------------------------------- */
737 
738  int (*complex_divide) (double ax, double az, double bx, double bz,
739  double *cx, double *cz) ;
740 
741  /* flag = complex_divide (ax, az, bx, bz, &cx, &cz) computes the complex
742  * division c = a/b, where ax and az hold the real and imaginary part
743  * of a, and b and c are stored similarly. flag is returned as 1 if
744  * a divide-by-zero occurs, or 0 otherwise. By default, the function
745  * pointer Common->complex_divide is set equal to cholmod_divcomplex.
746  */
747 
748  double (*hypotenuse) (double x, double y) ;
749 
750  /* s = hypotenuse (x,y) computes s = sqrt (x*x + y*y), but does so more
751  * accurately. By default, the function pointer Common->hypotenuse is
752  * set equal to cholmod_hypot. See also the hypot function in the C99
753  * standard, which has an identical syntax and function. If you have
754  * a C99-compliant compiler, you can set Common->hypotenuse = hypot. */
755 
756  /* ---------------------------------------------------------------------- */
757  /* METIS workarounds */
758  /* ---------------------------------------------------------------------- */
759 
760  double metis_memory ; /* This is a parameter for CHOLMOD's interface to
761  * METIS, not a parameter to METIS itself. METIS
762  * uses an amount of memory that is difficult to estimate precisely
763  * beforehand. If it runs out of memory, it terminates your program.
764  * All routines in CHOLMOD except for CHOLMOD's interface to METIS
765  * return an error status and safely return to your program if they run
766  * out of memory. To mitigate this problem, the CHOLMOD interface
767  * can allocate a single block of memory equal in size to an empirical
768  * upper bound of METIS's memory usage times the Common->metis_memory
769  * parameter, and then immediately free it. It then calls METIS. If
770  * this pre-allocation fails, it is possible that METIS will fail as
771  * well, and so CHOLMOD returns with an out-of-memory condition without
772  * calling METIS.
773  *
774  * METIS_NodeND (used in the CHOLMOD_METIS ordering option) with its
775  * default parameter settings typically uses about (4*nz+40n+4096)
776  * times sizeof(int) memory, where nz is equal to the number of entries
777  * in A for the symmetric case or AA' if an unsymmetric matrix is
778  * being ordered (where nz includes both the upper and lower parts
779  * of A or AA'). The observed "upper bound" (with 2 exceptions),
780  * measured in an instrumented copy of METIS 4.0.1 on thousands of
781  * matrices, is (10*nz+50*n+4096) * sizeof(int). Two large matrices
782  * exceeded this bound, one by almost a factor of 2 (Gupta/gupta2).
783  *
784  * If your program is terminated by METIS, try setting metis_memory to
785  * 2.0, or even higher if needed. By default, CHOLMOD assumes that METIS
786  * does not have this problem (so that CHOLMOD will work correctly when
787  * this issue is fixed in METIS). Thus, the default value is zero.
788  * This work-around is not guaranteed anyway.
789  *
790  * If a matrix exceeds this predicted memory usage, AMD is attempted
791  * instead. It, too, may run out of memory, but if it does so it will
792  * not terminate your program.
793  */
794 
795  double metis_dswitch ; /* METIS_NodeND in METIS 4.0.1 gives a seg */
796  size_t metis_nswitch ; /* fault with one matrix of order n = 3005 and
797  * nz = 6,036,025. This is a very dense graph.
798  * The workaround is to use AMD instead of METIS for matrices of dimension
799  * greater than Common->metis_nswitch (default 3000) or more and with
800  * density of Common->metis_dswitch (default 0.66) or more.
801  * cholmod_nested_dissection has no problems with the same matrix, even
802  * though it uses METIS_NodeComputeSeparator on this matrix. If this
803  * seg fault does not affect you, set metis_nswitch to zero or less,
804  * and CHOLMOD will not switch to AMD based just on the density of the
805  * matrix (it will still switch to AMD if the metis_memory parameter
806  * causes the switch).
807  */
808 
809  /* ---------------------------------------------------------------------- */
810  /* workspace */
811  /* ---------------------------------------------------------------------- */
812 
813  /* CHOLMOD has several routines that take less time than the size of
814  * workspace they require. Allocating and initializing the workspace would
815  * dominate the run time, unless workspace is allocated and initialized
816  * just once. CHOLMOD allocates this space when needed, and holds it here
817  * between calls to CHOLMOD. cholmod_start sets these pointers to NULL
818  * (which is why it must be the first routine called in CHOLMOD).
819  * cholmod_finish frees the workspace (which is why it must be the last
820  * call to CHOLMOD).
821  */
822 
823  size_t nrow ; /* size of Flag and Head */
824  UF_long mark ; /* mark value for Flag array */
825  size_t iworksize ; /* size of Iwork. Upper bound: 6*nrow+ncol */
826  size_t xworksize ; /* size of Xwork, in bytes.
827  * maxrank*nrow*sizeof(double) for update/downdate.
828  * 2*nrow*sizeof(double) otherwise */
829 
830  /* initialized workspace: contents needed between calls to CHOLMOD */
831  void *Flag ; /* size nrow, an integer array. Kept cleared between
832  * calls to cholmod rouines (Flag [i] < mark) */
833 
834  void *Head ; /* size nrow+1, an integer array. Kept cleared between
835  * calls to cholmod routines (Head [i] = EMPTY) */
836 
837  void *Xwork ; /* a double array. Its size varies. It is nrow for
838  * most routines (cholmod_rowfac, cholmod_add,
839  * cholmod_aat, cholmod_norm, cholmod_ssmult) for the real case, twice
840  * that when the input matrices are complex or zomplex. It is of size
841  * 2*nrow for cholmod_rowadd and cholmod_rowdel. For cholmod_updown,
842  * its size is maxrank*nrow where maxrank is 2, 4, or 8. Kept cleared
843  * between calls to cholmod (set to zero). */
844 
845  /* uninitialized workspace, contents not needed between calls to CHOLMOD */
846  void *Iwork ; /* size iworksize, 2*nrow+ncol for most routines,
847  * up to 6*nrow+ncol for cholmod_analyze. */
848 
849  int itype ; /* If CHOLMOD_LONG, Flag, Head, and Iwork are UF_long.
850  * Otherwise all three arrays are int. */
851 
852  int dtype ; /* double or float */
853 
854  /* Common->itype and Common->dtype are used to define the types of all
855  * sparse matrices, triplet matrices, dense matrices, and factors
856  * created using this Common struct. The itypes and dtypes of all
857  * parameters to all CHOLMOD routines must match. */
858 
859  int no_workspace_reallocate ; /* this is an internal flag, used as a
860  * precaution by cholmod_analyze. It is normally false. If true,
861  * cholmod_allocate_work is not allowed to reallocate any workspace;
862  * they must use the existing workspace in Common (Iwork, Flag, Head,
863  * and Xwork). Added for CHOLMOD v1.1 */
864 
865  /* ---------------------------------------------------------------------- */
866  /* statistics */
867  /* ---------------------------------------------------------------------- */
868 
869  /* fl and lnz are set only in cholmod_analyze and cholmod_rowcolcounts,
870  * in the Cholesky modudle. modfl is set only in the Modify module. */
871 
872  int status ; /* error code */
873  double fl ; /* LL' flop count from most recent analysis */
874  double lnz ; /* fundamental nz in L */
875  double anz ; /* nonzeros in tril(A) if A is symmetric/lower,
876  * triu(A) if symmetric/upper, or tril(A*A') if
877  * unsymmetric, in last call to cholmod_analyze. */
878  double modfl ; /* flop count from most recent update/downdate/
879  * rowadd/rowdel (excluding flops to modify the
880  * solution to Lx=b, if computed) */
881  size_t malloc_count ; /* # of objects malloc'ed minus the # free'd*/
882  size_t memory_usage ; /* peak memory usage in bytes */
883  size_t memory_inuse ; /* current memory usage in bytes */
884 
885  double nrealloc_col ; /* # of column reallocations */
886  double nrealloc_factor ;/* # of factor reallocations due to col. reallocs */
887  double ndbounds_hit ; /* # of times diagonal modified by dbound */
888 
889  double rowfacfl ; /* # of flops in last call to cholmod_rowfac */
890  double aatfl ; /* # of flops to compute A(:,f)*A(:,f)' */
891 
892  /* ---------------------------------------------------------------------- */
893  /* future expansion */
894  /* ---------------------------------------------------------------------- */
895 
896  /* To allow CHOLMOD to be updated without recompiling the user application,
897  * additional space is set aside here for future statistics, parameters,
898  * and workspace. Note: additional entries were added in v1.1 to the
899  * method array, above, and thus v1.0 and v1.1 are not binary compatible.
900  *
901  * v1.1 to the current version are binary compatible.
902  */
903 
904  double other1 [16] ;
906  int other3 [13] ; /* reduced from size 16 in v1.1. */
907 
908  int prefer_binary ; /* cholmod_read_triplet converts a symmetric
909  * pattern-only matrix into a real matrix. If
910  * prefer_binary is FALSE, the diagonal entries are set to 1 + the degree
911  * of the row/column, and off-diagonal entries are set to -1 (resulting
912  * in a positive definite matrix if the diagonal is zero-free). Most
913  * symmetric patterns are the pattern a positive definite matrix. If
914  * this parameter is TRUE, then the matrix is returned with a 1 in each
915  * entry, instead. Default: FALSE. Added in v1.3. */
916 
917  /* control parameter (added for v1.2): */
918  int default_nesdis ; /* Default: FALSE. If FALSE, then the default
919  * ordering strategy (when Common->nmethods == 0)
920  * is to try the given ordering (if present), AMD, and then METIS if AMD
921  * reports high fill-in. If Common->default_nesdis is TRUE then NESDIS
922  * is used instead in the default strategy. */
923 
924  /* statistic (added for v1.2): */
925  int called_nd ; /* TRUE if the last call to
926  * cholmod_analyze called NESDIS or METIS. */
927 
928  size_t other4 [16] ;
929  void *other5 [16] ;
930 
931 } cholmod_common ;
932 
933 /* -------------------------------------------------------------------------- */
934 /* cholmod_start: first call to CHOLMOD */
935 /* -------------------------------------------------------------------------- */
936 
938 (
939  cholmod_common *Common
940 ) ;
941 
943 
944 /* -------------------------------------------------------------------------- */
945 /* cholmod_finish: last call to CHOLMOD */
946 /* -------------------------------------------------------------------------- */
947 
949 (
950  cholmod_common *Common
951 ) ;
952 
954 
955 /* -------------------------------------------------------------------------- */
956 /* cholmod_defaults: restore default parameters */
957 /* -------------------------------------------------------------------------- */
958 
960 (
961  cholmod_common *Common
962 ) ;
963 
965 
966 /* -------------------------------------------------------------------------- */
967 /* cholmod_maxrank: return valid maximum rank for update/downdate */
968 /* -------------------------------------------------------------------------- */
969 
970 size_t amesos_cholmod_maxrank /* returns validated value of Common->maxrank */
971 (
972  /* ---- input ---- */
973  size_t n, /* A and L will have n rows */
974  /* --------------- */
975  cholmod_common *Common
976 ) ;
977 
978 size_t amesos_cholmod_l_maxrank (size_t, cholmod_common *) ;
979 
980 /* -------------------------------------------------------------------------- */
981 /* cholmod_allocate_work: allocate workspace in Common */
982 /* -------------------------------------------------------------------------- */
983 
985 (
986  /* ---- input ---- */
987  size_t nrow, /* size: Common->Flag (nrow), Common->Head (nrow+1) */
988  size_t iworksize, /* size of Common->Iwork */
989  size_t xworksize, /* size of Common->Xwork */
990  /* --------------- */
991  cholmod_common *Common
992 ) ;
993 
994 int amesos_cholmod_l_allocate_work (size_t, size_t, size_t, cholmod_common *) ;
995 
996 /* -------------------------------------------------------------------------- */
997 /* cholmod_free_work: free workspace in Common */
998 /* -------------------------------------------------------------------------- */
999 
1001 (
1002  cholmod_common *Common
1003 ) ;
1004 
1006 
1007 /* -------------------------------------------------------------------------- */
1008 /* cholmod_clear_flag: clear Flag workspace in Common */
1009 /* -------------------------------------------------------------------------- */
1010 
1011 /* use a macro for speed */
1012 #define CHOLMOD_CLEAR_FLAG(Common) \
1013 { \
1014  Common->mark++ ; \
1015  if (Common->mark <= 0) \
1016  { \
1017  Common->mark = EMPTY ; \
1018  CHOLMOD (clear_flag) (Common) ; \
1019  } \
1020 }
1021 
1023 (
1024  cholmod_common *Common
1025 ) ;
1026 
1028 
1029 /* -------------------------------------------------------------------------- */
1030 /* cholmod_error: called when CHOLMOD encounters an error */
1031 /* -------------------------------------------------------------------------- */
1032 
1034 (
1035  /* ---- input ---- */
1036  int status, /* error status */
1037  char *file, /* name of source code file where error occured */
1038  int line, /* line number in source code file where error occured*/
1039  char *message, /* error message */
1040  /* --------------- */
1041  cholmod_common *Common
1042 ) ;
1043 
1044 int amesos_cholmod_l_error (int, char *, int, char *, cholmod_common *) ;
1045 
1046 /* -------------------------------------------------------------------------- */
1047 /* cholmod_dbound: for internal use in CHOLMOD only */
1048 /* -------------------------------------------------------------------------- */
1049 
1050 double amesos_cholmod_dbound /* returns modified diagonal entry of D or L */
1051 (
1052  /* ---- input ---- */
1053  double dj, /* diagonal entry of D for LDL' or L for LL' */
1054  /* --------------- */
1055  cholmod_common *Common
1056 ) ;
1057 
1058 double amesos_cholmod_l_dbound (double, cholmod_common *) ;
1059 
1060 /* -------------------------------------------------------------------------- */
1061 /* cholmod_hypot: compute sqrt (x*x + y*y) accurately */
1062 /* -------------------------------------------------------------------------- */
1063 
1064 double amesos_cholmod_hypot
1065 (
1066  /* ---- input ---- */
1067  double x, double y
1068 ) ;
1069 
1070 double amesos_cholmod_l_hypot (double, double) ;
1071 
1072 /* -------------------------------------------------------------------------- */
1073 /* cholmod_divcomplex: complex division, c = a/b */
1074 /* -------------------------------------------------------------------------- */
1075 
1076 int amesos_cholmod_divcomplex /* return 1 if divide-by-zero, 0 otherise */
1077 (
1078  /* ---- input ---- */
1079  double ar, double ai, /* real and imaginary parts of a */
1080  double br, double bi, /* real and imaginary parts of b */
1081  /* ---- output --- */
1082  double *cr, double *ci /* real and imaginary parts of c */
1083 ) ;
1084 
1085 int amesos_cholmod_l_divcomplex (double, double, double, double, double *, double *) ;
1086 
1087 
1088 /* ========================================================================== */
1089 /* === Core/cholmod_sparse ================================================== */
1090 /* ========================================================================== */
1091 
1092 /* A sparse matrix stored in compressed-column form. */
1093 
1095 {
1096  size_t nrow ; /* the matrix is nrow-by-ncol */
1097  size_t ncol ;
1098  size_t nzmax ; /* maximum number of entries in the matrix */
1099 
1100  /* pointers to int or UF_long: */
1101  void *p ; /* p [0..ncol], the column pointers */
1102  void *i ; /* i [0..nzmax-1], the row indices */
1103 
1104  /* for unpacked matrices only: */
1105  void *nz ; /* nz [0..ncol-1], the # of nonzeros in each col. In
1106  * packed form, the nonzero pattern of column j is in
1107  * A->i [A->p [j] ... A->p [j+1]-1]. In unpacked form, column j is in
1108  * A->i [A->p [j] ... A->p [j]+A->nz[j]-1] instead. In both cases, the
1109  * numerical values (if present) are in the corresponding locations in
1110  * the array x (or z if A->xtype is CHOLMOD_ZOMPLEX). */
1111 
1112  /* pointers to double or float: */
1113  void *x ; /* size nzmax or 2*nzmax, if present */
1114  void *z ; /* size nzmax, if present */
1115 
1116  int stype ; /* Describes what parts of the matrix are considered:
1117  *
1118  * 0: matrix is "unsymmetric": use both upper and lower triangular parts
1119  * (the matrix may actually be symmetric in pattern and value, but
1120  * both parts are explicitly stored and used). May be square or
1121  * rectangular.
1122  * >0: matrix is square and symmetric, use upper triangular part.
1123  * Entries in the lower triangular part are ignored.
1124  * <0: matrix is square and symmetric, use lower triangular part.
1125  * Entries in the upper triangular part are ignored.
1126  *
1127  * Note that stype>0 and stype<0 are different for cholmod_sparse and
1128  * cholmod_triplet. See the cholmod_triplet data structure for more
1129  * details.
1130  */
1131 
1132  int itype ; /* CHOLMOD_INT: p, i, and nz are int.
1133  * CHOLMOD_INTLONG: p is UF_long, i and nz are int.
1134  * CHOLMOD_LONG: p, i, and nz are UF_long. */
1135 
1136  int xtype ; /* pattern, real, complex, or zomplex */
1137  int dtype ; /* x and z are double or float */
1138  int sorted ; /* TRUE if columns are sorted, FALSE otherwise */
1139  int packed ; /* TRUE if packed (nz ignored), FALSE if unpacked
1140  * (nz is required) */
1141 
1142 } cholmod_sparse ;
1143 
1144 /* -------------------------------------------------------------------------- */
1145 /* cholmod_allocate_sparse: allocate a sparse matrix */
1146 /* -------------------------------------------------------------------------- */
1147 
1149 (
1150  /* ---- input ---- */
1151  size_t nrow, /* # of rows of A */
1152  size_t ncol, /* # of columns of A */
1153  size_t nzmax, /* max # of nonzeros of A */
1154  int sorted, /* TRUE if columns of A sorted, FALSE otherwise */
1155  int packed, /* TRUE if A will be packed, FALSE otherwise */
1156  int stype, /* stype of A */
1157  int xtype, /* CHOLMOD_PATTERN, _REAL, _COMPLEX, or _ZOMPLEX */
1158  /* --------------- */
1159  cholmod_common *Common
1160 ) ;
1161 
1162 cholmod_sparse *amesos_cholmod_l_allocate_sparse (size_t, size_t, size_t, int, int,
1163  int, int, cholmod_common *) ;
1164 
1165 /* -------------------------------------------------------------------------- */
1166 /* cholmod_free_sparse: free a sparse matrix */
1167 /* -------------------------------------------------------------------------- */
1168 
1170 (
1171  /* ---- in/out --- */
1172  cholmod_sparse **A, /* matrix to deallocate, NULL on output */
1173  /* --------------- */
1174  cholmod_common *Common
1175 ) ;
1176 
1178 
1179 /* -------------------------------------------------------------------------- */
1180 /* cholmod_reallocate_sparse: change the size (# entries) of sparse matrix */
1181 /* -------------------------------------------------------------------------- */
1182 
1184 (
1185  /* ---- input ---- */
1186  size_t nznew, /* new # of entries in A */
1187  /* ---- in/out --- */
1188  cholmod_sparse *A, /* matrix to reallocate */
1189  /* --------------- */
1190  cholmod_common *Common
1191 ) ;
1192 
1194 
1195 /* -------------------------------------------------------------------------- */
1196 /* cholmod_nnz: return number of nonzeros in a sparse matrix */
1197 /* -------------------------------------------------------------------------- */
1198 
1200 (
1201  /* ---- input ---- */
1202  cholmod_sparse *A,
1203  /* --------------- */
1204  cholmod_common *Common
1205 ) ;
1206 
1208 
1209 /* -------------------------------------------------------------------------- */
1210 /* cholmod_speye: sparse identity matrix */
1211 /* -------------------------------------------------------------------------- */
1212 
1214 (
1215  /* ---- input ---- */
1216  size_t nrow, /* # of rows of A */
1217  size_t ncol, /* # of columns of A */
1218  int xtype, /* CHOLMOD_PATTERN, _REAL, _COMPLEX, or _ZOMPLEX */
1219  /* --------------- */
1220  cholmod_common *Common
1221 ) ;
1222 
1223 cholmod_sparse *amesos_cholmod_l_speye (size_t, size_t, int, cholmod_common *) ;
1224 
1225 /* -------------------------------------------------------------------------- */
1226 /* cholmod_spzeros: sparse zero matrix */
1227 /* -------------------------------------------------------------------------- */
1228 
1230 (
1231  /* ---- input ---- */
1232  size_t nrow, /* # of rows of A */
1233  size_t ncol, /* # of columns of A */
1234  size_t nzmax, /* max # of nonzeros of A */
1235  int xtype, /* CHOLMOD_PATTERN, _REAL, _COMPLEX, or _ZOMPLEX */
1236  /* --------------- */
1237  cholmod_common *Common
1238 ) ;
1239 
1240 cholmod_sparse *amesos_cholmod_l_spzeros (size_t, size_t, size_t, int,
1241  cholmod_common *) ;
1242 
1243 /* -------------------------------------------------------------------------- */
1244 /* cholmod_transpose: transpose a sparse matrix */
1245 /* -------------------------------------------------------------------------- */
1246 
1247 /* Return A' or A.' The "values" parameter is 0, 1, or 2 to denote the pattern
1248  * transpose, the array transpose (A.'), and the complex conjugate transpose
1249  * (A').
1250  */
1251 
1253 (
1254  /* ---- input ---- */
1255  cholmod_sparse *A, /* matrix to transpose */
1256  int values, /* 0: pattern, 1: array transpose, 2: conj. transpose */
1257  /* --------------- */
1258  cholmod_common *Common
1259 ) ;
1260 
1262 
1263 /* -------------------------------------------------------------------------- */
1264 /* cholmod_transpose_unsym: transpose an unsymmetric sparse matrix */
1265 /* -------------------------------------------------------------------------- */
1266 
1267 /* Compute F = A', A (:,f)', or A (p,f)', where A is unsymmetric and F is
1268  * already allocated. See cholmod_transpose for a simpler routine. */
1269 
1271 (
1272  /* ---- input ---- */
1273  cholmod_sparse *A, /* matrix to transpose */
1274  int values, /* 0: pattern, 1: array transpose, 2: conj. transpose */
1275  int *Perm, /* size nrow, if present (can be NULL) */
1276  int *fset, /* subset of 0:(A->ncol)-1 */
1277  size_t fsize, /* size of fset */
1278  /* ---- output --- */
1279  cholmod_sparse *F, /* F = A', A(:,f)', or A(p,f)' */
1280  /* --------------- */
1281  cholmod_common *Common
1282 ) ;
1283 
1285  size_t, cholmod_sparse *, cholmod_common *) ;
1286 
1287 /* -------------------------------------------------------------------------- */
1288 /* cholmod_transpose_sym: transpose a symmetric sparse matrix */
1289 /* -------------------------------------------------------------------------- */
1290 
1291 /* Compute F = A' or A (p,p)', where A is symmetric and F is already allocated.
1292  * See cholmod_transpose for a simpler routine. */
1293 
1295 (
1296  /* ---- input ---- */
1297  cholmod_sparse *A, /* matrix to transpose */
1298  int values, /* 0: pattern, 1: array transpose, 2: conj. transpose */
1299  int *Perm, /* size nrow, if present (can be NULL) */
1300  /* ---- output --- */
1301  cholmod_sparse *F, /* F = A' or A(p,p)' */
1302  /* --------------- */
1303  cholmod_common *Common
1304 ) ;
1305 
1307  cholmod_common *) ;
1308 
1309 /* -------------------------------------------------------------------------- */
1310 /* cholmod_ptranspose: transpose a sparse matrix */
1311 /* -------------------------------------------------------------------------- */
1312 
1313 /* Return A' or A(p,p)' if A is symmetric. Return A', A(:,f)', or A(p,f)' if
1314  * A is unsymmetric. */
1315 
1317 (
1318  /* ---- input ---- */
1319  cholmod_sparse *A, /* matrix to transpose */
1320  int values, /* 0: pattern, 1: array transpose, 2: conj. transpose */
1321  int *Perm, /* if non-NULL, F = A(p,f) or A(p,p) */
1322  int *fset, /* subset of 0:(A->ncol)-1 */
1323  size_t fsize, /* size of fset */
1324  /* --------------- */
1325  cholmod_common *Common
1326 ) ;
1327 
1329  UF_long *, size_t, cholmod_common *) ;
1330 
1331 /* -------------------------------------------------------------------------- */
1332 /* cholmod_sort: sort row indices in each column of sparse matrix */
1333 /* -------------------------------------------------------------------------- */
1334 
1336 (
1337  /* ---- in/out --- */
1338  cholmod_sparse *A, /* matrix to sort */
1339  /* --------------- */
1340  cholmod_common *Common
1341 ) ;
1342 
1344 
1345 /* -------------------------------------------------------------------------- */
1346 /* cholmod_band: C = tril (triu (A,k1), k2) */
1347 /* -------------------------------------------------------------------------- */
1348 
1350 (
1351  /* ---- input ---- */
1352  cholmod_sparse *A, /* matrix to extract band matrix from */
1353  UF_long k1, /* ignore entries below the k1-st diagonal */
1354  UF_long k2, /* ignore entries above the k2-nd diagonal */
1355  int mode, /* >0: numerical, 0: pattern, <0: pattern (no diag) */
1356  /* --------------- */
1357  cholmod_common *Common
1358 ) ;
1359 
1361  cholmod_common *) ;
1362 
1363 /* -------------------------------------------------------------------------- */
1364 /* cholmod_band_inplace: A = tril (triu (A,k1), k2) */
1365 /* -------------------------------------------------------------------------- */
1366 
1368 (
1369  /* ---- input ---- */
1370  UF_long k1, /* ignore entries below the k1-st diagonal */
1371  UF_long k2, /* ignore entries above the k2-nd diagonal */
1372  int mode, /* >0: numerical, 0: pattern, <0: pattern (no diag) */
1373  /* ---- in/out --- */
1374  cholmod_sparse *A, /* matrix from which entries not in band are removed */
1375  /* --------------- */
1376  cholmod_common *Common
1377 ) ;
1378 
1380  cholmod_common *) ;
1381 
1382 /* -------------------------------------------------------------------------- */
1383 /* cholmod_aat: C = A*A' or A(:,f)*A(:,f)' */
1384 /* -------------------------------------------------------------------------- */
1385 
1387 (
1388  /* ---- input ---- */
1389  cholmod_sparse *A, /* input matrix; C=A*A' is constructed */
1390  int *fset, /* subset of 0:(A->ncol)-1 */
1391  size_t fsize, /* size of fset */
1392  int mode, /* >0: numerical, 0: pattern, <0: pattern (no diag),
1393  * -2: pattern only, no diagonal, add 50%+n extra
1394  * space to C */
1395  /* --------------- */
1396  cholmod_common *Common
1397 ) ;
1398 
1400  cholmod_common *) ;
1401 
1402 /* -------------------------------------------------------------------------- */
1403 /* cholmod_copy_sparse: C = A, create an exact copy of a sparse matrix */
1404 /* -------------------------------------------------------------------------- */
1405 
1407 (
1408  /* ---- input ---- */
1409  cholmod_sparse *A, /* matrix to copy */
1410  /* --------------- */
1411  cholmod_common *Common
1412 ) ;
1413 
1415 
1416 /* -------------------------------------------------------------------------- */
1417 /* cholmod_copy: C = A, with possible change of stype */
1418 /* -------------------------------------------------------------------------- */
1419 
1421 (
1422  /* ---- input ---- */
1423  cholmod_sparse *A, /* matrix to copy */
1424  int stype, /* requested stype of C */
1425  int mode, /* >0: numerical, 0: pattern, <0: pattern (no diag) */
1426  /* --------------- */
1427  cholmod_common *Common
1428 ) ;
1429 
1431 
1432 /* -------------------------------------------------------------------------- */
1433 /* cholmod_add: C = alpha*A + beta*B */
1434 /* -------------------------------------------------------------------------- */
1435 
1437 (
1438  /* ---- input ---- */
1439  cholmod_sparse *A, /* matrix to add */
1440  cholmod_sparse *B, /* matrix to add */
1441  double alpha [2], /* scale factor for A */
1442  double beta [2], /* scale factor for B */
1443  int values, /* if TRUE compute the numerical values of C */
1444  int sorted, /* if TRUE, sort columns of C */
1445  /* --------------- */
1446  cholmod_common *Common
1447 ) ;
1448 
1450  double *, int, int, cholmod_common *) ;
1451 
1452 /* -------------------------------------------------------------------------- */
1453 /* cholmod_sparse_xtype: change the xtype of a sparse matrix */
1454 /* -------------------------------------------------------------------------- */
1455 
1457 (
1458  /* ---- input ---- */
1459  int to_xtype, /* requested xtype (pattern, real, complex, zomplex) */
1460  /* ---- in/out --- */
1461  cholmod_sparse *A, /* sparse matrix to change */
1462  /* --------------- */
1463  cholmod_common *Common
1464 ) ;
1465 
1467 
1468 
1469 /* ========================================================================== */
1470 /* === Core/cholmod_factor ================================================== */
1471 /* ========================================================================== */
1472 
1473 /* A symbolic and numeric factorization, either simplicial or supernodal.
1474  * In all cases, the row indices in the columns of L are kept sorted. */
1475 
1477 {
1478  /* ---------------------------------------------------------------------- */
1479  /* for both simplicial and supernodal factorizations */
1480  /* ---------------------------------------------------------------------- */
1481 
1482  size_t n ; /* L is n-by-n */
1483 
1484  size_t minor ; /* If the factorization failed, L->minor is the column
1485  * at which it failed (in the range 0 to n-1). A value
1486  * of n means the factorization was successful or
1487  * the matrix has not yet been factorized. */
1488 
1489  /* ---------------------------------------------------------------------- */
1490  /* symbolic ordering and analysis */
1491  /* ---------------------------------------------------------------------- */
1492 
1493  void *Perm ; /* size n, permutation used */
1494  void *ColCount ; /* size n, column counts for simplicial L */
1495 
1496  /* ---------------------------------------------------------------------- */
1497  /* simplicial factorization */
1498  /* ---------------------------------------------------------------------- */
1499 
1500  size_t nzmax ; /* size of i and x */
1501 
1502  void *p ; /* p [0..ncol], the column pointers */
1503  void *i ; /* i [0..nzmax-1], the row indices */
1504  void *x ; /* x [0..nzmax-1], the numerical values */
1505  void *z ;
1506  void *nz ; /* nz [0..ncol-1], the # of nonzeros in each column.
1507  * i [p [j] ... p [j]+nz[j]-1] contains the row indices,
1508  * and the numerical values are in the same locatins
1509  * in x. The value of i [p [k]] is always k. */
1510 
1511  void *next ; /* size ncol+2. next [j] is the next column in i/x */
1512  void *prev ; /* size ncol+2. prev [j] is the prior column in i/x.
1513  * head of the list is ncol+1, and the tail is ncol. */
1514 
1515  /* ---------------------------------------------------------------------- */
1516  /* supernodal factorization */
1517  /* ---------------------------------------------------------------------- */
1518 
1519  /* Note that L->x is shared with the simplicial data structure. L->x has
1520  * size L->nzmax for a simplicial factor, and size L->xsize for a supernodal
1521  * factor. */
1522 
1523  size_t nsuper ; /* number of supernodes */
1524  size_t ssize ; /* size of s, integer part of supernodes */
1525  size_t xsize ; /* size of x, real part of supernodes */
1526  size_t maxcsize ; /* size of largest update matrix */
1527  size_t maxesize ; /* max # of rows in supernodes, excl. triangular part */
1528 
1529  void *super ; /* size nsuper+1, first col in each supernode */
1530  void *pi ; /* size nsuper+1, pointers to integer patterns */
1531  void *px ; /* size nsuper+1, pointers to real parts */
1532  void *s ; /* size ssize, integer part of supernodes */
1533 
1534  /* ---------------------------------------------------------------------- */
1535  /* factorization type */
1536  /* ---------------------------------------------------------------------- */
1537 
1538  int ordering ; /* ordering method used */
1539 
1540  int is_ll ; /* TRUE if LL', FALSE if LDL' */
1541  int is_super ; /* TRUE if supernodal, FALSE if simplicial */
1542  int is_monotonic ; /* TRUE if columns of L appear in order 0..n-1.
1543  * Only applicable to simplicial numeric types. */
1544 
1545  /* There are 8 types of factor objects that cholmod_factor can represent
1546  * (only 6 are used):
1547  *
1548  * Numeric types (xtype is not CHOLMOD_PATTERN)
1549  * --------------------------------------------
1550  *
1551  * simplicial LDL': (is_ll FALSE, is_super FALSE). Stored in compressed
1552  * column form, using the simplicial components above (nzmax, p, i,
1553  * x, z, nz, next, and prev). The unit diagonal of L is not stored,
1554  * and D is stored in its place. There are no supernodes.
1555  *
1556  * simplicial LL': (is_ll TRUE, is_super FALSE). Uses the same storage
1557  * scheme as the simplicial LDL', except that D does not appear.
1558  * The first entry of each column of L is the diagonal entry of
1559  * that column of L.
1560  *
1561  * supernodal LDL': (is_ll FALSE, is_super TRUE). Not used.
1562  * FUTURE WORK: add support for supernodal LDL'
1563  *
1564  * supernodal LL': (is_ll TRUE, is_super TRUE). A supernodal factor,
1565  * using the supernodal components described above (nsuper, ssize,
1566  * xsize, maxcsize, maxesize, super, pi, px, s, x, and z).
1567  *
1568  *
1569  * Symbolic types (xtype is CHOLMOD_PATTERN)
1570  * -----------------------------------------
1571  *
1572  * simplicial LDL': (is_ll FALSE, is_super FALSE). Nothing is present
1573  * except Perm and ColCount.
1574  *
1575  * simplicial LL': (is_ll TRUE, is_super FALSE). Identical to the
1576  * simplicial LDL', except for the is_ll flag.
1577  *
1578  * supernodal LDL': (is_ll FALSE, is_super TRUE). Not used.
1579  * FUTURE WORK: add support for supernodal LDL'
1580  *
1581  * supernodal LL': (is_ll TRUE, is_super TRUE). A supernodal symbolic
1582  * factorization. The simplicial symbolic information is present
1583  * (Perm and ColCount), as is all of the supernodal factorization
1584  * except for the numerical values (x and z).
1585  */
1586 
1587  int itype ; /* The integer arrays are Perm, ColCount, p, i, nz,
1588  * next, prev, super, pi, px, and s. If itype is
1589  * CHOLMOD_INT, all of these are int arrays.
1590  * CHOLMOD_INTLONG: p, pi, px are UF_long, others int.
1591  * CHOLMOD_LONG: all integer arrays are UF_long. */
1592  int xtype ; /* pattern, real, complex, or zomplex */
1593  int dtype ; /* x and z double or float */
1594 
1595 } cholmod_factor ;
1596 
1597 
1598 /* -------------------------------------------------------------------------- */
1599 /* cholmod_allocate_factor: allocate a factor (symbolic LL' or LDL') */
1600 /* -------------------------------------------------------------------------- */
1601 
1603 (
1604  /* ---- input ---- */
1605  size_t n, /* L is n-by-n */
1606  /* --------------- */
1607  cholmod_common *Common
1608 ) ;
1609 
1611 
1612 /* -------------------------------------------------------------------------- */
1613 /* cholmod_free_factor: free a factor */
1614 /* -------------------------------------------------------------------------- */
1615 
1617 (
1618  /* ---- in/out --- */
1619  cholmod_factor **L, /* factor to free, NULL on output */
1620  /* --------------- */
1621  cholmod_common *Common
1622 ) ;
1623 
1625 
1626 /* -------------------------------------------------------------------------- */
1627 /* cholmod_reallocate_factor: change the # entries in a factor */
1628 /* -------------------------------------------------------------------------- */
1629 
1631 (
1632  /* ---- input ---- */
1633  size_t nznew, /* new # of entries in L */
1634  /* ---- in/out --- */
1635  cholmod_factor *L, /* factor to modify */
1636  /* --------------- */
1637  cholmod_common *Common
1638 ) ;
1639 
1641 
1642 /* -------------------------------------------------------------------------- */
1643 /* cholmod_change_factor: change the type of factor (e.g., LDL' to LL') */
1644 /* -------------------------------------------------------------------------- */
1645 
1647 (
1648  /* ---- input ---- */
1649  int to_xtype, /* to CHOLMOD_PATTERN, _REAL, _COMPLEX, _ZOMPLEX */
1650  int to_ll, /* TRUE: convert to LL', FALSE: LDL' */
1651  int to_super, /* TRUE: convert to supernodal, FALSE: simplicial */
1652  int to_packed, /* TRUE: pack simplicial columns, FALSE: do not pack */
1653  int to_monotonic, /* TRUE: put simplicial columns in order, FALSE: not */
1654  /* ---- in/out --- */
1655  cholmod_factor *L, /* factor to modify */
1656  /* --------------- */
1657  cholmod_common *Common
1658 ) ;
1659 
1660 int amesos_cholmod_l_change_factor ( int, int, int, int, int, cholmod_factor *,
1661  cholmod_common *) ;
1662 
1663 /* -------------------------------------------------------------------------- */
1664 /* cholmod_pack_factor: pack the columns of a factor */
1665 /* -------------------------------------------------------------------------- */
1666 
1667 /* Pack the columns of a simplicial factor. Unlike cholmod_change_factor,
1668  * it can pack the columns of a factor even if they are not stored in their
1669  * natural order (non-monotonic). */
1670 
1672 (
1673  /* ---- in/out --- */
1674  cholmod_factor *L, /* factor to modify */
1675  /* --------------- */
1676  cholmod_common *Common
1677 ) ;
1678 
1680 
1681 /* -------------------------------------------------------------------------- */
1682 /* cholmod_reallocate_column: resize a single column of a factor */
1683 /* -------------------------------------------------------------------------- */
1684 
1686 (
1687  /* ---- input ---- */
1688  size_t j, /* the column to reallocate */
1689  size_t need, /* required size of column j */
1690  /* ---- in/out --- */
1691  cholmod_factor *L, /* factor to modify */
1692  /* --------------- */
1693  cholmod_common *Common
1694 ) ;
1695 
1696 int amesos_cholmod_l_reallocate_column (size_t, size_t, cholmod_factor *,
1697  cholmod_common *) ;
1698 
1699 /* -------------------------------------------------------------------------- */
1700 /* cholmod_factor_to_sparse: create a sparse matrix copy of a factor */
1701 /* -------------------------------------------------------------------------- */
1702 
1703 /* Only operates on numeric factors, not symbolic ones */
1704 
1706 (
1707  /* ---- in/out --- */
1708  cholmod_factor *L, /* factor to copy, converted to symbolic on output */
1709  /* --------------- */
1710  cholmod_common *Common
1711 ) ;
1712 
1714  cholmod_common *) ;
1715 
1716 /* -------------------------------------------------------------------------- */
1717 /* cholmod_copy_factor: create a copy of a factor */
1718 /* -------------------------------------------------------------------------- */
1719 
1721 (
1722  /* ---- input ---- */
1723  cholmod_factor *L, /* factor to copy */
1724  /* --------------- */
1725  cholmod_common *Common
1726 ) ;
1727 
1729 
1730 /* -------------------------------------------------------------------------- */
1731 /* cholmod_factor_xtype: change the xtype of a factor */
1732 /* -------------------------------------------------------------------------- */
1733 
1735 (
1736  /* ---- input ---- */
1737  int to_xtype, /* requested xtype (real, complex, or zomplex) */
1738  /* ---- in/out --- */
1739  cholmod_factor *L, /* factor to change */
1740  /* --------------- */
1741  cholmod_common *Common
1742 ) ;
1743 
1745 
1746 
1747 /* ========================================================================== */
1748 /* === Core/cholmod_dense =================================================== */
1749 /* ========================================================================== */
1750 
1751 /* A dense matrix in column-oriented form. It has no itype since it contains
1752  * no integers. Entry in row i and column j is located in x [i+j*d].
1753  */
1754 
1755 typedef struct cholmod_dense_struct
1756 {
1757  size_t nrow ; /* the matrix is nrow-by-ncol */
1758  size_t ncol ;
1759  size_t nzmax ; /* maximum number of entries in the matrix */
1760  size_t d ; /* leading dimension (d >= nrow must hold) */
1761  void *x ; /* size nzmax or 2*nzmax, if present */
1762  void *z ; /* size nzmax, if present */
1763  int xtype ; /* pattern, real, complex, or zomplex */
1764  int dtype ; /* x and z double or float */
1765 
1766 } cholmod_dense ;
1767 
1768 /* -------------------------------------------------------------------------- */
1769 /* cholmod_allocate_dense: allocate a dense matrix (contents uninitialized) */
1770 /* -------------------------------------------------------------------------- */
1771 
1773 (
1774  /* ---- input ---- */
1775  size_t nrow, /* # of rows of matrix */
1776  size_t ncol, /* # of columns of matrix */
1777  size_t d, /* leading dimension */
1778  int xtype, /* CHOLMOD_REAL, _COMPLEX, or _ZOMPLEX */
1779  /* --------------- */
1780  cholmod_common *Common
1781 ) ;
1782 
1783 cholmod_dense *amesos_cholmod_l_allocate_dense (size_t, size_t, size_t, int,
1784  cholmod_common *) ;
1785 
1786 /* -------------------------------------------------------------------------- */
1787 /* cholmod_zeros: allocate a dense matrix and set it to zero */
1788 /* -------------------------------------------------------------------------- */
1789 
1791 (
1792  /* ---- input ---- */
1793  size_t nrow, /* # of rows of matrix */
1794  size_t ncol, /* # of columns of matrix */
1795  int xtype, /* CHOLMOD_REAL, _COMPLEX, or _ZOMPLEX */
1796  /* --------------- */
1797  cholmod_common *Common
1798 ) ;
1799 
1800 cholmod_dense *amesos_cholmod_l_zeros (size_t, size_t, int, cholmod_common *) ;
1801 
1802 /* -------------------------------------------------------------------------- */
1803 /* cholmod_ones: allocate a dense matrix and set it to all ones */
1804 /* -------------------------------------------------------------------------- */
1805 
1807 (
1808  /* ---- input ---- */
1809  size_t nrow, /* # of rows of matrix */
1810  size_t ncol, /* # of columns of matrix */
1811  int xtype, /* CHOLMOD_REAL, _COMPLEX, or _ZOMPLEX */
1812  /* --------------- */
1813  cholmod_common *Common
1814 ) ;
1815 
1816 cholmod_dense *amesos_cholmod_l_ones (size_t, size_t, int, cholmod_common *) ;
1817 
1818 /* -------------------------------------------------------------------------- */
1819 /* cholmod_eye: allocate a dense matrix and set it to the identity matrix */
1820 /* -------------------------------------------------------------------------- */
1821 
1823 (
1824  /* ---- input ---- */
1825  size_t nrow, /* # of rows of matrix */
1826  size_t ncol, /* # of columns of matrix */
1827  int xtype, /* CHOLMOD_REAL, _COMPLEX, or _ZOMPLEX */
1828  /* --------------- */
1829  cholmod_common *Common
1830 ) ;
1831 
1832 cholmod_dense *amesos_cholmod_l_eye (size_t, size_t, int, cholmod_common *) ;
1833 
1834 /* -------------------------------------------------------------------------- */
1835 /* cholmod_free_dense: free a dense matrix */
1836 /* -------------------------------------------------------------------------- */
1837 
1839 (
1840  /* ---- in/out --- */
1841  cholmod_dense **X, /* dense matrix to deallocate, NULL on output */
1842  /* --------------- */
1843  cholmod_common *Common
1844 ) ;
1845 
1847 
1848 /* -------------------------------------------------------------------------- */
1849 /* cholmod_sparse_to_dense: create a dense matrix copy of a sparse matrix */
1850 /* -------------------------------------------------------------------------- */
1851 
1853 (
1854  /* ---- input ---- */
1855  cholmod_sparse *A, /* matrix to copy */
1856  /* --------------- */
1857  cholmod_common *Common
1858 ) ;
1859 
1861  cholmod_common *) ;
1862 
1863 /* -------------------------------------------------------------------------- */
1864 /* cholmod_dense_to_sparse: create a sparse matrix copy of a dense matrix */
1865 /* -------------------------------------------------------------------------- */
1866 
1868 (
1869  /* ---- input ---- */
1870  cholmod_dense *X, /* matrix to copy */
1871  int values, /* TRUE if values to be copied, FALSE otherwise */
1872  /* --------------- */
1873  cholmod_common *Common
1874 ) ;
1875 
1877  cholmod_common *) ;
1878 
1879 /* -------------------------------------------------------------------------- */
1880 /* cholmod_copy_dense: create a copy of a dense matrix */
1881 /* -------------------------------------------------------------------------- */
1882 
1884 (
1885  /* ---- input ---- */
1886  cholmod_dense *X, /* matrix to copy */
1887  /* --------------- */
1888  cholmod_common *Common
1889 ) ;
1890 
1892 
1893 /* -------------------------------------------------------------------------- */
1894 /* cholmod_copy_dense2: copy a dense matrix (pre-allocated) */
1895 /* -------------------------------------------------------------------------- */
1896 
1898 (
1899  /* ---- input ---- */
1900  cholmod_dense *X, /* matrix to copy */
1901  /* ---- output --- */
1902  cholmod_dense *Y, /* copy of matrix X */
1903  /* --------------- */
1904  cholmod_common *Common
1905 ) ;
1906 
1908 
1909 /* -------------------------------------------------------------------------- */
1910 /* cholmod_dense_xtype: change the xtype of a dense matrix */
1911 /* -------------------------------------------------------------------------- */
1912 
1914 (
1915  /* ---- input ---- */
1916  int to_xtype, /* requested xtype (real, complex,or zomplex) */
1917  /* ---- in/out --- */
1918  cholmod_dense *X, /* dense matrix to change */
1919  /* --------------- */
1920  cholmod_common *Common
1921 ) ;
1922 
1924 
1925 
1926 /* ========================================================================== */
1927 /* === Core/cholmod_triplet ================================================= */
1928 /* ========================================================================== */
1929 
1930 /* A sparse matrix stored in triplet form. */
1931 
1933 {
1934  size_t nrow ; /* the matrix is nrow-by-ncol */
1935  size_t ncol ;
1936  size_t nzmax ; /* maximum number of entries in the matrix */
1937  size_t nnz ; /* number of nonzeros in the matrix */
1938 
1939  void *i ; /* i [0..nzmax-1], the row indices */
1940  void *j ; /* j [0..nzmax-1], the column indices */
1941  void *x ; /* size nzmax or 2*nzmax, if present */
1942  void *z ; /* size nzmax, if present */
1943 
1944  int stype ; /* Describes what parts of the matrix are considered:
1945  *
1946  * 0: matrix is "unsymmetric": use both upper and lower triangular parts
1947  * (the matrix may actually be symmetric in pattern and value, but
1948  * both parts are explicitly stored and used). May be square or
1949  * rectangular.
1950  * >0: matrix is square and symmetric. Entries in the lower triangular
1951  * part are transposed and added to the upper triangular part when
1952  * the matrix is converted to cholmod_sparse form.
1953  * <0: matrix is square and symmetric. Entries in the upper triangular
1954  * part are transposed and added to the lower triangular part when
1955  * the matrix is converted to cholmod_sparse form.
1956  *
1957  * Note that stype>0 and stype<0 are different for cholmod_sparse and
1958  * cholmod_triplet. The reason is simple. You can permute a symmetric
1959  * triplet matrix by simply replacing a row and column index with their
1960  * new row and column indices, via an inverse permutation. Suppose
1961  * P = L->Perm is your permutation, and Pinv is an array of size n.
1962  * Suppose a symmetric matrix A is represent by a triplet matrix T, with
1963  * entries only in the upper triangular part. Then the following code:
1964  *
1965  * Ti = T->i ;
1966  * Tj = T->j ;
1967  * for (k = 0 ; k < n ; k++) Pinv [P [k]] = k ;
1968  * for (k = 0 ; k < nz ; k++) Ti [k] = Pinv [Ti [k]] ;
1969  * for (k = 0 ; k < nz ; k++) Tj [k] = Pinv [Tj [k]] ;
1970  *
1971  * creates the triplet form of C=P*A*P'. However, if T initially
1972  * contains just the upper triangular entries (T->stype = 1), after
1973  * permutation it has entries in both the upper and lower triangular
1974  * parts. These entries should be transposed when constructing the
1975  * cholmod_sparse form of A, which is what cholmod_triplet_to_sparse
1976  * does. Thus:
1977  *
1978  * C = cholmod_triplet_to_sparse (T, 0, &Common) ;
1979  *
1980  * will return the matrix C = P*A*P'.
1981  *
1982  * Since the triplet matrix T is so simple to generate, it's quite easy
1983  * to remove entries that you do not want, prior to converting T to the
1984  * cholmod_sparse form. So if you include these entries in T, CHOLMOD
1985  * assumes that there must be a reason (such as the one above). Thus,
1986  * no entry in a triplet matrix is ever ignored.
1987  */
1988 
1989  int itype ; /* CHOLMOD_LONG: i and j are UF_long. Otherwise int. */
1990  int xtype ; /* pattern, real, complex, or zomplex */
1991  int dtype ; /* x and z are double or float */
1992 
1993 } cholmod_triplet ;
1994 
1995 /* -------------------------------------------------------------------------- */
1996 /* cholmod_allocate_triplet: allocate a triplet matrix */
1997 /* -------------------------------------------------------------------------- */
1998 
2000 (
2001  /* ---- input ---- */
2002  size_t nrow, /* # of rows of T */
2003  size_t ncol, /* # of columns of T */
2004  size_t nzmax, /* max # of nonzeros of T */
2005  int stype, /* stype of T */
2006  int xtype, /* CHOLMOD_PATTERN, _REAL, _COMPLEX, or _ZOMPLEX */
2007  /* --------------- */
2008  cholmod_common *Common
2009 ) ;
2010 
2011 cholmod_triplet *amesos_cholmod_l_allocate_triplet (size_t, size_t, size_t, int, int,
2012  cholmod_common *) ;
2013 
2014 /* -------------------------------------------------------------------------- */
2015 /* cholmod_free_triplet: free a triplet matrix */
2016 /* -------------------------------------------------------------------------- */
2017 
2019 (
2020  /* ---- in/out --- */
2021  cholmod_triplet **T, /* triplet matrix to deallocate, NULL on output */
2022  /* --------------- */
2023  cholmod_common *Common
2024 ) ;
2025 
2027 
2028 /* -------------------------------------------------------------------------- */
2029 /* cholmod_reallocate_triplet: change the # of entries in a triplet matrix */
2030 /* -------------------------------------------------------------------------- */
2031 
2033 (
2034  /* ---- input ---- */
2035  size_t nznew, /* new # of entries in T */
2036  /* ---- in/out --- */
2037  cholmod_triplet *T, /* triplet matrix to modify */
2038  /* --------------- */
2039  cholmod_common *Common
2040 ) ;
2041 
2043 
2044 /* -------------------------------------------------------------------------- */
2045 /* cholmod_sparse_to_triplet: create a triplet matrix copy of a sparse matrix*/
2046 /* -------------------------------------------------------------------------- */
2047 
2049 (
2050  /* ---- input ---- */
2051  cholmod_sparse *A, /* matrix to copy */
2052  /* --------------- */
2053  cholmod_common *Common
2054 ) ;
2055 
2057  cholmod_common *) ;
2058 
2059 /* -------------------------------------------------------------------------- */
2060 /* cholmod_triplet_to_sparse: create a sparse matrix copy of a triplet matrix*/
2061 /* -------------------------------------------------------------------------- */
2062 
2064 (
2065  /* ---- input ---- */
2066  cholmod_triplet *T, /* matrix to copy */
2067  size_t nzmax, /* allocate at least this much space in output matrix */
2068  /* --------------- */
2069  cholmod_common *Common
2070 ) ;
2071 
2073  cholmod_common *) ;
2074 
2075 /* -------------------------------------------------------------------------- */
2076 /* cholmod_copy_triplet: create a copy of a triplet matrix */
2077 /* -------------------------------------------------------------------------- */
2078 
2080 (
2081  /* ---- input ---- */
2082  cholmod_triplet *T, /* matrix to copy */
2083  /* --------------- */
2084  cholmod_common *Common
2085 ) ;
2086 
2088 
2089 /* -------------------------------------------------------------------------- */
2090 /* cholmod_triplet_xtype: change the xtype of a triplet matrix */
2091 /* -------------------------------------------------------------------------- */
2092 
2094 (
2095  /* ---- input ---- */
2096  int to_xtype, /* requested xtype (pattern, real, complex,or zomplex)*/
2097  /* ---- in/out --- */
2098  cholmod_triplet *T, /* triplet matrix to change */
2099  /* --------------- */
2100  cholmod_common *Common
2101 ) ;
2102 
2104 
2105 
2106 /* ========================================================================== */
2107 /* === Core/cholmod_memory ================================================== */
2108 /* ========================================================================== */
2109 
2110 /* The user may make use of these, just like malloc and free. You can even
2111  * malloc an object and safely free it with cholmod_free, and visa versa
2112  * (except that the memory usage statistics will be corrupted). These routines
2113  * do differ from malloc and free. If cholmod_free is given a NULL pointer,
2114  * for example, it does nothing (unlike the ANSI free). cholmod_realloc does
2115  * not return NULL if given a non-NULL pointer and a nonzero size, even if it
2116  * fails (it returns the original pointer and sets an error code in
2117  * Common->status instead).
2118  *
2119  * CHOLMOD keeps track of the amount of memory it has allocated, and so the
2120  * cholmod_free routine also takes the size of the object being freed. This
2121  * is only used for statistics. If you, the user of CHOLMOD, pass the wrong
2122  * size, the only consequence is that the memory usage statistics will be
2123  * corrupted.
2124  */
2125 
2126 void *amesos_cholmod_malloc /* returns pointer to the newly malloc'd block */
2127 (
2128  /* ---- input ---- */
2129  size_t n, /* number of items */
2130  size_t size, /* size of each item */
2131  /* --------------- */
2132  cholmod_common *Common
2133 ) ;
2134 
2135 void *amesos_cholmod_l_malloc (size_t, size_t, cholmod_common *) ;
2136 
2137 void *amesos_cholmod_calloc /* returns pointer to the newly calloc'd block */
2138 (
2139  /* ---- input ---- */
2140  size_t n, /* number of items */
2141  size_t size, /* size of each item */
2142  /* --------------- */
2143  cholmod_common *Common
2144 ) ;
2145 
2146 void *amesos_cholmod_l_calloc (size_t, size_t, cholmod_common *) ;
2147 
2148 void *amesos_cholmod_free /* always returns NULL */
2149 (
2150  /* ---- input ---- */
2151  size_t n, /* number of items */
2152  size_t size, /* size of each item */
2153  /* ---- in/out --- */
2154  void *p, /* block of memory to free */
2155  /* --------------- */
2156  cholmod_common *Common
2157 ) ;
2158 
2159 void *amesos_cholmod_l_free (size_t, size_t, void *, cholmod_common *) ;
2160 
2161 void *amesos_cholmod_realloc /* returns pointer to reallocated block */
2162 (
2163  /* ---- input ---- */
2164  size_t nnew, /* requested # of items in reallocated block */
2165  size_t size, /* size of each item */
2166  /* ---- in/out --- */
2167  void *p, /* block of memory to realloc */
2168  size_t *n, /* current size on input, nnew on output if successful*/
2169  /* --------------- */
2170  cholmod_common *Common
2171 ) ;
2172 
2173 void *amesos_cholmod_l_realloc (size_t, size_t, void *, size_t *, cholmod_common *) ;
2174 
2176 (
2177  /* ---- input ---- */
2178  size_t nnew, /* requested # of items in reallocated blocks */
2179  int nint, /* number of int/UF_long blocks */
2180  int xtype, /* CHOLMOD_PATTERN, _REAL, _COMPLEX, or _ZOMPLEX */
2181  /* ---- in/out --- */
2182  void **I, /* int or UF_long block */
2183  void **J, /* int or UF_long block */
2184  void **X, /* complex, double, or float block */
2185  void **Z, /* zomplex case only: double or float block */
2186  size_t *n, /* current size of the I,J,X,Z blocks on input,
2187  * nnew on output if successful */
2188  /* --------------- */
2189  cholmod_common *Common
2190 ) ;
2191 
2192 int amesos_cholmod_l_realloc_multiple (size_t, int, int, void **, void **, void **,
2193  void **, size_t *, cholmod_common *) ;
2194 
2195 /* ========================================================================== */
2196 /* === symmetry types ======================================================= */
2197 /* ========================================================================== */
2198 
2199 #define CHOLMOD_MM_RECTANGULAR 1
2200 #define CHOLMOD_MM_UNSYMMETRIC 2
2201 #define CHOLMOD_MM_SYMMETRIC 3
2202 #define CHOLMOD_MM_HERMITIAN 4
2203 #define CHOLMOD_MM_SKEW_SYMMETRIC 5
2204 #define CHOLMOD_MM_SYMMETRIC_POSDIAG 6
2205 #define CHOLMOD_MM_HERMITIAN_POSDIAG 7
2206 
2207 /* ========================================================================== */
2208 /* === Numerical relop macros =============================================== */
2209 /* ========================================================================== */
2210 
2211 /* These macros correctly handle the NaN case.
2212  *
2213  * CHOLMOD_IS_NAN(x):
2214  * True if x is NaN. False otherwise. The commonly-existing isnan(x)
2215  * function could be used, but it's not in Kernighan & Ritchie 2nd edition
2216  * (ANSI C89). It may appear in <math.h>, but I'm not certain about
2217  * portability. The expression x != x is true if and only if x is NaN,
2218  * according to the IEEE 754 floating-point standard.
2219  *
2220  * CHOLMOD_IS_ZERO(x):
2221  * True if x is zero. False if x is nonzero, NaN, or +/- Inf.
2222  * This is (x == 0) if the compiler is IEEE 754 compliant.
2223  *
2224  * CHOLMOD_IS_NONZERO(x):
2225  * True if x is nonzero, NaN, or +/- Inf. False if x zero.
2226  * This is (x != 0) if the compiler is IEEE 754 compliant.
2227  *
2228  * CHOLMOD_IS_LT_ZERO(x):
2229  * True if x is < zero or -Inf. False if x is >= 0, NaN, or +Inf.
2230  * This is (x < 0) if the compiler is IEEE 754 compliant.
2231  *
2232  * CHOLMOD_IS_GT_ZERO(x):
2233  * True if x is > zero or +Inf. False if x is <= 0, NaN, or -Inf.
2234  * This is (x > 0) if the compiler is IEEE 754 compliant.
2235  *
2236  * CHOLMOD_IS_LE_ZERO(x):
2237  * True if x is <= zero or -Inf. False if x is > 0, NaN, or +Inf.
2238  * This is (x <= 0) if the compiler is IEEE 754 compliant.
2239  */
2240 
2241 #ifdef CHOLMOD_WINDOWS
2242 
2243 /* Yes, this is exceedingly ugly. Blame Microsoft, which hopelessly */
2244 /* violates the IEEE 754 floating-point standard in a bizarre way. */
2245 /* If you're using an IEEE 754-compliant compiler, then x != x is true */
2246 /* iff x is NaN. For Microsoft, (x < x) is true iff x is NaN. */
2247 /* So either way, this macro safely detects a NaN. */
2248 #define CHOLMOD_IS_NAN(x) (((x) != (x)) || (((x) < (x))))
2249 #define CHOLMOD_IS_ZERO(x) (((x) == 0.) && !CHOLMOD_IS_NAN(x))
2250 #define CHOLMOD_IS_NONZERO(x) (((x) != 0.) || CHOLMOD_IS_NAN(x))
2251 #define CHOLMOD_IS_LT_ZERO(x) (((x) < 0.) && !CHOLMOD_IS_NAN(x))
2252 #define CHOLMOD_IS_GT_ZERO(x) (((x) > 0.) && !CHOLMOD_IS_NAN(x))
2253 #define CHOLMOD_IS_LE_ZERO(x) (((x) <= 0.) && !CHOLMOD_IS_NAN(x))
2254 
2255 #else
2256 
2257 /* These all work properly, according to the IEEE 754 standard ... except on */
2258 /* a PC with windows. Works fine in Linux on the same PC... */
2259 #define CHOLMOD_IS_NAN(x) ((x) != (x))
2260 #define CHOLMOD_IS_ZERO(x) ((x) == 0.)
2261 #define CHOLMOD_IS_NONZERO(x) ((x) != 0.)
2262 #define CHOLMOD_IS_LT_ZERO(x) ((x) < 0.)
2263 #define CHOLMOD_IS_GT_ZERO(x) ((x) > 0.)
2264 #define CHOLMOD_IS_LE_ZERO(x) ((x) <= 0.)
2265 
2266 #endif
2267 
2268 #endif
int amesos_cholmod_l_reallocate_column(size_t, size_t, cholmod_factor *, cholmod_common *)
int amesos_cholmod_l_factor_xtype(int, cholmod_factor *, cholmod_common *)
void * amesos_cholmod_l_calloc(size_t, size_t, cholmod_common *)
void * amesos_cholmod_l_free(size_t, size_t, void *, cholmod_common *)
int amesos_cholmod_error(int status, char *file, int line, char *message, cholmod_common *Common)
cholmod_dense * amesos_cholmod_ones(size_t nrow, size_t ncol, int xtype, cholmod_common *Common)
cholmod_sparse * amesos_cholmod_l_triplet_to_sparse(cholmod_triplet *, size_t, cholmod_common *)
cholmod_dense * amesos_cholmod_copy_dense(cholmod_dense *X, cholmod_common *Common)
int amesos_cholmod_realloc_multiple(size_t nnew, int nint, int xtype, void **I, void **J, void **X, void **Z, size_t *n, cholmod_common *Common)
cholmod_dense * amesos_cholmod_l_eye(size_t, size_t, int, cholmod_common *)
int amesos_cholmod_defaults(cholmod_common *Common)
cholmod_sparse * amesos_cholmod_speye(size_t nrow, size_t ncol, int xtype, cholmod_common *Common)
struct cholmod_triplet_struct cholmod_triplet
int amesos_cholmod_l_triplet_xtype(int, cholmod_triplet *, cholmod_common *)
int(* complex_divide)(double ax, double az, double bx, double bz, double *cx, double *cz)
int(* print_function)(const char *,...)
int amesos_cholmod_free_triplet(cholmod_triplet **T, cholmod_common *Common)
int amesos_cholmod_l_transpose_sym(cholmod_sparse *, int, UF_long *, cholmod_sparse *, cholmod_common *)
cholmod_sparse * amesos_cholmod_triplet_to_sparse(cholmod_triplet *T, size_t nzmax, cholmod_common *Common)
double amesos_cholmod_l_dbound(double, cholmod_common *)
struct cholmod_dense_struct cholmod_dense
int amesos_cholmod_l_dense_xtype(int, cholmod_dense *, cholmod_common *)
int amesos_cholmod_factor_xtype(int to_xtype, cholmod_factor *L, cholmod_common *Common)
cholmod_sparse * amesos_cholmod_l_add(cholmod_sparse *, cholmod_sparse *, double *, double *, int, int, cholmod_common *)
int amesos_cholmod_l_error(int, char *, int, char *, cholmod_common *)
int amesos_cholmod_reallocate_sparse(size_t nznew, cholmod_sparse *A, cholmod_common *Common)
UF_long amesos_cholmod_clear_flag(cholmod_common *Common)
struct cholmod_common_struct::cholmod_method_struct method[CHOLMOD_MAXMETHODS+1]
int amesos_cholmod_l_sort(cholmod_sparse *, cholmod_common *)
struct cholmod_factor_struct cholmod_factor
cholmod_sparse * amesos_cholmod_band(cholmod_sparse *A, UF_long k1, UF_long k2, int mode, cholmod_common *Common)
void * amesos_cholmod_malloc(size_t n, size_t size, cholmod_common *Common)
struct cholmod_common_struct cholmod_common
cholmod_dense * amesos_cholmod_eye(size_t nrow, size_t ncol, int xtype, cholmod_common *Common)
cholmod_dense * amesos_cholmod_l_zeros(size_t, size_t, int, cholmod_common *)
void * amesos_cholmod_calloc(size_t n, size_t size, cholmod_common *Common)
int amesos_cholmod_l_free_triplet(cholmod_triplet **, cholmod_common *)
int amesos_cholmod_l_allocate_work(size_t, size_t, size_t, cholmod_common *)
cholmod_factor * amesos_cholmod_l_allocate_factor(size_t, cholmod_common *)
cholmod_sparse * amesos_cholmod_l_transpose(cholmod_sparse *, int, cholmod_common *)
int amesos_cholmod_l_transpose_unsym(cholmod_sparse *, int, UF_long *, UF_long *, size_t, cholmod_sparse *, cholmod_common *)
int amesos_cholmod_l_copy_dense2(cholmod_dense *, cholmod_dense *, cholmod_common *)
int amesos_cholmod_free_dense(cholmod_dense **X, cholmod_common *Common)
cholmod_sparse * amesos_cholmod_l_allocate_sparse(size_t, size_t, size_t, int, int, int, int, cholmod_common *)
UF_long amesos_cholmod_nnz(cholmod_sparse *A, cholmod_common *Common)
double amesos_cholmod_hypot(double x, double y)
cholmod_sparse * amesos_cholmod_l_spzeros(size_t, size_t, size_t, int, cholmod_common *)
cholmod_triplet * amesos_cholmod_l_sparse_to_triplet(cholmod_sparse *, cholmod_common *)
cholmod_sparse * amesos_cholmod_add(cholmod_sparse *A, cholmod_sparse *B, double alpha[2], double beta[2], int values, int sorted, cholmod_common *Common)
int amesos_cholmod_l_free_work(cholmod_common *)
cholmod_sparse * amesos_cholmod_allocate_sparse(size_t nrow, size_t ncol, size_t nzmax, int sorted, int packed, int stype, int xtype, cholmod_common *Common)
int amesos_cholmod_l_change_factor(int, int, int, int, int, cholmod_factor *, cholmod_common *)
int amesos_cholmod_l_divcomplex(double, double, double, double, double *, double *)
int amesos_cholmod_transpose_unsym(cholmod_sparse *A, int values, int *Perm, int *fset, size_t fsize, cholmod_sparse *F, cholmod_common *Common)
cholmod_dense * amesos_cholmod_l_ones(size_t, size_t, int, cholmod_common *)
cholmod_sparse * amesos_cholmod_l_ptranspose(cholmod_sparse *, int, UF_long *, UF_long *, size_t, cholmod_common *)
cholmod_dense * amesos_cholmod_l_copy_dense(cholmod_dense *, cholmod_common *)
int amesos_cholmod_l_reallocate_triplet(size_t, cholmod_triplet *, cholmod_common *)
int amesos_cholmod_band_inplace(UF_long k1, UF_long k2, int mode, cholmod_sparse *A, cholmod_common *Common)
int amesos_cholmod_l_pack_factor(cholmod_factor *, cholmod_common *)
cholmod_triplet * amesos_cholmod_l_allocate_triplet(size_t, size_t, size_t, int, int, cholmod_common *)
void(* error_handler)(int status, char *file, int line, char *message)
cholmod_dense * amesos_cholmod_sparse_to_dense(cholmod_sparse *A, cholmod_common *Common)
void * amesos_cholmod_l_realloc(size_t, size_t, void *, size_t *, cholmod_common *)
int amesos_cholmod_l_finish(cholmod_common *)
int amesos_cholmod_pack_factor(cholmod_factor *L, cholmod_common *Common)
cholmod_sparse * amesos_cholmod_l_factor_to_sparse(cholmod_factor *, cholmod_common *)
double(* hypotenuse)(double x, double y)
int amesos_cholmod_free_factor(cholmod_factor **L, cholmod_common *Common)
int amesos_cholmod_allocate_work(size_t nrow, size_t iworksize, size_t xworksize, cholmod_common *Common)
int amesos_cholmod_sparse_xtype(int to_xtype, cholmod_sparse *A, cholmod_common *Common)
int amesos_cholmod_dense_xtype(int to_xtype, cholmod_dense *X, cholmod_common *Common)
cholmod_sparse * amesos_cholmod_dense_to_sparse(cholmod_dense *X, int values, cholmod_common *Common)
int amesos_cholmod_reallocate_column(size_t j, size_t need, cholmod_factor *L, cholmod_common *Common)
int amesos_cholmod_change_factor(int to_xtype, int to_ll, int to_super, int to_packed, int to_monotonic, cholmod_factor *L, cholmod_common *Common)
cholmod_sparse * amesos_cholmod_aat(cholmod_sparse *A, int *fset, size_t fsize, int mode, cholmod_common *Common)
int amesos_cholmod_reallocate_triplet(size_t nznew, cholmod_triplet *T, cholmod_common *Common)
cholmod_sparse * amesos_cholmod_l_aat(cholmod_sparse *, UF_long *, size_t, int, cholmod_common *)
cholmod_sparse * amesos_cholmod_l_copy_sparse(cholmod_sparse *, cholmod_common *)
cholmod_sparse * amesos_cholmod_l_band(cholmod_sparse *, UF_long, UF_long, int, cholmod_common *)
cholmod_triplet * amesos_cholmod_l_copy_triplet(cholmod_triplet *, cholmod_common *)
int amesos_cholmod_l_realloc_multiple(size_t, int, int, void **, void **, void **, void **, size_t *, cholmod_common *)
double amesos_cholmod_l_hypot(double, double)
cholmod_dense * amesos_cholmod_allocate_dense(size_t nrow, size_t ncol, size_t d, int xtype, cholmod_common *Common)
cholmod_triplet * amesos_cholmod_allocate_triplet(size_t nrow, size_t ncol, size_t nzmax, int stype, int xtype, cholmod_common *Common)
int amesos_cholmod_free_work(cholmod_common *Common)
cholmod_dense * amesos_cholmod_l_allocate_dense(size_t, size_t, size_t, int, cholmod_common *)
double amesos_cholmod_dbound(double dj, cholmod_common *Common)
size_t amesos_cholmod_l_maxrank(size_t, cholmod_common *)
int amesos_cholmod_l_sparse_xtype(int, cholmod_sparse *, cholmod_common *)
int amesos_cholmod_reallocate_factor(size_t nznew, cholmod_factor *L, cholmod_common *Common)
int amesos_cholmod_l_reallocate_factor(size_t, cholmod_factor *, cholmod_common *)
cholmod_factor * amesos_cholmod_copy_factor(cholmod_factor *L, cholmod_common *Common)
#define CHOLMOD_MAXMETHODS
cholmod_dense * amesos_cholmod_zeros(size_t nrow, size_t ncol, int xtype, cholmod_common *Common)
void * amesos_cholmod_realloc(size_t nnew, size_t size, void *p, size_t *n, cholmod_common *Common)
UF_long amesos_cholmod_l_clear_flag(cholmod_common *)
cholmod_sparse * amesos_cholmod_copy_sparse(cholmod_sparse *A, cholmod_common *Common)
cholmod_sparse * amesos_cholmod_transpose(cholmod_sparse *A, int values, cholmod_common *Common)
cholmod_dense * amesos_cholmod_l_sparse_to_dense(cholmod_sparse *, cholmod_common *)
cholmod_sparse * amesos_cholmod_l_copy(cholmod_sparse *, int, int, cholmod_common *)
int amesos_cholmod_l_free_factor(cholmod_factor **, cholmod_common *)
int amesos_cholmod_copy_dense2(cholmod_dense *X, cholmod_dense *Y, cholmod_common *Common)
int amesos_cholmod_l_band_inplace(UF_long, UF_long, int, cholmod_sparse *, cholmod_common *)
int amesos_cholmod_start(cholmod_common *Common)
int amesos_cholmod_l_reallocate_sparse(size_t, cholmod_sparse *, cholmod_common *)
struct cholmod_sparse_struct cholmod_sparse
cholmod_factor * amesos_cholmod_allocate_factor(size_t n, cholmod_common *Common)
cholmod_sparse * amesos_cholmod_factor_to_sparse(cholmod_factor *L, cholmod_common *Common)
int amesos_cholmod_divcomplex(double ar, double ai, double br, double bi, double *cr, double *ci)
cholmod_sparse * amesos_cholmod_spzeros(size_t nrow, size_t ncol, size_t nzmax, int xtype, cholmod_common *Common)
int amesos_cholmod_l_start(cholmod_common *)
void * amesos_cholmod_l_malloc(size_t, size_t, cholmod_common *)
cholmod_sparse * amesos_cholmod_l_speye(size_t, size_t, int, cholmod_common *)
UF_long amesos_cholmod_l_nnz(cholmod_sparse *, cholmod_common *)
cholmod_sparse * amesos_cholmod_ptranspose(cholmod_sparse *A, int values, int *Perm, int *fset, size_t fsize, cholmod_common *Common)
void * amesos_cholmod_free(size_t n, size_t size, void *p, cholmod_common *Common)
int amesos_cholmod_l_free_sparse(cholmod_sparse **, cholmod_common *)
#define UF_long
int amesos_cholmod_transpose_sym(cholmod_sparse *A, int values, int *Perm, cholmod_sparse *F, cholmod_common *Common)
int amesos_cholmod_finish(cholmod_common *Common)
size_t amesos_cholmod_maxrank(size_t n, cholmod_common *Common)
int n
int amesos_cholmod_triplet_xtype(int to_xtype, cholmod_triplet *T, cholmod_common *Common)
cholmod_triplet * amesos_cholmod_sparse_to_triplet(cholmod_sparse *A, cholmod_common *Common)
cholmod_factor * amesos_cholmod_l_copy_factor(cholmod_factor *, cholmod_common *)
cholmod_sparse * amesos_cholmod_l_dense_to_sparse(cholmod_dense *, int, cholmod_common *)
int amesos_cholmod_free_sparse(cholmod_sparse **A, cholmod_common *Common)
int amesos_cholmod_sort(cholmod_sparse *A, cholmod_common *Common)
int amesos_cholmod_l_free_dense(cholmod_dense **, cholmod_common *)
int amesos_cholmod_l_defaults(cholmod_common *)
cholmod_sparse * amesos_cholmod_copy(cholmod_sparse *A, int stype, int mode, cholmod_common *Common)
cholmod_triplet * amesos_cholmod_copy_triplet(cholmod_triplet *T, cholmod_common *Common)