Fixing errors in klu_analyze_given.
[JKLU.git] / src / main / java / edu / ufl / cise / klu / common / KLU_common.java
blob002ff9e849eb8b1f4381885d1867020e8166f3bf
1 /**
2 * KLU: a sparse LU factorization algorithm.
3 * Copyright (C) 2004-2009, Timothy A. Davis.
4 * Copyright (C) 2011, Richard W. Lincoln.
5 * http://www.cise.ufl.edu/research/sparse/klu
7 * -------------------------------------------------------------------------
9 * KLU is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * KLU is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this Module; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 package edu.ufl.cise.klu.common;
27 /**
28 * KLU control parameters and statistics.
30 public class KLU_common
33 /* ---------------------------------------------------------------------- */
34 /* parameters */
35 /* ---------------------------------------------------------------------- */
37 public double tol; /* pivot tolerance for diagonal preference */
38 public double memgrow; /* realloc memory growth size for LU factors */
39 public double initmem_amd; /* init. memory size with AMD: c*nnz(L) + n */
40 public double initmem; /* init. memory size: c*nnz(A) + n */
41 public double maxwork; /* maxwork for BTF, <= 0 if no limit */
43 public int btf; /* use BTF pre-ordering, or not */
44 public int ordering; /* 0: AMD, 1: COLAMD, 2: user P and Q,
45 * 3: user function */
46 public int scale; /* row scaling: -1: none (and no error check),
47 * 0: none, 1: sum, 2: max */
49 /* memory management routines */
50 // void *(*malloc_memory) (size_t); /* pointer to malloc */
51 // void *(*realloc_memory) (void *, size_t); /* pointer to realloc */
52 // void (*free_memory) (void *); /* pointer to free */
53 // void *(*calloc_memory) (size_t, size_t); /* pointer to calloc */
55 /* pointer to user ordering function */
56 public Object user_order;
59 /* pointer to user data, passed unchanged as the last parameter to the
60 * user ordering function (optional, the user function need not use this
61 * information). */
62 public Object user_data;
64 public int halt_if_singular; /* how to handle a singular matrix:
65 * FALSE: keep going. Return a Numeric object with a zero U(k,k). A
66 * divide-by-zero may occur when computing L(:,k). The Numeric object
67 * can be passed to klu_solve (a divide-by-zero will occur). It can
68 * also be safely passed to klu_refactor.
69 * TRUE: stop quickly. klu_factor will free the partially-constructed
70 * Numeric object. klu_refactor will not free it, but will leave the
71 * numerical values only partially defined. This is the default. */
73 /* ---------------------------------------------------------------------- */
74 /* statistics */
75 /* ---------------------------------------------------------------------- */
77 public int status; /* KLU_OK if OK, < 0 if error */
78 public int nrealloc; /* # of reallocations of L and U */
80 public int structural_rank; /* 0 to n-1 if the matrix is structurally rank
81 * deficient (as determined by maxtrans). -1 if not computed. n if the
82 * matrix has full structural rank. This is computed by klu_analyze
83 * if a BTF preordering is requested. */
85 public int numerical_rank; /* First k for which a zero U(k,k) was found,
86 * if the matrix was singular (in the range 0 to n-1). n if the matrix
87 * has full rank. This is not a true rank-estimation. It just reports
88 * where the first zero pivot was found. -1 if not computed.
89 * Computed by klu_factor and klu_refactor. */
91 public int singular_col; /* n if the matrix is not singular. If in the
92 * range 0 to n-1, this is the column index of the original matrix A that
93 * corresponds to the column of U that contains a zero diagonal entry.
94 * -1 if not computed. Computed by klu_factor and klu_refactor. */
96 public int noffdiag; /* # of off-diagonal pivots, -1 if not computed */
98 public double flops; /* actual factorization flop count, from klu_flops */
99 public double rcond; /* crude reciprocal condition est., from klu_rcond */
100 public double condest; /* accurate condition est., from klu_condest */
101 public double rgrowth; /* reciprocal pivot rgrowth, from klu_rgrowth */
102 public double work; /* actual work done in BTF, in klu_analyze */
104 public long memusage; /* current memory usage, in bytes */
105 public long mempeak; /* peak memory usage, in bytes */