diff options
author | jthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5> | 2003-06-02 18:15:12 +0000 |
---|---|---|
committer | jthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5> | 2003-06-02 18:15:12 +0000 |
commit | bc624aa56b9c7815cf03684da0d1701d66a17b6d (patch) | |
tree | 4ab63e3948e8e14df20994bb63e331033218df70 /src/sparse-matrix | |
parent | 6359c74e2de8d5591b4517b6d418d21652bc1087 (diff) |
import of these files into AHFinderDirect cvs
git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinAnalysis/AHFinderDirect/trunk@1087 f88db872-0e4f-0410-b76b-b9085cfa78c5
Diffstat (limited to 'src/sparse-matrix')
76 files changed, 8332 insertions, 0 deletions
diff --git a/src/sparse-matrix/umfpack/ChangeLog b/src/sparse-matrix/umfpack/ChangeLog new file mode 100644 index 0000000..d290b60 --- /dev/null +++ b/src/sparse-matrix/umfpack/ChangeLog @@ -0,0 +1,223 @@ +Apr 11, 2002: + + * bug fix: the Microsoft compiler doesn't handle NaN's properly. + utIsNaN, and other ut* routines, added for MathWorks version + to handle this properly. + +Apr 1, 2002: + + * bug fix: if a column was all NaN's, then UMFPACK would fail + to find a pivot row. umf_row_search.c and umf_internal.h + modified to fix this problem. + +Mar 9, 2002: V4.0beta released + + * Map argument added to umfpack_*_triplet_to_col. New files + (umf_triplet.[ch]) added. + * minor changes made so that UMFPACK can be compiled with g++ + * additional error checking added to umfpack_*_numeric, for + detecting more changes in pattern (Ap, Ai) since last + call to umfpack_*_symbolic + +Feb 21, 2002: + + * User Guide explains the Makefile vs. GNUmakefile + + * umf_config.h modified, so that the complex SCSL C-BLAS uses + (void *) arguments instead of (scsl_zomplex *). gcc generates + some spurious warnings (cc doesn't complain). Affects the SGI + IRIX only. + + * ported to Compaq Alpha + +Feb 20, 2002: V4.0 (alpha) released. + + * V4.0 not yet ported to the Compaq Alpha (V3.2 was ported). + +Feb 6 to Feb 19, 2002: + + * Relaxed restrictions on sizes of arrays for umfpack_*_transpose and + umfpack_*_triplet_to_col. Size of "max(n,nz)" now just size nz. + + * workspace for umfpack_*_wsolve increased in size. + + * two user arrays for umfpack_*_get_symbolic increased in size, + by 1 (Chain_maxrows, Chain_maxcols). + + * lu_normest.m added. + +Jan 18 to Feb 5, 2002: + + * The matrix A can be complex, singular, and/or rectangular. + The solve step that uses the LU factors can only handle + matrices that are complex or real, singuluar or non-singular, + and *** square ***, however. + + * Estimate of the condition number computed: + (min (abs (diag (U))) / (max (abs (diag (U))))) + + * Forward/backsolves can solve with A.' as well as A'. + + * char * arguments removed from user-callable routines to make it + easier for Fortran to call UMFPACK. No Fortran interface is (yet) + provided, however. + + The solve codes for umfpack_*_*solve changed to #define'd + integers: + + UMFPACK_A Ax=b + UMFPACK_At A'x=b + UMFPACK_Aat A.'x=b + UMFPACK_Pt_L P'Lx=b + UMFPACK_L Lx=b + UMFPACK_Lt_P L'Px=b + UMFPACK_Lat_P L.'Px=b + UMFPACK_Lt L'x=b + UMFPACK_U_Qt UQ'x=b + UMFPACK_U Ux=b + UMFPACK_Q_Ut QU'x=b + UMFPACK_Q_Uat QU.'x=b + UMFPACK_Ut U'x=b + UMFPACK_Uat U.'x=b + + All arguments are now either int, long scalars (pass by value), + or int, long, double arrays (pass by reference), or void * pointers + (pass by value or reference). A void * pointer is of size 32 or 64 + bits on most machines. There is no need for the caller (C or Fortran) + to dereference the void * pointers, so these can be treated as + integer*4 or integer*8 in Fortran. A Fortran interface would have to + have all arguments passed by reference. + + * All user-callable routine names changed. The four sets are now: + umfpack_di_* real (double precision), int's as integers + umfpack_dl_* real (double precision), longs's as integers + umfpack_zi_* real (double precision), int's as integers + umfpack_zl_* real (double precision), longs's as integers + + * Ptree (row preordering) and info on pivotal rows for each front + added to Symbolic object (extracted by umfpack_*_get_symbolic). + Ptree added as output argument to "umfpack (A, 'symbolic')" + mexFunction. + + * umfpack_*_transpose can do A' or A.' + + * umfpack_wsolve.c file removed (now generated from umfpack_solve.c). + + * Can now extract just the diagonal of U with umfpack_*_get_numeric, + without having to extract the entire matrix U. + + * UMFPACK_ERROR_singular_matrix (-2) removed. + + * UMFPACK_WARNING_singular_matrix (1) added. + + * Control [UMFPACK_PIVOT_OPTION] removed. No longer any symmetric + pivot option (conflicts with the handling of singular and + rectangular matrices). + + * Iterative refinement can do Ax=b, A'x=b, or A.'x=b. + + * Most floating-point operations done in macros, to support the complex + versions. + + * Info [UMFPACK_N] is now Info [UMFPACK_NROW] + + * Info [UMFPACK_NCOL], Info [UMFPACK_UDIAG_NZ], Info [UMFPACK_UDIAG_NZ] + added. + + * umfpack_* routines with "n" as input now use two arguments, + n_row and n_col. + + * umfpack mexFunction now explicitly transposes A for b/A. It computes + it using the array transpose as (A.'\b.').' + +January 1, 2002: UMFPACK Version 3.2 released. Submitted to ACM Trans. + on Mathematical Software. + + * The umfpack mexFunction now returns the Info array when the matrix + is singular. Returned an empty array prior to this change. + + * Renamed variable that conflicted with system library routines + (system and j1). + + * Added a #ifdef MATHWORKS definition, so the built-in UMFPACK routine + (in a future release of MATLAB) can use the internal ut* memory + allocation routines, ut* assertion routine, and utPrintf. + + * MAX and MIN are not defined if they are already defined. + + * A bug fix in umf_kernel_init (a variable was not properly initialized). + + * Removed unused variables. + +October 8, 2001: UMFPACK Version 3.1 released. + +August-October, 2001: + + * added umfpack_btf M-file. + + * modified the BLAS update in the frontal matrix. If there are only + a few pivots in remaining in the current front, then the BLAS3 update + is delayed to include pivots in the next front. + + * Removed the special-case handling of dense columns from the numerical + factorization (kept it in the colamd preordering). This improves the + performance of UMFPACK on dense matrices by a factor of 5 or so, and + simplifies the code. + + * Added a symmetric-preference pivoting option. The option slightly + (but uniformly) improves the ordering when factorizing matrices with + symmetric nonzero pattern. That class of matrix is better handled by + the symmetric-pattern multifrontal method (MA41 in the Harwell + Subroutine Library), however. + + * Fixed the detection of integer overflow. The 32-bit version cannot + make use of more than 2GB of main memory (use the 64-bit version + in that case, instead). The 32-bit version did not correctly detect + when it was trying to factorize too large of a matrix. + +May 4, 2001: + + * SGI port extended. It can now call the SCSL Scientific Library, with + 64-bit BLAS. Make.sgi and umf_config.h modified. + +April 30, 2001: UMFPACK Version 3.0 released. Changes since 3.0Beta release: + + * Long integer version added (umfpack_l_* user-callable routines). + + * Peak memory usage in the numerical factorization reduced by a total of + 12n integers (8n temporary workspace used during numerical + factorization, and 4n for the permanent LU factors which was allocated + at the beginning of factorization). + + * Ported to the IBM RS 6000 and Compaq Alpha, with help from Anshul Gupta + and Friedrich Grund, respectively. + + * 64-bit version added. Uses dgemm_64, dgemv_64, and dger_64 in the Sun + Performance Library. 64-bit versions with the BLAS might not work on + any other platform, because they take int's as their integer input + arguments instead of long's. Unfortunately, the proposed ANSI + definition of the C-BLAS also uses int's as input integer arguments. + It ought to use long's, or include a version that uses long's, just + like the Sun Performance Library BLAS. + + * Additional statistics returned in Info: + Info [UMFPACK_SIZE_OF_INT] sizeof (int) + Info [UMFPACK_SIZE_OF_LONG] sizeof (long) + Info [UMFPACK_SIZE_OF_POINTER] sizeof (void *) + Info [UMFPACK_SIZE_OF_ENTRY] (was Info [UMFPACK_WORD]) + Info [UMFPACK_MAX_FRONT_SIZE_ESTIMATE] est. front matrix size + Info [UMFPACK_MAX_FRONT_SIZE] actual max frontal matrix size. + Contents of Info rearranged. + + * UMFPACK_ERROR_bad_configurution error code replaced with + UMFPACK_ERROR_problem_too_large error code. The "bad configuration" + error occured when sizeof (int) < sizeof (size_t). Now, the int + version of UMFPACK can use 32-bit int's and 64-bit pointers, and the + long version can use 64-bit long's and 64-bit pointers. Both versions + check to see if the array sizes allocated are larger than what can be + accessed by an integer index variable (int or long, depending on the + version), and returns UMFPACK_ERROR_problem_too_large if they become + too large. + +March 15, 2001: UMFPACK Version 3.0Beta released. + diff --git a/src/sparse-matrix/umfpack/License b/src/sparse-matrix/umfpack/License new file mode 100644 index 0000000..2dd1e94 --- /dev/null +++ b/src/sparse-matrix/umfpack/License @@ -0,0 +1,26 @@ +UMFPACK Version 4.0 (Apr 11, 2002). Copyright (c) 2002 by Timothy A. +Davis. All Rights Reserved. + +UMFPACK License: + + Your use or distribution of UMFPACK or any modified version of + UMFPACK implies that you agree to this License. + + THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY + EXPRESSED OR IMPLIED. ANY USE IS AT YOUR OWN RISK. + + Permission is hereby granted to use or copy this program, provided + that the Copyright, this License, and the Availability of the original + version is retained on all copies. User documentation of any code that + uses UMFPACK or any modified version of UMFPACK code must cite the + Copyright, this License, the Availability note, and "Used by permission." + Permission to modify the code and to distribute modified code is granted, + provided the Copyright, this License, and the Availability note are + retained, and a notice that the code was modified is included. This + software was developed with support from the National Science Foundation, + and is provided to you free of charge. + +Availability: + + http://www.cise.ufl.edu/research/sparse/umfpack + diff --git a/src/sparse-matrix/umfpack/README b/src/sparse-matrix/umfpack/README new file mode 100644 index 0000000..b19cca2 --- /dev/null +++ b/src/sparse-matrix/umfpack/README @@ -0,0 +1,9 @@ +This directory contains a subset of the files from the +UMFPACK Version 4.0 (Apr 11, 2002) sparse matrix package. +UMFPACK is copyright (c) 2002 by Timothy A. Davis. +See License for the UMFPACK license. + +See README.UMFPACK for the original UMFPACK README file, including +the url where the full package (including documentation) may be optained. + +make.code.defn controls compilation of this directory in Cactus. diff --git a/src/sparse-matrix/umfpack/README.UMFPACK b/src/sparse-matrix/umfpack/README.UMFPACK new file mode 100644 index 0000000..f890b80 --- /dev/null +++ b/src/sparse-matrix/umfpack/README.UMFPACK @@ -0,0 +1,268 @@ +UMFPACK Version 4.0 (Apr 11, 2002). Copyright (c) 2002 by Timothy A. +Davis. All Rights Reserved. + +This is the UMFPACK Version 4.0 README file. It is a terse overview of UMFPACK. +Refer to the User Guide (UserGuide.ps (postscript) or UserGuide.pdf (PDF)) +for how to install and use UMFPACK. + +Description: + + UMFPACK is a set of routines for solving unsymmetric sparse linear systems, + Ax=b, using the Unsymmetric MultiFrontal method. Written in ANSI/ISO C, + with a MATLAB (Version 6.0 and 6.1) interface. + +Authors: + + Timothy A. Davis (davis@cise.ufl.edu), University of Florida. + + UMFPACK Version 2.2.1 (MA38 in the Harwell Subroutine Library) is + co-authored with Iain Duff, Rutherford Appleton Laboratory. + + Includes a modified version of COLAMD V2.0, by Stefan I. Larimore and + Timothy A. Davis, University of Florida. The COLAMD algorithm was developed + in collaboration with John Gilbert, Xerox Palo Alto Research Center, and + Esmond Ng, Lawrence Berkeley National Laboratory. + +Acknowledgements: + + This work was supported by the National Science Foundation, under + grants DMS-9504974 and DMS-9803599. + + I would also like to thank the many researchers who provided sparse + matrices from a wide range of domains and used earlier versions of UMFPACK/ + MA38 in their applications, and thus assisted in the practical development + of the algorithm (see http://www.cise.ufl.edu/research/sparse, future + contributions of matrices are always welcome). + + The MathWorks, Inc., provided a pre-release of MATLAB V6 which allowed me + to release the umfpack mexFunction (v3.0) about 6 months earlier than I had + originally planned. + + Penny Anderson (The MathWorks, Inc.), Anshul Gupta (IBM), and Friedrich + Grund (WAIS) assisted in porting UMFPACK to different platforms. Penny + Anderson also incorporated UMFPACK into MATLAB, for lu, backslash (\), + and forward slash (/). + +UMFPACK License: + + Your use or distribution of UMFPACK or any modified version of + UMFPACK implies that you agree to this License. + + THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY + EXPRESSED OR IMPLIED. ANY USE IS AT YOUR OWN RISK. + + Permission is hereby granted to use or copy this program, provided + that the Copyright, this License, and the Availability of the original + version is retained on all copies. User documentation of any code that + uses UMFPACK or any modified version of UMFPACK code must cite the + Copyright, this License, the Availability note, and "Used by permission." + Permission to modify the code and to distribute modified code is granted, + provided the Copyright, this License, and the Availability note are + retained, and a notice that the code was modified is included. This + software was developed with support from the National Science Foundation, + and is provided to you free of charge. + +Availability: + + UMFPACK (including versions 2.2.1 and earlier, in Fortran) is available at + http://www.cise.ufl.edu/research/sparse. MA38 is available in the Harwell + Subroutine Library. This version of UMFPACK includes a modified form of + COLAMD Version 2.0, originally released on Jan. 31, 2001, also available at + http://www.cise.ufl.edu/research/sparse. COLAMD V2.0 is also incorporated + as a built-in function in MATLAB V6, by The MathWorks, Inc. + (http://www.mathworks.com). COLAMD V1.0 appears as a column-preordering + in SuperLU (SuperLU is available at http://www.netlib.org). + +-------------------------------------------------------------------------------- +Files in this V4.0 distribution: +-------------------------------------------------------------------------------- + + ---------------------------------------------------------------------------- + Compiling umfpack.a and the umfpack mexFunction: + ---------------------------------------------------------------------------- + + GNUmakefile a nice Makefile, for GNU make + Makefile an ugly Unix Makefile (for older make's) + Make.alpha Makefile additions for Compaq Alpha + Make.generic Generic Makefile additions + Make.linux Makefile additions for Linux + Make.rs6000 Makefile additions for RS 6000 + Make.sgi Makefile additions for SGI + Make.solaris Makefile additions for Solaris + + ---------------------------------------------------------------------------- + Documentation: + ---------------------------------------------------------------------------- + + ChangeLog change log + License the UMFPACK License + README this file + UserGuide.bib references for user guide + UserGuide.stex user guide source + UserGuide.sed1 sed script for processing UserGuide.stex + UserGuide.sed2 sed script for processing UserGuide.stex + UserGuide.tex user guide in Latex (from UserGuide.stex) + UserGuide.pdf user guide in PDF + UserGuide.ps user guide in postscript + UserGuide.dvi user guide in DVI + + ---------------------------------------------------------------------------- + MATLAB m-functions: + ---------------------------------------------------------------------------- + + Contents.m for "help umfpack" listing of toolbox contents + umfpack.m for "help umfpack" only + umfpack_demo.m a full umfpack demo + umfpack_demo.m.out output of umfpack_demo.m + umfpack_details.m the details of how to use umfpack + umfpack_make.m compile the umfpack mexFunction + umfpack_report.m report statistics + umfpack_simple.m a simple umfpack demo + umfpack_simple.m.out output of umfpack_simple + umfpack_btf.m solve Ax=b using umfpack and dmperm + lu_normest.m 1-norm estimate of A-L*U (by Hager & Davis). + + ---------------------------------------------------------------------------- + User-callable C routines: + ---------------------------------------------------------------------------- + + umfpack.h include file for user programs + + umfpack_col_to_triplet.[ch] convert col form to triplet + umfpack_defaults.[ch] set Control defaults + umfpack_free_numeric.[ch] free Numeric object + umfpack_free_symbolic.[ch] free Symbolic object + umfpack_get_lunz.[ch] get nz's in L and U + umfpack_get_numeric.[ch] get Numeric object + umfpack_get_symbolic.[ch] get Symbolic object + umfpack_numeric.[ch] numeric factorization + umfpack_qsymbolic.[ch] symbolic factorization, user Q + umfpack_report_control.[ch] print Control settings + umfpack_report_info.[ch] print Info statistics + umfpack_report_matrix.[ch] print col or row-form sparse matrix + umfpack_report_numeric.[ch] print Numeric object + umfpack_report_perm.[ch] print permutation + umfpack_report_status.[ch] print return status + umfpack_report_symbolic.[ch] print Symbolic object + umfpack_report_triplet.[ch] print triplet matrix + umfpack_report_vector.[ch] print dense vector + umfpack_solve.[ch] solve a linear system + umfpack_symbolic.[ch] symbolic factorization + umfpack_timer.[ch] timer + umfpack_transpose.[ch] transpose a matrix + umfpack_triplet_to_col.[ch] convert triplet to col form + umfpack_wsolve.h solve a linear system + (note that there is no umfpack_wsolve.c; + it is generated from umfpack_solve.c) + + ---------------------------------------------------------------------------- + MATLAB mexFunction + ---------------------------------------------------------------------------- + + umfpackmex.c + + ---------------------------------------------------------------------------- + C demo programs + ---------------------------------------------------------------------------- + + umfpack_simple.c a simple demo + umpack_xx_demo.c template to create the demo codes below + umfpack_di_demo.sed for creating umfpack_di_demo.c + umfpack_dl_demo.sed for creating umfpack_dl_demo.c + umfpack_zi_demo.sed for creating umfpack_zi_demo.c + umfpack_zl_demo.sed for creating umfpack_zl_demo.c + + umfpack_di_demo.c a full demo (real/int version) + umfpack_di_demo.out output of umfpack_di_demo with Make.generic + umfpack_di_demo.out64 output of umfpack_di_demo with Make.solaris, + in LP64 mode and using the Sun Performance + Library BLAS (option 4: in Make.solaris). + + umfpack_dl_demo.c a full demo (real/long version) + umfpack_dl_demo.out output of umfpack_dl_demo with Make.generic + umfpack_dl_demo.out64 output of umfpack_dl_demo with Make.solaris, + in LP64 mode and using the Sun Performance + Library BLAS (option 4 in Make.solaris). + + umfpack_zi_demo.c a full demo (complex/int version) + umfpack_zi_demo.out output of umfpack_zi_demo with Make.generic + umfpack_zi_demo.out64 output of umfpack_zi_demo with Make.solaris, + in LP64 mode and using the Sun Performance + Library BLAS (option 4 in Make.solaris). + + umfpack_zl_demo.c a full demo (complex/long version) + umfpack_zl_demo.out output of umfpack_zl_demo with Make.generic + umfpack_zl_demo.out64 output of umfpack_zl_demo with Make.solaris, + in LP64 mode and using the Sun Performance + Library BLAS (option 4 in Make.solaris). + + ---------------------------------------------------------------------------- + Non-user-callable C code: + ---------------------------------------------------------------------------- + + umf_analyze.[ch] symbolic factorization of A'*A + umf_apply_order.[ch] apply column etree postorder + umf_assemble.[ch] assemble elements into current front + umf_blas3_update.[ch] rank-k update + umf_build_tuples.[ch] construct tuples for elements + umf_build_tuples_usage.[ch] determine memory usage for umf_build_tuples + umf_colamd.[ch] COLAMD pre-ordering, modified for UMFPACK + umf_create_element.[ch] create a new element + umf_dump.[ch] debugging routines + umf_extend_front.[ch] extend the current frontal matrix + umf_free.[ch] free memory + umf_garbage_collection.[ch] compact Numeric->Memory + umf_get_memory.[ch] make Numeric->Memory bigger + umf_init_front.[ch] initialize a new frontal matrix + umf_is_permutation.[ch] checks the validity of a permutation vector + umf_kernel.[ch] the main numeric factorization kernel + umf_kernel_init.[ch] initializations for umf_kernel + umf_kernel_init_usage.[ch] determine memory usage for umf_kernel_init + umf_kernel_wrapup.[ch] wrapup for umf_kernel + umf_local_search.[ch] local row and column pivot search + umf_lsolve.[ch] solve Lx=b + umf_ltsolve.[ch] solve L'x=b and L.'x=b + umf_malloc.[ch] malloc some memory + umf_mem_alloc_element.[ch] allocate element in Numeric->Memory + umf_mem_alloc_head_block.[ch] alloc. block at head of Numeric->Memory + umf_mem_alloc_tail_block.[ch] alloc. block at tail of Numeric->Memory + umf_mem_free_tail_block.[ch] free block at tail of Numeric->Memory + umf_mem_init_memoryspace.[ch] initialize Numeric->Memory + umf_order_front_tree.[ch] column etree post-ordering + umf_realloc.[ch] realloc memory + umf_report_perm.[ch] print a permutation vector + umf_report_vector.[ch] print a double vector + umf_row_search.[ch] look for a pivot row + umf_scale_column.[ch] divide the pivot column by the pivot and log LU + umf_set_stats.[ch] set statistics (final or estimates) + umf_solve.[ch] solve a linear system + umf_symbolic_usage.[ch] determine memory usage for Symbolic object + umf_transpose.[ch] transpose a matrix in row or col form + umf_tuple_lengths.[ch] determine the tuple list lengths + umf_usolve.[ch] solve Ux=b + umf_utsolve.[ch] solve U'x=b and U.'x=b + umf_valid_numeric.[ch] checks the validity of a Numeric object + umf_valid_symbolic.[ch] check the validity of a Symbolic object + + ---------------------------------------------------------------------------- + Non-user-accessible C include files: + ---------------------------------------------------------------------------- + + umf_config.h configuration file + umf_internal.h definitions internal to UMFPACK + umf_version.h version definitions (int/long, real/complex) + + ---------------------------------------------------------------------------- + BLAS library for MATLAB's lcc compiler + ---------------------------------------------------------------------------- + + lcc_lib/libmwlapack.lib for mex, needed for Windows version only + lcc_lib/lapacksyms.def used to created libmwlapack.lib + + ---------------------------------------------------------------------------- + For Windows (these are not tested) + ---------------------------------------------------------------------------- + + Make.windows include file for Cygnus make on Windows + libumfpack.def routines exported by libumfpack.dll + diff --git a/src/sparse-matrix/umfpack/umf_analyze.h b/src/sparse-matrix/umfpack/umf_analyze.h new file mode 100644 index 0000000..d9f6d56 --- /dev/null +++ b/src/sparse-matrix/umfpack/umf_analyze.h @@ -0,0 +1,24 @@ +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +GLOBAL Int UMF_analyze +( + Int n_row, + Int n_col, + Int Ai [ ], + Int Ap [ ], + Int Up [ ], + Int Front_ncols [ ], + Int W [ ], + Int Link [ ], + Int Front_nrows [ ], + Int Front_npivcol [ ], + Int Front_parent [ ], + Int *nfr_out, + Int *p_ncompactions +) ; + diff --git a/src/sparse-matrix/umfpack/umf_apply_order.h b/src/sparse-matrix/umfpack/umf_apply_order.h new file mode 100644 index 0000000..95d699e --- /dev/null +++ b/src/sparse-matrix/umfpack/umf_apply_order.h @@ -0,0 +1,16 @@ +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +GLOBAL void UMF_apply_order +( + Int Front [ ], + const Int Order [ ], + Int Temp [ ], + Int n_col, + Int nfr +) ; + diff --git a/src/sparse-matrix/umfpack/umf_assemble.h b/src/sparse-matrix/umfpack/umf_assemble.h new file mode 100644 index 0000000..615313d --- /dev/null +++ b/src/sparse-matrix/umfpack/umf_assemble.h @@ -0,0 +1,13 @@ +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +GLOBAL void UMF_assemble +( + NumericType *Numeric, + WorkType *Work +) ; + diff --git a/src/sparse-matrix/umfpack/umf_blas3_update.h b/src/sparse-matrix/umfpack/umf_blas3_update.h new file mode 100644 index 0000000..e39779c --- /dev/null +++ b/src/sparse-matrix/umfpack/umf_blas3_update.h @@ -0,0 +1,12 @@ +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +GLOBAL void UMF_blas3_update +( + WorkType *Work +) ; + diff --git a/src/sparse-matrix/umfpack/umf_build_tuples.h b/src/sparse-matrix/umfpack/umf_build_tuples.h new file mode 100644 index 0000000..8968527 --- /dev/null +++ b/src/sparse-matrix/umfpack/umf_build_tuples.h @@ -0,0 +1,13 @@ +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +GLOBAL Int UMF_build_tuples +( + NumericType *Numeric, + WorkType *Work +) ; + diff --git a/src/sparse-matrix/umfpack/umf_build_tuples_usage.h b/src/sparse-matrix/umfpack/umf_build_tuples_usage.h new file mode 100644 index 0000000..1a1ef2e --- /dev/null +++ b/src/sparse-matrix/umfpack/umf_build_tuples_usage.h @@ -0,0 +1,18 @@ +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +GLOBAL Int UMF_build_tuples_usage +( + const Int Col_tlen [ ], + const Int Col_degree [ ], + const Int Row_tlen [ ], + const Int Row_degree [ ], + Int n_row, + Int n_col, + double *dusage +) ; + diff --git a/src/sparse-matrix/umfpack/umf_colamd.h b/src/sparse-matrix/umfpack/umf_colamd.h new file mode 100644 index 0000000..97fc00c --- /dev/null +++ b/src/sparse-matrix/umfpack/umf_colamd.h @@ -0,0 +1,247 @@ +/* ========================================================================== */ +/* === umf_colamd.h ========================================================= */ +/* ========================================================================== */ + +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +/* + +Authors: + + The authors of the COLAMD code itself are Stefan I. Larimore and Timothy A. + Davis, University of Florida. The algorithm was developed in collaboration + with John Gilbert, Xerox PARC, and Esmond Ng, Oak Ridge National Laboratory. + +Date: + + UMFPACK Version: see above. + COLAMD Version 2.0 was released on January 31, 2000. + +Acknowledgements: + + This work was supported by the National Science Foundation, under + grants DMS-9504974 and DMS-9803599. + +UMFPACK: Copyright (c) 2002 by Timothy A. Davis. All Rights Reserved. + +See the UMFPACK README file for the License for your use of this code. + +Availability: + + Both UMFPACK and the original unmodified colamd/symamd library are + available at http://www.cise.ufl.edu/research/sparse. + +*/ + +#ifndef COLAMD_H +#define COLAMD_H + +/* ========================================================================== */ +/* === Include files ======================================================== */ +/* ========================================================================== */ + +#include <stdlib.h> + +/* ========================================================================== */ +/* === Knob and statistics definitions ====================================== */ +/* ========================================================================== */ + +/* size of the knobs [ ] array. Only knobs [0..1] are currently used. */ +#define COLAMD_KNOBS 20 + +/* number of output statistics. Only stats [0..8] are currently used. */ +#define COLAMD_STATS 20 + +/* knobs [0] and stats [0]: dense row knob and output statistic. */ +#define COLAMD_DENSE_ROW 0 + +/* knobs [1] and stats [1]: dense column knob and output statistic. */ +#define COLAMD_DENSE_COL 1 + +/* stats [2]: memory defragmentation count output statistic */ +#define COLAMD_DEFRAG_COUNT 2 + +/* stats [3]: colamd status: zero OK, > 0 warning or notice, < 0 error */ +#define COLAMD_STATUS 3 + +/* stats [4..6]: error info, or info on jumbled columns */ +#define COLAMD_INFO1 4 +#define COLAMD_INFO2 5 +#define COLAMD_INFO3 6 + +/* ------------------ */ +/* added for UMFPACK: */ +/* stats [7]: number of originally empty rows */ +#define COLAMD_EMPTY_ROW 7 +/* stats [8]: number of originally empty cols */ +#define COLAMD_EMPTY_COL 8 +/* stats [9]: number of rows with entries only in dense cols */ +#define COLAMD_NEWLY_EMPTY_ROW 9 +/* stats [10]: number of cols with entries only in dense rows */ +#define COLAMD_NEWLY_EMPTY_COL 10 +/* ------------------ */ + +/* error codes returned in stats [3]: */ +#define COLAMD_OK (0) +#define COLAMD_ERROR_jumbled_matrix (-11) +#define COLAMD_ERROR_A_not_present (-1) +#define COLAMD_ERROR_p_not_present (-2) +#define COLAMD_ERROR_nrow_negative (-3) +#define COLAMD_ERROR_ncol_negative (-4) +#define COLAMD_ERROR_nnz_negative (-5) +#define COLAMD_ERROR_p0_nonzero (-6) +#define COLAMD_ERROR_A_too_small (-7) +#define COLAMD_ERROR_col_length_negative (-8) +#define COLAMD_ERROR_row_index_out_of_bounds (-9) +#define COLAMD_ERROR_out_of_memory (-10) +#define COLAMD_ERROR_internal_error (-999) + +/* ========================================================================== */ +/* === Row and Column structures ============================================ */ +/* ========================================================================== */ + +/* User code that makes use of the colamd/symamd routines need not directly */ +/* reference these structures. They are used only for the COLAMD_RECOMMENDED */ +/* macro. */ + +typedef struct Colamd_Col_struct +{ + Int start ; /* index for A of first row in this column, or DEAD */ + /* if column is dead */ + Int length ; /* number of rows in this column */ + union + { + Int thickness ; /* number of original columns represented by this */ + /* col, if the column is alive */ + Int parent ; /* parent in parent tree super-column structure, if */ + /* the column is dead */ + } shared1 ; + union + { + Int score ; /* the score used to maintain heap, if col is alive */ + Int order ; /* pivot ordering of this column, if col is dead */ + } shared2 ; + union + { + Int headhash ; /* head of a hash bucket, if col is at the head of */ + /* a degree list */ + Int hash ; /* hash value, if col is not in a degree list */ + Int prev ; /* previous column in degree list, if col is in a */ + /* degree list (but not at the head of a degree list) */ + } shared3 ; + union + { + Int degree_next ; /* next column, if col is in a degree list */ + Int hash_next ; /* next column, if col is in a hash list */ + } shared4 ; + + /* ------------------ */ + /* added for UMFPACK: */ + Int nextcol ; /* next column in this supercolumn */ + Int lastcol ; /* last column in this supercolumn */ + /* ------------------ */ + +} Colamd_Col ; + +typedef struct Colamd_Row_struct +{ + Int start ; /* index for A of first col in this row */ + Int length ; /* number of principal columns in this row */ + union + { + Int degree ; /* number of principal & non-principal columns in row */ + Int p ; /* used as a row pointer in init_rows_cols () */ + } shared1 ; + union + { + Int mark ; /* for computing set differences and marking dead rows*/ + Int first_column ;/* first column in row (used in garbage collection) */ + } shared2 ; + + /* ------------------ */ + /* added for UMFPACK: */ + Int thickness ; /* number of original rows represented by this row */ + /* that are not yet pivotal */ + Int front ; /* -1 if an original row */ + /* k if this row represents the kth frontal matrix */ + /* where k goes from 0 to at most n_col-1 */ + /* ------------------ */ + +} Colamd_Row ; + + + +/* ========================================================================== */ +/* === Colamd recommended memory size ======================================= */ +/* ========================================================================== */ + +/* + The recommended length Alen of the array A passed to colamd is given by + the COLAMD_RECOMMENDED (nnz, n_row, n_col) macro. It returns -1 if any + argument is negative. 2*nnz space is required for the row and column + indices of the matrix. COLAMD_C (n_col) + COLAMD_R (n_row) space is + required for the Col and Row arrays, respectively, which are internal to + colamd. An additional n_col space is the minimal amount of "elbow room", + and nnz/5 more space is recommended for run time efficiency. + + This macro is not needed when using symamd. +*/ + +#define UMF_COLAMD_C(n_col) ((n_col + 1) * sizeof (Colamd_Col) / sizeof (Int)) +#define UMF_COLAMD_R(n_row) ((n_row + 1) * sizeof (Colamd_Row) / sizeof (Int)) + +/* UMFPACK: make sure Clen is > 3*n_col + Col and Row structures */ +#define UMF_COLAMD_RECOMMENDED(nnz, n_row, n_col) \ +( \ +((nnz) < 0 || (n_row) < 0 || (n_col) < 0) \ +? \ + (-1) \ +: \ + (MAX (2 * (nnz), 3 * (n_col)) + \ + (Int) UMF_COLAMD_C (n_col) + \ + (Int) UMF_COLAMD_R (n_row) + (n_col) + ((nnz) / 5)) \ +) + +/* ========================================================================== */ +/* === Prototypes of user-callable routines ================================= */ +/* ========================================================================== */ + +/* colamd_recommended removed for UMFPACK */ + +void UMF_colamd_set_defaults /* sets default parameters */ +( /* knobs argument is modified on output */ + double knobs [COLAMD_KNOBS] /* parameter settings for colamd */ +) ; + +Int UMF_colamd /* returns (1) if successful, (0) otherwise*/ +( /* A and p arguments are modified on output */ + Int n_row, /* number of rows in A */ + Int n_col, /* number of columns in A */ + Int Alen, /* size of the array A */ + Int A [], /* row indices of A, of size Alen */ + Int p [], /* column pointers of A, of size n_col+1 */ + double knobs [COLAMD_KNOBS],/* parameter settings for colamd */ + Int stats [COLAMD_STATS] /* colamd output statistics and error codes */ + /* ------------------ */ + /* added for UMFPACK: */ + , Int Front_npivcol [ ] + , Int Front_nrows [ ] + , Int Front_ncols [ ] + , Int Front_parent [ ] + , Int Front_cols [ ] + , Int *p_nfr + /* ------------------ */ +) ; + +/* symamd deleted for UMFPACK */ + +/* colamd_report deleted for UMFPACK */ + +/* symamd_report deleted for UMFPACK */ + +#endif /* COLAMD_H */ diff --git a/src/sparse-matrix/umfpack/umf_config.h b/src/sparse-matrix/umfpack/umf_config.h new file mode 100644 index 0000000..60bf5f9 --- /dev/null +++ b/src/sparse-matrix/umfpack/umf_config.h @@ -0,0 +1,811 @@ +/* ========================================================================== */ +/* === umf_config.h ========================================================= */ +/* ========================================================================== */ + +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +/* + This file controls the compile-time configuration of UMFPACK. Modify the + Makefile, the architecture-dependent Make.* file, and this file if + necessary, to control these options. The following flags may be given + as options to your C compiler (as in "cc -DNBLAS", for example). These + flags are normally placed in your CONFIG string, defined in your Make.*. + + -DNBLAS + + BLAS mode. If -DNBLAS is set, then no BLAS will be used. Vanilla + C code will be used instead. This is portable, and easier to + install, but you won't get the best performance. + + If -DNBLAS is not set, then externally-available BLAS routines + (dgemm, dger, and dgemv or the equivalent C-BLAS routines) will be + used. This will give you the best performance, but perhaps at the + expense of portability. + + The default is to use the BLAS, for both the C-callable umfpack.a + library and the MATLAB mexFunction. If you have trouble installing + UMFPACK, set -DNBLAS. + + -DNCBLAS + + If -DNCBLAS is set, then the C-BLAS will not be called. This is the + default when compiling the MATLAB mexFunction, or when compiling + umfpack.a on Sun Solaris or SGI IRIX. + + If -DNCBLAS is not set, then the C-BLAS interface to the BLAS is + used. If your vendor-supplied BLAS library does not have a C-BLAS + interface, you can obtain the ATLAS BLAS, available at + http://www.netlib.org/atlas. + + Using the C-BLAS is the default when compiling umfpack.a on all + architectures except Sun Solaris (the Sun Performance Library is + somewhat faster). The ANSI C interface to the BLAS is fully + portable. + + This flag is ignored if -DNBLAS is set. + + -DLP64 + + This should be defined if you are compiling in the LP64 model + (32 bit int's, 64 bit long's, and 64 bit pointers). In Solaris, + this is obtained with the flags -xtarget=ultra -xarch=v9 for + the cc compiler (for example). + + -DLONGBLAS + + If not defined, then the BLAS are not called in the long integer + version of UMFPACK (the umfpack_*l_* routines). The most common + definitions of the BLAS, unfortunately, use int arguments, and + are thus not suitable for use in the LP64 model. Only the Sun + Performance Library, as far as I can tell, has a version of the + BLAS that allows long integer (64-bit) input arguments. This + flag is set automatically in Sun Solaris if you are using the + Sun Performance BLAS. You can set it yourself, too, if your BLAS + routines can take long integer input arguments. + + -DNSUNPERF + + Applies only to Sun Solaris. If -DNSUNPERF is set, then the Sun + Performance Library BLAS will not be used. + + The Sun Performance Library BLAS is used by default when compiling + the C-callable umfpack.a library on Sun Solaris. + + This flag is ignored if -DNBLAS is set. + + -DNSCSL + + Applies only to SGI IRIX. If -DSCSL is set, then the SGI SCSL + Scientific Library BLAS will not be used. + + The SGI SCSL Scientific Library BLAS is used by default when + compiling the C-callable umfpack.a library on SGI IRIX. + + This flag is ignored if -DNBLAS is set. + + -DGETRUSAGE + + If -DGETRUSAGE is set, then your system's getrusage routine will be + used for getting the process CPU time. Otherwise the ANSI C clock + routine will be used. The default is to use getrusage on Sun + Solaris, SGI Irix, Linux, and AIX (IBM RS 6000) and to use clock on + all other architectures. + + You should normally not set these flags yourself: + + -DBLAS_BY_VALUE if scalars are passed by value, not reference + -DBLAS_NO_UNDERSCORE if no underscore should be appended + -DBLAS_CHAR_ARG if BLAS options are single char's, not strings + + The BLAS options are normally set automatically. If your + architecture cannot be determined (see UMFPACK_ARCHITECTURE, below) + then you may need to set these flags yourself. + + -DMATLAB_MEX_FILE + + This flag is turned on when compiling the umfpack mexFunction for + use in MATLAB. When compiling the MATLAB mexFunction, the MATLAB + BLAS are used (unless -DNBLAS is set). The -DNCBLAS, -DNSCSL, and + -DNSUNPERF flags are all ignored. + + -DMATHWORKS + + This flag is turned on when compiling umfpack as a built-in routine + in MATLAB. The MATLAB BLAS are used for all architectures (-DNBLAS, + -DNCBLAS, -DNSCSL, and -DNSUNPERF flags are all ignored). Internal + routines utMalloc, utFree, utRealloc, utPrintf, utDivideComplex, + and utFdlibm_hypot are used, and the "util.h" file is included. + This avoids the problem discussed in the User Guide regarding memory + allocation in MATLAB. utMalloc returns NULL on failure, instead of + terminating the mexFunction (which is what mxMalloc does). However, + the ut* routines are not documented by The MathWorks, Inc., so I + cannot guarantee that you will always be able to use them. + + -DNDEBUG + + Debugging mode (if NDEBUG is not defined). The default, of course, + is no debugging. Turning on debugging takes some work (see below). + If you do not edit this file, then debugging is turned off anyway, + regardless of whether or not -DNDEBUG is specified in your compiler + options. + + You can change the memory allocator routines by editting the definitions + of ALLOCATE, FREE, and REALLOCATE, below. +*/ + + + +/* ========================================================================== */ +/* === NDEBUG =============================================================== */ +/* ========================================================================== */ + +/* + UMFPACK will be exceedingly slow when running in debug mode. The next three + lines ensure that debugging is turned off. If you want to compile UMFPACK + in debugging mode, you must comment out the three lines below: +*/ +#ifndef NDEBUG +#define NDEBUG +#endif + +/* + Next, you must either remove the -DNDEBUG option in the Makefile, or simply + add the following line: +#undef NDEBUG +*/ + +/* ========================================================================== */ +/* === Memory allocator ===================================================== */ +/* ========================================================================== */ + +/* The MATLAB mexFunction uses MATLAB's memory manager, while the C-callable */ +/* umfpack.a library uses the ANSI C malloc, free, and realloc routines. */ + +#ifdef MATLAB_MEX_FILE +#define ALLOCATE mxMalloc +#define FREE mxFree +#define REALLOCATE mxRealloc +#else +#ifdef MATHWORKS +/* Compiling UMFPACK as a built-in routine. */ +/* Since UMFPACK carefully checks for out-of-memory after every allocation, */ +/* we can use ut* routines here. */ +#define ALLOCATE utMalloc +#define FREE utFree +#define REALLOCATE utRealloc +#else +#define ALLOCATE malloc +#define FREE free +#define REALLOCATE realloc +#endif +#endif + + +/* ========================================================================== */ +/* === PRINTF macro ========================================================= */ +/* ========================================================================== */ + +/* All output goes through the PRINTF macro. Printing occurs only from the */ +/* UMFPACK_report_* routines. */ + +#ifdef MATLAB_MEX_FILE +#define PRINTF(params) { (void) mexPrintf params ; } +#else +#ifdef MATHWORKS +/* Already #included "util.h" in umf_version.h */ +#define PRINTF(params) { (void) utPrintf params ; } +#else +#define PRINTF(params) { (void) printf params ; } +#endif +#endif + + +/* ========================================================================== */ +/* === 0-based or 1-based printing ========================================== */ +/* ========================================================================== */ + +#if defined (MATLAB_MEX_FILE) && defined (NDEBUG) +/* In MATLAB, matrices are 1-based to the user, but 0-based internally. */ +/* One is added to all row and column indices when printing matrices */ +/* in UMFPACK_report_*. */ +#define INDEX(i) ((i)+1) +#else +/* In ANSI C, matrices are 0-based and indices are reported as such. */ +/* This mode is also used for debug mode, and if MATHWORKS is defined rather */ +/* than MATLAB_MEX_FILE. */ +#define INDEX(i) (i) +#endif + + +/* ========================================================================== */ +/* === Timer ================================================================ */ +/* ========================================================================== */ + +/* + If you have the getrusage routine (all Unix systems I've test do), then use + that. Otherwise, use the ANSI C clock function. Note that on many + systems, the ANSI clock function wraps around after only 2147 seconds, or + about 36 minutes. BE CAREFUL: if you compare the run time of UMFPACK with + other sparse matrix packages, be sure to use the same timer. See + umfpack_timer.c for the timer used by UMFPACK. +*/ + +/* Sun Solaris, SGI Irix, Linux, Compaq Alpha, and IBM RS 6000 all have */ +/* getrusage. It's in BSD unix, so perhaps all unix systems have it. */ +#if defined (UMF_SOL2) || defined (UMF_SGI) || defined (UMF_LINUX) \ +|| defined (UMF_ALPHA) || defined (UMF_AIX) +#define GETRUSAGE +#endif + + +/* ========================================================================== */ +/* === BLAS ================================================================= */ +/* ========================================================================== */ + +/* + The adventure begins. Figure out how to call the BLAS ... + + This works, but it is incredibly ugly. The C-BLAS was supposed to solve + this problem, and make it easier to interface a C program to the BLAS. + Unfortunately, the C-BLAS does not have a "long" integer (64 bit) version. + Various vendors have done their own 64-bit BLAS. Sun has dgemm_64 routines + with long integers, SGI has a 64-bit dgemm in their scsl_blas_i8 library + with long long integers, and so on. + + Different vendors also have different ways of defining a complex number, + some using struct's. That's a bad idea. See umf_version.h for the better + way to do it (the method that was also chosen for the complex C-BLAS). + + To make matters worse, SGI's SCSL BLAS has a C-BLAS interface which + differs from the ATLAS C-BLAS interface (see immediately below); + although a more recent version of SGI's C-BLAS interface is correct + if SCSL_VOID_ARGS is defined. +*/ + + +/* -------------------------------------------------------------------------- */ +/* Determine which BLAS to use. */ +/* -------------------------------------------------------------------------- */ + +#if defined (MATHWORKS) +#define USE_MATLAB_BLAS + +#elif defined (NBLAS) +#define USE_NO_BLAS + +#elif defined (MATLAB_MEX_FILE) +#define USE_MATLAB_BLAS + +#elif defined (UMF_SOL2) && !defined (NSUNPERF) +#define USE_SUNPERF_BLAS + +#elif defined (UMF_SGI) && !defined (NSCSL) +#define USE_SCSL_BLAS + +#elif !defined (NCBLAS) +#define USE_C_BLAS + +#else +#define USE_FORTRAN_BLAS +#endif + +/* -------------------------------------------------------------------------- */ +/* int vs. long integer arguments */ +/* -------------------------------------------------------------------------- */ + +/* + Determine if the BLAS exists for the long integer version. It exists if + LONGBLAS is defined in the Makefile, or if using the BLAS from the + Sun Performance Library, or SGI's SCSL Scientific Library. +*/ + +#if defined (USE_SUNPERF_BLAS) || defined (USE_SCSL_BLAS) +#ifndef LONGBLAS +#define LONGBLAS +#endif +#endif + +/* do not use the BLAS if Int's are long and LONGBLAS is not defined */ +#if defined (LONG_INTEGER) && !defined (LONGBLAS) && !defined (USE_NO_BLAS) +#define USE_NO_BLAS +#endif + + +/* -------------------------------------------------------------------------- */ +/* Use (void *) arguments for the SGI */ +/* -------------------------------------------------------------------------- */ + +#if defined (UMF_SGI) +/* + Use (void *) pointers for complex types in SCSL. + The ATLAS C-BLAS, and the SGI C-BLAS differ. The former uses (void *) + arguments, the latter uses SCSL_ZOMPLEX_T, which are either scsl_zomplex + or (void *). Using (void *) is simpler, and is selected by defining + SCSL_VOID_ARGS, below. The cc compiler doesn't complain, but gcc is + more picky, and generates a warning without this next statement. + With gcc and the 07/09/98 version of SGI's cblas.h, spurious warnings + about complex BLAS arguments will be reported anyway. This is because this + older version of SGI's cblas.h does not make use of the SCSL_VOID_ARGS + parameter, which is present in the 12/6/01 version of SGI's cblas.h. You + can safely ignore these warnings. +*/ +#define SCSL_VOID_ARGS +#endif + + +/* -------------------------------------------------------------------------- */ +/* The BLAS exists, construct appropriate macros */ +/* -------------------------------------------------------------------------- */ + +#if !defined (USE_NO_BLAS) /* { */ + +/* + If the compile-time flag -DNBLAS is defined, then the BLAS are not used, + portable vanilla C code is used instead, and the remainder of this file + is ignored. + + Using the BLAS is much faster, but how C calls the Fortran BLAS is + machine-dependent and thus can cause portability problems. Thus, use + -DNBLAS to ensure portability (at the expense of speed). + + Preferences: + + *** The best interface to use, regardless of the option you select + below, is the standard C-BLAS interface. Not all vendor-supplied + BLAS libraries use this interface (as of April 2001). The only + problem with this interface is that it does not extend to the LP64 + model. The C-BLAS does not provide for a 64-bit integer. In + addition, SGI's older cblas.h can cause spurious warnings when + using the C-BLAS interface. + + 1) most preferred: use the optimized vendor-supplied library (such as + the Sun Performance Library, or IBM's ESSL). This is often the + fastest, but might not be portable and might not always be + available. When compiling a MATLAB mexFunction it might be + difficult get the mex compiler script to recognize the vendor- + supplied BLAS. + + 2) When compiling the UMFPACK mexFunction to use UMFPACK in MATLAB, use + the BLAS provided by The Mathworks, Inc. This assumes you are using + MATLAB V6 or higher, since the BLAS are not incorporated in V5 or + earlier versions. On my Sun workstation, the MATLAB BLAS gave + slightly worse performance than the Sun Perf. BLAS. The advantage + of using the MATLAB BLAS is that it's available on any computer that + has MATLAB V6 or higher. I have not tried using MATLAB BLAS outside + of a mexFunction in a stand-alone C code, but MATLAB (V6) allows for + this. This is well worth trying if you have MATLAB and don't want + to bother installing the ATLAS BLAS (option 3a, below). The only + glitch to this is that MATLAB does not provide a portable interface + to the BLAS (an underscore is required for some but not all + architectures). These variations are taken into account in the + mexopts.sh file provided with UMFPACK. For Windows and MATLAB 6.0 + or 6.1, you also need to copy the libmwlapack.dll file; see the + User Guide for details. + + In the current distribution, the only BLAS that the UMFPACK + mexFunction will use is the internal MATLAB BLAS. It's possible to + use other BLAS, but handling the porting of using the mex compiler + with different BLAS libraries is not trivial. + + 3) Use a portable high-performance BLAS library: + + (a) The ATLAS BLAS, available at http://www.netlib.org/atlas, + by R. Clint Whaley, Antoine Petitet, and Jack Dongarra. + This has a standard C interface, and thus the interface to it is + fully portable. Its performance rivals, and sometimes exceeds, + the vendor-supplied BLAS on many computers. + + (b) The Fortran RISC BLAS by Michel Dayde', Iain Duff, Antoine + Petitet, and Abderrahim Qrichi Aniba, available via anonymous + ftp to ftp.enseeiht.fr in the pub/numerique/BLAS/RISC directory, + See M. J. Dayde' and I. S. Duff, "The RISC BLAS: A blocked + implementation of level 3 BLAS for RISC processors, ACM Trans. + Math. Software, vol. 25, no. 3., Sept. 1999. This will give + you good performance, but with the same C-to-Fortran portability + problems as option (1). + + 4) Use UMFPACK's built-in vanilla C code by setting -DNBLAS at compile + time. The key advantage is portability, which is guaranteed if you + have an ANSI C compliant compiler. You also don't need to download + any other package - UMFPACK is stand-alone. No Fortran is used + anywhere in UMFPACK. UMFPACK will be much slower than when using + options (1) through (3), however. + + 5) least preferred: use the standard Fortran implementation of the + BLAS, also available at Netlib (http://www.netlib.org/blas). This + will be no faster than option (4), and not portable because of + C-to-Fortran calling conventions. Don't bother trying option (5). + + The mechanics of how C calls the BLAS on various computers are as follows: + + * C-BLAS (from the ATLAS library, for example): + The same interface is used on all computers. + + * Defaults for calling the Fortran BLAS: + add underscore, pass scalars by reference, use string arguments. + + * The Fortran BLAS on Sun Solaris (when compiling the MATLAB mexFunction + or when using the Fortran RISC BLAS), SGI IRIX, Linux, and Compaq + Alpha: use defaults. + + * Sun Solaris (when using the C-callable Sun Performance library): + no underscore, pass scalars by value, use character arguments. + + * The Fortran BLAS (ESSL Library) on the IBM RS 6000, and HP Unix: + no underscore, pass scalars by reference, use string arguments. + + * The Fortran BLAS on Windows: + no underscore, pass scalars by reference, use string arguments. + If you compile the umfpack mexFunction using umfpack_make, and are + using the lcc compiler bundled with MATLAB, then you must first + copy the umfpack\lcc_lib\libmwlapack.lib file into the + <matlab>\extern\lib\win32\lcc\ directory, where <matlab> is the + directory in which MATLAB is installed. Next, type mex -setup + at the MATLAB prompt, and ask MATLAB to select the lcc compiler. + MATLAB has built-in BLAS, but it cannot be accessed by a program + compiled by lcc without first copying this file. +*/ + + + +/* -------------------------------------------------------------------------- */ +#ifdef USE_C_BLAS /* { */ +/* -------------------------------------------------------------------------- */ + + +/* -------------------------------------------------------------------------- */ +/* use the C-BLAS (any computer) */ +/* -------------------------------------------------------------------------- */ + +/* + C-BLAS is the default interface, with the following exceptions. Solaris + uses the Sun Performance BLAS for umfpack.a (the C-callable library). SGI + IRIX uses the SCSL BLAS for umfpack.a. All architectures use MATLAB's + internal BLAS for the mexFunction on any architecture. These options are + set in the Make.* files. The Make.generic file uses no BLAS at all. + + If you use the ATLAS C-BLAS, then be sure to set the -I flag to + -I/path/ATLAS/include, where /path/ATLAS is the ATLAS installation + directory. See Make.solaris for an example. You do not need to do this + for the SGI, which has a /usr/include/cblas.h. +*/ + +#include "cblas.h" + +#ifdef COMPLEX +#define BLAS_GEMM_ROUTINE cblas_zgemm +#define BLAS_GEMV_ROUTINE cblas_zgemv +#define BLAS_GER_ROUTINE cblas_zgeru +#define BLAS_DECLARE_SCALAR(x) double x [2] +#define BLAS_ASSIGN(x,xr,xi) { x [0] = xr ; x [1] = xi ; } +#else +#define BLAS_GEMM_ROUTINE cblas_dgemm +#define BLAS_GEMV_ROUTINE cblas_dgemv +#define BLAS_GER_ROUTINE cblas_dger +#define BLAS_DECLARE_SCALAR(x) double x +#define BLAS_ASSIGN(x,xr,xi) { x = xr ; } +#endif + +#define BLAS_NO_TRANSPOSE CblasNoTrans +#define BLAS_TRANSPOSE CblasTrans +#define BLAS_COLUMN_MAJOR_ORDER CblasColMajor, +#define BLAS_SCALAR(x) x +#define BLAS_INT_SCALAR(n) n +#define BLAS_ARRAY(a) a + + + +/* -------------------------------------------------------------------------- */ +#else /* } USE_C_BLAS { */ +/* -------------------------------------------------------------------------- */ + +/* -------------------------------------------------------------------------- */ +/* use Fortran (or other architecture-specific) BLAS */ +/* -------------------------------------------------------------------------- */ + +/* No such argument when not using the C-BLAS */ +#define BLAS_COLUMN_MAJOR_ORDER + +/* Determine which architecture we're on and set options accordingly. */ +/* The default, if nothing is defined is to add an underscore, */ +/* pass scalars by reference, and use string arguments. */ + +/* ---------------------------------- */ +/* Sun Performance BLAS */ +/* ---------------------------------- */ + +#ifdef USE_SUNPERF_BLAS +#ifdef _SUNPERF_H +/* <sunperf.h> has been included somehow anyway, outside of umf_config.h */ +#error "sunperf.h must NOT be #include'd. See umf_config.h for details." +#endif +#define BLAS_BY_VALUE +#define BLAS_NO_UNDERSCORE +#define BLAS_CHAR_ARG +#endif /* USE_SUNPERF_BLAS */ + +/* ---------------------------------- */ +/* SGI SCSL BLAS */ +/* ---------------------------------- */ + +#ifdef USE_SCSL_BLAS +#if defined (LP64) +#include <scsl_blas_i8.h> +#else +#include <scsl_blas.h> +#endif +#define BLAS_BY_VALUE +#define BLAS_NO_UNDERSCORE +#endif /* USE_SCSL_BLAS */ + +/* ---------------------------------- */ +/* IBM AIX, Windows, and HP Fortran BLAS */ +/* ---------------------------------- */ + +#if defined (UMF_AIX) || defined (UMF_WINDOWS) || defined (UMF_HP) +#define BLAS_NO_UNDERSCORE +#endif + + +/* -------------------------------------------------------------------------- */ +/* BLAS names */ +/* -------------------------------------------------------------------------- */ + +#if defined (LP64) && defined (USE_SUNPERF_BLAS) && defined (LONG_INTEGER) + +/* 64-bit sunperf BLAS, for Sun Solaris only */ +#ifdef COMPLEX +#define BLAS_GEMM_ROUTINE zgemm_64 +#define BLAS_GEMV_ROUTINE zgemv_64 +#define BLAS_GER_ROUTINE zgeru_64 +#else +#define BLAS_GEMM_ROUTINE dgemm_64 +#define BLAS_GEMV_ROUTINE dgemv_64 +#define BLAS_GER_ROUTINE dger_64 +#endif /* COMPLEX */ + +#else + +#ifdef COMPLEX + +/* naming convention (use underscore, or not) */ +#ifdef BLAS_NO_UNDERSCORE +#define BLAS_GEMM_ROUTINE zgemm +#define BLAS_GEMV_ROUTINE zgemv +#define BLAS_GER_ROUTINE zgeru +#else +/* default: add underscore */ +#define BLAS_GEMM_ROUTINE zgemm_ +#define BLAS_GEMV_ROUTINE zgemv_ +#define BLAS_GER_ROUTINE zgeru_ +#endif + +#else + +/* naming convention (use underscore, or not) */ +#ifdef BLAS_NO_UNDERSCORE +#define BLAS_GEMM_ROUTINE dgemm +#define BLAS_GEMV_ROUTINE dgemv +#define BLAS_GER_ROUTINE dger +#else +/* default: add underscore */ +#define BLAS_GEMM_ROUTINE dgemm_ +#define BLAS_GEMV_ROUTINE dgemv_ +#define BLAS_GER_ROUTINE dger_ +#endif + +#endif /* COMPLEX */ + +#endif /* LP64 && USE_SUNPERF_BLAS */ + + +/* -------------------------------------------------------------------------- */ +/* BLAS real or complex floating-point scalars */ +/* -------------------------------------------------------------------------- */ + +#ifdef COMPLEX + +/* + The SunPerf BLAS expects to see a doublecomplex scalar, but it + also will accept an array of size 2. See the manual, normally at + file:///opt/SUNWspro/WS6U1/lib/locale/C/html/manuals/perflib/user_guide + /plug_using_perflib.html . This manual is inconsistent with the man pages + for zgemm, zgemv, and zgeru and also inconsistent with the <sunperf.h> + include file. Use this instead, for SunPerf (only works if you do NOT + include sunperf.h). Fortunately, this file (umf_config.h) is not included + in any user code that calls UMFPACK. Thus, the caller may include + sunperf.h in his or her own code, and that is safely ignored here. + SGI's SCSL BLAS has yet a different kind of struct, but we can use a + double array of size 2 instead (since SCSL_VOID_ARGS is defined). + Most BLAS expect complex scalars as pointers to double arrays of size 2. +*/ + +#define BLAS_DECLARE_SCALAR(x) double x [2] +#define BLAS_ASSIGN(x,xr,xi) { x [0] = xr ; x [1] = xi ; } +#define BLAS_SCALAR(x) x + +#else + +#define BLAS_DECLARE_SCALAR(x) double x +#define BLAS_ASSIGN(x,xr,xi) { x = xr ; } +#ifdef BLAS_BY_VALUE +#define BLAS_SCALAR(x) x +#else +#define BLAS_SCALAR(x) &(x) +#endif + +#endif /* COMPLEX */ + + +/* -------------------------------------------------------------------------- */ +/* BLAS integer scalars */ +/* -------------------------------------------------------------------------- */ + +/* + Fortran requires integers to be passed by reference. + The SCSL BLAS requires long long arguments in LP64 mode. +*/ + +#if defined (USE_SCSL_BLAS) && defined (LP64) +#define BLAS_INT_SCALAR(n) ((long long) n) +#else +#ifdef BLAS_BY_VALUE +#define BLAS_INT_SCALAR(n) n +#else +#define BLAS_INT_SCALAR(n) &(n) +#endif +#endif + + +/* -------------------------------------------------------------------------- */ +/* BLAS strings */ +/* -------------------------------------------------------------------------- */ + +/* + The Sun Performance BLA wants a character instead of a string. +*/ + +#ifdef BLAS_CHAR_ARG +#define BLAS_NO_TRANSPOSE 'N' +#define BLAS_TRANSPOSE 'T' +#else +#define BLAS_NO_TRANSPOSE "N" +#define BLAS_TRANSPOSE "T" +#endif + + +/* -------------------------------------------------------------------------- */ +/* BLAS arrays */ +/* -------------------------------------------------------------------------- */ + +/* + The complex SunPerf BLAS expects to see a doublecomplex array of size s. + This is broken (see above, regarding complex scalars in sunperf.h). + For SunPerf BLAS, just pass a pointer to the array, and ignore sunperf.h. + With sunperf.h, you would need: + + #define BLAS_ARRAY(a) ((doublecomplex *)(a)) + + SGI's SCSL BLAS has yet a different kind of struct, but we can use a + double array of size 2 instead (since SCSL_VOID_ARGS is defined). + + The real versions all use just a (double *) pointer. + + In all cases, no typecast is required. This will break if <sunperf.h> is + included. + + If you have read this far, I hope you see now why (void *) a much better + choice for complex BLAS prototypes, and why double x [2] is better than + an architecture dependent struct { double real ; double imag ; } + type definition. + +*/ + +#define BLAS_ARRAY(a) (a) + + +/* -------------------------------------------------------------------------- */ +#endif /* USE_C_BLAS } */ +/* -------------------------------------------------------------------------- */ + + + + + +/* -------------------------------------------------------------------------- */ +/* BLAS macros, for all interfaces */ +/* -------------------------------------------------------------------------- */ + +/* + All architecture dependent issues have now been taken into consideration, + and folded into the macros BLAS_DECLARE_SCALAR, BLAS_ASSIGN, BLAS_*_ROUTINE, + BLAS_COLUMN_MAJOR_ORDER, BLAS_NO_TRANSPOSE, BLAS_TRANSPOSE, BLAS_SCALAR, + BLAS_INT_SCALAR, BLAS_ARRAY, and Int. + + You will note that there is not a *** single *** name, declaration, or + argument to the BLAS which is not somehow different in one or more versions + of the BLAS! +*/ + + + + +/* C = C - A*B, where A is m-by-k, B is k-by-n, and leading dimension is d */ +#define BLAS_GEMM(m,n,k,A,B,C,d) \ +{ \ + BLAS_DECLARE_SCALAR (alpha) ; \ + BLAS_DECLARE_SCALAR (beta) ; \ + BLAS_ASSIGN (alpha, -1.0, 0.0) ; \ + BLAS_ASSIGN (beta, 1.0, 0.0) ; \ + (void) BLAS_GEMM_ROUTINE (BLAS_COLUMN_MAJOR_ORDER \ + BLAS_NO_TRANSPOSE, BLAS_NO_TRANSPOSE, \ + BLAS_INT_SCALAR (m), BLAS_INT_SCALAR (n), BLAS_INT_SCALAR (k), \ + BLAS_SCALAR (alpha), \ + BLAS_ARRAY (A), BLAS_INT_SCALAR (d), \ + BLAS_ARRAY (B), BLAS_INT_SCALAR (d), BLAS_SCALAR (beta), \ + BLAS_ARRAY (C), BLAS_INT_SCALAR (d)) ; \ +} + + +/* A = A - x*y', where A is m-by-n with leading dimension d */ +#define BLAS_GER(m,n,x,y,A,d) \ +{ \ + Int incx = 1 ; \ + BLAS_DECLARE_SCALAR (alpha) ; \ + BLAS_ASSIGN (alpha, -1.0, 0.0) ; \ + (void) BLAS_GER_ROUTINE (BLAS_COLUMN_MAJOR_ORDER \ + BLAS_INT_SCALAR (m), BLAS_INT_SCALAR (n), \ + BLAS_SCALAR (alpha), \ + BLAS_ARRAY (x), BLAS_INT_SCALAR (incx), \ + BLAS_ARRAY (y), BLAS_INT_SCALAR (d), \ + BLAS_ARRAY (A), BLAS_INT_SCALAR (d)) ; \ +} + + +/* y = y - A'*x, where A is m-by-n with leading dimension d, */ +/* and x and y are row vectors with stride d */ +#define BLAS_GEMV_ROW(m,n,A,x,y,d) \ +{ \ + BLAS_DECLARE_SCALAR (alpha) ; \ + BLAS_DECLARE_SCALAR (beta) ; \ + BLAS_ASSIGN (alpha, -1.0, 0.0) ; \ + BLAS_ASSIGN (beta, 1.0, 0.0) ; \ + (void) BLAS_GEMV_ROUTINE (BLAS_COLUMN_MAJOR_ORDER \ + BLAS_TRANSPOSE, \ + BLAS_INT_SCALAR (m), BLAS_INT_SCALAR (n), \ + BLAS_SCALAR (alpha), \ + BLAS_ARRAY (A), BLAS_INT_SCALAR (d), \ + BLAS_ARRAY (x), BLAS_INT_SCALAR (d), BLAS_SCALAR (beta), \ + BLAS_ARRAY (y), BLAS_INT_SCALAR (d)) ; \ +} + + +/* y = y - A*x, where A is m-by-n with leading dimension d, */ +/* and x and y are column vectors with stride 1 */ +#define BLAS_GEMV_COL(m,n,A,x,y,d) \ +{ \ + Int incx = 1 ; \ + Int incy = 1 ; \ + BLAS_DECLARE_SCALAR (alpha) ; \ + BLAS_DECLARE_SCALAR (beta) ; \ + BLAS_ASSIGN (alpha, -1.0, 0.0) ; \ + BLAS_ASSIGN (beta, 1.0, 0.0) ; \ + (void) BLAS_GEMV_ROUTINE (BLAS_COLUMN_MAJOR_ORDER \ + BLAS_NO_TRANSPOSE, \ + BLAS_INT_SCALAR (m), BLAS_INT_SCALAR (n), \ + BLAS_SCALAR (alpha), \ + BLAS_ARRAY (A), BLAS_INT_SCALAR (d), \ + BLAS_ARRAY (x), BLAS_INT_SCALAR (incx), BLAS_SCALAR (beta), \ + BLAS_ARRAY (y), BLAS_INT_SCALAR (incy)) ; \ +} + + +#endif /* !defined (USE_NO_BLAS) } */ + + + diff --git a/src/sparse-matrix/umfpack/umf_create_element.h b/src/sparse-matrix/umfpack/umf_create_element.h new file mode 100644 index 0000000..737af7f --- /dev/null +++ b/src/sparse-matrix/umfpack/umf_create_element.h @@ -0,0 +1,13 @@ +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +GLOBAL Int UMF_create_element +( + NumericType *Numeric, + WorkType *Work +) ; + diff --git a/src/sparse-matrix/umfpack/umf_dump.h b/src/sparse-matrix/umfpack/umf_dump.h new file mode 100644 index 0000000..fef196e --- /dev/null +++ b/src/sparse-matrix/umfpack/umf_dump.h @@ -0,0 +1,187 @@ +/* ========================================================================== */ +/* === UMF_dump ============================================================= */ +/* ========================================================================== */ + +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +/* Debugging definitions. */ + +#include <assert.h> + +#ifndef NDEBUG + +GLOBAL void UMF_dump_dense +( + Entry *Fx, + Int dim, + Int m, + Int n +) ; + +GLOBAL void UMF_dump_element +( + NumericType *Numeric, + WorkType *Work, + Int e, + Int clean +) ; + +GLOBAL void UMF_dump_rowcol +( + Int dump_which, + NumericType *Numeric, + WorkType *Work, + Int dump_index, + Int check_degree +) ; + +GLOBAL void UMF_dump_matrix +( + NumericType *Numeric, + WorkType *Work, + Int check_degree +) ; + +GLOBAL void UMF_dump_current_front +( + NumericType *Numeric, + WorkType *Work, + Int check +) ; + +GLOBAL void UMF_dump_lu +( + NumericType *Numeric +) ; + +GLOBAL void UMF_dump_memory +( + NumericType *Numeric +) ; + +GLOBAL void UMF_dump_packed_memory +( + NumericType *Numeric, + WorkType *Work +) ; + +GLOBAL void UMF_dump_col_matrix +( + const double Ax [ ], +#ifdef COMPLEX + const double Az [ ], +#endif + const Int Ai [ ], + const Int Ap [ ], + Int n_row, + Int n_col, + Int nz +) ; + +GLOBAL void UMF_dump_chain +( + Int frontid, + Int Front_parent [ ], + Int Front_npivcol [ ], + Int Front_nrows [ ], + Int Front_ncols [ ], + Int nfr +) ; + +GLOBAL void UMF_dump_rowmerge +( + NumericType *Numeric, + SymbolicType *Symbolic, + WorkType *Work +) ; + +GLOBAL void UMF_dump_start +( + void +) ; + + +#define UMF_DBMAX 50000 +GLOBAL extern Int UMF_debug ; +GLOBAL extern Int UMF_nbug ; +GLOBAL extern Int UMF_fbug ; +GLOBAL extern Int UMF_allocfail ; +GLOBAL extern double UMF_gprob ; + +#define DEBUGk(k,params) { if (UMF_debug >= (k)) { PRINTF (params) ; } } + +#define DEBUG0(params) DEBUGk (0, params) +#define DEBUG1(params) DEBUGk (1, params) +#define DEBUG2(params) DEBUGk (2, params) +#define DEBUG3(params) DEBUGk (3, params) +#define DEBUG4(params) DEBUGk (4, params) +#define DEBUG5(params) DEBUGk (5, params) +#define DEBUG6(params) DEBUGk (6, params) +#define DEBUG7(params) DEBUGk (7, params) +#define DEBUG8(params) DEBUGk (8, params) +#define DEBUG9(params) DEBUGk (9, params) + +#define EDEBUGk(k,a) { if (UMF_debug >= (k)) { PRINT_ENTRY (a) ; } } + +#define EDEBUG0(a) EDEBUGk (0, a) +#define EDEBUG1(a) EDEBUGk (1, a) +#define EDEBUG2(a) EDEBUGk (2, a) +#define EDEBUG3(a) EDEBUGk (3, a) +#define EDEBUG4(a) EDEBUGk (4, a) +#define EDEBUG5(a) EDEBUGk (5, a) +#define EDEBUG6(a) EDEBUGk (6, a) +#define EDEBUG7(a) EDEBUGk (7, a) +#define EDEBUG8(a) EDEBUGk (8, a) +#define EDEBUG9(a) EDEBUGk (9, a) + +#ifdef MATLAB_MEX_FILE +#define ASSERT(expression) (mxAssert ((expression), "")) +#else +#ifdef MATHWORKS +#define ASSERT(expression) (utAssert (expression)) +#else +#define ASSERT(expression) (assert (expression)) +#endif +#endif /* MATLAB_MEX_FILE */ + +#else + +/* ========================================================================== */ +/* === No debugging ========================================================= */ +/* ========================================================================== */ + +/* turn off all debugging macros */ + +#define DEBUGk(k,params) + +#define DEBUG0(params) +#define DEBUG1(params) +#define DEBUG2(params) +#define DEBUG3(params) +#define DEBUG4(params) +#define DEBUG5(params) +#define DEBUG6(params) +#define DEBUG7(params) +#define DEBUG8(params) +#define DEBUG9(params) + +#define EDEBUG0(a) +#define EDEBUG1(a) +#define EDEBUG2(a) +#define EDEBUG3(a) +#define EDEBUG4(a) +#define EDEBUG5(a) +#define EDEBUG6(a) +#define EDEBUG7(a) +#define EDEBUG8(a) +#define EDEBUG9(a) + +#define ASSERT(expression) + +#endif /* NDEBUG */ + diff --git a/src/sparse-matrix/umfpack/umf_extend_front.h b/src/sparse-matrix/umfpack/umf_extend_front.h new file mode 100644 index 0000000..850eff2 --- /dev/null +++ b/src/sparse-matrix/umfpack/umf_extend_front.h @@ -0,0 +1,12 @@ +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +GLOBAL void UMF_extend_front +( + WorkType *Work +) ; + diff --git a/src/sparse-matrix/umfpack/umf_free.h b/src/sparse-matrix/umfpack/umf_free.h new file mode 100644 index 0000000..82d1ab6 --- /dev/null +++ b/src/sparse-matrix/umfpack/umf_free.h @@ -0,0 +1,12 @@ +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +GLOBAL void *UMF_free +( + void *p +) ; + diff --git a/src/sparse-matrix/umfpack/umf_garbage_collection.h b/src/sparse-matrix/umfpack/umf_garbage_collection.h new file mode 100644 index 0000000..6621675 --- /dev/null +++ b/src/sparse-matrix/umfpack/umf_garbage_collection.h @@ -0,0 +1,13 @@ +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +GLOBAL void UMF_garbage_collection +( + NumericType *Numeric, + WorkType *Work +) ; + diff --git a/src/sparse-matrix/umfpack/umf_get_memory.h b/src/sparse-matrix/umfpack/umf_get_memory.h new file mode 100644 index 0000000..8c306ac --- /dev/null +++ b/src/sparse-matrix/umfpack/umf_get_memory.h @@ -0,0 +1,14 @@ +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +GLOBAL Int UMF_get_memory +( + NumericType *Numeric, + WorkType *Work, + Int needunits +) ; + diff --git a/src/sparse-matrix/umfpack/umf_init_front.h b/src/sparse-matrix/umfpack/umf_init_front.h new file mode 100644 index 0000000..802fba4 --- /dev/null +++ b/src/sparse-matrix/umfpack/umf_init_front.h @@ -0,0 +1,12 @@ +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +GLOBAL void UMF_init_front +( + WorkType *Work +) ; + diff --git a/src/sparse-matrix/umfpack/umf_internal.h b/src/sparse-matrix/umfpack/umf_internal.h new file mode 100644 index 0000000..205285a --- /dev/null +++ b/src/sparse-matrix/umfpack/umf_internal.h @@ -0,0 +1,644 @@ +/* ========================================================================== */ +/* === umf_internal.h ======================================================= */ +/* ========================================================================== */ + +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +/* + This file is for internal use in UMFPACK itself, and should not be included + in user code. Use umfpack.h instead. User-accessible file names and + routine names all start with the letters "umfpack_". Non-user-accessible + file names and routine names all start with "umf_". +*/ + +/* -------------------------------------------------------------------------- */ +/* ANSI standard include files */ +/* -------------------------------------------------------------------------- */ + +/* from stdlib.h: malloc, free, realloc */ +/* and when in debug mode: rand, RAND_MAX */ +#include <stdlib.h> + +/* from limits.h: INT_MAX and LONG_MAX */ +#include <limits.h> + +/* from float.h: DBL_EPSILON */ +#include <float.h> + +/* from stdio.h: printf, NULL */ +/* and when in debug mode: fopen, fscanf */ +#include <stdio.h> + +/* from string.h: strcmp */ +#include <string.h> + +/* from math.h: sqrt, ceil */ +#include <math.h> + +/* when debugging, assert.h and the assert macro are used (see umf_dump.h) */ + +/* -------------------------------------------------------------------------- */ +/* MATLAB include files */ +/* -------------------------------------------------------------------------- */ + +#ifdef MATHWORKS +#include "util.h" +#endif + +#ifdef MATLAB_MEX_FILE +#include "matrix.h" +#include "mex.h" +#endif + +/* -------------------------------------------------------------------------- */ +/* Architecture */ +/* -------------------------------------------------------------------------- */ + +#if defined (__sun) || defined (MSOL2) || defined (ARCH_SOL2) +#define UMF_SOL2 +#define UMFPACK_ARCHITECTURE "Sun Solaris" + +#elif defined (__sgi) || defined (MSGI) || defined (ARCH_SGI) +#define UMF_SGI +#define UMFPACK_ARCHITECTURE "SGI Irix" + +#elif defined (__linux) || defined (MGLNX86) || defined (ARCH_GLNX86) +#define UMF_LINUX +#define UMFPACK_ARCHITECTURE "Linux" + +#elif defined (_AIX) || defined (MIBM_RS) || defined (ARCH_IBM_RS) +#define UMF_AIX +#define UMFPACK_ARCHITECTURE "IBM AIX" + +#elif defined (__alpha) || defined (MALPHA) || defined (ARCH_ALPHA) +#define UMF_ALPHA +#define UMFPACK_ARCHITECTURE "Compaq Alpha" + +#elif defined (__WIN32) || defined (_WIN32) || defined (_win32) || defined (__win32) || defined (WIN32) +#define UMF_WINDOWS +#define UMFPACK_ARCHITECTURE "Microsoft Windows" + +#elif defined (__hppa) || defined (__hpux) || defined (MHPUX) || defined (ARCH_HPUX) +#define UMF_HP +#define UMFPACK_ARCHITECTURE "HP Unix" + +#elif defined (__hp700) || defined (MHP700) || defined (ARCH_HP700) +#define UMF_HP +#define UMFPACK_ARCHITECTURE "HP 700 Unix" + +#else +/* If the architecture is unknown, and you call the BLAS, you may need to */ +/* define BLAS_BY_VALUE, BLAS_NO_UNDERSCORE, and/or BLAS_CHAR_ARG yourself. */ +#define UMFPACK_ARCHITECTURE "unknown" +#endif + + +/* -------------------------------------------------------------------------- */ +/* basic definitions */ +/* -------------------------------------------------------------------------- */ + +#ifdef MAX +#undef MAX +#endif +#ifdef MIN +#undef MIN +#endif + +/* for integer MAX/MIN, or for doubles when we don't care how NaN's behave: */ +#define MAX(a,b) (((a) > (b)) ? (a) : (b)) +#define MIN(a,b) (((a) < (b)) ? (a) : (b)) + +#define ONES_COMPLEMENT(r) (-(r)-1) + +/* largest allowable double precision epsilon */ +#define MAX_EPSILON 1e-8 + +/* logical expression of p implies q: */ +#define IMPLIES(p,q) (!(p) || (q)) + +/* Note that the IBM RS 6000 xlc predefines TRUE and FALSE in <types.h>. */ +/* The Compaq Alpha also predefines TRUE and FALSE. */ +#ifdef TRUE +#undef TRUE +#endif +#ifdef FALSE +#undef FALSE +#endif + +#define TRUE (1) +#define FALSE (0) +#define PRIVATE static +#define GLOBAL +#define EMPTY (-1) + +/* Note that Linux's gcc 2.96 defines NULL as ((void *) 0), but other */ +/* compilers (even gcc 2.95.2 on Solaris) define NULL as 0 or (0). */ +#ifdef NULL +#undef NULL +#endif + +#define NULL 0 + +/* -------------------------------------------------------------------------- */ +/* Real/complex and int/long definitions, double relops */ +/* -------------------------------------------------------------------------- */ + +#include "umf_version.h" + +/* -------------------------------------------------------------------------- */ +/* Compile-time configurations */ +/* -------------------------------------------------------------------------- */ + +#include "umf_config.h" + +/* -------------------------------------------------------------------------- */ +/* umfpack include file */ +/* -------------------------------------------------------------------------- */ + +#include "umfpack.h" + +/* -------------------------------------------------------------------------- */ +/* for contents of Info. This must correlate with umfpack.h */ +/* -------------------------------------------------------------------------- */ + +#define ESTIMATE (UMFPACK_NUMERIC_SIZE_ESTIMATE - UMFPACK_NUMERIC_SIZE) +#define ACTUAL 0 + +/* -------------------------------------------------------------------------- */ +/* for clearing the external degree counters */ +/* -------------------------------------------------------------------------- */ + +#define MAX_MARK(n) Int_MAX - (2*(n)+1) + +/* -------------------------------------------------------------------------- */ +/* dense row/column macro */ +/* -------------------------------------------------------------------------- */ + +/* In order for a row or column to be treated as "dense", it must have more */ +/* entries than the value returned by this macro. n is the dimension of the */ +/* matrix, and alpha is the dense row/column control parameter. */ + +/* Note: this is not defined in alpha is NaN or Inf: */ +#define UMFPACK_DENSE_DEGREE_THRESHOLD(alpha,n) \ + ((Int) MAX (16.0, (alpha) * 16.0 * sqrt ((double) (n)))) + +/* -------------------------------------------------------------------------- */ +/* PRINTF */ +/* -------------------------------------------------------------------------- */ + +#define PRINTFk(k,params) { if (prl >= (k)) { PRINTF (params) ; } } +#define PRINTF1(params) PRINTFk (1, params) +#define PRINTF2(params) PRINTFk (2, params) +#define PRINTF3(params) PRINTFk (3, params) +#define PRINTF4(params) PRINTFk (4, params) +#define PRINTF5(params) PRINTFk (5, params) +#define PRINTF6(params) PRINTFk (6, params) + +/* -------------------------------------------------------------------------- */ +/* Fixed control parameters */ +/* -------------------------------------------------------------------------- */ + +/* maximum number of columns to consider at one time, in a single front */ +#define MAX_CANDIDATES 128 + +/* reduce Numeric->Memory request by this ratio, if allocation fails */ +#define UMF_REALLOC_REDUCTION (0.95) + +/* increase Numeric->Memory request by this ratio, if we need more */ +#define UMF_REALLOC_INCREASE (1.2) + +/* -------------------------------------------------------------------------- */ +/* Memory space definitions */ +/* -------------------------------------------------------------------------- */ + +/* for memory alignment - assume double has worst case alignment */ +typedef double Align ; + +/* get number of bytes required to hold n items of a type: */ +/* note that this will not overflow, because sizeof (type) is always */ +/* greater than or equal to sizeof (Int) >= 2 */ +#define BYTES(type,n) (sizeof (type) * (n)) + +/* ceiling of (b/u). Assumes b >= 0 and u > 0 */ +#define CEILING(b,u) (((b) + (u) - 1) / (u)) + +/* get number of Units required to hold n items of a type: */ +#define UNITS(type,n) (CEILING (BYTES (type, n), sizeof (Unit))) + +/* same as DUNITS, but use double instead of int to avoid overflow */ +#define DUNITS(type,n) (ceil (BYTES (type, (double) n) / sizeof (Unit))) + +union Unit_union +{ /* memory is allocated in multiples of Unit */ + struct + { + Int + size, /* size, in Units, of the block, excl. header block */ + /* size >= 0: block is in use */ + /* size < 0: block is free, of |size| Units */ + prevsize ; /* size, in Units, of preceding block in S->Memory */ + /* during garbage_collection, prevsize is set to -e-1 */ + /* for element e, or positive (and thus a free block) */ + /* otherwise */ + } header ; /* block header */ + Align xxxxxx ; /* force alignment of blocks (xxxxxx is never used) */ +} ; + +typedef union Unit_union Unit ; + +/* get the size of an allocated block */ +#define GET_BLOCK_SIZE(p) (((p)-1)->header.size) + +/* -------------------------------------------------------------------------- */ +/* Numeric */ +/* -------------------------------------------------------------------------- */ + +/* + NUMERIC_VALID and SYMBOLIC_VALID: + The different values of SYBOLIC_VALID and NUMERIC_VALID are chosen as a + first defense against corrupted *Symbolic or *Numeric pointers passed to an + UMFPACK routine. They also ensure that the objects are used only by the + same version that created them (umfpack_di_*, umfpack_dl_*, umfpack_zi_*, + or umfpack_zl_*). The values have also been changed since prior releases of + the code to ensure that all routines that operate on the objects are of the + same release. The values themselves are purely arbitrary. The are less + than the ANSI C required minimums of INT_MAX and LONG_MAX, respectively. +*/ + +#ifdef DINT +#define NUMERIC_VALID 15674 +#define SYMBOLIC_VALID 41234 +#endif +#ifdef DLONG +#define NUMERIC_VALID 456789120 +#define SYMBOLIC_VALID 432192913 +#endif +#ifdef ZINT +#define NUMERIC_VALID 17654 +#define SYMBOLIC_VALID 40123 +#endif +#ifdef ZLONG +#define NUMERIC_VALID 123987654 +#define SYMBOLIC_VALID 119291234 +#endif + +typedef struct /* NumericType */ +{ + double + flops, /* "true" flop count */ + relpt, /* relative pivot tolerance used */ + relax, /* relaxed amalgamation parameter */ + relax2, /* relax2 amalgamation parameter */ + relax3, /* relax3 amalgamation parameter */ + alloc_init ; /* initial allocation of Numeric->memory */ + + Int valid ; /* set to NUMERIC_VALID, for validity check */ + + /* Memory space for A and LU factors */ + Unit + *Memory ; /* working memory for A and LU factors */ + Int + ihead, /* pointer to tail of LU factors, in Numeric->Memory */ + itail, /* pointer to top of elements & tuples, */ + /* in Numeric->Memory */ + ibig, /* pointer to largest free block seen in tail */ + size ; /* size of Memory, in Units */ + + Int + *Rperm, /* pointer to row perm array, size: n+1 */ + /* after UMF_kernel: Rperm [new] = old */ + /* during UMF_kernel: Rperm [old] = new */ + *Cperm, /* pointer to col perm array, size: n+1 */ + /* after UMF_kernel: Cperm [new] = old */ + /* during UMF_kernel: Cperm [old] = new */ + + *Upos, /* see UMFPACK_get_numeric for a description */ + *Lpos, + *Lip, + *Lilen, + *Uip, + *Uilen, + *Upattern ; /* pattern of last row of U (if singular) */ + + Int + ulen, /* length of Upattern */ + npiv, /* number of structural pivots found (sprank approx) */ + nnzpiv ; /* number of numerical (nonzero) pivots found */ + + Entry + *D ; /* D [i] is the diagonal entry of U */ + + double + min_udiag, /* smallest abs value on diagonal of D */ + max_udiag, /* smallest abs value on diagonal of D */ + rcond ; /* min (D) / max (D) */ + + Int + n_row, n_col ; /* A is n_row-by-n_row */ + + /* for information only: */ + Int + tail_usage, /* amount of memory allocated in tail */ + /* head_usage is Numeric->ihead */ + init_usage, /* memory usage just after UMF_kernel_init */ + max_usage, /* peak memory usage (excludes internal and external */ + /* fragmentation in the tail) */ + ngarbage, /* number of garbage collections performed */ + nrealloc, /* number of reallocations performed */ + ncostly, /* number of costly reallocations performed */ + isize, /* size of integer pattern of L and U */ + nLentries, /* number of entries in L, excluding diagonal */ + nUentries, /* number of entries in U, including diagonal */ + /* Some entries may be numerically zero. */ + lnz, /* number of nonzero entries in L, excl. diagonal */ + unz, /* number of nonzero entries in U, excl. diagonal */ + maxfrsize ; /* largest actual front size */ + +} NumericType ; + + + +/* -------------------------------------------------------------------------- */ +/* Element tuples for connecting elements together in a matrix */ +/* -------------------------------------------------------------------------- */ + +typedef struct /* Tuple */ +{ + /* The (e,f) tuples for the element lists */ + Int + e, /* element */ + f ; /* contribution to the row/col appears at this offset */ + +} Tuple ; + +/* Col_degree is aliased with Cperm, and Row_degree with Rperm */ +#define NON_PIVOTAL_COL(col) (Col_degree [col] >= 0) +#define NON_PIVOTAL_ROW(row) (Row_degree [row] >= 0) + +/* -------------------------------------------------------------------------- */ +/* An element */ +/* -------------------------------------------------------------------------- */ + +typedef struct /* Element */ +{ + Int + + cdeg, /* external column degree + cdeg0 offset */ + rdeg, /* external row degree + rdeg0 offset */ + nrowsleft, /* number of rows remaining */ + ncolsleft, /* number of columns remaining */ + nrows, /* number of rows */ + ncols, /* number of columns */ + next ; /* for list link of sons, used during assembly only */ + + /* followed in memory by: + Int + col [0..ncols-1], column indices of this element + row [0..nrows-1] ; row indices of this element + Entry (suitably aligned, see macro below) + C [0...nrows-1, 0...ncols-1] ; + size of C is nrows*ncols Entry's + */ + +} Element ; + +/* macros for computing pointers to row/col indices, and contribution block: */ + +#define GET_ELEMENT_SIZE(nr,nc) \ +(UNITS (Element, 1) + UNITS (Int, (nc) + (nr)) + UNITS (Entry, (nc) * (nr))) + +#define DGET_ELEMENT_SIZE(nr,nc) \ +(DUNITS (Element, 1) + DUNITS (Int, (nc) + (nr)) + DUNITS (Entry, (nc) * (nr))) + +#define GET_ELEMENT_COLS(ep,p,Cols) { \ + ASSERT (p) ; \ + ASSERT (p >= Numeric->Memory + Numeric->itail) ; \ + ASSERT (p <= Numeric->Memory + Numeric->size) ; \ + ep = (Element *) p ; \ + p += UNITS (Element, 1) ; \ + Cols = (Int *) p ; \ +} + +#define GET_ELEMENT_PATTERN(ep,p,Cols,Rows,ncm) { \ + GET_ELEMENT_COLS (ep, p, Cols) ; \ + ncm = ep->ncols ; \ + Rows = Cols + ncm ; \ +} + +#define GET_ELEMENT(ep,p,Cols,Rows,ncm,nrm,C) { \ + GET_ELEMENT_PATTERN (ep, p, Cols, Rows, ncm) ; \ + nrm = ep->nrows ; \ + p += UNITS (Int, ncm + nrm) ; \ + C = (Entry *) p ; \ +} + +/* -------------------------------------------------------------------------- */ +/* Work data structure */ +/* -------------------------------------------------------------------------- */ + +/* + This data structure holds items needed only during factorization. + All of this is freed when UMFPACK_numeric completes. Note that some of + it is stored in the tail end of Numeric->S (namely, the Tuples and the + Elements). +*/ + +typedef struct /* WorkType */ +{ + + /* ---------------------------------------------------------------------- */ + /* information about each row and col of A */ + /* ---------------------------------------------------------------------- */ + + /* + Row_tuples: pointer to tuple list (alias with Numeric->Uip) + Row_tlen: number of tuples (alias with Numeric->Uilen) + Col_tuples: pointer to tuple list (alias with Numeric->Lip) + Col_tlen: number of tuples (alias with Numeric->Lilen) + Row_degree: degree of the row or column (alias Numeric->Rperm) + Col_degree: degree of the row or column (alias Numeric->Cperm) + + The Row_degree and Col_degree are MATLAB-style colmmd approximations, + are equal to the sum of the sizes of the elements (contribution blocks) + in each row and column. They are maintained when elements are created + and assembled. They are used only during the pivot row and column + search. They are not needed to represent the pattern of the remaining + matrix. + */ + + /* ---------------------------------------------------------------------- */ + /* information about each element */ + /* ---------------------------------------------------------------------- */ + + Int *E ; /* E [0 .. n_col + n_inner] element "pointers" */ + /* (offsets in Numeric->Memory) */ + + /* ---------------------------------------------------------------------- */ + /* generic workspace */ + /* ---------------------------------------------------------------------- */ + + Int /* Sizes: nn = MAX (n_row, n_col) */ + *Wp, /* nn+1 */ + *Wm, /* maxnrows+1 */ + *Wio, /* maxncols+1 */ + *Woi, /* maxncols+1 */ + *Woo, /* MAX (maxnrows,maxncols)+1 */ + *Wcol, /* pointer to Wm */ + *Wrow ; /* pointer to Fcols, Wio, or Woi */ + + /* ---------------------------------------------------------------------- */ + Int + *Lpattern, /* pattern of column of L, for one Lchain */ + *Upattern, /* pattern of row of U, for one Uchain */ + ulen, llen ; /* length of Upattern and Lpattern */ + + /* ---------------------------------------------------------------------- */ + + Int + n_row, n_col, /* matrix is n_row-by-n_col */ + nz, /* nonzeros in the elements for this matrix */ + npiv, /* number of pivot rows and columns so far */ + Wpflag, + nel, /* elements in use are in the range 1..nel */ + nelorig, /* elements 1..nelorig are original elements */ + prior_element, + overlap, + rdeg0, cdeg0, + rrdeg, ccdeg, + Candidates [MAX_CANDIDATES], /* current candidate pivot columns */ + ncand, /* number of candidates (some not in Candidates[ ]) */ + nextcand, /* next candidate to place in Candidate search set */ + pivrow, /* current pivot row */ + pivcol, /* current pivot column */ + scan_pivrow, scan_pivcol, + do_extend, /* true if the next pivot extends the current front */ + do_update, /* true if update should be applied */ + do_scan2row, + do_scan2col, + pivot_case, + frontid, /* id of current frontal matrix */ + nfr, /* number of frontal matrices */ + maxfrsize, + maxnrows, /* largest number of rows in any front */ + maxncols ; /* largest number of columns in any front */ + + /* ---------------------------------------------------------------------- */ + /* For row-merge tree */ + /* ---------------------------------------------------------------------- */ + + Int + *Front_new1strow ; + + /* ---------------------------------------------------------------------- */ + /* current frontal matrix */ + /* ---------------------------------------------------------------------- */ + + Entry + *Fx ; /* Fx [0..fnrows_max-1, 0..fncols_max-1] */ + /* working array */ + Int + *Frows, /* Frows [0.. ]: row indices of F */ + + *Fcols, /* Fcols [0.. ]: column indices of F */ + + *Frpos, /* position of row indices in F, or -1 if not present */ + /* if Frows[i] == row, then Frpos[row] == i */ + + *Fcpos, /* position of col indices in F, or -1 if not present */ + /* if Fcols[j] == col, then */ + /* Fcpos[col] == j*Front->fnrows_max */ + + fnrows, /* number of rows in contribution block in F */ + fncols, /* number of columns in contribution block in F */ + fnrows_max, /* column-dimension (max # of rows) of F */ + fncols_max, /* row-dimension (max # of columns) of F */ + fnpiv, /* number of pivots in F */ + fcolpos, /* offset of candidate pivot column in Fcols [...] */ + frowpos, /* offset of candidate pivot row in Frows [...] */ + fnzeros, /* number of explicit zero entries in LU block */ + fscan_row, + fscan_col, + pivrow_in_front, /* true if current pivot row in Frows */ + pivcol_in_front ; /* true if current pivot column in Fcols */ + + /* ---------------------------------------------------------------------- */ + /* Current frontal matrix */ + /* ---------------------------------------------------------------------- */ + /* Fx points to current frontal matrix (contribution block and LU */ + /* factors). For example, if Front->fnrows = 4, Front->fncols = 6, and */ + /* Front->fnpiv = 3, then "x" is a term in the contribution block, "l" */ + /* in L1, "u" in U1, "L" in L2, "U" in U2, and "." is unused. Fx [0] is */ + /* "X". The first 3 pivot values (diagonal entries in U1) are 1,2, and 3.*/ + /* For this frontal matrix, Front->fncols_max = 12 (the number of */ + /* columns), and Front->fnrows_max = 8 (the number of rows). The */ + /* frontal matrix is (Front->fnrows_max)-by-(Front->fncols_max) */ + /* */ + /* |----------- col 1 of L1 and L2, etc. */ + /* V */ + /* X x x x x x . . . L L L */ + /* x x x x x x . . . L L L */ + /* x x x x x x . . . L L L */ + /* x x x x x x . . . L L L */ + /* . . . . . . . . . . . . */ + /* U U U U U U . . . 3 l l <- row 3 of U1 and U2 */ + /* U U U U U U . . . u 2 l <- row 2 of U1 and U2 */ + /* U U U U U U . . . u u 1 <- row 1 of U1 and U2 */ + /* */ + /* ---------------------------------------------------------------------- */ + +} WorkType ; + + +/* -------------------------------------------------------------------------- */ +/* Symbolic */ +/* -------------------------------------------------------------------------- */ + +/* + This is is constructed by UMFPACK_symbolic, and is needed by UMFPACK_numeric + to factor the matrix. +*/ + +typedef struct /* SymbolicType */ +{ + + double + drow, /* dense row control parameter used */ + dcol, /* dense column control parameter used */ + num_mem_usage_est, /* estimated max Numeric->Memory size */ + num_mem_size_est, /* estimated final Numeric->Memory size */ + peak_sym_usage ; /* peak Symbolic and SymbolicWork usage */ + + Int valid, /* set to SYMBOLIC_VALID, for validity check */ + nchains, + *Chain_start, + *Chain_maxrows, + *Chain_maxcols, + maxfrsize, + maxnrows, /* largest number of rows in any front */ + maxncols, /* largest number of columns in any front */ + *Front_npivcol, /* Front_npivcol [j] = size of jth supercolumn*/ + *Front_1strow, /* first row index in front j */ + *Front_leftmostdesc, /* leftmost desc of front j */ + *Front_parent, /* super-column elimination tree */ + *Cperm_init, /* initial column ordering */ + *Rperm_init, /* initial row ordering */ + nfr, + n_row, n_col, /* matrix A is n_row-by-n_col */ + nz, /* nz of original matrix */ + nb, /* block size for BLAS 3 */ + num_mem_init_usage ; /* min Numeric->Memory for UMF_kernel_init */ + +} SymbolicType ; + + +/* -------------------------------------------------------------------------- */ +/* for debugging only: */ +/* -------------------------------------------------------------------------- */ + +#include "umf_dump.h" + diff --git a/src/sparse-matrix/umfpack/umf_is_permutation.h b/src/sparse-matrix/umfpack/umf_is_permutation.h new file mode 100644 index 0000000..62b7c60 --- /dev/null +++ b/src/sparse-matrix/umfpack/umf_is_permutation.h @@ -0,0 +1,15 @@ +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +GLOBAL Int UMF_is_permutation +( + const Int P [ ], + Int W [ ], + Int n, + Int r +) ; + diff --git a/src/sparse-matrix/umfpack/umf_kernel.h b/src/sparse-matrix/umfpack/umf_kernel.h new file mode 100644 index 0000000..5a13680 --- /dev/null +++ b/src/sparse-matrix/umfpack/umf_kernel.h @@ -0,0 +1,20 @@ +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +GLOBAL Int UMF_kernel +( + const Int Ap [ ], + const Int Ai [ ], + const double Ax [ ], +#ifdef COMPLEX + const double Az [ ], +#endif + NumericType *Numeric, + WorkType *Work, + SymbolicType *Symbolic +) ; + diff --git a/src/sparse-matrix/umfpack/umf_kernel_init.h b/src/sparse-matrix/umfpack/umf_kernel_init.h new file mode 100644 index 0000000..b58a6c6 --- /dev/null +++ b/src/sparse-matrix/umfpack/umf_kernel_init.h @@ -0,0 +1,20 @@ +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +GLOBAL Int UMF_kernel_init +( + const Int Ap [ ], + const Int Ai [ ], + const double Ax [ ], +#ifdef COMPLEX + const double Az [ ], +#endif + NumericType *Numeric, + WorkType *Work, + SymbolicType *Symbolic +) ; + diff --git a/src/sparse-matrix/umfpack/umf_kernel_init_usage.h b/src/sparse-matrix/umfpack/umf_kernel_init_usage.h new file mode 100644 index 0000000..50c6d8b --- /dev/null +++ b/src/sparse-matrix/umfpack/umf_kernel_init_usage.h @@ -0,0 +1,16 @@ +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +GLOBAL Int UMF_kernel_init_usage +( + const Int Ap [ ], + const Int Row_degree [ ], + Int n_row, + Int n_col, + double *dusage +) ; + diff --git a/src/sparse-matrix/umfpack/umf_kernel_wrapup.h b/src/sparse-matrix/umfpack/umf_kernel_wrapup.h new file mode 100644 index 0000000..d010239 --- /dev/null +++ b/src/sparse-matrix/umfpack/umf_kernel_wrapup.h @@ -0,0 +1,14 @@ +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +GLOBAL void UMF_kernel_wrapup +( + NumericType *Numeric, + SymbolicType *Symbolic, + WorkType *Work +) ; + diff --git a/src/sparse-matrix/umfpack/umf_local_search.h b/src/sparse-matrix/umfpack/umf_local_search.h new file mode 100644 index 0000000..5b9558e --- /dev/null +++ b/src/sparse-matrix/umfpack/umf_local_search.h @@ -0,0 +1,14 @@ +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +GLOBAL Int UMF_local_search +( + NumericType *Numeric, + WorkType *Work, + SymbolicType *Symbolic +) ; + diff --git a/src/sparse-matrix/umfpack/umf_lsolve.h b/src/sparse-matrix/umfpack/umf_lsolve.h new file mode 100644 index 0000000..58e1443 --- /dev/null +++ b/src/sparse-matrix/umfpack/umf_lsolve.h @@ -0,0 +1,14 @@ +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +GLOBAL double UMF_lsolve +( + NumericType *Numeric, + Entry X [ ], + Int Pattern [ ] +) ; + diff --git a/src/sparse-matrix/umfpack/umf_ltsolve.h b/src/sparse-matrix/umfpack/umf_ltsolve.h new file mode 100644 index 0000000..950f205 --- /dev/null +++ b/src/sparse-matrix/umfpack/umf_ltsolve.h @@ -0,0 +1,22 @@ +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +GLOBAL double UMF_ltsolve +( + NumericType *Numeric, + Entry X [ ], + Int Pattern [ ] +) ; + + +GLOBAL double UMF_lhsolve +( + NumericType *Numeric, + Entry X [ ], + Int Pattern [ ] +) ; + diff --git a/src/sparse-matrix/umfpack/umf_malloc.h b/src/sparse-matrix/umfpack/umf_malloc.h new file mode 100644 index 0000000..c2b8849 --- /dev/null +++ b/src/sparse-matrix/umfpack/umf_malloc.h @@ -0,0 +1,17 @@ +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +#if defined (UMF_MALLOC_COUNT) || !defined (NDEBUG) +GLOBAL extern Int UMF_malloc_count ; +#endif + +GLOBAL void *UMF_malloc +( + Int n_objects, + size_t size_of_object +) ; + diff --git a/src/sparse-matrix/umfpack/umf_mem_alloc_element.h b/src/sparse-matrix/umfpack/umf_mem_alloc_element.h new file mode 100644 index 0000000..fb42ecc --- /dev/null +++ b/src/sparse-matrix/umfpack/umf_mem_alloc_element.h @@ -0,0 +1,19 @@ +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +GLOBAL Int UMF_mem_alloc_element +( + NumericType *Numeric, + Int nrows, + Int ncols, + Int **Rows, + Int **Cols, + Entry **C, + Int *size, + Element **epout +) ; + diff --git a/src/sparse-matrix/umfpack/umf_mem_alloc_head_block.h b/src/sparse-matrix/umfpack/umf_mem_alloc_head_block.h new file mode 100644 index 0000000..ae6f115 --- /dev/null +++ b/src/sparse-matrix/umfpack/umf_mem_alloc_head_block.h @@ -0,0 +1,13 @@ +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +GLOBAL Int UMF_mem_alloc_head_block +( + NumericType *Numeric, + Int nunits +) ; + diff --git a/src/sparse-matrix/umfpack/umf_mem_alloc_tail_block.h b/src/sparse-matrix/umfpack/umf_mem_alloc_tail_block.h new file mode 100644 index 0000000..3b7df49 --- /dev/null +++ b/src/sparse-matrix/umfpack/umf_mem_alloc_tail_block.h @@ -0,0 +1,13 @@ +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +GLOBAL Int UMF_mem_alloc_tail_block +( + NumericType *Numeric, + Int nunits +) ; + diff --git a/src/sparse-matrix/umfpack/umf_mem_free_tail_block.h b/src/sparse-matrix/umfpack/umf_mem_free_tail_block.h new file mode 100644 index 0000000..16df07f --- /dev/null +++ b/src/sparse-matrix/umfpack/umf_mem_free_tail_block.h @@ -0,0 +1,13 @@ +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +GLOBAL void UMF_mem_free_tail_block +( + NumericType *Numeric, + Int i +) ; + diff --git a/src/sparse-matrix/umfpack/umf_mem_init_memoryspace.h b/src/sparse-matrix/umfpack/umf_mem_init_memoryspace.h new file mode 100644 index 0000000..3d8c25d --- /dev/null +++ b/src/sparse-matrix/umfpack/umf_mem_init_memoryspace.h @@ -0,0 +1,12 @@ +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +GLOBAL void UMF_mem_init_memoryspace +( + NumericType *Numeric +) ; + diff --git a/src/sparse-matrix/umfpack/umf_order_front_tree.h b/src/sparse-matrix/umfpack/umf_order_front_tree.h new file mode 100644 index 0000000..78d0b96 --- /dev/null +++ b/src/sparse-matrix/umfpack/umf_order_front_tree.h @@ -0,0 +1,17 @@ +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +GLOBAL Int UMF_order_front_tree +( + Int root, + Int k, + Int Front_child [ ], + const Int Front_sibling [ ], + Int Front_order [ ], + Int Stack [ ] +) ; + diff --git a/src/sparse-matrix/umfpack/umf_realloc.h b/src/sparse-matrix/umfpack/umf_realloc.h new file mode 100644 index 0000000..94335cf --- /dev/null +++ b/src/sparse-matrix/umfpack/umf_realloc.h @@ -0,0 +1,14 @@ +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +GLOBAL void *UMF_realloc +( + void *p, + Int n_objects, + size_t size_of_object +) ; + diff --git a/src/sparse-matrix/umfpack/umf_report_perm.h b/src/sparse-matrix/umfpack/umf_report_perm.h new file mode 100644 index 0000000..3751c5a --- /dev/null +++ b/src/sparse-matrix/umfpack/umf_report_perm.h @@ -0,0 +1,16 @@ +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +GLOBAL Int UMF_report_perm +( + Int n, + const Int P [ ], + Int W [ ], + Int prl, + Int user +) ; + diff --git a/src/sparse-matrix/umfpack/umf_report_vector.h b/src/sparse-matrix/umfpack/umf_report_vector.h new file mode 100644 index 0000000..10f4de0 --- /dev/null +++ b/src/sparse-matrix/umfpack/umf_report_vector.h @@ -0,0 +1,16 @@ +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +GLOBAL Int UMF_report_vector +( + Int n, + const double Xx [ ], + const double Xz [ ], + Int prl, + Int user +) ; + diff --git a/src/sparse-matrix/umfpack/umf_row_search.h b/src/sparse-matrix/umfpack/umf_row_search.h new file mode 100644 index 0000000..e3105a1 --- /dev/null +++ b/src/sparse-matrix/umfpack/umf_row_search.h @@ -0,0 +1,24 @@ +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +GLOBAL Int UMF_row_search +( + NumericType *Numeric, + WorkType *Work, + SymbolicType *Symbolic, + Int cdeg, + const Int Pattern [ ], + Int pivrow [2], + Int rdeg [2], + Int W_i [ ], + Int W_o [ ], + Int prior_pivrow [2], + const Entry Fcol [ ], + Int pivcol, + Int freebie [2] +) ; + diff --git a/src/sparse-matrix/umfpack/umf_scale_column.h b/src/sparse-matrix/umfpack/umf_scale_column.h new file mode 100644 index 0000000..4534d35 --- /dev/null +++ b/src/sparse-matrix/umfpack/umf_scale_column.h @@ -0,0 +1,13 @@ +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +GLOBAL Int UMF_scale_column +( + NumericType *Numeric, + WorkType *Work +) ; + diff --git a/src/sparse-matrix/umfpack/umf_set_stats.h b/src/sparse-matrix/umfpack/umf_set_stats.h new file mode 100644 index 0000000..446c668 --- /dev/null +++ b/src/sparse-matrix/umfpack/umf_set_stats.h @@ -0,0 +1,22 @@ +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +GLOBAL void UMF_set_stats +( + double Info [ ], + SymbolicType *Symbolic, + double max_usage, + double num_mem_size, + double flops, + double lnz, + double unz, + double maxfrsize, + double ulen, + double npiv, + Int what +) ; + diff --git a/src/sparse-matrix/umfpack/umf_solve.h b/src/sparse-matrix/umfpack/umf_solve.h new file mode 100644 index 0000000..cf2a05f --- /dev/null +++ b/src/sparse-matrix/umfpack/umf_solve.h @@ -0,0 +1,27 @@ +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +GLOBAL Int UMF_solve +( + Int sys, + const Int Ap [ ], + const Int Ai [ ], + const double Ax [ ], + double Xx [ ], + const double Bx [ ], +#ifdef COMPLEX + const double Az [ ], + double Xz [ ], + const double Bz [ ], +#endif + NumericType *Numeric, + Int irstep, + double Info [UMFPACK_INFO], + Int Pattern [ ], + double SolveWork [ ] +) ; + diff --git a/src/sparse-matrix/umfpack/umf_symbolic_usage.h b/src/sparse-matrix/umfpack/umf_symbolic_usage.h new file mode 100644 index 0000000..2c54ffc --- /dev/null +++ b/src/sparse-matrix/umfpack/umf_symbolic_usage.h @@ -0,0 +1,15 @@ +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +GLOBAL double UMF_symbolic_usage +( + Int n_row, + Int n_col, + Int nchains, + Int nfr +) ; + diff --git a/src/sparse-matrix/umfpack/umf_transpose.h b/src/sparse-matrix/umfpack/umf_transpose.h new file mode 100644 index 0000000..c230983 --- /dev/null +++ b/src/sparse-matrix/umfpack/umf_transpose.h @@ -0,0 +1,29 @@ +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +GLOBAL Int UMF_transpose +( + Int n_row, + Int n_col, + const Int Ap [ ], + const Int Ai [ ], + const double Ax [ ], + const Int P [ ], + const Int Q [ ], + Int nq, + Int Rp [ ], + Int Ri [ ], + double Rx [ ], + Int W [ ], + Int check +#ifdef COMPLEX + , const double Az [ ] + , double Rz [ ] + , Int do_conjugate +#endif +) ; + diff --git a/src/sparse-matrix/umfpack/umf_triplet.h b/src/sparse-matrix/umfpack/umf_triplet.h new file mode 100644 index 0000000..e2d3b84 --- /dev/null +++ b/src/sparse-matrix/umfpack/umf_triplet.h @@ -0,0 +1,87 @@ +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +GLOBAL Int UMF_triplet_map_x +( + Int n_row, + Int n_col, + Int nz, + const Int Ti [ ], + const Int Tj [ ], + Int Ap [ ], + Int Ai [ ], + Int Rp [ ], + Int Rj [ ], + Int W [ ], + Int RowCount [ ] + , const double Tx [ ] + , double Ax [ ] + , double Rx [ ] +#ifdef COMPLEX + , const double Tz [ ] + , double Az [ ] + , double Rz [ ] +#endif + , Int Map [ ] + , Int Map2 [ ] +) ; + +GLOBAL Int UMF_triplet_map_nox +( + Int n_row, + Int n_col, + Int nz, + const Int Ti [ ], + const Int Tj [ ], + Int Ap [ ], + Int Ai [ ], + Int Rp [ ], + Int Rj [ ], + Int W [ ], + Int RowCount [ ] + , Int Map [ ] + , Int Map2 [ ] +) ; + +GLOBAL Int UMF_triplet_nomap_x +( + Int n_row, + Int n_col, + Int nz, + const Int Ti [ ], + const Int Tj [ ], + Int Ap [ ], + Int Ai [ ], + Int Rp [ ], + Int Rj [ ], + Int W [ ], + Int RowCount [ ] + , const double Tx [ ] + , double Ax [ ] + , double Rx [ ] +#ifdef COMPLEX + , const double Tz [ ] + , double Az [ ] + , double Rz [ ] +#endif +) ; + +GLOBAL Int UMF_triplet_nomap_nox +( + Int n_row, + Int n_col, + Int nz, + const Int Ti [ ], + const Int Tj [ ], + Int Ap [ ], + Int Ai [ ], + Int Rp [ ], + Int Rj [ ], + Int W [ ], + Int RowCount [ ] +) ; + diff --git a/src/sparse-matrix/umfpack/umf_tuple_lengths.h b/src/sparse-matrix/umfpack/umf_tuple_lengths.h new file mode 100644 index 0000000..6594cfa --- /dev/null +++ b/src/sparse-matrix/umfpack/umf_tuple_lengths.h @@ -0,0 +1,14 @@ +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +GLOBAL Int UMF_tuple_lengths +( + NumericType *Numeric, + WorkType *Work, + double *dusage +) ; + diff --git a/src/sparse-matrix/umfpack/umf_usolve.h b/src/sparse-matrix/umfpack/umf_usolve.h new file mode 100644 index 0000000..2b1b2de --- /dev/null +++ b/src/sparse-matrix/umfpack/umf_usolve.h @@ -0,0 +1,14 @@ +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +GLOBAL double UMF_usolve +( + NumericType *Numeric, + Entry X [ ], + Int Pattern [ ] +) ; + diff --git a/src/sparse-matrix/umfpack/umf_utsolve.h b/src/sparse-matrix/umfpack/umf_utsolve.h new file mode 100644 index 0000000..5540c71 --- /dev/null +++ b/src/sparse-matrix/umfpack/umf_utsolve.h @@ -0,0 +1,22 @@ +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +GLOBAL double UMF_utsolve +( + NumericType *Numeric, + Entry X [ ], + Int Pattern [ ] +) ; + + +GLOBAL double UMF_uhsolve +( + NumericType *Numeric, + Entry X [ ], + Int Pattern [ ] +) ; + diff --git a/src/sparse-matrix/umfpack/umf_valid_numeric.h b/src/sparse-matrix/umfpack/umf_valid_numeric.h new file mode 100644 index 0000000..b98ecf2 --- /dev/null +++ b/src/sparse-matrix/umfpack/umf_valid_numeric.h @@ -0,0 +1,12 @@ +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +GLOBAL Int UMF_valid_numeric +( + NumericType *Numeric +) ; + diff --git a/src/sparse-matrix/umfpack/umf_valid_symbolic.h b/src/sparse-matrix/umfpack/umf_valid_symbolic.h new file mode 100644 index 0000000..6ad6f90 --- /dev/null +++ b/src/sparse-matrix/umfpack/umf_valid_symbolic.h @@ -0,0 +1,12 @@ +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +GLOBAL Int UMF_valid_symbolic +( + SymbolicType *Symbolic +) ; + diff --git a/src/sparse-matrix/umfpack/umf_version.h b/src/sparse-matrix/umfpack/umf_version.h new file mode 100644 index 0000000..7226fb0 --- /dev/null +++ b/src/sparse-matrix/umfpack/umf_version.h @@ -0,0 +1,863 @@ +/* ========================================================================== */ +/* === umf_version ========================================================== */ +/* ========================================================================== */ + +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +/* + Define routine names and integer type, depending on version being compiled. + + DINT: double precision, int's as integers + DLONG: double precision, long's as integers + + ZLONG: complex double precision, long's as integers + ZINT: complex double precision, int's as integers +*/ + +/* Set DINT as the default, if nothing is defined */ +#if !defined (DLONG) && !defined (DINT) && !defined (ZLONG) && !defined (ZINT) +#define DINT +#endif + +/* Determine if this is a real or complex version */ +#if defined (ZLONG) || defined (ZINT) +#define COMPLEX +#endif + +/* -------------------------------------------------------------------------- */ +/* integer type */ +/* -------------------------------------------------------------------------- */ + +#if defined (DLONG) || defined (ZLONG) + +#define LONG_INTEGER +#define Int long +#define ID "%ld" +#define Int_MAX LONG_MAX + +#else + +#define Int int +#define ID "%d" +#define Int_MAX INT_MAX + +#endif + +/* -------------------------------------------------------------------------- */ +/* Numerical relop macros for correctly handling the NaN case */ +/* -------------------------------------------------------------------------- */ + +/* +SCALAR_IS_NAN(x): + True if x is NaN. False otherwise. The commonly-existing isnan(x) + function could be used, but it's not in Kernighan & Ritchie 2nd edition + (ANSI C). It may appear in <math.h>, but I'm not certain about + portability. The expression x != x is true if and only if x is NaN, + according to the IEEE 754 floating-point standard. + +SCALAR_IS_ZERO(x): + True if x is zero. False if x is nonzero, NaN, or +/- Inf. + This is (x == 0) if the compiler is IEEE 754 compliant. + +SCALAR_IS_NONZERO(x): + True if x is nonzero, NaN, or +/- Inf. False if x zero. + This is (x != 0) if the compiler is IEEE 754 compliant. + +SCALAR_IS_LTZERO(x): + True if x is < zero or -Inf. False if x is >= 0, NaN, or +Inf. + This is (x < 0) if the compiler is IEEE 754 compliant. +*/ + +#if defined (MATHWORKS) + +/* The MathWorks has their own macros in util.h that handle NaN's properly. */ +#define SCALAR_IS_NAN(x) (utIsNaN (x)) +#define SCALAR_IS_ZERO(x) (utEQZero (x)) +#define SCALAR_IS_NONZERO(x) (utNEZero (x)) +#define SCALAR_IS_LTZERO(x) (utLTZero (x)) + +#elif defined (UMF_WINDOWS) + +/* Yes, this is exceedingly ugly. Blame Microsoft, which hopelessly */ +/* violates the IEEE 754 floating-point standard in a bizarre way. */ +/* If you're using an IEEE 754-compliant compiler, then x != x is true */ +/* iff x is NaN. For Microsoft, (x < x) is true iff x is NaN. */ +/* So either way, this macro safely detects a NaN. */ +#define SCALAR_IS_NAN(x) (((x) != (x)) || (((x) < (x)))) +#define SCALAR_IS_ZERO(x) (((x) == 0.) && !SCALAR_IS_NAN(x)) +#define SCALAR_IS_NONZERO(x) (((x) != 0.) || SCALAR_IS_NAN(x)) +#define SCALAR_IS_LTZERO(x) (((x) < 0.) && !SCALAR_IS_NAN(x)) + +#else + +/* These all work properly, according to the IEEE 754 standard ... except on */ +/* a PC with windows. Works fine in Linux on the same PC... */ +#define SCALAR_IS_NAN(x) ((x) != (x)) +#define SCALAR_IS_ZERO(x) ((x) == 0.) +#define SCALAR_IS_NONZERO(x) ((x) != 0.) +#define SCALAR_IS_LTZERO(x) ((x) < 0.) + +#endif + +/* scalar absolute value macro. If x is NaN, the result is NaN: */ +#define SCALAR_ABS(x) ((SCALAR_IS_LTZERO (x)) ? -(x) : (x)) + +/* true if an integer (stored in double x) would overflow (or if x is NaN) */ +#define INT_OVERFLOW(x) ((!((x) * (1.0 + MAX_EPSILON) <= Int_MAX)) || SCALAR_IS_NAN (x)) + + +/* -------------------------------------------------------------------------- */ +/* Real floating-point arithmetic */ +/* -------------------------------------------------------------------------- */ + +#ifndef COMPLEX + +#define Entry double + +#define REAL_COMPONENT(c) (c) +#define IMAG_COMPONENT(c) (0.) +#define ASSIGN(c,s1,s2) { (c) = (s1) ; } +#define CLEAR(c) { (c) = 0. ; } +#define IS_ZERO(a) SCALAR_IS_ZERO (a) +#define IS_NONZERO(a) SCALAR_IS_NONZERO (a) +#define ASSEMBLE(c,a) { (c) += (a) ; } +#define DECREMENT(c,a) { (c) -= (a) ; } +#define MULT(c,a,b) { (c) = (a) * (b) ; } +#define MULT_CONJ(c,a,b) { (c) = (a) * (b) ; } +#define MULT_SUB(c,a,b) { (c) -= (a) * (b) ; } +#define MULT_SUB_CONJ(c,a,b) { (c) -= (a) * (b) ; } +#define DIV(c,a,b) { (c) = (a) / (b) ; } +#define DIV_CONJ(c,a,b) { (c) = (a) / (b) ; } +#define APPROX_ABS(s,a) { (s) = SCALAR_ABS (a) ; } +#define ABS(s,a) { (s) = SCALAR_ABS (a) ; } + +/* print an entry (avoid printing "-0" for negative zero). */ +#define PRINT_ENTRY(a) \ +{ \ + if (SCALAR_IS_NONZERO (a)) \ + { \ + PRINTF ((" (%g)", (a))) ; \ + } \ + else \ + { \ + PRINTF ((" (0)")) ; \ + } \ +} + +/* for flop counts */ +#define MULTSUB_FLOPS 2. /* c -= a*b */ +#define DIV_FLOPS 1. /* c = a/b */ +#define ABS_FLOPS 0. /* c = abs (a) */ +#define ASSEMBLE_FLOPS 1. /* c += a */ +#define DECREMENT_FLOPS 1. /* c -= a */ +#define MULT_FLOPS 1. /* c = a*b */ + +#else + +/* -------------------------------------------------------------------------- */ +/* Complex floating-point arithmetic */ +/* -------------------------------------------------------------------------- */ + +/* + Note: An alternative to this DoubleComplex type would be to use a + struct { double r ; double i ; }. The problem with that method + (used by the Sun Performance Library, for example) is that ANSI C provides + no guarantee about the layout of a struct. It is possible that the sizeof + the struct above would be greater than 2 * sizeof (double). This would + mean that the complex BLAS could not be used. The method used here avoids + that possibility. ANSI C *does* guarantee that an array of structs has + the same size as n times the size of one struct. + + The ANSI C99 version of the C language includes a "double _Complex" type. + It should be possible in that case to do the following: + + #define Entry double _Complex + + and remove the DoubleComplex struct. The macros, below, could then be + replaced with instrinsic operators. Note that the #define Real and + #define Imag should also be removed (they only appear in this file). + + For the MULT, MULT_SUB, MULT_SUB_CONJ, DIV, and DIV_CONJ macros, + the output argument c cannot be the same as any input argument. + +*/ + +typedef struct +{ + double component [2] ; /* real and imaginary parts */ + +} DoubleComplex ; + +#define Entry DoubleComplex +#define Real component [0] +#define Imag component [1] + +/* for flop counts */ +#define MULTSUB_FLOPS 8. /* c -= a*b */ +#define DIV_FLOPS 9. /* c = a/b */ +#define ABS_FLOPS 6. /* c = abs (a), count sqrt as one flop */ +#define ASSEMBLE_FLOPS 2. /* c += a */ +#define DECREMENT_FLOPS 2. /* c -= a */ +#define MULT_FLOPS 6. /* c = a*b */ + +/* -------------------------------------------------------------------------- */ + +/* real part of c */ +#define REAL_COMPONENT(c) ((c).Real) + +/* -------------------------------------------------------------------------- */ + +/* imag part of c */ +#define IMAG_COMPONENT(c) ((c).Imag) + +/* -------------------------------------------------------------------------- */ + +/* c = (s1) + (s2)i */ +#define ASSIGN(c,s1,s2) \ +{ \ + (c).Real = (s1) ; \ + (c).Imag = (s2) ; \ +} + +/* -------------------------------------------------------------------------- */ + +/* c = 0 */ +#define CLEAR(c) \ +{ \ + (c).Real = 0. ; \ + (c).Imag = 0. ; \ +} + +/* -------------------------------------------------------------------------- */ + +/* True if a == 0 */ +#define IS_ZERO(a) \ + (SCALAR_IS_ZERO ((a).Real) && SCALAR_IS_ZERO ((a).Imag)) + +/* -------------------------------------------------------------------------- */ + +/* True if a != 0 */ +#define IS_NONZERO(a) \ + (SCALAR_IS_NONZERO ((a).Real) || SCALAR_IS_NONZERO ((a).Imag)) + +/* -------------------------------------------------------------------------- */ + +/* c += a */ +#define ASSEMBLE(c,a) \ +{ \ + (c).Real += (a).Real ; \ + (c).Imag += (a).Imag ; \ +} + +/* -------------------------------------------------------------------------- */ + +/* c -= a */ +#define DECREMENT(c,a) \ +{ \ + (c).Real -= (a).Real ; \ + (c).Imag -= (a).Imag ; \ +} + +/* -------------------------------------------------------------------------- */ + +/* c = a*b, assert because c cannot be the same as a or b */ +#define MULT(c,a,b) \ +{ \ + ASSERT (&(c) != &(a) && &(c) != &(b)) ; \ + (c).Real = (a).Real * (b).Real - (a).Imag * (b).Imag ; \ + (c).Imag = (a).Imag * (b).Real + (a).Real * (b).Imag ; \ +} + +/* -------------------------------------------------------------------------- */ + +/* c = a*conjugate(b), assert because c cannot be the same as a or b */ +#define MULT_CONJ(c,a,b) \ +{ \ + ASSERT (&(c) != &(a) && &(c) != &(b)) ; \ + (c).Real = (a).Real * (b).Real + (a).Imag * (b).Imag ; \ + (c).Imag = (a).Imag * (b).Real - (a).Real * (b).Imag ; \ +} + +/* -------------------------------------------------------------------------- */ + +/* c -= a*b, assert because c cannot be the same as a or b */ +#define MULT_SUB(c,a,b) \ +{ \ + ASSERT (&(c) != &(a) && &(c) != &(b)) ; \ + (c).Real -= (a).Real * (b).Real - (a).Imag * (b).Imag ; \ + (c).Imag -= (a).Imag * (b).Real + (a).Real * (b).Imag ; \ +} + +/* -------------------------------------------------------------------------- */ + +/* c -= a*conjugate(b), assert because c cannot be the same as a or b */ +#define MULT_SUB_CONJ(c,a,b) \ +{ \ + ASSERT (&(c) != &(a) && &(c) != &(b)) ; \ + (c).Real -= (a).Real * (b).Real + (a).Imag * (b).Imag ; \ + (c).Imag -= (a).Imag * (b).Real - (a).Real * (b).Imag ; \ +} + +/* -------------------------------------------------------------------------- */ + +/* c = a/b, be careful to avoid underflow and overflow */ +#ifdef MATHWORKS +#define DIV(c,a,b) \ +{ \ + (void) utDivideComplex ((a).Real, (a).Imag, (b).Real, (b).Imag, \ + &((c).Real), &((c).Imag)) ; \ +} +#else +/* This uses ACM Algo 116, by R. L. Smith, 1962. */ +/* c cannot be the same variable as a or b. */ +/* Ignore NaN case for double relop br>=bi. */ +#define DIV(c,a,b) \ +{ \ + double r, den, br, bi ; \ + ASSERT (&(c) != &(a) && &(c) != &(b)) ; \ + br = SCALAR_ABS ((b).Real) ; \ + bi = SCALAR_ABS ((b).Imag) ; \ + if (br >= bi) \ + { \ + r = (b).Imag / (b).Real ; \ + den = (b).Real + r * (b).Imag ; \ + (c).Real = ((a).Real + (a).Imag * r) / den ; \ + (c).Imag = ((a).Imag - (a).Real * r) / den ; \ + } \ + else \ + { \ + r = (b).Real / (b).Imag ; \ + den = r * (b).Real + (b).Imag ; \ + (c).Real = ((a).Real * r + (a).Imag) / den ; \ + (c).Imag = ((a).Imag * r - (a).Real) / den ; \ + } \ +} +#endif + +/* -------------------------------------------------------------------------- */ + +/* c = a/conjugate(b), be careful to avoid underflow and overflow */ +#ifdef MATHWORKS +#define DIV_CONJ(c,a,b) \ +{ \ + (void) utDivideComplex ((a).Real, (a).Imag, (b).Real, (-(b).Imag), \ + &((c).Real), &((c).Imag)) ; \ +} +#else +/* This uses ACM Algo 116, by R. L. Smith, 1962. */ +/* c cannot be the same variable as a or b. */ +/* Ignore NaN case for double relop br>=bi. */ +#define DIV_CONJ(c,a,b) \ +{ \ + double r, den, br, bi ; \ + ASSERT (&(c) != &(a) && &(c) != &(b)) ; \ + br = SCALAR_ABS ((b).Real) ; \ + bi = SCALAR_ABS ((b).Imag) ; \ + if (br >= bi) \ + { \ + r = (-(b).Imag) / (b).Real ; \ + den = (b).Real - r * (b).Imag ; \ + (c).Real = ((a).Real + (a).Imag * r) / den ; \ + (c).Imag = ((a).Imag - (a).Real * r) / den ; \ + } \ + else \ + { \ + r = (b).Real / (-(b).Imag) ; \ + den = r * (b).Real - (b).Imag; \ + (c).Real = ((a).Real * r + (a).Imag) / den ; \ + (c).Imag = ((a).Imag * r - (a).Real) / den ; \ + } \ +} +#endif + +/* -------------------------------------------------------------------------- */ + +/* approximate absolute value, s = |r|+|i| */ +#define APPROX_ABS(s,a) \ +{ \ + (s) = SCALAR_ABS ((a).Real) + SCALAR_ABS ((a).Imag) ; \ +} + +/* -------------------------------------------------------------------------- */ + +/* exact absolute value, s = sqrt (a.real^2 + amag^2) */ +#ifdef MATHWORKS +#define ABS(s,a) \ +{ \ + (s) = utFdlibm_hypot ((a).Real, (a).Imag) ; \ +} +#else +/* Ignore NaN case for the double relops ar>=ai and ar+ai==ar. */ +#define ABS(s,a) \ +{ \ + double r, ar, ai ; \ + ar = SCALAR_ABS ((a).Real) ; \ + ai = SCALAR_ABS ((a).Imag) ; \ + if (ar >= ai) \ + { \ + if (ar + ai == ar) \ + { \ + (s) = ar ; \ + } \ + else \ + { \ + r = ai / ar ; \ + (s) = ar * sqrt (1.0 + r*r) ; \ + } \ + } \ + else \ + { \ + if (ai + ar == ai) \ + { \ + (s) = ai ; \ + } \ + else \ + { \ + r = ar / ai ; \ + (s) = ai * sqrt (1.0 + r*r) ; \ + } \ + } \ +} +#endif + +/* -------------------------------------------------------------------------- */ + +/* print an entry (avoid printing "-0" for negative zero). */ +#define PRINT_ENTRY(a) \ +{ \ + if (SCALAR_IS_NONZERO ((a).Real)) \ + { \ + PRINTF ((" (%g", (a).Real)) ; \ + } \ + else \ + { \ + PRINTF ((" (0")) ; \ + } \ + if (SCALAR_IS_LTZERO ((a).Imag)) \ + { \ + PRINTF ((" - %gi)", -(a).Imag)) ; \ + } \ + else if (SCALAR_IS_ZERO ((a).Imag)) \ + { \ + PRINTF ((" + 0i)")) ; \ + } \ + else \ + { \ + PRINTF ((" + %gi)", (a).Imag)) ; \ + } \ +} + +/* -------------------------------------------------------------------------- */ + +#endif /* #ifndef COMPLEX */ + +/* -------------------------------------------------------------------------- */ +/* Double precision, with int's as integers */ +/* -------------------------------------------------------------------------- */ + +#ifdef DINT + +#define UMF_analyze umfdi_analyze +#define UMF_apply_order umfdi_apply_order +#define UMF_assemble umfdi_assemble +#define UMF_blas3_update umfdi_blas3_update +#define UMF_build_tuples umfdi_build_tuples +#define UMF_build_tuples_usage umfdi_build_tuples_usage +#define UMF_colamd umfdi_colamd +#define UMF_colamd_set_defaults umfdi_colamd_set_defaults +#define UMF_create_element umfdi_create_element +#define UMF_extend_front umfdi_extend_front +#define UMF_free umfdi_free +#define UMF_garbage_collection umfdi_garbage_collection +#define UMF_get_memory umfdi_get_memory +#define UMF_init_front umfdi_init_front +#define UMF_is_permutation umfdi_is_permutation +#define UMF_kernel umfdi_kernel +#define UMF_kernel_init umfdi_kernel_init +#define UMF_kernel_init_usage umfdi_kernel_init_usage +#define UMF_kernel_wrapup umfdi_kernel_wrapup +#define UMF_local_search umfdi_local_search +#define UMF_lsolve umfdi_lsolve +#define UMF_ltsolve umfdi_ltsolve +#define UMF_lhsolve umfdi_lhsolve +#define UMF_malloc umfdi_malloc +#define UMF_mem_alloc_element umfdi_mem_alloc_element +#define UMF_mem_alloc_head_block umfdi_mem_alloc_head_block +#define UMF_mem_alloc_tail_block umfdi_mem_alloc_tail_block +#define UMF_mem_free_tail_block umfdi_mem_free_tail_block +#define UMF_mem_init_memoryspace umfdi_mem_init_memoryspace +#define UMF_order_front_tree umfdi_order_front_tree +#define UMF_realloc umfdi_realloc +#define UMF_report_perm umfdi_report_perm +#define UMF_report_vector umfdi_report_vector +#define UMF_row_search umfdi_row_search +#define UMF_scale_column umfdi_scale_column +#define UMF_set_stats umfdi_set_stats +#define UMF_solve umfdi_solve +#define UMF_symbolic_usage umfdi_symbolic_usage +#define UMF_transpose umfdi_transpose +#define UMF_tuple_lengths umfdi_tuple_lengths +#define UMF_usolve umfdi_usolve +#define UMF_utsolve umfdi_utsolve +#define UMF_uhsolve umfdi_uhsolve +#define UMF_valid_numeric umfdi_valid_numeric +#define UMF_valid_symbolic umfdi_valid_symbolic +#define UMF_triplet_map_x umfdi_triplet_map_x +#define UMF_triplet_map_nox umfdi_triplet_map_nox +#define UMF_triplet_nomap_x umfdi_triplet_nomap_x +#define UMF_triplet_nomap_nox umfdi_triplet_nomap_nox +#define UMFPACK_col_to_triplet umfpack_di_col_to_triplet +#define UMFPACK_defaults umfpack_di_defaults +#define UMFPACK_free_numeric umfpack_di_free_numeric +#define UMFPACK_free_symbolic umfpack_di_free_symbolic +#define UMFPACK_get_lunz umfpack_di_get_lunz +#define UMFPACK_get_numeric umfpack_di_get_numeric +#define UMFPACK_get_symbolic umfpack_di_get_symbolic +#define UMFPACK_numeric umfpack_di_numeric +#define UMFPACK_qsymbolic umfpack_di_qsymbolic +#define UMFPACK_report_control umfpack_di_report_control +#define UMFPACK_report_info umfpack_di_report_info +#define UMFPACK_report_matrix umfpack_di_report_matrix +#define UMFPACK_report_numeric umfpack_di_report_numeric +#define UMFPACK_report_perm umfpack_di_report_perm +#define UMFPACK_report_status umfpack_di_report_status +#define UMFPACK_report_symbolic umfpack_di_report_symbolic +#define UMFPACK_report_triplet umfpack_di_report_triplet +#define UMFPACK_report_vector umfpack_di_report_vector +#define UMFPACK_solve umfpack_di_solve +#define UMFPACK_symbolic umfpack_di_symbolic +#define UMFPACK_transpose umfpack_di_transpose +#define UMFPACK_triplet_to_col umfpack_di_triplet_to_col +#define UMFPACK_wsolve umfpack_di_wsolve + +/* for debugging only: */ +#define UMF_malloc_count umfdi_malloc_count +#define UMF_debug umfdi_debug +#define UMF_nbug umfdi_nbug +#define UMF_fbug umfdi_fbug +#define UMF_allocfail umfdi_allocfail +#define UMF_gprob umfdi_gprob +#define UMF_dump_dense umfdi_dump_dense +#define UMF_dump_element umfdi_dump_element +#define UMF_dump_rowcol umfdi_dump_rowcol +#define UMF_dump_matrix umfdi_dump_matrix +#define UMF_dump_current_front umfdi_dump_current_front +#define UMF_dump_lu umfdi_dump_lu +#define UMF_dump_memory umfdi_dump_memory +#define UMF_dump_packed_memory umfdi_dump_packed_memory +#define UMF_dump_col_matrix umfdi_dump_col_matrix +#define UMF_dump_chain umfdi_dump_chain +#define UMF_dump_start umfdi_dump_start +#define UMF_dump_rowmerge umfdi_dump_rowmerge + +#endif + + +/* -------------------------------------------------------------------------- */ +/* Double precision, with long's as integers */ +/* -------------------------------------------------------------------------- */ + +#ifdef DLONG + +#define UMF_analyze umfdl_analyze +#define UMF_apply_order umfdl_apply_order +#define UMF_assemble umfdl_assemble +#define UMF_blas3_update umfdl_blas3_update +#define UMF_build_tuples umfdl_build_tuples +#define UMF_build_tuples_usage umfdl_build_tuples_usage +#define UMF_colamd umfdl_colamd +#define UMF_colamd_set_defaults umfdl_colamd_set_defaults +#define UMF_create_element umfdl_create_element +#define UMF_extend_front umfdl_extend_front +#define UMF_free umfdl_free +#define UMF_garbage_collection umfdl_garbage_collection +#define UMF_get_memory umfdl_get_memory +#define UMF_init_front umfdl_init_front +#define UMF_is_permutation umfdl_is_permutation +#define UMF_kernel umfdl_kernel +#define UMF_kernel_init umfdl_kernel_init +#define UMF_kernel_init_usage umfdl_kernel_init_usage +#define UMF_kernel_wrapup umfdl_kernel_wrapup +#define UMF_local_search umfdl_local_search +#define UMF_lsolve umfdl_lsolve +#define UMF_ltsolve umfdl_ltsolve +#define UMF_lhsolve umfdl_lhsolve +#define UMF_malloc umfdl_malloc +#define UMF_mem_alloc_element umfdl_mem_alloc_element +#define UMF_mem_alloc_head_block umfdl_mem_alloc_head_block +#define UMF_mem_alloc_tail_block umfdl_mem_alloc_tail_block +#define UMF_mem_free_tail_block umfdl_mem_free_tail_block +#define UMF_mem_init_memoryspace umfdl_mem_init_memoryspace +#define UMF_order_front_tree umfdl_order_front_tree +#define UMF_realloc umfdl_realloc +#define UMF_report_perm umfdl_report_perm +#define UMF_report_vector umfdl_report_vector +#define UMF_row_search umfdl_row_search +#define UMF_scale_column umfdl_scale_column +#define UMF_set_stats umfdl_set_stats +#define UMF_solve umfdl_solve +#define UMF_symbolic_usage umfdl_symbolic_usage +#define UMF_transpose umfdl_transpose +#define UMF_tuple_lengths umfdl_tuple_lengths +#define UMF_usolve umfdl_usolve +#define UMF_utsolve umfdl_utsolve +#define UMF_uhsolve umfdl_uhsolve +#define UMF_valid_numeric umfdl_valid_numeric +#define UMF_valid_symbolic umfdl_valid_symbolic +#define UMF_triplet_map_x umfdl_triplet_map_x +#define UMF_triplet_map_nox umfdl_triplet_map_nox +#define UMF_triplet_nomap_x umfdl_triplet_nomap_x +#define UMF_triplet_nomap_nox umfdl_triplet_nomap_nox +#define UMFPACK_col_to_triplet umfpack_dl_col_to_triplet +#define UMFPACK_defaults umfpack_dl_defaults +#define UMFPACK_free_numeric umfpack_dl_free_numeric +#define UMFPACK_free_symbolic umfpack_dl_free_symbolic +#define UMFPACK_get_lunz umfpack_dl_get_lunz +#define UMFPACK_get_numeric umfpack_dl_get_numeric +#define UMFPACK_get_symbolic umfpack_dl_get_symbolic +#define UMFPACK_numeric umfpack_dl_numeric +#define UMFPACK_qsymbolic umfpack_dl_qsymbolic +#define UMFPACK_report_control umfpack_dl_report_control +#define UMFPACK_report_info umfpack_dl_report_info +#define UMFPACK_report_matrix umfpack_dl_report_matrix +#define UMFPACK_report_numeric umfpack_dl_report_numeric +#define UMFPACK_report_perm umfpack_dl_report_perm +#define UMFPACK_report_status umfpack_dl_report_status +#define UMFPACK_report_symbolic umfpack_dl_report_symbolic +#define UMFPACK_report_triplet umfpack_dl_report_triplet +#define UMFPACK_report_vector umfpack_dl_report_vector +#define UMFPACK_solve umfpack_dl_solve +#define UMFPACK_symbolic umfpack_dl_symbolic +#define UMFPACK_transpose umfpack_dl_transpose +#define UMFPACK_triplet_to_col umfpack_dl_triplet_to_col +#define UMFPACK_wsolve umfpack_dl_wsolve + +/* for debugging only: */ +#define UMF_malloc_count umfdl_malloc_count +#define UMF_debug umfdl_debug +#define UMF_nbug umfdl_nbug +#define UMF_fbug umfdl_fbug +#define UMF_allocfail umfdl_allocfail +#define UMF_gprob umfdl_gprob +#define UMF_dump_dense umfdl_dump_dense +#define UMF_dump_element umfdl_dump_element +#define UMF_dump_rowcol umfdl_dump_rowcol +#define UMF_dump_matrix umfdl_dump_matrix +#define UMF_dump_current_front umfdl_dump_current_front +#define UMF_dump_lu umfdl_dump_lu +#define UMF_dump_memory umfdl_dump_memory +#define UMF_dump_packed_memory umfdl_dump_packed_memory +#define UMF_dump_col_matrix umfdl_dump_col_matrix +#define UMF_dump_chain umfdl_dump_chain +#define UMF_dump_start umfdl_dump_start +#define UMF_dump_rowmerge umfdl_dump_rowmerge + +#endif + +/* -------------------------------------------------------------------------- */ +/* Complex double precision, with int's as integers */ +/* -------------------------------------------------------------------------- */ + +#ifdef ZINT + +#define UMF_analyze umfzi_analyze +#define UMF_apply_order umfzi_apply_order +#define UMF_assemble umfzi_assemble +#define UMF_blas3_update umfzi_blas3_update +#define UMF_build_tuples umfzi_build_tuples +#define UMF_build_tuples_usage umfzi_build_tuples_usage +#define UMF_colamd umfzi_colamd +#define UMF_colamd_set_defaults umfzi_colamd_set_defaults +#define UMF_create_element umfzi_create_element +#define UMF_extend_front umfzi_extend_front +#define UMF_free umfzi_free +#define UMF_garbage_collection umfzi_garbage_collection +#define UMF_get_memory umfzi_get_memory +#define UMF_init_front umfzi_init_front +#define UMF_is_permutation umfzi_is_permutation +#define UMF_kernel umfzi_kernel +#define UMF_kernel_init umfzi_kernel_init +#define UMF_kernel_init_usage umfzi_kernel_init_usage +#define UMF_kernel_wrapup umfzi_kernel_wrapup +#define UMF_local_search umfzi_local_search +#define UMF_lsolve umfzi_lsolve +#define UMF_ltsolve umfzi_ltsolve +#define UMF_lhsolve umfzi_lhsolve +#define UMF_malloc umfzi_malloc +#define UMF_mem_alloc_element umfzi_mem_alloc_element +#define UMF_mem_alloc_head_block umfzi_mem_alloc_head_block +#define UMF_mem_alloc_tail_block umfzi_mem_alloc_tail_block +#define UMF_mem_free_tail_block umfzi_mem_free_tail_block +#define UMF_mem_init_memoryspace umfzi_mem_init_memoryspace +#define UMF_order_front_tree umfzi_order_front_tree +#define UMF_realloc umfzi_realloc +#define UMF_report_perm umfzi_report_perm +#define UMF_report_vector umfzi_report_vector +#define UMF_row_search umfzi_row_search +#define UMF_scale_column umfzi_scale_column +#define UMF_set_stats umfzi_set_stats +#define UMF_solve umfzi_solve +#define UMF_symbolic_usage umfzi_symbolic_usage +#define UMF_transpose umfzi_transpose +#define UMF_tuple_lengths umfzi_tuple_lengths +#define UMF_usolve umfzi_usolve +#define UMF_utsolve umfzi_utsolve +#define UMF_uhsolve umfzi_uhsolve +#define UMF_valid_numeric umfzi_valid_numeric +#define UMF_valid_symbolic umfzi_valid_symbolic +#define UMF_triplet_map_x umfzi_triplet_map_x +#define UMF_triplet_map_nox umfzi_triplet_map_nox +#define UMF_triplet_nomap_x umfzi_triplet_nomap_x +#define UMF_triplet_nomap_nox umfzi_triplet_nomap_nox +#define UMFPACK_col_to_triplet umfpack_zi_col_to_triplet +#define UMFPACK_defaults umfpack_zi_defaults +#define UMFPACK_free_numeric umfpack_zi_free_numeric +#define UMFPACK_free_symbolic umfpack_zi_free_symbolic +#define UMFPACK_get_lunz umfpack_zi_get_lunz +#define UMFPACK_get_numeric umfpack_zi_get_numeric +#define UMFPACK_get_symbolic umfpack_zi_get_symbolic +#define UMFPACK_numeric umfpack_zi_numeric +#define UMFPACK_qsymbolic umfpack_zi_qsymbolic +#define UMFPACK_report_control umfpack_zi_report_control +#define UMFPACK_report_info umfpack_zi_report_info +#define UMFPACK_report_matrix umfpack_zi_report_matrix +#define UMFPACK_report_numeric umfpack_zi_report_numeric +#define UMFPACK_report_perm umfpack_zi_report_perm +#define UMFPACK_report_status umfpack_zi_report_status +#define UMFPACK_report_symbolic umfpack_zi_report_symbolic +#define UMFPACK_report_triplet umfpack_zi_report_triplet +#define UMFPACK_report_vector umfpack_zi_report_vector +#define UMFPACK_solve umfpack_zi_solve +#define UMFPACK_symbolic umfpack_zi_symbolic +#define UMFPACK_transpose umfpack_zi_transpose +#define UMFPACK_triplet_to_col umfpack_zi_triplet_to_col +#define UMFPACK_wsolve umfpack_zi_wsolve + +/* for debugging only: */ +#define UMF_malloc_count umfzi_malloc_count +#define UMF_debug umfzi_debug +#define UMF_nbug umfzi_nbug +#define UMF_fbug umfzi_fbug +#define UMF_allocfail umfzi_allocfail +#define UMF_gprob umfzi_gprob +#define UMF_dump_dense umfzi_dump_dense +#define UMF_dump_element umfzi_dump_element +#define UMF_dump_rowcol umfzi_dump_rowcol +#define UMF_dump_matrix umfzi_dump_matrix +#define UMF_dump_current_front umfzi_dump_current_front +#define UMF_dump_lu umfzi_dump_lu +#define UMF_dump_memory umfzi_dump_memory +#define UMF_dump_packed_memory umfzi_dump_packed_memory +#define UMF_dump_col_matrix umfzi_dump_col_matrix +#define UMF_dump_chain umfzi_dump_chain +#define UMF_dump_start umfzi_dump_start +#define UMF_dump_rowmerge umfzi_dump_rowmerge + +#endif + + +/* -------------------------------------------------------------------------- */ +/* Complex double precision, with long's as integers */ +/* -------------------------------------------------------------------------- */ + +#ifdef ZLONG + +#define UMF_analyze umfzl_analyze +#define UMF_apply_order umfzl_apply_order +#define UMF_assemble umfzl_assemble +#define UMF_blas3_update umfzl_blas3_update +#define UMF_build_tuples umfzl_build_tuples +#define UMF_build_tuples_usage umfzl_build_tuples_usage +#define UMF_colamd umfzl_colamd +#define UMF_colamd_set_defaults umfzl_colamd_set_defaults +#define UMF_create_element umfzl_create_element +#define UMF_extend_front umfzl_extend_front +#define UMF_free umfzl_free +#define UMF_garbage_collection umfzl_garbage_collection +#define UMF_get_memory umfzl_get_memory +#define UMF_init_front umfzl_init_front +#define UMF_is_permutation umfzl_is_permutation +#define UMF_kernel umfzl_kernel +#define UMF_kernel_init umfzl_kernel_init +#define UMF_kernel_init_usage umfzl_kernel_init_usage +#define UMF_kernel_wrapup umfzl_kernel_wrapup +#define UMF_local_search umfzl_local_search +#define UMF_lsolve umfzl_lsolve +#define UMF_ltsolve umfzl_ltsolve +#define UMF_lhsolve umfzl_lhsolve +#define UMF_malloc umfzl_malloc +#define UMF_mem_alloc_element umfzl_mem_alloc_element +#define UMF_mem_alloc_head_block umfzl_mem_alloc_head_block +#define UMF_mem_alloc_tail_block umfzl_mem_alloc_tail_block +#define UMF_mem_free_tail_block umfzl_mem_free_tail_block +#define UMF_mem_init_memoryspace umfzl_mem_init_memoryspace +#define UMF_order_front_tree umfzl_order_front_tree +#define UMF_realloc umfzl_realloc +#define UMF_report_perm umfzl_report_perm +#define UMF_report_vector umfzl_report_vector +#define UMF_row_search umfzl_row_search +#define UMF_scale_column umfzl_scale_column +#define UMF_set_stats umfzl_set_stats +#define UMF_solve umfzl_solve +#define UMF_symbolic_usage umfzl_symbolic_usage +#define UMF_transpose umfzl_transpose +#define UMF_tuple_lengths umfzl_tuple_lengths +#define UMF_usolve umfzl_usolve +#define UMF_utsolve umfzl_utsolve +#define UMF_uhsolve umfzl_uhsolve +#define UMF_valid_numeric umfzl_valid_numeric +#define UMF_valid_symbolic umfzl_valid_symbolic +#define UMF_triplet_map_x umfzl_triplet_map_x +#define UMF_triplet_map_nox umfzl_triplet_map_nox +#define UMF_triplet_nomap_x umfzl_triplet_nomap_x +#define UMF_triplet_nomap_nox umfzl_triplet_nomap_nox +#define UMFPACK_col_to_triplet umfpack_zl_col_to_triplet +#define UMFPACK_defaults umfpack_zl_defaults +#define UMFPACK_free_numeric umfpack_zl_free_numeric +#define UMFPACK_free_symbolic umfpack_zl_free_symbolic +#define UMFPACK_get_lunz umfpack_zl_get_lunz +#define UMFPACK_get_numeric umfpack_zl_get_numeric +#define UMFPACK_get_symbolic umfpack_zl_get_symbolic +#define UMFPACK_numeric umfpack_zl_numeric +#define UMFPACK_qsymbolic umfpack_zl_qsymbolic +#define UMFPACK_report_control umfpack_zl_report_control +#define UMFPACK_report_info umfpack_zl_report_info +#define UMFPACK_report_matrix umfpack_zl_report_matrix +#define UMFPACK_report_numeric umfpack_zl_report_numeric +#define UMFPACK_report_perm umfpack_zl_report_perm +#define UMFPACK_report_status umfpack_zl_report_status +#define UMFPACK_report_symbolic umfpack_zl_report_symbolic +#define UMFPACK_report_triplet umfpack_zl_report_triplet +#define UMFPACK_report_vector umfpack_zl_report_vector +#define UMFPACK_solve umfpack_zl_solve +#define UMFPACK_symbolic umfpack_zl_symbolic +#define UMFPACK_transpose umfpack_zl_transpose +#define UMFPACK_triplet_to_col umfpack_zl_triplet_to_col +#define UMFPACK_wsolve umfpack_zl_wsolve + +/* for debugging only: */ +#define UMF_malloc_count umfzl_malloc_count +#define UMF_debug umfzl_debug +#define UMF_nbug umfzl_nbug +#define UMF_fbug umfzl_fbug +#define UMF_allocfail umfzl_allocfail +#define UMF_gprob umfzl_gprob +#define UMF_dump_dense umfzl_dump_dense +#define UMF_dump_element umfzl_dump_element +#define UMF_dump_rowcol umfzl_dump_rowcol +#define UMF_dump_matrix umfzl_dump_matrix +#define UMF_dump_current_front umfzl_dump_current_front +#define UMF_dump_lu umfzl_dump_lu +#define UMF_dump_memory umfzl_dump_memory +#define UMF_dump_packed_memory umfzl_dump_packed_memory +#define UMF_dump_col_matrix umfzl_dump_col_matrix +#define UMF_dump_chain umfzl_dump_chain +#define UMF_dump_start umfzl_dump_start +#define UMF_dump_rowmerge umfzl_dump_rowmerge + +#endif diff --git a/src/sparse-matrix/umfpack/umfpack.h b/src/sparse-matrix/umfpack/umfpack.h new file mode 100644 index 0000000..3871ef9 --- /dev/null +++ b/src/sparse-matrix/umfpack/umfpack.h @@ -0,0 +1,303 @@ +/* ========================================================================== */ +/* === umfpack.h ============================================================ */ +/* ========================================================================== */ + +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +/* + This is the umfpack.h include file, and should be included in all user code + that uses UMFPACK. Do not include any of the umf_* header files in user + code. All routines in UMFPACK starting with "umfpack_" are user-callable. + All other routines are prefixed "umfXY_", (where X is d or z, and Y is + i or l) and are not user-callable. +*/ + +#ifndef UMFPACK_H +#define UMFPACK_H + +/* -------------------------------------------------------------------------- */ +/* size of Info and Control arrays */ +/* -------------------------------------------------------------------------- */ + +#define UMFPACK_INFO 90 +#define UMFPACK_CONTROL 20 + +/* -------------------------------------------------------------------------- */ +/* User-callable routines */ +/* -------------------------------------------------------------------------- */ + +/* Primary routines: */ +#include "umfpack_symbolic.h" +#include "umfpack_numeric.h" +#include "umfpack_solve.h" +#include "umfpack_free_symbolic.h" +#include "umfpack_free_numeric.h" + +/* Alternative routines: */ +#include "umfpack_defaults.h" +#include "umfpack_qsymbolic.h" +#include "umfpack_wsolve.h" + +/* Matrix manipulation routines: */ +#include "umfpack_triplet_to_col.h" +#include "umfpack_col_to_triplet.h" +#include "umfpack_transpose.h" + +/* Getting the contents of the Symbolic and Numeric opaque objects: */ +#include "umfpack_get_lunz.h" +#include "umfpack_get_numeric.h" +#include "umfpack_get_symbolic.h" + +/* Reporting routines (the above 14 routines print nothing): */ +#include "umfpack_report_status.h" +#include "umfpack_report_info.h" +#include "umfpack_report_control.h" +#include "umfpack_report_matrix.h" +#include "umfpack_report_triplet.h" +#include "umfpack_report_vector.h" +#include "umfpack_report_symbolic.h" +#include "umfpack_report_numeric.h" +#include "umfpack_report_perm.h" + +/* Utility routines: */ +#include "umfpack_timer.h" + + +/* -------------------------------------------------------------------------- */ +/* Version, copyright, and license */ +/* -------------------------------------------------------------------------- */ + +#define UMFPACK_VERSION "UMFPACK V4.0 (Apr 11, 2002)" + +#define UMFPACK_COPYRIGHT \ +"UMFPACK: Copyright (c) 2002 by Timothy A. Davis. All Rights Reserved.\n" + +#define UMFPACK_LICENSE_PART1 \ +"\nUMFPACK License:\n" \ +"\n" \ +" Your use or distribution of UMFPACK or any modified version of\n" \ +" UMFPACK implies that you agree to this License.\n" \ +"\n" \ +" THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY\n" \ +" EXPRESSED OR IMPLIED. ANY USE IS AT YOUR OWN RISK.\n" +#define UMFPACK_LICENSE_PART2 \ +"\n" \ +" Permission is hereby granted to use or copy this program, provided\n" \ +" that the Copyright, this License, and the Availability of the original\n" \ +" version is retained on all copies. User documentation of any code that\n" \ +" uses UMFPACK or any modified version of UMFPACK code must cite the\n" \ +" Copyright, this License, the Availability note, and \"Used by permission.\"\n" +#define UMFPACK_LICENSE_PART3 \ +" Permission to modify the code and to distribute modified code is granted,\n" \ +" provided the Copyright, this License, and the Availability note are\n" \ +" retained, and a notice that the code was modified is included. This\n" \ +" software was developed with support from the National Science Foundation,\n" \ +" and is provided to you free of charge.\n" \ +"\n" \ +"Availability: http://www.cise.ufl.edu/research/sparse/umfpack\n" \ +"\n" + +/* -------------------------------------------------------------------------- */ +/* contents of Info */ +/* -------------------------------------------------------------------------- */ + +/* Note that umfpack_report.m must coincide with these definitions. */ + +/* returned by all routines that use Info: */ +#define UMFPACK_STATUS 0 +#define UMFPACK_NROW 1 +#define UMFPACK_NCOL 16 +#define UMFPACK_NZ 2 + +/* computed in UMFPACK_*symbolic and UMFPACK_numeric: */ +#define UMFPACK_SIZE_OF_UNIT 3 + +/* computed in UMFPACK_*symbolic: */ +#define UMFPACK_SIZE_OF_INT 4 +#define UMFPACK_SIZE_OF_LONG 5 +#define UMFPACK_SIZE_OF_POINTER 6 +#define UMFPACK_SIZE_OF_ENTRY 7 +#define UMFPACK_NDENSE_ROW 8 +#define UMFPACK_NEMPTY_ROW 9 +#define UMFPACK_NDENSE_COL 10 +#define UMFPACK_NEMPTY_COL 11 +#define UMFPACK_SYMBOLIC_DEFRAG 12 +#define UMFPACK_SYMBOLIC_PEAK_MEMORY 13 +#define UMFPACK_SYMBOLIC_SIZE 14 +#define UMFPACK_SYMBOLIC_TIME 15 + +/* Info [17..19] unused */ + +/* estimates computed in UMFPACK_*symbolic: */ +#define UMFPACK_NUMERIC_SIZE_ESTIMATE 20 +#define UMFPACK_PEAK_MEMORY_ESTIMATE 21 +#define UMFPACK_FLOPS_ESTIMATE 22 +#define UMFPACK_LNZ_ESTIMATE 23 +#define UMFPACK_UNZ_ESTIMATE 24 +#define UMFPACK_VARIABLE_INIT_ESTIMATE 25 +#define UMFPACK_VARIABLE_PEAK_ESTIMATE 26 +#define UMFPACK_VARIABLE_FINAL_ESTIMATE 27 +#define UMFPACK_MAX_FRONT_SIZE_ESTIMATE 28 + +/* Info [29..39] unused */ + +/* exact values, (estimates shown above) computed in UMFPACK_numeric: */ +#define UMFPACK_NUMERIC_SIZE 40 +#define UMFPACK_PEAK_MEMORY 41 +#define UMFPACK_FLOPS 42 +#define UMFPACK_LNZ 43 +#define UMFPACK_UNZ 44 +#define UMFPACK_VARIABLE_INIT 45 +#define UMFPACK_VARIABLE_PEAK 46 +#define UMFPACK_VARIABLE_FINAL 47 +#define UMFPACK_MAX_FRONT_SIZE 48 + +/* Info [49..59] unused */ + +/* computed in UMFPACK_numeric: */ +#define UMFPACK_NUMERIC_DEFRAG 60 +#define UMFPACK_NUMERIC_REALLOC 61 +#define UMFPACK_NUMERIC_COSTLY_REALLOC 62 +#define UMFPACK_COMPRESSED_PATTERN 63 +#define UMFPACK_LU_ENTRIES 64 +#define UMFPACK_NUMERIC_TIME 65 +#define UMFPACK_UDIAG_NZ 66 +#define UMFPACK_RCOND 67 + +/* Info [68..79] unused */ + +/* computed in UMFPACK_solve: */ +#define UMFPACK_IR_TAKEN 80 +#define UMFPACK_IR_ATTEMPTED 81 +#define UMFPACK_OMEGA1 82 +#define UMFPACK_OMEGA2 83 +#define UMFPACK_SOLVE_FLOPS 84 +#define UMFPACK_SOLVE_TIME 85 + +/* Info [86..89] unused */ + +/* Unused parts of Info may be used in future versions of UMFPACK. */ + + +/* -------------------------------------------------------------------------- */ +/* contents of Control */ +/* -------------------------------------------------------------------------- */ + +/* used in all UMFPACK_report_* routines: */ +#define UMFPACK_PRL 0 + +/* used in UMFPACK_*symbolic only: */ +#define UMFPACK_DENSE_ROW 1 +#define UMFPACK_DENSE_COL 2 + +/* used in UMFPACK_numeric only: */ +#define UMFPACK_PIVOT_TOLERANCE 3 +#define UMFPACK_BLOCK_SIZE 4 +#define UMFPACK_RELAXED_AMALGAMATION 5 +#define UMFPACK_ALLOC_INIT 6 +/* #define UMFPACK_PIVOT_OPTION 12: obsolete */ +#define UMFPACK_RELAXED2_AMALGAMATION 13 +#define UMFPACK_RELAXED3_AMALGAMATION 14 + +/* used in UMFPACK_*solve only: */ +#define UMFPACK_IRSTEP 7 + +/* compile-time settings - Control [8..11] cannot be changed at run time: */ +#define UMFPACK_COMPILED_WITH_BLAS 8 +#define UMFPACK_COMPILED_FOR_MATLAB 9 +#define UMFPACK_COMPILED_WITH_GETRUSAGE 10 +#define UMFPACK_COMPILED_IN_DEBUG_MODE 11 + +/* Control [12, 15...19] unused */ + +/* Unused parts of Control may be used in future versions of UMFPACK. */ + + +/* -------------------------------------------------------------------------- */ +/* default values of Control [0..7,13..14]: */ +/* -------------------------------------------------------------------------- */ + +/* Note that the default block sized changed for Version 3.1 and following. */ + +#define UMFPACK_DEFAULT_PRL 1 +#define UMFPACK_DEFAULT_DENSE_ROW 0.2 +#define UMFPACK_DEFAULT_DENSE_COL 0.2 +#define UMFPACK_DEFAULT_PIVOT_TOLERANCE 0.1 +#define UMFPACK_DEFAULT_BLOCK_SIZE 24 +#define UMFPACK_DEFAULT_RELAXED_AMALGAMATION 0.25 +#define UMFPACK_DEFAULT_RELAXED2_AMALGAMATION 0.1 +#define UMFPACK_DEFAULT_RELAXED3_AMALGAMATION 0.125 +#define UMFPACK_DEFAULT_ALLOC_INIT 0.7 +#define UMFPACK_DEFAULT_IRSTEP 2 +/* #define UMFPACK_DEFAULT_PIVOT_OPTION 0: obsolete */ + +/* default values of Control [0..7,13..14] may change in future versions */ +/* of UMFPACK. */ + +/* -------------------------------------------------------------------------- */ +/* status codes */ +/* -------------------------------------------------------------------------- */ + +#define UMFPACK_OK (0) + +/* status > 0 means a warning, but the method was successful anyway. */ +/* A Symbolic or Numeric object was still created. */ +#define UMFPACK_WARNING_singular_matrix (1) + +/* status < 0 means an error, and the method was not successful. */ +/* No Symbolic of Numeric object was created. */ +#define UMFPACK_ERROR_out_of_memory (-1) +#define UMFPACK_ERROR_invalid_Numeric_object (-3) +#define UMFPACK_ERROR_invalid_Symbolic_object (-4) +#define UMFPACK_ERROR_argument_missing (-5) +#define UMFPACK_ERROR_n_nonpositive (-6) +#define UMFPACK_ERROR_nz_negative (-7) +#define UMFPACK_ERROR_jumbled_matrix (-8) +#define UMFPACK_ERROR_Ap0_nonzero (-9) +#define UMFPACK_ERROR_row_index_out_of_bounds (-10) +#define UMFPACK_ERROR_different_pattern (-11) +#define UMFPACK_ERROR_col_length_negative (-12) +#define UMFPACK_ERROR_invalid_system (-13) +#define UMFPACK_ERROR_invalid_triplet (-14) +#define UMFPACK_ERROR_invalid_permutation (-15) +#define UMFPACK_ERROR_problem_too_large (-16) +#define UMFPACK_ERROR_internal_error (-911) + +/* -------------------------------------------------------------------------- */ +/* solve codes */ +/* -------------------------------------------------------------------------- */ + +/* Solve the system ( )x=b, where ( ) is defined below. "t" refers to the */ +/* linear algebraic transpose (complex conjugate if A is complex), or the (') */ +/* operator in MATLAB. "at" refers to the array transpose, or the (.') */ +/* operator in MATLAB. */ + +#define UMFPACK_A (0) /* Ax=b */ +#define UMFPACK_At (1) /* A'x=b */ +#define UMFPACK_Aat (2) /* A.'x=b */ + +#define UMFPACK_Pt_L (3) /* P'Lx=b */ +#define UMFPACK_L (4) /* Lx=b */ +#define UMFPACK_Lt_P (5) /* L'Px=b */ +#define UMFPACK_Lat_P (6) /* L.'Px=b */ +#define UMFPACK_Lt (7) /* L'x=b */ +#define UMFPACK_Lat (8) /* L.'x=b */ + +#define UMFPACK_U_Qt (9) /* UQ'x=b */ +#define UMFPACK_U (10) /* Ux=b */ +#define UMFPACK_Q_Ut (11) /* QU'x=b */ +#define UMFPACK_Q_Uat (12) /* QU.'x=b */ +#define UMFPACK_Ut (13) /* U'x=b */ +#define UMFPACK_Uat (14) /* U.'x=b */ + +/* -------------------------------------------------------------------------- */ + +/* Integer constants are used for status and solve codes instead of enum */ +/* to make it easier for a Fortran code to call UMFPACK. */ + +#endif /* UMFPACK_H */ diff --git a/src/sparse-matrix/umfpack/umfpack_col_to_triplet.h b/src/sparse-matrix/umfpack/umfpack_col_to_triplet.h new file mode 100644 index 0000000..aa31878 --- /dev/null +++ b/src/sparse-matrix/umfpack/umfpack_col_to_triplet.h @@ -0,0 +1,113 @@ +/* ========================================================================== */ +/* === umfpack_col_to_triplet =============================================== */ +/* ========================================================================== */ + +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +int umfpack_di_col_to_triplet +( + int n_col, + const int Ap [ ], + int Tj [ ] +) ; + +long umfpack_dl_col_to_triplet +( + long n_col, + const long Ap [ ], + long Tj [ ] +) ; + +int umfpack_zi_col_to_triplet +( + int n_col, + const int Ap [ ], + int Tj [ ] +) ; + +long umfpack_zl_col_to_triplet +( + long n_col, + const long Ap [ ], + long Tj [ ] +) ; + +/* +double int Syntax: + + #include "umfpack.h" + int n_col, *Tj, *Ap, status ; + status = umfpack_di_col_to_triplet (n_col, Ap, Tj) ; + +double long Syntax: + + #include "umfpack.h" + long n_col, *Tj, *Ap, status ; + status = umfpack_dl_col_to_triplet (n_col, Ap, Tj) ; + +complex int Syntax: + + #include "umfpack.h" + int n_col, *Tj, *Ap, status ; + status = umfpack_zi_col_to_triplet (n_col, Ap, Tj) ; + +complex long Syntax: + + #include "umfpack.h" + long n_col, *Tj, *Ap, status ; + status = umfpack_zl_col_to_triplet (n_col, Ap, Tj) ; + +Purpose: + + Converts a column-oriented matrix to a triplet form. Only the column + pointers, Ap, are required, and only the column indices of the triplet form + are constructed. This routine is the opposite of umfpack_*_triplet_to_col. + The matrix may be singular and/or rectangular. Analogous to [i, Tj, x] = + find (A) in MATLAB, except that zero entries present in the column-form of + A are present in the output, and i and x are not created (those are just Ai + and Ax+Az*1i, respectively, for a column-form matrix A). + +Returns: + + UMFPACK_OK if successful + UMFPACK_ERROR_argument_missing if Ap or Tj is missing + UMFPACK_ERROR_n_nonpositive if n_col <= 0 + UMFPACK_ERROR_Ap0_nonzero if Ap [0] != 0 + UMFPACK_ERROR_nz_negative if Ap [n_col] < 0 + UMFPACK_ERROR_col_length_negative if Ap [j] > Ap [j+1] for any j in the + range 0 to n-1. + Unsorted columns and duplicate entries do not cause an error (these would + only be evident by examining Ai). Empty rows and columns are OK. + +Arguments: + + Int n_col ; Input argument, not modified. + + A is an n_row-by-n_col matrix. Restriction: n_col > 0. + (n_row is not required) + + Int Ap [n_col+1] ; Input argument, not modified. + + The column pointers of the column-oriented form of the matrix. See + umfpack_*_*symbolic for a description. The number of entries in + the matrix is nz = Ap [n_col]. Restrictions on Ap are the same as those + for umfpack_*_transpose. Ap [0] must be zero, nz must be >= 0, and + Ap [j] <= Ap [j+1] and Ap [j] <= Ap [n_col] must be true for all j in + the range 0 to n_col-1. Empty columns are OK (that is, Ap [j] may equal + Ap [j+1] for any j in the range 0 to n_col-1). + + Int Tj [nz] ; Output argument. + + Tj is an integer array of size nz on input, where nz = Ap [n_col]. + Suppose the column-form of the matrix is held in Ap, Ai, Ax, and Az + (see umfpack_*_*symbolic for a description). Then on output, the + triplet form of the same matrix is held in Ai (row indices), Tj (column + indices), and Ax (numerical values). Note, however, that this routine + does not require Ai and Ax (or Az for the complex version) in order to + do the conversion. +*/ diff --git a/src/sparse-matrix/umfpack/umfpack_defaults.h b/src/sparse-matrix/umfpack/umfpack_defaults.h new file mode 100644 index 0000000..6c4efec --- /dev/null +++ b/src/sparse-matrix/umfpack/umfpack_defaults.h @@ -0,0 +1,70 @@ +/* ========================================================================== */ +/* === umfpack_defaults ===================================================== */ +/* ========================================================================== */ + +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +void umfpack_di_defaults +( + double Control [UMFPACK_CONTROL] +) ; + +void umfpack_dl_defaults +( + double Control [UMFPACK_CONTROL] +) ; + +void umfpack_zi_defaults +( + double Control [UMFPACK_CONTROL] +) ; + +void umfpack_zl_defaults +( + double Control [UMFPACK_CONTROL] +) ; + +/* +double int Syntax: + + #include "umfpack.h" + double Control [UMFPACK_CONTROL] ; + umfpack_di_defaults (Control) ; + +double long Syntax: + + #include "umfpack.h" + double Control [UMFPACK_CONTROL] ; + umfpack_dl_defaults (Control) ; + +complex int Syntax: + + #include "umfpack.h" + double Control [UMFPACK_CONTROL] ; + umfpack_zi_defaults (Control) ; + +complex long Syntax: + + #include "umfpack.h" + double Control [UMFPACK_CONTROL] ; + umfpack_zl_defaults (Control) ; + +Purpose: + + Sets the default control parameter settings. + +Arguments: + + double Control [UMFPACK_CONTROL] ; Output argument. + + Control is set to the default control parameter settings. You can + then modify individual settings by changing specific entries in the + Control array. If Control is a (double *) NULL pointer, then + umfpack_*_defaults returns silently (no error is generated, since + passing a NULL pointer for Control to any UMFPACK routine is valid). +*/ diff --git a/src/sparse-matrix/umfpack/umfpack_free_numeric.h b/src/sparse-matrix/umfpack/umfpack_free_numeric.h new file mode 100644 index 0000000..ee99275 --- /dev/null +++ b/src/sparse-matrix/umfpack/umfpack_free_numeric.h @@ -0,0 +1,72 @@ +/* ========================================================================== */ +/* === umfpack_free_numeric ================================================= */ +/* ========================================================================== */ + +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +void umfpack_di_free_numeric +( + void **Numeric +) ; + +void umfpack_dl_free_numeric +( + void **Numeric +) ; + +void umfpack_zi_free_numeric +( + void **Numeric +) ; + +void umfpack_zl_free_numeric +( + void **Numeric +) ; + +/* +double int Syntax: + + #include "umfpack.h" + void *Numeric ; + umfpack_di_free_numeric (&Numeric) ; + +double long Syntax: + + #include "umfpack.h" + void *Numeric ; + umfpack_dl_free_numeric (&Numeric) ; + +complex int Syntax: + + #include "umfpack.h" + void *Numeric ; + umfpack_zi_free_numeric (&Numeric) ; + +complex long Syntax: + + #include "umfpack.h" + void *Numeric ; + umfpack_zl_free_numeric (&Numeric) ; + +Purpose: + + Deallocates the Numeric object and sets the Numeric handle to NULL. + This routine is the only valid way of destroying the Numeric object; + any other action (such as using "free (Numeric) ;" or not freeing Numeric + at all) will lead to memory leaks. + +Arguments: + + void **Numeric ; Input argument, deallocated and Numeric is + set to (void *) NULL on output. + + Numeric must point to a valid Numeric object, computed by + umfpack_*_numeric. No action is taken if Numeric is a (void *) NULL + pointer. +*/ diff --git a/src/sparse-matrix/umfpack/umfpack_free_symbolic.h b/src/sparse-matrix/umfpack/umfpack_free_symbolic.h new file mode 100644 index 0000000..f776833 --- /dev/null +++ b/src/sparse-matrix/umfpack/umfpack_free_symbolic.h @@ -0,0 +1,72 @@ +/* ========================================================================== */ +/* === umfpack_free_symbolic ================================================ */ +/* ========================================================================== */ + +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +void umfpack_di_free_symbolic +( + void **Symbolic +) ; + +void umfpack_dl_free_symbolic +( + void **Symbolic +) ; + +void umfpack_zi_free_symbolic +( + void **Symbolic +) ; + +void umfpack_zl_free_symbolic +( + void **Symbolic +) ; + +/* +double int Syntax: + + #include "umfpack.h" + void *Symbolic ; + umfpack_di_free_symbolic (&Symbolic) ; + +double long Syntax: + + #include "umfpack.h" + void *Symbolic ; + umfpack_dl_free_symbolic (&Symbolic) ; + +complex int Syntax: + + #include "umfpack.h" + void *Symbolic ; + umfpack_zi_free_symbolic (&Symbolic) ; + +complex long Syntax: + + #include "umfpack.h" + void *Symbolic ; + umfpack_zl_free_symbolic (&Symbolic) ; + +Purpose: + + Deallocates the Symbolic object and sets the Symbolic handle to NULL. + This routine is the only valid way of destroying the Symbolic object; + any other action (such as using "free (Symbolic) ;" or not freeing Symbolic + at all) will lead to memory leaks. + +Arguments: + + void **Symbolic ; Input argument, deallocated and Symbolic is + set to (void *) NULL on output. + + Symbolic must point to a valid Symbolic object, computed by + umfpack_*_symbolic. No action is taken if Symbolic is a (void *) NULL + pointer. +*/ diff --git a/src/sparse-matrix/umfpack/umfpack_get_lunz.h b/src/sparse-matrix/umfpack/umfpack_get_lunz.h new file mode 100644 index 0000000..963123e --- /dev/null +++ b/src/sparse-matrix/umfpack/umfpack_get_lunz.h @@ -0,0 +1,134 @@ +/* ========================================================================== */ +/* === umfpack_get_lunz ===================================================== */ +/* ========================================================================== */ + +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +int umfpack_di_get_lunz +( + int *lnz, + int *unz, + int *n_row, + int *n_col, + int *nz_udiag, + void *Numeric +) ; + +long umfpack_dl_get_lunz +( + long *lnz, + long *unz, + long *n_row, + long *n_col, + long *nz_udiag, + void *Numeric +) ; + +int umfpack_zi_get_lunz +( + int *lnz, + int *unz, + int *n_row, + int *n_col, + int *nz_udiag, + void *Numeric +) ; + +long umfpack_zl_get_lunz +( + long *lnz, + long *unz, + long *n_row, + long *n_col, + long *nz_udiag, + void *Numeric +) ; + +/* +double int Syntax: + + #include "umfpack.h" + void *Numeric ; + int status, lnz, unz, n_row, n_col ; + status = umfpack_di_get_lunz (&lnz, &unz, &n_row, &n_col, Numeric) ; + +double long Syntax: + + #include "umfpack.h" + void *Numeric ; + long status, lnz, unz, n_row, n_col ; + status = umfpack_dl_get_lunz (&lnz, &unz, &n_row, &n_col, Numeric) ; + +complex int Syntax: + + #include "umfpack.h" + void *Numeric ; + int status, lnz, unz, n_row, n_col ; + status = umfpack_zi_get_lunz (&lnz, &unz, &n_row, &n_col, Numeric) ; + +complex long Syntax: + + #include "umfpack.h" + void *Numeric ; + long status, lnz, unz, n_row, n_col ; + status = umfpack_zl_get_lunz (&lnz, &unz, &n_row, &n_col, Numeric) ; + +Purpose: + + Determines the size and number of nonzeros in the LU factors held by the + Numeric object. These are also the sizes of the output arrays required + by umfpack_*_get_numeric. + + The matrix L is n_row -by- min(n_row,n_col), with lnz nonzeros, including + the entries on the unit diagonal of L. + + The matrix U is min(n_row,n_col) -by- n_col, with unz nonzeros, including + nonzeros on the diagonal of U. + +Returns: + + UMFPACK_OK if successful. + UMFPACK_ERROR_invalid_Numeric_object if Numeric is not a valid object. + UMFPACK_ERROR_argument_missing if any other argument is (Int *) NULL. + +Arguments: + + Int *lnz ; Output argument. + + The number of nonzeros in L, including the diagonal (which is all + one's). This value is the required size of the Lj and Lx arrays as + computed by umfpack_*_get_numeric. The value of lnz is identical to + Info [UMFPACK_LNZ], if that value was returned by umfpack_*_numeric. + + Int *unz ; Output argument. + + The number of nonzeros in U, including the diagonal. This value is the + required size of the Ui and Ux arrays as computed by + umfpack_*_get_numeric. The value of unz is identical to + Info [UMFPACK_UNZ], if that value was returned by umfpack_*_numeric. + + Int *n_row ; Output argument. + Int *n_col ; Output argument. + + The order of the L and U matrices. L is n_row -by- min(n_row,n_col) + and U is min(n_row,n_col) -by- n_col. + + Int *nz_udiag ; Output argument. + + The number of numerically nonzero values on the diagonal of U. The + matrix is singular if nz_diag < min(n_row,n_col). A divide-by-zero + will occur if nz_diag < n_row == n_col when solving a sparse system + involving the matrix U in umfpack_*_*solve. The value of nz_udiag is + identical to Info [UMFPACK_UDIAG_NZ] if that value was returned by + umfpack_*_numeric. + + void *Numeric ; Input argument, not modified. + + Numeric must point to a valid Numeric object, computed by + umfpack_*_numeric. +*/ diff --git a/src/sparse-matrix/umfpack/umfpack_get_numeric.h b/src/sparse-matrix/umfpack/umfpack_get_numeric.h new file mode 100644 index 0000000..011093b --- /dev/null +++ b/src/sparse-matrix/umfpack/umfpack_get_numeric.h @@ -0,0 +1,207 @@ +/* ========================================================================== */ +/* === umfpack_get_numeric ================================================== */ +/* ========================================================================== */ + +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +int umfpack_di_get_numeric +( + int Lp [ ], + int Lj [ ], + double Lx [ ], + int Up [ ], + int Ui [ ], + double Ux [ ], + int P [ ], + int Q [ ], + double Dx [ ], + void *Numeric +) ; + +long umfpack_dl_get_numeric +( + long Lp [ ], + long Lj [ ], + double Lx [ ], + long Up [ ], + long Ui [ ], + double Ux [ ], + long P [ ], + long Q [ ], + double Dx [ ], + void *Numeric +) ; + +int umfpack_zi_get_numeric +( + int Lp [ ], + int Lj [ ], + double Lx [ ], double Lz [ ], + int Up [ ], + int Ui [ ], + double Ux [ ], double Uz [ ], + int P [ ], + int Q [ ], + double Dx [ ], double Dz [ ], + void *Numeric +) ; + +long umfpack_zl_get_numeric +( + long Lp [ ], + long Lj [ ], + double Lx [ ], double Lz [ ], + long Up [ ], + long Ui [ ], + double Ux [ ], double Uz [ ], + long P [ ], + long Q [ ], + double Dx [ ], double Dz [ ], + void *Numeric +) ; + +/* +double int Syntax: + + #include "umfpack.h" + void *Numeric ; + int *Lp, *Lj, *Up, *Ui, *P, *Q, status ; + double *Lx, *Ux, *Dx ; + status = umfpack_di_get_numeric (Lp, Lj, Lx, Up, Ui, Ux, P, Q, Dx, Numeric); + +double long Syntax: + + #include "umfpack.h" + void *Numeric ; + long *Lp, *Lj, *Up, *Ui, *P, *Q, status ; + double *Lx, *Ux, *Dx ; + status = umfpack_dl_get_numeric (Lp, Lj, Lx, Up, Ui, Ux, P, Q, Dx, Numeric); + +complex int Syntax: + + #include "umfpack.h" + void *Numeric ; + int *Lp, *Lj, *Up, *Ui, *P, *Q, status ; + double *Lx, *Lz, *Ux, *Uz, *Dx, *Dz ; + status = umfpack_zi_get_numeric (Lp, Lj, Lx, Lz, Up, Ui, Ux, Uz, P, Q, + Dx, Dz, Numeric) ; + +complex long Syntax: + + #include "umfpack.h" + void *Numeric ; + long *Lp, *Lj, *Up, *Ui, *P, *Q, status ; + double *Lx, *Lz, *Ux, *Uz, *Dx, *Dz ; + status = umfpack_zl_get_numeric (Lp, Lj, Lx, Lz, Up, Ui, Ux, Uz, P, Q, + Dx, Dz, Numeric) ; + +Purpose: + + This routine copies the LU factors and permutation vectors from the Numeric + object into user-accessible arrays. This routine is not needed to solve a + linear system. Note that the output arrays Lp, Lj, Lx, Up, Ui, Ux, P, Q, + and Dx are not allocated by umfpack_*_get_numeric; they must exist on input. + Similarly, Lz, Uz and Dz must exist on input for the complex versions. + +Returns: + + Returns UMFPACK_OK if successful. Returns UMFPACK_ERROR_out_of_memory + if insufficient memory is available for the 2*max(n_row,n_col) integer + workspace that umfpack_*_get_numeric allocates to construct L and/or U. + Returns UMFPACK_ERROR_invalid_Numeric_object if the Numeric object provided + as input is invalid. + +Arguments: + + Int Lp [n_row+1] ; Output argument. + Int Lj [lnz] ; Output argument. + double Lx [lnz] ; Output argument. + double Lz [lnz] ; Output argument for complex versions. + + The n_row-by-min(n_row,n_col) matrix L is returned in compressed-row + form. The column indices of row i and corresponding numerical values + are in: + + Lj [Lp [i] ... Lp [i+1]-1] + Lx [Lp [i] ... Lp [i+1]-1] real part + Lz [Lp [i] ... Lp [i+1]-1] imaginary part (complex versions) + + respectively. Each row is stored in sorted order, from low column + indices to higher. The last entry in each row is the diagonal, which + is numerically equal to one. The sizes of Lp, Lj, Lx, and Lz are + returned by umfpack_*_get_lunz. If Lp, Lj, or Ux (or Uz for the + complex version) are not present, then the matrix L is not returned. + This is not an error condition. The L matrix can be printed if n_row, + Lp, Lj, Lx (and Lz for the complex versions) are passed to + umfpack_*_report_matrix (using the "row" form). + + Future complex version: if Lx is present and Lz is NULL, then both real + and imaginary parts will be returned in Lx[0..2*lnz-1], with Lx[2*k] + and Lx[2*k+1] being the real and imaginary part of the kth entry. + + Int Up [n_col+1] ; Output argument. + Int Ui [unz] ; Output argument. + double Ux [unz] ; Output argument. + double Uz [unz] ; Output argument for complex versions. + + The min(n_row,n_co)-by-n_col matrix U is returned in compressed-column + form. The row indices of column j and corresponding numerical values + are in + + Ui [Up [j] ... Up [j+1]-1] + Ux [Up [j] ... Up [j+1]-1] real part + Uz [Up [j] ... Up [j+1]-1] imaginary part (complex versions) + + respectively. Each column is stored in sorted order, from low row + indices to higher. The last entry in each column is the diagonal + (assuming that it is nonzero). The sizes of Up, Ui, Ux, and Uz are + returned by umfpack_*_get_lunz. If Up, Ui, or Ux (or Uz for the complex + version) are not present, then the matrix U is not returned. This is + not an error condition. The U matrix can be printed if n_col, Up, Ui, + Ux (and Uz for the complex versions) are passed to + umfpack_*_report_matrix (using the "column" form). + + Future complex version: if Ux is present and Uz is NULL, then both real + and imaginary parts will be returned in Ux[0..2*unz-1], with Ux[2*k] + and Ux[2*k+1] being the real and imaginary part of the kth entry. + + Int P [n_row] ; Output argument. + + The permutation vector P is defined as P [k] = i, where the original + row i of A is the kth pivot row in PAQ. If you do not want the P vector + to be returned, simply pass (Int *) NULL for P. This is not an error + condition. You can print P and Q with umfpack_*_report_perm. + + Int Q [n_col] ; Output argument. + + The permutation vector Q is defined as Q [k] = j, where the original + column j of A is the kth pivot column in PAQ. If you not want the Q + vector to be returned, simply pass (Int *) NULL for Q. This is not + an error condition. Note that Q is not necessarily identical to + Qtree, the column preordering held in the Symbolic object. Refer to + the description of Qtree and Front_npivcol in umfpack_*_get_symbolic for + details. + + double Dx [min(n_row,n_col)] ; Output argument. + double Dz [min(n_row,n_col)] ; Output argument for complex versions. + + The diagonal of U is also returned in Dx and Dz. You can extract the + diagonal of U without getting all of U by passing a non-NULL Dx (and + Dz for the complex version) and passing Up, Ui, and Ux as NULL. Dx is + the real part of the diagonal, and Dz is the imaginary part. + + Future complex version: if Dx is present and Dz is NULL, then both real + and imaginary parts will be returned in Dx[0..2*min(n_row,n_col)-1], + with Dx[2*k] and Dx[2*k+1] being the real and imaginary part of the kth + entry. + + void *Numeric ; Input argument, not modified. + + Numeric must point to a valid Numeric object, computed by + umfpack_*_numeric. +*/ diff --git a/src/sparse-matrix/umfpack/umfpack_get_symbolic.h b/src/sparse-matrix/umfpack/umfpack_get_symbolic.h new file mode 100644 index 0000000..23d30bf --- /dev/null +++ b/src/sparse-matrix/umfpack/umfpack_get_symbolic.h @@ -0,0 +1,311 @@ +/* ========================================================================== */ +/* === umfpack_get_symbolic ================================================= */ +/* ========================================================================== */ + +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +int umfpack_di_get_symbolic +( + int *n_row, + int *n_col, + int *nz, + int *nfr, + int *nchains, + int Ptree [ ], + int Qtree [ ], + int Front_npivcol [ ], + int Front_parent [ ], + int Front_1strow [ ], + int Front_leftmostdesc [ ], + int Chain_start [ ], + int Chain_maxrows [ ], + int Chain_maxcols [ ], + void *Symbolic +) ; + +long umfpack_dl_get_symbolic +( + long *n_row, + long *n_col, + long *nz, + long *nfr, + long *nchains, + long Ptree [ ], + long Qtree [ ], + long Front_npivcol [ ], + long Front_parent [ ], + long Front_1strow [ ], + long Front_leftmostdesc [ ], + long Chain_start [ ], + long Chain_maxrows [ ], + long Chain_maxcols [ ], + void *Symbolic +) ; + +int umfpack_zi_get_symbolic +( + int *n_row, + int *n_col, + int *nz, + int *nfr, + int *nchains, + int Ptree [ ], + int Qtree [ ], + int Front_npivcol [ ], + int Front_parent [ ], + int Front_1strow [ ], + int Front_leftmostdesc [ ], + int Chain_start [ ], + int Chain_maxrows [ ], + int Chain_maxcols [ ], + void *Symbolic +) ; + +long umfpack_zl_get_symbolic +( + long *n_row, + long *n_col, + long *nz, + long *nfr, + long *nchains, + long Ptree [ ], + long Qtree [ ], + long Front_npivcol [ ], + long Front_parent [ ], + long Front_1strow [ ], + long Front_leftmostdesc [ ], + long Chain_start [ ], + long Chain_maxrows [ ], + long Chain_maxcols [ ], + void *Symbolic +) ; + +/* +double int Syntax: + + #include "umfpack.h" + int status, n_row, n_col, nz, nfr, nchains, *Ptree, *Qtree, + *Front_npivcol, *Front_parent, *Front_1strow, *Front_leftmostdesc, + *Chain_start, *Chain_maxrows, *Chain_maxcols ; + void *Symbolic ; + status = umfpack_di_get_symbolic (&n_row, &n_col, &nz, &nfr, &nchains, + Ptree, Qtree, Front_npivcol, Front_parent, Front_1strow, + Front_leftmostdesc, Chain_start, Chain_maxrows, Chain_maxcols, + Symbolic) ; + +double long Syntax: + + #include "umfpack.h" + long status, n_row, n_col, nz, nfr, nchains, *Ptree, *Qtree, + *Front_npivcol, *Front_parent, *Front_1strow, *Front_leftmostdesc, + *Chain_start, *Chain_maxrows, *Chain_maxcols ; + void *Symbolic ; + status = umfpack_dl_get_symbolic (&n_row, &n_col, &nz, &nfr, &nchains, + Ptree, Qtree, Front_npivcol, Front_parent, Front_1strow, + Front_leftmostdesc, Chain_start, Chain_maxrows, Chain_maxcols, + Symbolic) ; + +complex int Syntax: + + #include "umfpack.h" + int status, n_row, n_col, nz, nfr, nchains, *Ptree, *Qtree, + *Front_npivcol, *Front_parent, *Front_1strow, *Front_leftmostdesc, + *Chain_start, *Chain_maxrows, *Chain_maxcols ; + void *Symbolic ; + status = umfpack_zi_get_symbolic (&n_row, &n_col, &nz, &nfr, &nchains, + Ptree, Qtree, Front_npivcol, Front_parent, Front_1strow, + Front_leftmostdesc, Chain_start, Chain_maxrows, Chain_maxcols, + Symbolic) ; + +complex long Syntax: + + #include "umfpack.h" + long status, n_row, n_col, nz, nfr, nchains, *Ptree, *Qtree, + *Front_npivcol, *Front_parent, *Front_1strow, *Front_leftmostdesc, + *Chain_start, *Chain_maxrows, *Chain_maxcols ; + void *Symbolic ; + status = umfpack_zl_get_symbolic (&n_row, &n_col, &nz, &nfr, &nchains, + Ptree, Qtree, Front_npivcol, Front_parent, Front_1strow, + Front_leftmostdesc, Chain_start, Chain_maxrows, Chain_maxcols, + Symbolic) ; + +Purpose: + + Copies the contents of the Symbolic object into simple integer arrays + accessible to the user. This routine is not needed to factorize and/or + solve a sparse linear system using UMFPACK. Note that the output arrays + Ptree, Qtree, Front_npivcol, Front_parent, Front_1strow, Front_leftmostdesc, + Chain_start, Chain_maxrows, and Chain_maxcols are not allocated by + umfpack_*_get_symbolic; they must exist on input. + + The Symbolic object is small. Its size for an n-by-n square matrix is about + (3*nchains + 2*n + 4*nfr + 30) integers plus 5 double's, which is no greater + than about 9*n+40 int's. The object holds the initial column permutation, + the supernodal column elimination tree, and information about each frontal + matrix. You can print it with umfpack_*_report_symbolic. + +Returns: + + Returns UMFPACK_OK if successful, UMFPACK_ERROR_invalid_Symbolic_object + if Symbolic is an invalid object. + +Arguments: + + Note that if any of the output arguments are (Int *) NULL pointers, then + that argument is not returned. This is not an error condition. Thus, + if you do not want a particular part of the Symbolic object to be + returned to you, simply pass a (Int *) NULL pointer for that particular + output argument. + + Int *n_row ; Output argument. + Int *n_col ; Output argument. + + The dimensions of the matrix A analyzed by the call to + umfpack_*_symbolic that generated the Symbolic object. + + Int *nz ; Output argument. + + The number of nonzeros in A. + + Int *nfr ; Output argument. + + The number of frontal matrices that will be used by umfpack_*_numeric + to factorize the matrix A. It is in the range 0 to n_col. + + Int *nchains ; Output argument. + + The frontal matrices are related to one another by the supernodal + column elimination tree. Each node in this tree is one frontal matrix. + The tree is partitioned into a set of disjoint paths, and a frontal + matrix chain is one path in this tree. Each chain is factorized using + a unifrontal technique, with a single working array that holds each + frontal matrix in the chain, one at a time. nchains is in the range + 0 to nfr. + + Int Ptree [n_row] ; Output argument. + + The initial row permutation. If Ptree [k] = i, then this means that + row i is the kth row in the preordered matrix. Row i typically will + not be the kth pivot row, however. Ptree is the result of a sorting of + the rows according to the smallest column index of entries in the + matrix permuted by Qtree, below. + + Int Qtree [n_col] ; Output argument. + + The initial column permutation. If Qtree [k] = j, then this means that + column j is the kth pivot column in the preordered matrix. Qtree is + not necessarily the same as the final column permutation Q, computed by + umfpack_*_numeric. The numeric factorization may reorder the pivot + columns within each frontal matrix to reduce fill-in. + + Int Front_npivcol [n_col+1] ; Output argument. + + This array should be of size at least n_col+1, in order to guarantee + that it will be large enough to hold the output. Only the first nfr+1 + entries are used, however. + + The kth frontal matrix holds Front_npivcol [k] pivot columns. Thus, the + first frontal matrix, front 0, is used to factorize the first + Front_npivcol [0] columns; these correspond to the original columns + Qtree [0] through Qtree [Front_npivcol [0]-1]. The next frontal matrix + is used to factorize the next Front_npivcol [1] columns, which are thus + the original columns Qtree [Front_npivcol [0]] through + Qtree [Front_npivcol [0] + Front_npivcol [1] - 1], and so on. Columns + with no entries at all are put in a placeholder "front", + Front_npivcol [nfr]. The sum of Front_npivcol [0..nfr] is equal to + n_col. + + Any modifications that umfpack_*_numeric makes to the initial column + permutation are constrained to within each frontal matrix. Thus, for + the first frontal matrix, Q [0] through Q [Front_npivcol [0]-1] is some + permutation of the columns Qtree [0] through + Qtree [Front_npivcol [0]-1]. For second frontal matrix, + Q [Front_npivcol [0]] through Q [Front_npivcol [0] + Front_npivcol[1]-1] + is some permutation of the same portion of Qtree, and so on. All pivot + columns are numerically factorized within the frontal matrix originally + determined by the symbolic factorization; there is no delayed pivoting + across frontal matrices. + + Int Front_parent [n_col+1] ; Output argument. + + This array should be of size at least n_col+1, in order to guarantee + that it will be large enough to hold the output. Only the first nfr+1 + entries are used, however. + + Front_parent [0..nfr] holds the supernodal column elimination tree + (including the placeholder front nfr, which may be empty). Each node in + the tree corresponds to a single frontal matrix. The parent of node f + is Front_parent [f]. + + Int Front_1strow [n_col+1] ; Output argument. + + This array should be of size at least n_col+1, in order to guarantee + that it will be large enough to hold the output. Only the first nfr+1 + entries are used, however. + + Front_1strow [k] is the row index of the first row in A (Ptree,Qtree) + whose leftmost entry is in a pivot column for the kth front. This is + necessary only to properly factorize singular matrices. It is new to + Version 4.0. Rows in the range Front_1strow [k] to + Front_1strow [k+1]-1 first become pivot row candidates at the kth front. + Any rows not eliminated in the kth front may be selected as pivot rows + in the parent of k (Front_parent [k]) and so on up the tree. + + Int Front_leftmostdesc [n_col+1] ; Output argument. + + This array should be of size at least n_col+1, in order to guarantee + that it will be large enough to hold the output. Only the first nfr+1 + entries are used, however. + + Front_leftmostdesc [k] is the leftmost descendant of front k, or k + if the front has no children in the tree. Since the rows and columns + (Ptree and Qtree) have been post-ordered via a depth-first-search of + the tree, rows in the range Front_1strow [Front_leftmostdesc [k]] to + Front_1strow [k+1]-1 form the entire set of candidate pivot rows for + the kth front (some of these will typically have already been selected + by fronts in the range Front_leftmostdesc [k] to front k-1, before + the factorization reaches front k). + + Chain_start [n_col+1] ; Output argument. + + This array should be of size at least n_col+1, in order to guarantee + that it will be large enough to hold the output. Only the first + nchains+1 entries are used, however. + + The kth frontal matrix chain consists of frontal matrices Chain_start[k] + through Chain_start [k+1]-1. Thus, Chain_start [0] is always 0, and + Chain_start [nchains] is the total number of frontal matrices, nfr. For + two adjacent fronts f and f+1 within a single chain, f+1 is always the + parent of f (that is, Front_parent [f] = f+1). + + Int Chain_maxrows [n_col+1] ; Output argument. + Int Chain_maxcols [n_col+1] ; Output argument. + + These arrays should be of size at least n_col+1, in order to guarantee + that they will be large enough to hold the output. Only the first + nchains entries are used, however. + + The kth frontal matrix chain requires a single working array of + dimension Chain_maxrows [k] by Chain_maxcols [k], for the unifrontal + technique that factorizes the frontal matrix chain. Since the symbolic + factorization only provides an upper bound on the size of each frontal + matrix, not all of the working array is necessarily used during the + numerical factorization. + + Note that the upper bound on the number of rows and columns of each + frontal matrix is computed by umfpack_*_symbolic, but all that is + required by umfpack_*_numeric is the maximum of these two sets of + values for each frontal matrix chain. Thus, the size of each + individual frontal matrix is not preserved in the Symbolic object. + + void *Symbolic ; Input argument, not modified. + + The Symbolic object, which holds the symbolic factorization computed by + umfpack_*_symbolic. The Symbolic object is not modified by + umfpack_*_get_symbolic. +*/ diff --git a/src/sparse-matrix/umfpack/umfpack_numeric.h b/src/sparse-matrix/umfpack/umfpack_numeric.h new file mode 100644 index 0000000..0acd042 --- /dev/null +++ b/src/sparse-matrix/umfpack/umfpack_numeric.h @@ -0,0 +1,432 @@ +/* ========================================================================== */ +/* === umfpack_numeric ====================================================== */ +/* ========================================================================== */ + +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +int umfpack_di_numeric +( + const int Ap [ ], + const int Ai [ ], + const double Ax [ ], + void *Symbolic, + void **Numeric, + const double Control [UMFPACK_CONTROL], + double Info [UMFPACK_INFO] +) ; + +long umfpack_dl_numeric +( + const long Ap [ ], + const long Ai [ ], + const double Ax [ ], + void *Symbolic, + void **Numeric, + const double Control [UMFPACK_CONTROL], + double Info [UMFPACK_INFO] +) ; + +int umfpack_zi_numeric +( + const int Ap [ ], + const int Ai [ ], + const double Ax [ ], const double Az [ ], + void *Symbolic, + void **Numeric, + const double Control [UMFPACK_CONTROL], + double Info [UMFPACK_INFO] +) ; + +long umfpack_zl_numeric +( + const long Ap [ ], + const long Ai [ ], + const double Ax [ ], const double Az [ ], + void *Symbolic, + void **Numeric, + const double Control [UMFPACK_CONTROL], + double Info [UMFPACK_INFO] +) ; + +/* +double int Syntax: + + #include "umfpack.h" + void *Symbolic, *Numeric ; + int *Ap, *Ai, status ; + double *Ax, Control [UMFPACK_CONTROL], Info [UMFPACK_INFO] ; + status = umfpack_di_numeric (Ap, Ai, Ax, Symbolic, &Numeric, + Control, Info) ; + +double long Syntax: + + #include "umfpack.h" + void *Symbolic, *Numeric ; + long *Ap, *Ai, status ; + double *Ax, Control [UMFPACK_CONTROL], Info [UMFPACK_INFO] ; + status = umfpack_dl_numeric (Ap, Ai, Ax, Symbolic, &Numeric, + Control, Info) ; + +complex int Syntax: + + #include "umfpack.h" + void *Symbolic, *Numeric ; + int *Ap, *Ai, status ; + double *Ax, *Az, Control [UMFPACK_CONTROL], Info [UMFPACK_INFO] ; + status = umfpack_zi_numeric (Ap, Ai, Ax, Az, Symbolic, &Numeric, + Control, Info) ; + +complex long Syntax: + + #include "umfpack.h" + void *Symbolic, *Numeric ; + long *Ap, *Ai, status ; + double *Ax, *Az, Control [UMFPACK_CONTROL], Info [UMFPACK_INFO] ; + status = umfpack_zl_numeric (Ap, Ai, Ax, Symbolic, &Numeric, + Control, Info) ; + +Purpose: + + Given a sparse matrix A in column-oriented form, and a symbolic analysis + computed by umfpack_*_*symbolic, the umfpack_*_numeric routine performs the + numerical factorization, PAQ=LU, where P and Q are permutation matrices + (represented as permutation vectors), L is unit-lower triangular, and U + is upper triangular. This is required before the system Ax=b (or other + related linear systems) can be solved. umfpack_*_numeric can be called + multiple times for each call to umfpack_*_symbolic, to factorize a sequence + of matrices with identical nonzero pattern. Simply compute the Symbolic + object once, with umfpack_*_*symbolic, and reuse it for subsequent matrices. + umfpack_*_numeric safely detects if the pattern changes, and sets an + appropriate error code. + +Returns: + + The status code is returned. See Info [UMFPACK_STATUS], below. + +Arguments: + + Int Ap [n_col+1] ; Input argument, not modified. + + This must be identical to the Ap array passed to umfpack_*_*symbolic. + The value of n_col is what was passed to umfpack_*_*symbolic (this is + held in the Symbolic object). + + Int Ai [nz] ; Input argument, not modified, of size nz = Ap [n_col]. + + This must be identical to the Ai array passed to umfpack_*_*symbolic. + + double Ax [nz] ; Input argument, not modified, of size nz = Ap [n_col]. + + The numerical values of the sparse matrix A. The nonzero pattern (row + indices) for column j is stored in Ai [(Ap [j]) ... (Ap [j+1]-1)], and + the corresponding numerical values are stored in + Ax [(Ap [j]) ... (Ap [j+1]-1)]. + + double Az [nz] ; Input argument, not modified, for complex versions. + + For the complex versions, this holds the imaginary part of A. The + imaginary part of column j is held in Az [(Ap [j]) ... (Ap [j+1]-1)]. + + Future complex version: if Ax is present and Az is NULL, then both real + and imaginary parts will be contained in Ax[0..2*nz-1], with Ax[2*k] + and Ax[2*k+1] being the real and imaginary part of the kth entry. + + void *Symbolic ; Input argument, not modified. + + The Symbolic object, which holds the symbolic factorization computed by + umfpack_*_*symbolic. The Symbolic object is not modified by + umfpack_*_numeric. + + void **Numeric ; Output argument. + + **Numeric is the address of a (void *) pointer variable in the user's + calling routine (see Syntax, above). On input, the contents of this + variable are not defined. On output, this variable holds a (void *) + pointer to the Numeric object (if successful), or (void *) NULL if + a failure occurred. + + double Control [UMFPACK_CONTROL] ; Input argument, not modified. + + If a (double *) NULL pointer is passed, then the default control + settings are used. Otherwise, the settings are determined from the + Control array. See umfpack_*_defaults on how to fill the Control + array with the default settings. If Control contains NaN's, the + defaults are used. The following Control parameters are used: + + Control [UMFPACK_PIVOT_TOLERANCE]: relative pivot tolerance for + threshold partial pivoting with row interchanges. In any given + column, an entry is numerically acceptable if its absolute value is + greater than or equal to Control [UMFPACK_PIVOT_TOLERANCE] times + the largest absolute value in the column. A value of 1.0 gives true + partial pivoting. A value of zero is treated as 1.0. Default: 0.1. + Smaller values tend to lead to sparser LU factors, but the solution + to the linear system can become inaccurate. Larger values can lead + to a more accurate solution (but not always), and usually an + increase in the total work. + + For complex matrices, a cheap approximate of the absolute value + is used for the threshold partial pivoting test (|a_real| + |a_imag| + instead of the more expensive-to-compute exact absolute value + sqrt (a_real^2 + a_imag^2)). + + Control [UMFPACK_RELAXED_AMALGAMATION]: This controls the creation of + "elements" (small dense submatrices) that are formed when a frontal + matrix is factorized. A new element is created if the current one, + plus the new pivot, contains "too many" explicitly zero numerical + entries. The two elements are merged if the number of extra zero + entries is < Control [UMFPACK_RELAXED_AMALGAMATION] times the + size of the merged element. A lower setting decreases fill-in, but + run-time and memory usage can increase. A larger setting increases + fill-in (because the extra zeros are treated as normal entries + during pivot selection), but this can lead to an increase in + run-time but (paradoxically) a decrease in memory usage (one merged + elements can take less space than two separate elements). Except + for the initial column ordering, this parameter has the most impact + on the run-time, fill-in, operation count, and memory usage. + Default: 0.25, which is fine for nearly all matrices. + (For nearly all matrices that I've tested, different values of this + parameter can decrease the run-time by at most 5%, but can also + dramatically increase the run time for some matrices). + + Control [UMFPACK_RELAXED2_AMALGAMATION]: This, along with the block + size (Control [UMFPACK_BLOCK_SIZE]), controls how often the + pending updates are applied when the next pivot entry resides in + the current frontal matrix. If the number of zero entries in the + LU part of the current frontal matrix would exceed this parameter + times the size of the LU part, then the pending updates are applied + before the next pivot is included in the frontal matrix. + Default: 0.20 (that is, more than 20% zero entries causes the + pending updates to be applied). This input parameter is new + since Version 3.1. + + Control [UMFPACK_RELAXED3_AMALGAMATION]: This, along with the block + size (Control [UMFPACK_BLOCK_SIZE]), controls how often the pending + updates are applied when the next pivot entry does NOT reside + in the current frontal matrix. If the number of zero entries in the + LU part of the current frontal matrix would exceed this parameter + times the size of the LU part, then the pending updates are applied + before the next pivot is included in the frontal matrix. + Default: 0.10 (that is, more than 10% zero entries causes the + pending updates to be applied). This input parameter is new + since Version 3.1. + + Control [UMFPACK_ALLOC_INIT]: When umfpack_*_numeric starts, it + allocates memory for the Numeric object. Part of this is of fixed + size (approximately n double's + 12*n integers). The remainder is + of variable size, which grows to hold the LU factors and the frontal + matrices created during factorization. A estimate of the upper + bound is computed by umfpack_*_*symbolic, and returned by + umfpack_*_*symbolic in Info [UMFPACK_VARIABLE_PEAK_ESTIMATE]. + umfpack_*_numeric initially allocates space for the variable-sized + part equal to this estimate times Control [UMFPACK_ALLOC_INIT]. + Typically, umfpack_*_numeric needs only about half the estimated + memory space, so a setting of 0.5 or 0.6 often provides enough + memory for umfpack_*_numeric to factorize the matrix with no + subsequent increases in the size of this block. A value less than + zero is treated as zero (in which case, just the bare minimum + amount of memory needed to start the factorization is initially + allocated). The bare initial memory required is returned by + umfpack_*_*symbolic in Info [UMFPACK_VARIABLE_INIT_ESTIMATE] (which + in fact not an estimate, but exact). If the variable-size part of + the Numeric object is found to be too small sometime after numerical + factorization has started, the memory is increased in size by a + factor of 1.2. If this fails, the request is reduced by a factor + of 0.95 until it succeeds, or until it determines that no increase + in size is possible. Garbage collection then occurs. These two + factors (1.2 and 0.95) are fixed control parameters defined in + umf_internal.h and cannot be changed at run-time. You would need + to edit umf_internal.h to modify them. If you do this, be sure that + the two factors are greater than 1 and less than 1, respectively. + + The strategy of attempting to malloc a working space, and re-trying + with a smaller space, may not work under MATLAB, since mxMalloc + aborts the mexFunction if it fails. The built-in umfpack routine + uses utMalloc instead, which does cause this problem. If you are + using the umfpack mexFunction, decrease Control [UMFPACK_ALLOC_INIT] + if you run out of memory in MATLAB. + + Default initial allocation size: 0.7. Thus, with the default + control settings, the upper-bound is reached after two reallocations + (0.7 * 1.2 * 1.2 = 1.008). + + Changing this parameter has no effect on fill-in or operation count. + It has a small impact on run-time (the extra time required to do + the garbage collection and memory reallocation). + + double Info [UMFPACK_INFO] ; Output argument. + + Contains statistics about the numeric factorization. If a + (double *) NULL pointer is passed, then no statistics are returned in + Info (this is not an error condition). The following statistics are + computed in umfpack_*_numeric: + + Info [UMFPACK_STATUS]: status code. This is also the return value, + whether or not Info is present. + + UMFPACK_OK + + Numeric factorization was successful. umfpack_*_numeric + computed a valid numeric factorization. + + UMFPACK_WARNING_singular_matrix + + Numeric factorization was successful, but the matrix is + singular. umfpack_*_numeric computed a valid numeric + factorization, but you will get a divide by zero in + umfpack_*_*solve. For the other cases below, no Numeric object + is created (*Numeric is (void *) NULL). + + UMFPACK_ERROR_out_of_memory + + Insufficient memory to complete the numeric factorization. + + UMFPACK_ERROR_argument_missing + + One or more required arguments are missing. + + UMFPACK_ERROR_invalid_Symbolic_object + + Symbolic object provided as input is invalid. + + UMFPACK_ERROR_different_pattern + + The pattern (Ap and/or Ai) has changed since the call to + umfpack_*_*symbolic which produced the Symbolic object. + + Info [UMFPACK_NROW]: the value of n_row stored in the Symbolic object. + + Info [UMFPACK_NCOL]: the value of n_col stored in the Symbolic object. + + Info [UMFPACK_NZ]: the number of entries in the input matrix. + This value is obtained from the Symbolic object. + + Info [UMFPACK_SIZE_OF_UNIT]: the number of bytes in a Unit, for memory + usage statistics below. + + Info [UMFPACK_VARIABLE_INIT]: the initial size (in Units) of the + variable-sized part of the Numeric object. If this differs from + Info [UMFPACK_VARIABLE_INIT_ESTIMATE], then the pattern (Ap and/or + Ai) has changed since the last call to umfpack_*_*symbolic, which is + an error condition. + + Info [UMFPACK_VARIABLE_PEAK]: the peak size (in Units) of the + variable-sized part of the Numeric object. This size is the amount + of space actually used inside the block of memory, not the space + allocated via UMF_malloc. You can reduce UMFPACK's memory + requirements by setting Control [UMFPACK_ALLOC_INIT] to the ratio + Info [UMFPACK_VARIABLE_PEAK] / Info[UMFPACK_VARIABLE_PEAK_ESTIMATE]. + This will ensure that no memory reallocations occur (you may want to + add 0.001 to make sure that integer roundoff does not lead to a + memory size that is 1 Unit too small; otherwise, garbage collection + and reallocation will occur). + + Info [UMFPACK_VARIABLE_FINAL]: the final size (in Units) of the + variable-sized part of the Numeric object. It holds just the + sparse LU factors. + + Info [UMFPACK_NUMERIC_SIZE]: the actual final size (in Units) of the + entire Numeric object, including the final size of the variable + part of the object. Info [UMFPACK_NUMERIC_SIZE_ESTIMATE], + an estimate, was computed by umfpack_*_*symbolic. The estimate is + normally an upper bound on the actual final size, but this is not + guaranteed. + + Info [UMFPACK_PEAK_MEMORY]: the actual peak memory usage (in Units) of + both umfpack_*_*symbolic and umfpack_*_numeric. An estimate, + Info [UMFPACK_PEAK_MEMORY_ESTIMATE], was computed by + umfpack_*_*symbolic. The estimate is normally an upper bound on the + actual peak usage, but this is not guaranteed. With testing on + hundreds of matrix arising in real applications, I have never + observed a matrix where this estimate or the Numeric size estimate + was less than the actual result, but this is theoretically possible. + Please send me one if you find such a matrix. + + Info [UMFPACK_FLOPS]: the actual count of the (useful) floating-point + operations performed. An estimate, Info [UMFPACK_FLOPS_ESTIMATE], + was computed by umfpack_*_*symbolic. The estimate is guaranteed to + be an upper bound on this flop count. The flop count excludes + "useless" flops on zero values, flops performed during the pivot + search (for tentative updates and assembly of candidate columns), + and flops performed to add frontal matrices together. + + For the real version, only (+ - * /) are counted. For the complex + version, the following counts are used: + + operation flops + c = 1/b 6 + c = a*b 6 + c -= a*b 8 + + Info [UMFPACK_LNZ]: the actual nonzero entries in final factor L, + including the diagonal. This excludes any zero entries in L, + although some of these are stored in the Numeric object. The + Info [UMFPACK_LU_ENTRIES] statistic does account for all + explicitly stored zeros, however. Info [UMFPACK_LNZ_ESTIMATE], + an estimate, was computed by umfpack_*_*symbolic. The estimate is + guaranteed to be an upper bound on Info [UMFPACK_LNZ]. + + Info [UMFPACK_UNZ]: the actual nonzero entries in final factor U, + including the diagonal. This excludes any zero entries in U, + although some of these are stored in the Numeric object. The + Info [UMFPACK_LU_ENTRIES] statistic does account for all + explicitly stored zeros, however. Info [UMFPACK_UNZ_ESTIMATE], + an estimate, was computed by umfpack_*_*symbolic. The estimate is + guaranteed to be an upper bound on Info [UMFPACK_UNZ]. + + Info [UMFPACK_NUMERIC_DEFRAG]: The number of garbage collections + performed during umfpack_*_numeric, to compact the contents of the + variable-sized workspace used by umfpack_*_numeric. No estimate was + computed by umfpack_*_*symbolic. In the current version of UMFPACK, + garbage collection is performed and then the memory is reallocated, + so this statistic is the same as Info [UMFPACK_NUMERIC_REALLOC], + below. It may differ in future releases. + + Info [UMFPACK_NUMERIC_REALLOC]: The number of times that the Numeric + object was increased in size from its initial size. A rough upper + bound on the peak size of the Numeric object was computed by + umfpack_*_*symbolic, so reallocations should be rare. However, if + umfpack_*_numeric is unable to allocate that much storage, it + reduces its request until either the allocation succeeds, or until + it gets too small to do anything with. If the memory that it + finally got was small, but usable, then the reallocation count + could be high. No estimate of this count was computed by + umfpack_*_*symbolic. + + Info [UMFPACK_NUMERIC_COSTLY_REALLOC]: The number of times that the + system realloc library routine (or mxRealloc for the mexFunction) + had to move the workspace. Realloc can sometimes increase the size + of a block of memory without moving it, which is much faster. This + statistic will always be <= Info [UMFPACK_NUMERIC_REALLOC]. If your + memory space is fragmented, then the number of "costly" realloc's + will be equal to Info [UMFPACK_NUMERIC_REALLOC]. + + Info [UMFPACK_COMPRESSED_PATTERN]: The number of integers used to + represent the pattern of L and U. + + Info [UMFPACK_LU_ENTRIES]: The total number of numerical values that + are stored for the LU factors. Some of the values may be explicitly + zero in order to save space (allowing for a smaller compressed + pattern). + + Info [UMFPACK_NUMERIC_TIME]: The time taken by umfpack_*_numeric, in + seconds. In the ANSI C version, this may be invalid if the time + taken is more than about 36 minutes, because of wrap-around in the + ANSI C clock function. Compile UMFPACK with -DGETRUSAGE if you have + the more accurate getrusage function. + + Info [UMFPACK_RCOND]: A rough estimate of the condition number, equal + to min (abs (diag (U))) / max (abs (diag (U))), or zero if the + diagonal of U is all zero. + + Info [UMFPACK_UDIAG_NZ]: The number of numerically nonzero values on + the diagonal of U. + + Only the above listed Info [...] entries are accessed. The remaining + entries of Info are not accessed or modified by umfpack_*_numeric. + Future versions might modify different parts of Info. +*/ diff --git a/src/sparse-matrix/umfpack/umfpack_qsymbolic.h b/src/sparse-matrix/umfpack/umfpack_qsymbolic.h new file mode 100644 index 0000000..7b474f8 --- /dev/null +++ b/src/sparse-matrix/umfpack/umfpack_qsymbolic.h @@ -0,0 +1,163 @@ +/* ========================================================================== */ +/* === umfpack_qsymbolic ==================================================== */ +/* ========================================================================== */ + +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +int umfpack_di_qsymbolic +( + int n_row, + int n_col, + const int Ap [ ], + const int Ai [ ], + const int Qinit [ ], + void **Symbolic, + const double Control [UMFPACK_CONTROL], + double Info [UMFPACK_INFO] +) ; + +long umfpack_dl_qsymbolic +( + long n_row, + long n_col, + const long Ap [ ], + const long Ai [ ], + const long Qinit [ ], + void **Symbolic, + const double Control [UMFPACK_CONTROL], + double Info [UMFPACK_INFO] +) ; + +int umfpack_zi_qsymbolic +( + int n_row, + int n_col, + const int Ap [ ], + const int Ai [ ], + const int Qinit [ ], + void **Symbolic, + const double Control [UMFPACK_CONTROL], + double Info [UMFPACK_INFO] +) ; + +long umfpack_zl_qsymbolic +( + long n_row, + long n_col, + const long Ap [ ], + const long Ai [ ], + const long Qinit [ ], + void **Symbolic, + const double Control [UMFPACK_CONTROL], + double Info [UMFPACK_INFO] +) ; + +/* +double int Syntax: + + #include "umfpack.h" + void *Symbolic ; + int n_row, n_col, *Ap, *Ai, *Qinit, status ; + double Control [UMFPACK_CONTROL], Info [UMFPACK_INFO] ; + status = umfpack_di_qsymbolic (n_row, n_col, Ap, Ai, Qinit, &Symbolic, + Control, Info) ; + +double long Syntax: + + #include "umfpack.h" + void *Symbolic ; + long n_row, n_col, *Ap, *Ai, *Qinit, status ; + double Control [UMFPACK_CONTROL], Info [UMFPACK_INFO] ; + status = umfpack_dl_qsymbolic (n_row, n_col, Ap, Ai, Qinit, &Symbolic, + Control, Info) ; + +complex int Syntax: + + #include "umfpack.h" + void *Symbolic ; + int n_row, n_col, *Ap, *Ai, *Qinit, status ; + double Control [UMFPACK_CONTROL], Info [UMFPACK_INFO] ; + status = umfpack_zi_qsymbolic (n_row, n_col, Ap, Ai, Qinit, &Symbolic, + Control, Info) ; + +complex long Syntax: + + #include "umfpack.h" + void *Symbolic ; + long n_row, n_col, *Ap, *Ai, *Qinit, status ; + double Control [UMFPACK_CONTROL], Info [UMFPACK_INFO] ; + status = umfpack_zl_qsymbolic (n_row, n_col, Ap, Ai, Qinit, &Symbolic, + Control, Info) ; + +Purpose: + + Given the nonzero pattern of a sparse matrix A in column-oriented form, and + a sparsity preserving column preordering Qinit, umfpack_*_qsymbolic performs + the symbolic factorization of A*Qinit (or A (:,Qinit) in MATLAB notation). + It also computes the column elimination tree post-ordering. This is + identical to umfpack_*_symbolic, except that colamd is not called and the + user input column order Qinit is used instead. Note that in general, the + Qinit passed to umfpack_*_qsymbolic will differ from the final Q found in + umfpack_*_numeric, because of the column etree postordering done in + umfpack_*_qsymbolic and sparsity-preserving modifications made within each + frontal matrix during umfpack_*_numeric. + + *** WARNING *** A poor choice of Qinit can easily cause umfpack_*_numeric + to use a huge amount of memory and do a lot of work. The "default" symbolic + analysis method is umfpack_*_symbolic, not this routine. If you use this + routine, the performance of UMFPACK is your responsibility; UMFPACK will + not try to second-guess a poor choice of Qinit. If you are unsure about + the quality of your Qinit, then call both umfpack_*_symbolic and + umfpack_*_qsymbolic, and pick the one with lower estimates of work and + memory usage (Info [UMFPACK_FLOPS_ESTIMATE] and + Info [UMFPACK_PEAK_MEMORY_ESTIMATE]). Don't forget to call + umfpack_*_free_symbolic to free the Symbolic object that you don't need. + +Returns: + + The value of Info [UMFPACK_STATUS]; see below. + +Arguments: + + All arguments are the same as umfpack_*_symbolic, except for the following: + + Int Qinit [n_col] ; Input argument, not modified. + + The user's fill-reducing initial column preordering. This must be a + permutation of 0..n_col-1. If Qinit [k] = j, then column j is the kth + column of the matrix A (:,Qinit) to be factorized. If Qinit is an + (Int *) NULL pointer, then colamd is called instead. In fact, + + Symbolic = umfpack_*_symbolic (n_row, n_col, Ap, Ai, Control, Info) ; + + is identical to + + Symbolic = umfpack_*_qsymbolic (n_row, n_col, Ap, Ai, (Int *) NULL, + Control, Info) ; + + double Control [UMFPACK_CONTROL] ; Input argument, not modified. + + Identical to umfpack_*_symbolic if Qinit is (Int *) NULL. Otherwise, + if Qinit is present, it is identical to umfpack_*_symbolic except for + the following: + + Control [UMFPACK_DENSE_ROW]: ignored. + + Control [UMFPACK_DENSE_COL]: ignored. + + double Info [UMFPACK_INFO] ; Output argument, not defined on input. + + Identical to umfpack_*_symbolic if Qinit is (Int *) NULL. Otherwise, + if Qinit is present, it is identical to umfpack_*_symbolic except for + the following: + + Info [UMFPACK_NDENSE_ROW]: zero + Info [UMFPACK_NEMPTY_ROW]: number of empty rows. + Info [UMFPACK_NDENSE_COL]: zero + Info [UMFPACK_NEMPTY_COL]: number of empty columns. +*/ diff --git a/src/sparse-matrix/umfpack/umfpack_report_control.h b/src/sparse-matrix/umfpack/umfpack_report_control.h new file mode 100644 index 0000000..5fdea5f --- /dev/null +++ b/src/sparse-matrix/umfpack/umfpack_report_control.h @@ -0,0 +1,77 @@ +/* ========================================================================== */ +/* === umfpack_report_control =============================================== */ +/* ========================================================================== */ + +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +void umfpack_di_report_control +( + const double Control [UMFPACK_CONTROL] +) ; + +void umfpack_dl_report_control +( + const double Control [UMFPACK_CONTROL] +) ; + +void umfpack_zi_report_control +( + const double Control [UMFPACK_CONTROL] +) ; + +void umfpack_zl_report_control +( + const double Control [UMFPACK_CONTROL] +) ; + +/* +double int Syntax: + + #include "umfpack.h" + double Control [UMFPACK_CONTROL] ; + umfpack_di_report_control (Control) ; + +double long Syntax: + + #include "umfpack.h" + double Control [UMFPACK_CONTROL] ; + umfpack_dl_report_control (Control) ; + +complex int Syntax: + + #include "umfpack.h" + double Control [UMFPACK_CONTROL] ; + umfpack_zi_report_control (Control) ; + +double long Syntax: + + #include "umfpack.h" + double Control [UMFPACK_CONTROL] ; + umfpack_zl_report_control (Control) ; + +Purpose: + + Prints the current control settings. Note that with the default print + level, nothing is printed. Does nothing if Control is (double *) NULL. + +Arguments: + + double Control [UMFPACK_CONTROL] ; Input argument, not modified. + + If a (double *) NULL pointer is passed, then the default control + settings are used. Otherwise, the settings are determined from the + Control array. See umfpack_*_defaults on how to fill the Control + array with the default settings. If Control contains NaN's, the + defaults are used. The following Control parameters are used: + + Control [UMFPACK_PRL]: printing level. + + 1 or less: no output + 2 or more: print all of Control + Default: 1 +*/ diff --git a/src/sparse-matrix/umfpack/umfpack_report_info.h b/src/sparse-matrix/umfpack/umfpack_report_info.h new file mode 100644 index 0000000..e9ed9d1 --- /dev/null +++ b/src/sparse-matrix/umfpack/umfpack_report_info.h @@ -0,0 +1,87 @@ +/* ========================================================================== */ +/* === umfpack_report_info ================================================== */ +/* ========================================================================== */ + +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +void umfpack_di_report_info +( + const double Control [UMFPACK_CONTROL], + const double Info [UMFPACK_INFO] +) ; + +void umfpack_dl_report_info +( + const double Control [UMFPACK_CONTROL], + const double Info [UMFPACK_INFO] +) ; + +void umfpack_zi_report_info +( + const double Control [UMFPACK_CONTROL], + const double Info [UMFPACK_INFO] +) ; + +void umfpack_zl_report_info +( + const double Control [UMFPACK_CONTROL], + const double Info [UMFPACK_INFO] +) ; + +/* +double int Syntax: + + #include "umfpack.h" + double Control [UMFPACK_CONTROL], Info [UMFPACK_INFO] ; + umfpack_di_report_info (Control, Info) ; + +double long Syntax: + + #include "umfpack.h" + double Control [UMFPACK_CONTROL], Info [UMFPACK_INFO] ; + umfpack_dl_report_info (Control, Info) ; + +complex int Syntax: + + #include "umfpack.h" + double Control [UMFPACK_CONTROL], Info [UMFPACK_INFO] ; + umfpack_zi_report_info (Control, Info) ; + +complex long Syntax: + + #include "umfpack.h" + double Control [UMFPACK_CONTROL], Info [UMFPACK_INFO] ; + umfpack_zl_report_info (Control, Info) ; + +Purpose: + + Reports statistics from the umfpack_*_*symbolic, umfpack_*_numeric, and + umfpack_*_*solve routines. + +Arguments: + + double Control [UMFPACK_CONTROL] ; Input argument, not modified. + + If a (double *) NULL pointer is passed, then the default control + settings are used. Otherwise, the settings are determined from the + Control array. See umfpack_*_defaults on how to fill the Control + array with the default settings. If Control contains NaN's, the + defaults are used. The following Control parameters are used: + + Control [UMFPACK_PRL]: printing level. + + 0 or less: no output, even when an error occurs + 1: error messages only + 2 or more: error messages, and print all of Info + Default: 1 + + double Info [UMFPACK_INFO] ; Input argument, not modified. + + Info is an output argument of several UMFPACK routines. + The contents of Info are printed on standard output. +*/ diff --git a/src/sparse-matrix/umfpack/umfpack_report_matrix.h b/src/sparse-matrix/umfpack/umfpack_report_matrix.h new file mode 100644 index 0000000..c7cc5dd --- /dev/null +++ b/src/sparse-matrix/umfpack/umfpack_report_matrix.h @@ -0,0 +1,201 @@ +/* ========================================================================== */ +/* === umfpack_report_matrix ================================================ */ +/* ========================================================================== */ + +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +int umfpack_di_report_matrix +( + int n_row, + int n_col, + const int Ap [ ], + const int Ai [ ], + const double Ax [ ], + int col_form, + const double Control [UMFPACK_CONTROL] +) ; + +long umfpack_dl_report_matrix +( + long n_row, + long n_col, + const long Ap [ ], + const long Ai [ ], + const double Ax [ ], + long col_form, + const double Control [UMFPACK_CONTROL] +) ; + +int umfpack_zi_report_matrix +( + int n_row, + int n_col, + const int Ap [ ], + const int Ai [ ], + const double Ax [ ], const double Az [ ], + int col_form, + const double Control [UMFPACK_CONTROL] +) ; + +long umfpack_zl_report_matrix +( + long n_row, + long n_col, + const long Ap [ ], + const long Ai [ ], + const double Ax [ ], const double Az [ ], + long col_form, + const double Control [UMFPACK_CONTROL] +) ; + +/* +double int Syntax: + + #include "umfpack.h" + int n_row, n_col, *Ap, *Ai, status ; + double *Ax, Control [UMFPACK_CONTROL] ; + status = umfpack_di_report_matrix (n_row, n_col, Ap, Ai, Ax, 1, Control) ; +or: + status = umfpack_di_report_matrix (n_row, n_col, Ap, Ai, Ax, 0, Control) ; + +double long Syntax: + + #include "umfpack.h" + long n_row, n_col, *Ap, *Ai, status ; + double *Ax, Control [UMFPACK_CONTROL] ; + status = umfpack_dl_report_matrix (n_row, n_col, Ap, Ai, Ax, 1, Control) ; +or: + status = umfpack_dl_report_matrix (n_row, n_col, Ap, Ai, Ax, 0, Control) ; + +complex int Syntax: + + #include "umfpack.h" + int n_row, n_col, *Ap, *Ai, status ; + double *Ax, *Az, Control [UMFPACK_CONTROL] ; + status = umfpack_zi_report_matrix (n_row, n_col, Ap, Ai, Ax, Az, 1, + Control) ; +or: + status = umfpack_zi_report_matrix (n_row, n_col, Ap, Ai, Ax, Az, 0, + Control) ; + +complex long Syntax: + + #include "umfpack.h" + long n_row, n_col, *Ap, *Ai, status ; + double *Ax, Control [UMFPACK_CONTROL] ; + status = umfpack_zl_report_matrix (n_row, n_col, Ap, Ai, Ax, Az, 1, + Control) ; +or: + status = umfpack_zl_report_matrix (n_row, n_col, Ap, Ai, Ax, Az, 0, + Control) ; + +Purpose: + + Verifies and prints a row or column-oriented sparse matrix. + +Returns: + + UMFPACK_OK if Control [UMFPACK_PRL] <= 2 (the input is not checked). + + Otherwise (where n is n_col for the column form and n_row for row + and let ni be n_row for the column form and n_col for row): + + UMFPACK_OK if the matrix is valid. + + UMFPACK_ERROR_n_nonpositive if n_row <= 0 or n_col <= 0. + UMFPACK_ERROR_argument_missing if Ap and/or Ai are missing. + UMFPACK_ERROR_nz_negative if Ap [n] < 0. + UMFPACK_ERROR_Ap0_nonzero if Ap [0] is not zero. + UMFPACK_ERROR_col_length_negative if Ap [j+1] < Ap [j] for any j in the + range 0 to n-1. + UMFPACK_ERROR_out_of_memory if out of memory. + UMFPACK_ERROR_row_index_out_of_bounds if any row index in Ai is not in + the range 0 to ni-1. + UMFPACK_ERROR_jumbled_matrix if the row indices in any column are not in + ascending order, or contain duplicates. + +Arguments: + + Int n_row ; Input argument, not modified. + Int n_col ; Input argument, not modified. + + A is an n_row-by-n_row matrix. Restriction: n_row > 0 and n_col > 0. + + Int Ap [n+1] ; Input argument, not modified. + + n is n_row for a row-form matrix, and n_col for a column-form matrix. + + Ap is an integer array of size n+1. If col_form is true (nonzero), + then on input, it holds the "pointers" for the column form of the + sparse matrix A. The row indices of column j of the matrix A are held + in Ai [(Ap [j]) ... (Ap [j+1]-1)]. Otherwise, Ap holds the + row pointers, and the column indices of row j of the matrix are held + in Ai [(Ap [j]) ... (Ap [j+1]-1)]. + + The first entry, Ap [0], must be zero, and Ap [j] <= Ap [j+1] must hold + for all j in the range 0 to n-1. The value nz = Ap [n] is thus the + total number of entries in the pattern of the matrix A. + + Int Ai [nz] ; Input argument, not modified, of size nz = Ap [n]. + + If col_form is true (nonzero), then the nonzero pattern (row indices) + for column j is stored in Ai [(Ap [j]) ... (Ap [j+1]-1)]. Row indices + must be in the range 0 to n_row-1 (the matrix is 0-based). + + Otherwise, the nonzero pattern (column indices) for row j is stored in + Ai [(Ap [j]) ... (Ap [j+1]-1)]. Column indices must be in the range 0 + to n_col-1 (the matrix is 0-based). + + double Ax [nz] ; Input argument, not modified, of size nz = Ap [n]. + + The numerical values of the sparse matrix A. + + If col_form is true (nonzero), then the nonzero pattern (row indices) + for column j is stored in Ai [(Ap [j]) ... (Ap [j+1]-1)], and the + corresponding (real) numerical values are stored in + Ax [(Ap [j]) ... (Ap [j+1]-1)]. The imaginary parts are stored in + Az [(Ap [j]) ... (Ap [j+1]-1)], for the complex versions. + + Otherwise, the nonzero pattern (column indices) for row j + is stored in Ai [(Ap [j]) ... (Ap [j+1]-1)], and the corresponding + (real) numerical values are stored in Ax [(Ap [j]) ... (Ap [j+1]-1)]. + The imaginary parts are stored in Az [(Ap [j]) ... (Ap [j+1]-1)], + for the complex versions. + + No numerical values are printed if Ax or Az are (double *) NULL. + + double Az [nz] ; Input argument, not modified, for complex versions. + + The imaginary values of the sparse matrix A. See the description + of Ax, above. No numerical values are printed if Az is NULL. + + Future complex version: if Ax is present and Az is NULL, then both real + and imaginary parts will be contained in Ax[0..2*nz-1], with Ax[2*k] + and Ax[2*k+1] being the real and imaginary part of the kth entry. + + Int col_form ; Input argument, not modified. + + The matrix is in row-oriented form if form is col_form is false (0). + Otherwise, the matrix is in column-oriented form. + + double Control [UMFPACK_CONTROL] ; Input argument, not modified. + + If a (double *) NULL pointer is passed, then the default control + settings are used. Otherwise, the settings are determined from the + Control array. See umfpack_*_defaults on how to fill the Control + array with the default settings. If Control contains NaN's, the + defaults are used. The following Control parameters are used: + + Control [UMFPACK_PRL]: printing level. + + 2 or less: no output. returns silently without checking anything. + 3: fully check input, and print a short summary of its status + 4: as 3, but print first few entries of the input + 5: as 3, but print all of the input + Default: 1 +*/ diff --git a/src/sparse-matrix/umfpack/umfpack_report_numeric.h b/src/sparse-matrix/umfpack/umfpack_report_numeric.h new file mode 100644 index 0000000..8130cec --- /dev/null +++ b/src/sparse-matrix/umfpack/umfpack_report_numeric.h @@ -0,0 +1,113 @@ +/* ========================================================================== */ +/* === umfpack_report_numeric =============================================== */ +/* ========================================================================== */ + +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +int umfpack_di_report_numeric +( + void *Numeric, + const double Control [UMFPACK_CONTROL] +) ; + +long umfpack_dl_report_numeric +( + void *Numeric, + const double Control [UMFPACK_CONTROL] +) ; + +int umfpack_zi_report_numeric +( + void *Numeric, + const double Control [UMFPACK_CONTROL] +) ; + +long umfpack_zl_report_numeric +( + void *Numeric, + const double Control [UMFPACK_CONTROL] +) ; + +/* +double int Syntax: + + #include "umfpack.h" + void *Numeric ; + double Control [UMFPACK_CONTROL] ; + int status ; + status = umfpack_di_report_numeric (Numeric, Control) ; + +double long Syntax: + + #include "umfpack.h" + void *Numeric ; + double Control [UMFPACK_CONTROL] ; + long status ; + status = umfpack_dl_report_numeric (Numeric, Control) ; + +complex int Syntax: + + #include "umfpack.h" + void *Numeric ; + double Control [UMFPACK_CONTROL] ; + int status ; + status = umfpack_zi_report_numeric (Numeric, Control) ; + +complex long Syntax: + + #include "umfpack.h" + void *Numeric ; + double Control [UMFPACK_CONTROL] ; + long status ; + status = umfpack_zl_report_numeric (Numeric, Control) ; + +Purpose: + + Verifies and prints a Numeric object (the LU factorization, both its pattern + numerical values, and permutation vectors P and Q). This routine checks the + object more carefully than the computational routines. Normally, this check + is not required, since umfpack_*_numeric either returns (void *) NULL, or a + valid Numeric object. However, if you suspect that your own code has + corrupted the Numeric object (by overruning memory bounds, for example), + then this routine might be able to detect a corrupted Numeric object. Since + this is a complex object, not all such user-generated errors are guaranteed + to be caught by this routine. + +Returns: + + UMFPACK_OK if Control [UMFPACK_PRL] <= 2 (the input is not checked). + + Otherwise: + + UMFPACK_OK if the Numeric object is valid. + UMFPACK_ERROR_invalid_Numeric_object if the Numeric object is invalid. + UMFPACK_ERROR_out_of_memory if out of memory. + +Arguments: + + void *Numeric ; Input argument, not modified. + + The Numeric object, which holds the numeric factorization computed by + umfpack_*_numeric. + + double Control [UMFPACK_CONTROL] ; Input argument, not modified. + + If a (double *) NULL pointer is passed, then the default control + settings are used. Otherwise, the settings are determined from the + Control array. See umfpack_*_defaults on how to fill the Control + array with the default settings. If Control contains NaN's, the + defaults are used. The following Control parameters are used: + + Control [UMFPACK_PRL]: printing level. + + 2 or less: no output. returns silently without checking anything. + 3: fully check input, and print a short summary of its status + 4: as 3, but print first few entries of the input + 5: as 3, but print all of the input + Default: 1 +*/ diff --git a/src/sparse-matrix/umfpack/umfpack_report_perm.h b/src/sparse-matrix/umfpack/umfpack_report_perm.h new file mode 100644 index 0000000..44dd56b --- /dev/null +++ b/src/sparse-matrix/umfpack/umfpack_report_perm.h @@ -0,0 +1,113 @@ +/* ========================================================================== */ +/* === umfpack_report_perm ================================================== */ +/* ========================================================================== */ + +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +int umfpack_di_report_perm +( + int np, + const int Perm [ ], + const double Control [UMFPACK_CONTROL] +) ; + +long umfpack_dl_report_perm +( + long np, + const long Perm [ ], + const double Control [UMFPACK_CONTROL] +) ; + +int umfpack_zi_report_perm +( + int np, + const int Perm [ ], + const double Control [UMFPACK_CONTROL] +) ; + +long umfpack_zl_report_perm +( + long np, + const long Perm [ ], + const double Control [UMFPACK_CONTROL] +) ; + +/* +double int Syntax: + + #include "umfpack.h" + int np, *Perm, status ; + double Control [UMFPACK_CONTROL] ; + status = umfpack_di_report_perm (np, Perm, Control) ; + +double long Syntax: + + #include "umfpack.h" + long np, *Perm, status ; + double Control [UMFPACK_CONTROL] ; + status = umfpack_dl_report_perm (np, Perm, Control) ; + +complex int Syntax: + + #include "umfpack.h" + int np, *Perm, status ; + double Control [UMFPACK_CONTROL] ; + status = umfpack_zi_report_perm (np, Perm, Control) ; + +complex long Syntax: + + #include "umfpack.h" + long np, *Perm, status ; + double Control [UMFPACK_CONTROL] ; + status = umfpack_zl_report_perm (np, Perm, Control) ; + +Purpose: + + Verifies and prints a permutation vector. + +Returns: + + UMFPACK_OK if Control [UMFPACK_PRL] <= 2 (the input is not checked). + + Otherwise: + UMFPACK_OK if the permutation vector is valid (this includes that case + when Perm is (Int *) NULL, which is not an error condition). + UMFPACK_ERROR_n_nonpositive if np <= 0. + UMFPACK_ERROR_out_of_memory if out of memory. + UMFPACK_ERROR_invalid_permutation if Perm is not a valid permutation vector. + +Arguments: + + Int np ; Input argument, not modified. + + Perm is an integer vector of size np. Restriction: np > 0. + + Int Perm [np] ; Input argument, not modified. + + A permutation vector of size np. If Perm is not present (an (Int *) + NULL pointer), then it is assumed to be the identity permutation. This + is consistent with its use as an input argument to umfpack_*_qsymbolic, + and is not an error condition. If Perm is present, the entries in Perm + must range between 0 and np-1, and no duplicates may exist. + + double Control [UMFPACK_CONTROL] ; Input argument, not modified. + + If a (double *) NULL pointer is passed, then the default control + settings are used. Otherwise, the settings are determined from the + Control array. See umfpack_*_defaults on how to fill the Control + array with the default settings. If Control contains NaN's, the + defaults are used. The following Control parameters are used: + + Control [UMFPACK_PRL]: printing level. + + 2 or less: no output. returns silently without checking anything. + 3: fully check input, and print a short summary of its status + 4: as 3, but print first few entries of the input + 5: as 3, but print all of the input + Default: 1 +*/ diff --git a/src/sparse-matrix/umfpack/umfpack_report_status.h b/src/sparse-matrix/umfpack/umfpack_report_status.h new file mode 100644 index 0000000..9c8b1f1 --- /dev/null +++ b/src/sparse-matrix/umfpack/umfpack_report_status.h @@ -0,0 +1,91 @@ +/* ========================================================================== */ +/* === umfpack_report_status ================================================ */ +/* ========================================================================== */ + +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +void umfpack_di_report_status +( + const double Control [UMFPACK_CONTROL], + int status +) ; + +void umfpack_dl_report_status +( + const double Control [UMFPACK_CONTROL], + long status +) ; + +void umfpack_zi_report_status +( + const double Control [UMFPACK_CONTROL], + int status +) ; + +void umfpack_zl_report_status +( + const double Control [UMFPACK_CONTROL], + long status +) ; + +/* +double int Syntax: + + #include "umfpack.h" + double Control [UMFPACK_CONTROL] ; + int status ; + umfpack_di_report_status (Control, status) ; + +double long Syntax: + + #include "umfpack.h" + double Control [UMFPACK_CONTROL] ; + long status ; + umfpack_dl_report_status (Control, status) ; + +complex int Syntax: + + #include "umfpack.h" + double Control [UMFPACK_CONTROL] ; + int status ; + umfpack_zi_report_status (Control, status) ; + +complex long Syntax: + + #include "umfpack.h" + double Control [UMFPACK_CONTROL] ; + long status ; + umfpack_zl_report_status (Control, status) ; + +Purpose: + + Prints the status (return value) of other umfpack_* routines. + +Arguments: + + double Control [UMFPACK_CONTROL] ; Input argument, not modified. + + If a (double *) NULL pointer is passed, then the default control + settings are used. Otherwise, the settings are determined from the + Control array. See umfpack_*_defaults on how to fill the Control + array with the default settings. If Control contains NaN's, the + defaults are used. The following Control parameters are used: + + Control [UMFPACK_PRL]: printing level. + + 0 or less: no output, even when an error occurs + 1: error messages only + 2 or more: print status, whether or not an error occured + 4 or more: also print the UMFPACK Copyright + 6 or more: also print the UMFPACK License + Default: 1 + + Int status ; Input argument, not modified. + + The return value from another umfpack_* routine. +*/ diff --git a/src/sparse-matrix/umfpack/umfpack_report_symbolic.h b/src/sparse-matrix/umfpack/umfpack_report_symbolic.h new file mode 100644 index 0000000..9b07357 --- /dev/null +++ b/src/sparse-matrix/umfpack/umfpack_report_symbolic.h @@ -0,0 +1,112 @@ +/* ========================================================================== */ +/* === umfpack_report_symbolic ============================================== */ +/* ========================================================================== */ + +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +int umfpack_di_report_symbolic +( + void *Symbolic, + const double Control [UMFPACK_CONTROL] +) ; + +long umfpack_dl_report_symbolic +( + void *Symbolic, + const double Control [UMFPACK_CONTROL] +) ; + +int umfpack_zi_report_symbolic +( + void *Symbolic, + const double Control [UMFPACK_CONTROL] +) ; + +long umfpack_zl_report_symbolic +( + void *Symbolic, + const double Control [UMFPACK_CONTROL] +) ; + +/* +double int Syntax: + + #include "umfpack.h" + void *Symbolic ; + double Control [UMFPACK_CONTROL] ; + int status ; + status = umfpack_di_report_symbolic (Symbolic, Control) ; + +double long Syntax: + + #include "umfpack.h" + void *Symbolic ; + double Control [UMFPACK_CONTROL] ; + long status ; + status = umfpack_dl_report_symbolic (Symbolic, Control) ; + +complex int Syntax: + + #include "umfpack.h" + void *Symbolic ; + double Control [UMFPACK_CONTROL] ; + int status ; + status = umfpack_zi_report_symbolic (Symbolic, Control) ; + +complex long Syntax: + + #include "umfpack.h" + void *Symbolic ; + double Control [UMFPACK_CONTROL] ; + long status ; + status = umfpack_zl_report_symbolic (Symbolic, Control) ; + +Purpose: + + Verifies and prints a Symbolic object. This routine checks the object more + carefully than the computational routines. Normally, this check is not + required, since umfpack_*_*symbolic either returns (void *) NULL, or a valid + Symbolic object. However, if you suspect that your own code has corrupted + the Symbolic object (by overruning memory bounds, for example), then this + routine might be able to detect a corrupted Symbolic object. Since this is + a complex object, not all such user-generated errors are guaranteed to be + caught by this routine. + +Returns: + + UMFPACK_OK if Control [UMFPACK_PRL] is <= 2 (no inputs are checked). + + Otherwise: + + UMFPACK_OK if the Symbolic object is valid. + UMFPACK_ERROR_invalid_Symbolic_object if the Symbolic object is invalid. + UMFPACK_ERROR_out_of_memory if out of memory. + +Arguments: + + void *Symbolic ; Input argument, not modified. + + The Symbolic object, which holds the symbolic factorization computed by + umfpack_*_*symbolic. + + double Control [UMFPACK_CONTROL] ; Input argument, not modified. + + If a (double *) NULL pointer is passed, then the default control + settings are used. Otherwise, the settings are determined from the + Control array. See umfpack_*_defaults on how to fill the Control + array with the default settings. If Control contains NaN's, the + defaults are used. The following Control parameters are used: + + Control [UMFPACK_PRL]: printing level. + + 2 or less: no output. returns silently without checking anything. + 3: fully check input, and print a short summary of its status + 4: as 3, but print first few entries of the input + 5: as 3, but print all of the input + Default: 1 +*/ diff --git a/src/sparse-matrix/umfpack/umfpack_report_triplet.h b/src/sparse-matrix/umfpack/umfpack_report_triplet.h new file mode 100644 index 0000000..bed5aeb --- /dev/null +++ b/src/sparse-matrix/umfpack/umfpack_report_triplet.h @@ -0,0 +1,149 @@ +/* ========================================================================== */ +/* === umfpack_report_triplet =============================================== */ +/* ========================================================================== */ + +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +int umfpack_di_report_triplet +( + int n_row, + int n_col, + int nz, + const int Ti [ ], + const int Tj [ ], + const double Tx [ ], + const double Control [UMFPACK_CONTROL] +) ; + +long umfpack_dl_report_triplet +( + long n_row, + long n_col, + long nz, + const long Ti [ ], + const long Tj [ ], + const double Tx [ ], + const double Control [UMFPACK_CONTROL] +) ; + +int umfpack_zi_report_triplet +( + int n_row, + int n_col, + int nz, + const int Ti [ ], + const int Tj [ ], + const double Tx [ ], const double Tz [ ], + const double Control [UMFPACK_CONTROL] +) ; + +long umfpack_zl_report_triplet +( + long n_row, + long n_col, + long nz, + const long Ti [ ], + const long Tj [ ], + const double Tx [ ], const double Tz [ ], + const double Control [UMFPACK_CONTROL] +) ; + +/* +double int Syntax: + + #include "umfpack.h" + int n_row, n_col, nz, *Ti, *Tj, status ; + double *Tx, Control [UMFPACK_CONTROL] ; + status = umfpack_di_report_triplet (n_row, n_col, nz, Ti, Tj, Tx, Control) ; + +double long Syntax: + + #include "umfpack.h" + long n_row, n_col, nz, *Ti, *Tj, status ; + double *Tx, Control [UMFPACK_CONTROL] ; + status = umfpack_dl_report_triplet (n_row, n_col, nz, Ti, Tj, Tx, Control) ; + +complex int Syntax: + + #include "umfpack.h" + int n_row, n_col, nz, *Ti, *Tj, status ; + double *Tx, *Tz, Control [UMFPACK_CONTROL] ; + status = umfpack_zi_report_triplet (n_row, n_col, nz, Ti, Tj, Tx, Tz, + Control) ; + +complex long Syntax: + + #include "umfpack.h" + long n_row, n_col, nz, *Ti, *Tj, status ; + double *Tx, *Tz, Control [UMFPACK_CONTROL] ; + status = umfpack_zl_report_triplet (n_row, n_col, nz, Ti, Tj, Tx, Tz, + Control) ; + +Purpose: + + Verifies and prints a matrix in triplet form. + +Returns: + + UMFPACK_OK if Control [UMFPACK_PRL] <= 2 (the input is not checked). + + Otherwise: + + UMFPACK_OK if the Triplet matrix is OK. + UMFPACK_ERROR_argument_missing if Ti and/or Tj are missing. + UMFPACK_ERROR_n_nonpositive if n_row <= 0 or n_col <= 0. + UMFPACK_ERROR_nz_negative if nz < 0. + UMFPACK_ERROR_invalid_triplet if any row or column index in Ti and/or Tj + is not in the range 0 to n_row-1 or 0 to n_col-1, respectively. + +Arguments: + + Int n_row ; Input argument, not modified. + Int n_col ; Input argument, not modified. + + A is an n_row-by-n_col matrix. + + Int nz ; Input argument, not modified. + + The number of entries in the triplet form of the matrix. + + Int Ti [nz] ; Input argument, not modified. + Int Tj [nz] ; Input argument, not modified. + double Tx [nz] ; Input argument, not modified. + double Tz [nz] ; Input argument, not modified, for complex versions. + + Ti, Tj, Tx (and Tz for complex versions) hold the "triplet" form of a + sparse matrix. The kth nonzero entry is in row i = Ti [k], column + j = Tj [k], the real numerical value of a_ij is Tx [k], and the + imaginary part of a_ij is Tz [k] (for complex versions). The row and + column indices i and j must be in the range 0 to n_row-1 or 0 to + n_col-1, respectively. Duplicate entries may be present. The + "triplets" may be in any order. Tx and Tz are optional; if Tx or Tz are + not present ((double *) NULL pointers), then the numerical values are + not printed. + + Future complex version: if Tx is present and Tz is NULL, then both real + and imaginary parts will be contained in Tx[0..2*nz-1], with Tx[2*k] + and Tx[2*k+1] being the real and imaginary part of the kth entry. + + double Control [UMFPACK_CONTROL] ; Input argument, not modified. + + If a (double *) NULL pointer is passed, then the default control + settings are used. Otherwise, the settings are determined from the + Control array. See umfpack_*_defaults on how to fill the Control + array with the default settings. If Control contains NaN's, the + defaults are used. The following Control parameters are used: + + Control [UMFPACK_PRL]: printing level. + + 2 or less: no output. returns silently without checking anything. + 3: fully check input, and print a short summary of its status + 4: as 3, but print first few entries of the input + 5: as 3, but print all of the input + Default: 1 +*/ diff --git a/src/sparse-matrix/umfpack/umfpack_report_vector.h b/src/sparse-matrix/umfpack/umfpack_report_vector.h new file mode 100644 index 0000000..afe665d --- /dev/null +++ b/src/sparse-matrix/umfpack/umfpack_report_vector.h @@ -0,0 +1,134 @@ +/* ========================================================================== */ +/* === umfpack_report_vector ================================================ */ +/* ========================================================================== */ + +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +int umfpack_di_report_vector +( + int n, + const double X [ ], + const double Control [UMFPACK_CONTROL] +) ; + +long umfpack_dl_report_vector +( + long n, + const double X [ ], + const double Control [UMFPACK_CONTROL] +) ; + +int umfpack_zi_report_vector +( + int n, + const double Xx [ ], const double Xz [ ], + const double Control [UMFPACK_CONTROL] +) ; + +long umfpack_zl_report_vector +( + long n, + const double Xx [ ], const double Xz [ ], + const double Control [UMFPACK_CONTROL] +) ; + +/* +double int Syntax: + + #include "umfpack.h" + int n, status ; + double *X, Control [UMFPACK_CONTROL] ; + status = umfpack_di_report_vector (n, X, Control) ; + +double long Syntax: + + #include "umfpack.h" + long n, status ; + double *X, Control [UMFPACK_CONTROL] ; + status = umfpack_dl_report_vector (n, X, Control) ; + +complex int Syntax: + + #include "umfpack.h" + int n, status ; + double *Xx, *Xz, Control [UMFPACK_CONTROL] ; + status = umfpack_zi_report_vector (n, Xx, Xz, Control) ; + +complex long Syntax: + + #include "umfpack.h" + long n, status ; + double *Xx, *Xz, Control [UMFPACK_CONTROL] ; + status = umfpack_zl_report_vector (n, Xx, Xz, Control) ; + +Purpose: + + Verifies and prints a dense vector. + +Returns: + + UMFPACK_OK if Control [UMFPACK_PRL] <= 2 (the input is not checked). + + Otherwise: + + UMFPACK_OK if the vector is valid. + UMFPACK_ERROR_argument_missing if X or Xx is missing. + UMFPACK_ERROR_n_nonpositive if n <= 0. + +Arguments: + + Int n ; Input argument, not modified. + + X is a real or complex vector of size n. Restriction: n > 0. + + double X [n] ; Input argument, not modified. For real versions. + + A real vector of size n. X must not be (double *) NULL. + + double Xx [n or 2*n] ; Input argument, not modified. For complex versions. + double Xz [n or 0] ; Input argument, not modified. For complex versions. + + A complex vector of size n, in one of two storage formats. + Xx must not be (double *) NULL. + + If Xz is not (double *) NULL, then Xx [i] is the real part of X (i) and + Xz [i] is the imaginary part of X (i). Both vectors are of length n. + This is the "split" form of the complex vector X. + + If Xz is (double *) NULL, then Xx holds both real and imaginary parts, + where Xx [2*i] is the real part of X (i) and Xx [2*i+1] is the imaginary + part of X (i). Xx is of length 2*n doubles. If you have an ANSI C99 + compiler with the intrinsic double _Complex type, then Xx can be of + type double _Complex in the calling routine and typecast to (double *) + when passed to umfpack_*_report_vector (this is untested, however). + This is the "merged" form of the complex vector X. + + Future work: all complex routines in UMFPACK could use this same + strategy for their complex arguments. The split format is useful for + MATLAB, which holds its real and imaginary parts in seperate arrays. + The merged format is compatible with the intrinsic double _Complex + type in ANSI C99, and is also compatible with SuperLU's method of + storing complex matrices. In the current version, only + umfpack_*_report_vector supports both formats. + + double Control [UMFPACK_CONTROL] ; Input argument, not modified. + + If a (double *) NULL pointer is passed, then the default control + settings are used. Otherwise, the settings are determined from the + Control array. See umfpack_*_defaults on how to fill the Control + array with the default settings. If Control contains NaN's, the + defaults are used. The following Control parameters are used: + + Control [UMFPACK_PRL]: printing level. + + 2 or less: no output. returns silently without checking anything. + 3: fully check input, and print a short summary of its status + 4: as 3, but print first few entries of the input + 5: as 3, but print all of the input + Default: 1 +*/ diff --git a/src/sparse-matrix/umfpack/umfpack_solve.h b/src/sparse-matrix/umfpack/umfpack_solve.h new file mode 100644 index 0000000..90e6f5c --- /dev/null +++ b/src/sparse-matrix/umfpack/umfpack_solve.h @@ -0,0 +1,303 @@ +/* ========================================================================== */ +/* === umfpack_solve ======================================================== */ +/* ========================================================================== */ + +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +int umfpack_di_solve +( + int sys, + const int Ap [ ], + const int Ai [ ], + const double Ax [ ], + double X [ ], + const double B [ ], + void *Numeric, + const double Control [UMFPACK_CONTROL], + double Info [UMFPACK_INFO] +) ; + +long umfpack_dl_solve +( + long sys, + const long Ap [ ], + const long Ai [ ], + const double Ax [ ], + double X [ ], + const double B [ ], + void *Numeric, + const double Control [UMFPACK_CONTROL], + double Info [UMFPACK_INFO] +) ; + +int umfpack_zi_solve +( + int sys, + const int Ap [ ], + const int Ai [ ], + const double Ax [ ], const double Az [ ], + double Xx [ ], double Xz [ ], + const double Bx [ ], const double Bz [ ], + void *Numeric, + const double Control [UMFPACK_CONTROL], + double Info [UMFPACK_INFO] +) ; + +long umfpack_zl_solve +( + long sys, + const long Ap [ ], + const long Ai [ ], + const double Ax [ ], const double Az [ ], + double Xx [ ], double Xz [ ], + const double Bx [ ], const double Bz [ ], + void *Numeric, + const double Control [UMFPACK_CONTROL], + double Info [UMFPACK_INFO] +) ; + +/* +double int Syntax: + + #include "umfpack.h" + void *Numeric ; + int status, *Ap, *Ai, sys ; + double *B, *X, *Ax, Info [UMFPACK_INFO], Control [UMFPACK_CONTROL] ; + status = umfpack_di_solve (sys, Ap, Ai, Ax, X, B, Numeric, Control, Info) ; + +double long Syntax: + + #include "umfpack.h" + void *Numeric ; + long status, *Ap, *Ai, sys ; + double *B, *X, *Ax, Info [UMFPACK_INFO], Control [UMFPACK_CONTROL] ; + status = umfpack_dl_solve (sys, Ap, Ai, Ax, X, B, Numeric, Control, Info) ; + +complex int Syntax: + + #include "umfpack.h" + void *Numeric ; + int status, *Ap, *Ai, sys ; + double *Bx, *Bz, *Xx, *Xz, *Ax, *Az, Info [UMFPACK_INFO], + Control [UMFPACK_CONTROL] ; + status = umfpack_zi_solve (sys, Ap, Ai, Ax, Az, Xx, Xz, Bx, Bz, Numeric, + Control, Info) ; + +complex long Syntax: + + #include "umfpack.h" + void *Numeric ; + long status, *Ap, *Ai, sys ; + double *Bx, *Bz, *Xx, *Xz, *Ax, *Az, Info [UMFPACK_INFO], + Control [UMFPACK_CONTROL] ; + status = umfpack_zl_solve (sys, Ap, Ai, Ax, Az, Xx, Xz, Bx, Bz, Numeric, + Control, Info) ; + +Purpose: + + Given LU factors computed by umfpack_*_numeric (PAQ=LU) and the + right-hand-side, B, solve a linear system for the solution X. Iterative + refinement is optionally performed. This routine dynamically allocates + workspace of size O(n). Only square systems are handled. Singular matrices + result in a divide-by-zero for all systems except those involving just the + matrix L. Iterative refinement is not performed for singular matrices. + + In the discussion below, n is equal to n_row and n_col, because only + square systems are handled. + +Returns: + + The status code is returned. See Info [UMFPACK_STATUS], below. + +Arguments: + + Int sys ; Input argument, not modified. + + Defines which system to solve. (') is the linear algebraic transpose + (complex conjugate if A is complex), and (.') is the array transpose. + + sys value system solved + + UMFPACK_A Ax=b + UMFPACK_At A'x=b + UMFPACK_Aat A.'x=b + UMFPACK_Pt_L P'Lx=b + UMFPACK_L Lx=b + UMFPACK_Lt_P L'Px=b + UMFPACK_Lat_P L.'Px=b + UMFPACK_Lt L'x=b + UMFPACK_U_Qt UQ'x=b + UMFPACK_U Ux=b + UMFPACK_Q_Ut QU'x=b + UMFPACK_Q_Uat QU.'x=b + UMFPACK_Ut U'x=b + UMFPACK_Uat U.'x=b + + Iterative refinement can be optionally performed when sys is any of + the following: + + UMFPACK_A Ax=b + UMFPACK_At A'x=b + UMFPACK_Aat A.'x=b + + For the other values of the sys argument, iterative refinement is not + performed (Control [UMFPACK_IRSTEP], Ap, Ai, Ax, and Az are ignored). + + Earlier versions used a string argument for sys. It was changed to an + integer to make it easier for a Fortran code to call UMFPACK. + + Int Ap [n+1] ; Input argument, not modified. + Int Ai [nz] ; Input argument, not modified. + double Ax [nz] ; Input argument, not modified. + double Az [nz] ; Input argument, not modified, for complex versions. + + If iterative refinement is requested (Control [UMFPACK_IRSTEP] >= 1, + Ax=b, A'x=b, or A.'x=b is being solved, and A is nonsingular), then + these arrays must be identical to the same ones passed to + umfpack_*_numeric. The umfpack_*_solve routine does not check the + contents of these arguments, so the results are undefined if Ap, Ai, Ax, + and/or Az are modified between the calls the umfpack_*_numeric and + umfpack_*_solve. These three arrays do not need to be present (NULL + pointers can be passed) if Control [UMFPACK_IRSTEP] is zero, or if a + system other than Ax=b, A'x=b, or A.'x=b is being solved, or if A is + singular, since in each of these cases A is not accessed. + + Future complex version: if Ax is present and Az is NULL, then both real + and imaginary parts will be contained in Ax[0..2*nz-1], with Ax[2*k] + and Ax[2*k+1] being the real and imaginary part of the kth entry. + + double X [n] ; Output argument. + or: + double Xx [n] ; Output argument, real part. + double Xz [n] ; Output argument, imaginary part. + + The solution to the linear system, where n = n_row = n_col is the + dimension of the matrices A, L, and U. + + Future complex version: if Xx is present and Xz is NULL, then both real + and imaginary parts will be returned in Xx[0..2*n-1], with Xx[2*k] and + Xx[2*k+1] being the real and imaginary part of the kth entry. + + double B [n] ; Input argument, not modified. + or: + double Bx [n] ; Input argument, not modified, real part. + double Bz [n] ; Input argument, not modified, imaginary part. + + The right-hand side vector, b, stored as a conventional array of size n + (or two arrays of size n for complex versions). This routine does not + solve for multiple right-hand-sides, nor does it allow b to be stored in + a sparse-column form. + + Future complex version: if Bx is present and Bz is NULL, then both real + and imaginary parts will be contained in Bx[0..2*n-1], with Bx[2*k] + and Bx[2*k+1] being the real and imaginary part of the kth entry. + + void *Numeric ; Input argument, not modified. + + Numeric must point to a valid Numeric object, computed by + umfpack_*_numeric. + + double Control [UMFPACK_CONTROL] ; Input argument, not modified. + + If a (double *) NULL pointer is passed, then the default control + settings are used. Otherwise, the settings are determined from the + Control array. See umfpack_*_defaults on how to fill the Control + array with the default settings. If Control contains NaN's, the + defaults are used. The following Control parameters are used: + + Control [UMFPACK_IRSTEP]: The maximum number of iterative refinement + steps to attempt. A value less than zero is treated as zero. If + less than 1, or if Ax=b, A'x=b, or A.'x=b is not being solved, or + if A is singular, then the Ap, Ai, Ax, and Az arguments are not + accessed. Default: 2. + + double Info [UMFPACK_INFO] ; Output argument. + + Contains statistics about the solution factorization. If a + (double *) NULL pointer is passed, then no statistics are returned in + Info (this is not an error condition). The following statistics are + computed in umfpack_*_solve: + + Info [UMFPACK_STATUS]: status code. This is also the return value, + whether or not Info is present. + + UMFPACK_OK + + The linear system was successfully solved. + + UMFPACK_WARNING_singular_matrix + + A divide-by-zero occured. Your solution will contain Inf's + and/or NaN's. Some parts of the solution may be valid. For + example, solving Ax=b with + + A = [2 0] b = [ 1 ] returns x = [ 0.5 ] + [0 0] [ 0 ] [ Inf ] + + UMFPACK_ERROR_out_of_memory + + Insufficient memory to solve the linear system. + + UMFPACK_ERROR_argument_missing + + One or more required arguments are missing. The B, X, (or + Bx, Bz, Xx and Xz for the complex versions) arguments + are always required. Info and Control are not required. Ap, + Ai, Ax (and Az for complex versions) are required if Ax=b, + A'x=b, A.'x=b is to be solved, the (default) iterative + refinement is requested, and the matrix A is nonsingular. + + UMFPACK_ERROR_invalid_system + + The sys argument is not valid, or the matrix A is not square. + + UMFPACK_ERROR_invalid_Numeric_object + + The Numeric object is not valid. + + Info [UMFPACK_NROW], Info [UMFPACK_NCOL]: + The dimensions of the matrix A (L is n_row-by-n_inner and + U is n_inner-by-n_col, with n_inner = min(n_row,n_col)). + + Info [UMFPACK_NZ]: the number of entries in the input matrix, Ap [n], + if iterative refinement is requested (Ax=b, A'x=b, or A.'x=b is + being solved, Control [UMFPACK_IRSTEP] >= 1, and A is nonsingular). + + Info [UMFPACK_IR_TAKEN]: The number of iterative refinement steps + effectively taken. The number of steps attempted may be one more + than this; the refinement algorithm backtracks if the last + refinement step worsens the solution. + + Info [UMFPACK_IR_ATTEMPTED]: The number of iterative refinement steps + attempted. The number of times a linear system was solved is one + more than this (once for the initial Ax=b, and once for each Ay=r + solved for each iterative refinement step attempted). + + Info [UMFPACK_OMEGA1]: sparse backward error estimate, omega1, if + iterative refinement was performed, or -1 if iterative refinement + not performed. + + Info [UMFPACK_OMEGA2]: sparse backward error estimate, omega2, if + iterative refinement was performed, or -1 if iterative refinement + not performed. + + Info [UMFPACK_SOLVE_FLOPS]: the number of floating point operations + performed to solve the linear system. This includes the work + taken for all iterative refinement steps, including the backtrack + (if any). + + Info [UMFPACK_SOLVE_TIME]: The time taken by umfpack_*_solve, in + seconds. In the ANSI C version, this may be invalid if the time + taken is more than about 36 minutes, because of wrap-around in the + ANSI C clock function. Compile UMFPACK with -DGETRUSAGE if you have + the more accurate getrusage function. + + Only the above listed Info [...] entries are accessed. The remaining + entries of Info are not accessed or modified by umfpack_*_solve. + Future versions might modify different parts of Info. +*/ diff --git a/src/sparse-matrix/umfpack/umfpack_symbolic.h b/src/sparse-matrix/umfpack/umfpack_symbolic.h new file mode 100644 index 0000000..1a26a86 --- /dev/null +++ b/src/sparse-matrix/umfpack/umfpack_symbolic.h @@ -0,0 +1,363 @@ +/* ========================================================================== */ +/* === umfpack_symbolic ===================================================== */ +/* ========================================================================== */ + +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +int umfpack_di_symbolic +( + int n_row, + int n_col, + const int Ap [ ], + const int Ai [ ], + void **Symbolic, + const double Control [UMFPACK_CONTROL], + double Info [UMFPACK_INFO] +) ; + +long umfpack_dl_symbolic +( + long n_row, + long n_col, + const long Ap [ ], + const long Ai [ ], + void **Symbolic, + const double Control [UMFPACK_CONTROL], + double Info [UMFPACK_INFO] +) ; + +int umfpack_zi_symbolic +( + int n_row, + int n_col, + const int Ap [ ], + const int Ai [ ], + void **Symbolic, + const double Control [UMFPACK_CONTROL], + double Info [UMFPACK_INFO] +) ; + +long umfpack_zl_symbolic +( + long n_row, + long n_col, + const long Ap [ ], + const long Ai [ ], + void **Symbolic, + const double Control [UMFPACK_CONTROL], + double Info [UMFPACK_INFO] +) ; + +/* +double int Syntax: + + #include "umfpack.h" + void *Symbolic ; + int n_row, n_col, *Ap, *Ai, status ; + double Control [UMFPACK_CONTROL], Info [UMFPACK_INFO] ; + status = umfpack_di_symbolic (n_row, n_col, Ap, Ai, &Symbolic, Control, + Info) ; + +double long Syntax: + + #include "umfpack.h" + void *Symbolic ; + long n_row, n_col, *Ap, *Ai, status ; + double Control [UMFPACK_CONTROL], Info [UMFPACK_INFO] ; + status = umfpack_dl_symbolic (n_row, n_col, Ap, Ai, &Symbolic, Control, + Info) ; + +complex int Syntax: + + #include "umfpack.h" + void *Symbolic ; + int n_row, n_col, *Ap, *Ai, status ; + double Control [UMFPACK_CONTROL], Info [UMFPACK_INFO] ; + status = umfpack_zi_symbolic (n_row, n_col, Ap, Ai, &Symbolic, Control, + Info) ; + +complex long Syntax: + + #include "umfpack.h" + void *Symbolic ; + long n_row, n_col, *Ap, *Ai, status ; + double Control [UMFPACK_CONTROL], Info [UMFPACK_INFO] ; + status = umfpack_zl_symbolic (n_row, n_col, Ap, Ai, &Symbolic, Control, + Info) ; + +Purpose: + + Given nonzero pattern of a sparse matrix A in column-oriented form, + umfpack_*_symbolic performs a column pre-ordering to reduce fill-in + (using UMF_colamd, modified from colamd V2.0 for UMFPACK), and a symbolic + factorization. This is required before the matrix can be numerically + factorized with umfpack_*_numeric. If you wish to bypass the UMF_colamd + pre-ordering and provide your own ordering, use umfpack_*_qsymbolic instead. + +Returns: + + The status code is returned. See Info [UMFPACK_STATUS], below. + +Arguments: + + Int n_row ; Input argument, not modified. + Int n_col ; Input argument, not modified. + + A is an n_row-by-n_col matrix. Restriction: n_row > 0 and n_col > 0. + + Int Ap [n_col+1] ; Input argument, not modified. + + Ap is an integer array of size n_col+1. On input, it holds the + "pointers" for the column form of the sparse matrix A. Column j of + the matrix A is held in Ai [(Ap [j]) ... (Ap [j+1]-1)]. The first + entry, Ap [0], must be zero, and Ap [j] <= Ap [j+1] must hold for all + j in the range 0 to n_col-1. The value nz = Ap [n_col] is thus the + total number of entries in the pattern of the matrix A. nz must be + greater than or equal to zero. + + Int Ai [nz] ; Input argument, not modified, of size nz = Ap [n_col]. + + The nonzero pattern (row indices) for column j is stored in + Ai [(Ap [j]) ... (Ap [j+1]-1)]. The row indices in a given column j + must be in ascending order, and no duplicate row indices may be present. + Row indices must be in the range 0 to n_row-1 (the matrix is 0-based). + See umfpack_*_triplet_to_col for how to sort the columns of a matrix + and sum up the duplicate entries. See umfpack_*_report_matrix for how + to print the matrix A. + + void **Symbolic ; Output argument. + + **Symbolic is the address of a (void *) pointer variable in the user's + calling routine (see Syntax, above). On input, the contents of this + variable are not defined. On output, this variable holds a (void *) + pointer to the Symbolic object (if successful), or (void *) NULL if + a failure occurred. + + double Control [UMFPACK_CONTROL] ; Input argument, not modified. + + If a (double *) NULL pointer is passed, then the default control + settings are used. Otherwise, the settings are determined from the + Control array. See umfpack_*_defaults on how to fill the Control + array with the default settings. If Control contains NaN's, the + defaults are used. The following Control parameters are used: + + Control [UMFPACK_DENSE_COL]: columns with more than + max (16, Control [UMFPACK_DENSE_COL] * 16 * sqrt (n_row)) + entries are placed placed last in the column pre-ordering by + UMF_colamd. Default: 0.2. + + Control [UMFPACK_DENSE_ROW]: rows with more than + max (16, Control [UMFPACK_DENSE_ROW] * 16 * sqrt (n_col)) + entries (after "dense" columns are removed) are ignored in the + column pre-ordering, UMF_colamd. Default: 0.2. + + Control [UMFPACK_BLOCK_SIZE]: the block size to use for Level-3 BLAS + in the subsequent numerical factorization (umfpack_*_numeric). + A value less than 1 is treated as 1. Default: 24. Modifying this + parameter affects when updates are applied to the working frontal + matrix, and can indirectly affect fill-in and operation count. + As long as the block size is large enough (8 or so), this parameter + has modest effect on performance. In Version 3.0, this parameter + was an input to umfpack_*_numeric, and had a default value of 16. + On a Sun UltraSparc, a block size of 24 is better for larger + matrices (16 is better for smaller ones, but not by much). In the + current version, it is required in the symbolic analysis phase, and + is thus an input to this phase. + + double Info [UMFPACK_INFO] ; Output argument, not defined on input. + + Contains statistics about the symbolic analysis. If a (double *) NULL + pointer is passed, then no statistics are returned in Info (this is not + an error condition). The entire Info array is cleared (all entries set + to -1) and then the following statistics are computed: + + Info [UMFPACK_STATUS]: status code. This is also the return value, + whether or not Info is present. + + UMFPACK_OK + + Each column of the input matrix contained row indices + in increasing order, with no duplicates. Only in this case + does umfpack_*_symbolic compute a valid symbolic factorization. + For the other cases below, no Symbolic object is created + (*Symbolic is (void *) NULL). + + UMFPACK_ERROR_jumbled_matrix + + Columns of input matrix were jumbled (unsorted columns or + duplicate entries). + + UMFPACK_ERROR_n_nonpositive + + n is less than or equal to zero. + + UMFPACK_ERROR_nz_negative + + Number of entries in the matrix is negative. + + UMFPACK_ERROR_Ap0_nonzero + + Ap [0] is nonzero. + + UMFPACK_ERROR_col_length_negative + + A column has a negative number of entries. + + UMFPACK_ERROR_row_index_out_of_bounds + + A row index is out of bounds. + + UMFPACK_ERROR_out_of_memory + + Insufficient memory to perform the symbolic analysis. + + UMFPACK_ERROR_argument_missing + + One or more required arguments is missing. + + UMFPACK_ERROR_problem_too_large + + Problem is too large; memory usage estimate causes an integer + overlow. If you are using umfpack_*i_symbolic, try using + the long versions instead, umfpack_*l_symbolic. + + UMFPACK_ERROR_internal_error + + Something very serious went wrong. This is a bug. + Please contact the author (davis@cise.ufl.edu). + + Info [UMFPACK_NROW]: the value of the input argument n_row. + + Info [UMFPACK_NCOL]: the value of the input argument n_col. + + Info [UMFPACK_NZ]: the number of entries in the input matrix + (Ap [n_col]). + + Info [UMFPACK_SIZE_OF_UNIT]: the number of bytes in a Unit, + for memory usage statistics below. + + Info [UMFPACK_SIZE_OF_INT]: the number of bytes in an int. + + Info [UMFPACK_SIZE_OF_LONG]: the number of bytes in a long. + + Info [UMFPACK_SIZE_OF_POINTER]: the number of bytes in a void * + pointer. + + Info [UMFPACK_SIZE_OF_ENTRY]: the number of bytes in a numerical entry. + + Info [UMFPACK_NDENSE_ROW]: number of "dense" rows in A. These rows are + ignored when the column pre-ordering is computed in UMF_colamd. + If > 0, then the matrix had to be re-analyzed by UMF_analyze, which + does not ignore these rows. + + Info [UMFPACK_NEMPTY_ROW]: number of "empty" rows in A. These are + rows that either have no entries, or whose entries are all in + "dense" columns. Any given row is classified as either "dense" + or "empty" or "sparse". + + Info [UMFPACK_NDENSE_COL]: number of "dense" columns in A. These + columns are ordered last in the factorization, but before "empty" + columns. Any given column is classified as either "dense" or + "empty" or "sparse". + + Info [UMFPACK_NEMPTY_COL]: number of "empty" columns in A. These are + columns that either have no entries, or whose entries are all in + "dense" rows. These columns are ordered last in the factorization, + to the right of "dense" columns. + + Info [UMFPACK_SYMBOLIC_DEFRAG]: number of garbage collections + performed in UMF_colamd, the column pre-ordering routine, and in + UMF_analyze, which is called if UMF_colamd isn't, or if UMF_colamd + ignores one or more "dense" rows. + + Info [UMFPACK_SYMBOLIC_PEAK_MEMORY]: the amount of memory (in Units) + required for umfpack_*_symbolic to complete. This is roughly + 2.2*nz + (26 to 31)*n integers for a square matrix, depending on the + matrix. This count includes the size of the Symbolic object itself, + which is reported in Info [UMFPACK_SYMBOLIC_SIZE]. + + Info [UMFPACK_SYMBOLIC_SIZE]: the final size of the Symbolic object (in + Units). This is fairly small, roughly 2*n to 9*n integers, + depending on the matrix. + + Info [UMFPACK_VARIABLE_INIT_ESTIMATE]: the Numeric object contains two + parts. The first is fixed in size (O (n_row+n_col)). The + second part holds the sparse LU factors and the contribution blocks + from factorized frontal matrices. This part changes in size during + factorization. Info [UMFPACK_VARIABLE_INIT_ESTIMATE] is the exact + size (in Units) required for this second variable-sized part in + order for the numerical factorization to start. + + Info [UMFPACK_VARIABLE_PEAK_ESTIMATE]: the estimated peak size (in + Units) of the variable-sized part of the Numeric object. This is + usually an upper bound, but that is not guaranteed. + + Info [UMFPACK_VARIABLE_FINAL_ESTIMATE]: the estimated final size (in + Units) of the variable-sized part of the Numeric object. This is + usually an upper bound, but that is not guaranteed. It holds just + the sparse LU factors. + + Info [UMFPACK_NUMERIC_SIZE_ESTIMATE]: an estimate of the final size (in + Units) of the entire Numeric object (both fixed-size and variable- + sized parts), which holds the LU factorization (including the L, U, + P and Q matrices). + + Info [UMFPACK_PEAK_MEMORY_ESTIMATE]: an estimate of the total amount of + memory (in Units) required by umfpack_*_symbolic and + umfpack_*_numeric to perform both the symbolic and numeric + factorization. This is the larger of the amount of memory needed + in umfpack_*_numeric itself, and the amount of memory needed in + umfpack_*_symbolic (Info [UMFPACK_SYMBOLIC_PEAK_MEMORY]). The count + includes the size of both the Symbolic and Numeric objects + themselves. + + Info [UMFPACK_FLOPS_ESTIMATE]: an estimate of the total floating-point + operations required to factorize the matrix. This is a "true" + theoretical estimate of the number of flops that would be performed + by a flop-parsimonious sparse LU algorithm. It assumes that no + extra flops are performed except for what is strictly required to + compute the LU factorization. It ignores, for example, the flops + performed by umfpack_*_numeric to add contribution blocks of frontal + matrices together. If L and U are the upper bound on the pattern + of the factors, then this flop count estimate can be represented in + MATLAB (for real matrices, not complex) as: + + Lnz = full (sum (spones (L))) - 1 ; % nz in each col of L + Unz = full (sum (spones (U')))' - 1 ; % nz in each row of U + flops = 2*Lnz*Unz + sum (Lnz) ; + + The actual "true flop" count found by umfpack_*_numeric will be less + than this estimate. + + For the real version, only (+ - * /) are counted. For the complex + version, the following counts are used: + + operation flops + c = 1/b 6 + c = a*b 6 + c -= a*b 8 + + Info [UMFPACK_LNZ_ESTIMATE]: an estimate of the number of nonzeros in + L, including the diagonal. Since L is unit-diagonal, the diagonal + of L is not stored. This estimate is a strict upper bound on the + actual nonzeros in L to be computed by umfpack_*_numeric. + + Info [UMFPACK_UNZ_ESTIMATE]: an estimate of the number of nonzeros in + U, including the diagonal. This estimate is a strict upper bound on + the actual nonzeros in U to be computed by umfpack_*_numeric. + + Info [UMFPACK_SYMBOLIC_TIME]: The time taken by umfpack_*_symbolic, in + seconds. In the ANSI C version, this may be invalid if the time + taken is more than about 36 minutes, because of wrap-around in the + ANSI C clock function. Compile UMFPACK with -DGETRUSAGE if you have + the more accurate getrusage function. + + At the start of umfpack_*_symbolic, all of Info is set of -1, and then + after that only the above listed Info [...] entries are accessed. + Future versions might modify different parts of Info. +*/ diff --git a/src/sparse-matrix/umfpack/umfpack_timer.h b/src/sparse-matrix/umfpack/umfpack_timer.h new file mode 100644 index 0000000..ba53cf4 --- /dev/null +++ b/src/sparse-matrix/umfpack/umfpack_timer.h @@ -0,0 +1,38 @@ +/* ========================================================================== */ +/* === umfpack_timer ======================================================== */ +/* ========================================================================== */ + +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +double umfpack_timer ( void ) ; + +/* +Syntax (for all versions: di, dl, zi, and zl): + + #include "umfpack.h" + double t ; + t = umfpack_timer ( ) ; + +Purpose: + + Returns the CPU time used by the process. Includes both "user" and "system" + time (the latter is time spent by the system on behalf of the process, and + is thus charged to the process). It does not return the wall clock time. + + This routine uses the Unix getrusage routine, if available. It is less + subject to overflow than the ANSI C clock routine. If getrusage is not + available, the portable ANSI C clock routine is used instead. + Unfortunately, clock ( ) overflows if the CPU time exceeds 2147 seconds + (about 36 minutes) when sizeof (clock_t) is 4 bytes. If you have getrusage, + be sure to compile UMFPACK with the -DGETRUSAGE flag set; see umf_config.h + and the User Guide for details. Even the getrusage routine can overlow. + +Arguments: + + None. +*/ diff --git a/src/sparse-matrix/umfpack/umfpack_transpose.h b/src/sparse-matrix/umfpack/umfpack_transpose.h new file mode 100644 index 0000000..a62a3ae --- /dev/null +++ b/src/sparse-matrix/umfpack/umfpack_transpose.h @@ -0,0 +1,220 @@ +/* ========================================================================== */ +/* === umfpack_transpose ==================================================== */ +/* ========================================================================== */ + +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +int umfpack_di_transpose +( + int n_row, + int n_col, + const int Ap [ ], + const int Ai [ ], + const double Ax [ ], + const int P [ ], + const int Q [ ], + int Rp [ ], + int Ri [ ], + double Rx [ ] +) ; + +long umfpack_dl_transpose +( + long n_row, + long n_col, + const long Ap [ ], + const long Ai [ ], + const double Ax [ ], + const long P [ ], + const long Q [ ], + long Rp [ ], + long Ri [ ], + double Rx [ ] +) ; + +int umfpack_zi_transpose +( + int n_row, + int n_col, + const int Ap [ ], + const int Ai [ ], + const double Ax [ ], const double Az [ ], + const int P [ ], + const int Q [ ], + int Rp [ ], + int Ri [ ], + double Rx [ ], double Rz [ ], + int do_conjugate +) ; + +long umfpack_zl_transpose +( + long n_row, + long n_col, + const long Ap [ ], + const long Ai [ ], + const double Ax [ ], const double Az [ ], + const long P [ ], + const long Q [ ], + long Rp [ ], + long Ri [ ], + double Rx [ ], double Rz [ ], + long do_conjugate +) ; + +/* +double int Syntax: + + #include "umfpack.h" + int n_row, n_col, status, *Ap, *Ai, *P, *Q, *Rp, *Ri ; + double *Ax, *Rx ; + status = umfpack_di_transpose (n_row, n_col, Ap, Ai, Ax, P, Q, Rp, Ri, Rx) ; + +double long Syntax: + + #include "umfpack.h" + long n_row, n_col, status, *Ap, *Ai, *P, *Q, *Rp, *Ri ; + double *Ax, *Rx ; + status = umfpack_dl_transpose (n_row, n_col, Ap, Ai, Ax, P, Q, Rp, Ri, Rx) ; + +complex int Syntax: + + #include "umfpack.h" + int n_row, n_col, status, *Ap, *Ai, *P, *Q, *Rp, *Ri, do_conjugate ; + double *Ax, *Az, *Rx, *Rz ; + status = umfpack_zi_transpose (n_row, n_col, Ap, Ai, Ax, Az, P, Q, + Rp, Ri, Rx, Rz, do_conjugate) ; + +complex long Syntax: + + #include "umfpack.h" + long n_row, n_col, status, *Ap, *Ai, *P, *Q, *Rp, *Ri, do_conjugate ; + double *Ax, *Az, *Rx, *Rz ; + status = umfpack_zl_transpose (n_row, n_col, Ap, Ai, Ax, Az, P, Q, + Rp, Ri, Rx, Rz, do_conjugate) ; + +Purpose: + + Transposes and optionally permutes a sparse matrix in row or column-form, + R = (PAQ)'. In MATLAB notation, R = (A (P,Q))' or R = (A (P,Q)).' doing + either the linear algebraic transpose or the array transpose. Alternatively, + this routine can be viewed as converting A (P,Q) from column-form to + row-form, or visa versa (for the array transpose). Empty rows and columns + may exist. The matrix A may be singular and/or rectangular. + + umfpack_*_transpose is useful if you want to factorize A' or A.' instead of + A. Factorizing A' or A.' instead of A can be much better, particularly if + AA' is much sparser than A'A. You can still solve Ax=b if you factorize + A' or A.', by solving with the sys argument UMFPACK_At or UMFPACK_Aat, + respectively, in umfpack_*_*solve. The umfpack mexFunction (umfpackmex.c) + is one example. To compute x = A/b, it computes x = (A.'\b.').' instead, + by factorizing A.'. It then uses the regular solve, since b.' and x.' are + stored identically as b and x, respectively (both b.' and b are dense + vectors). If b and x were arrays, the umfpack mexFunction would need to + first compute b.' and then transpose the resulting solution. + +Returns: + + UMFPACK_OK if successful. + UMFPACK_ERROR_out_of_memory if umfpack_*_transpose fails to allocate a + size-max (n_row,n_col) workspace. + UMFPACK_ERROR_argument_missing if Ai, Ap, Ri, and/or Rp are missing. + UMFPACK_ERROR_n_nonpositive if n_row <= 0 or n_col <= 0 + UMFPACK_ERROR_invalid_permutation if P and/or Q are invalid. + UMFPACK_ERROR_nz_negative if Ap [n_col] < 0. + UMFPACK_ERROR_Ap0_nonzero if Ap [0] != 0. + UMFPACK_ERROR_col_length_negative if Ap [j] > Ap [j+1] for any j in the + range 0 to n_col-1. + UMFPACK_ERROR_row_index_out_of_bounds if any row index i is < 0 or >= n_row. + UMFPACK_ERROR_jumbled_matrix if the row indices in any column are not in + ascending order. + +Arguments: + + Int n_row ; Input argument, not modified. + Int n_col ; Input argument, not modified. + + A is an n_row-by-n_col matrix. Restriction: n_row > 0 and n_col > 0. + + Int Ap [n_col+1] ; Input argument, not modified. + + The column pointers of the column-oriented form of the matrix A. See + umfpack_*_symbolic for a description. The number of entries in + the matrix is nz = Ap [n_col]. Ap [0] must be zero, Ap [n_col] must be + => 0, and Ap [j] <= Ap [j+1] and Ap [j] <= Ap [n_col] must be true for + all j in the range 0 to n_col-1. Empty columns are OK (that is, Ap [j] + may equal Ap [j+1] for any j in the range 0 to n_col-1). + + Int Ai [nz] ; Input argument, not modified, of size nz = Ap [n_col]. + + The nonzero pattern (row indices) for column j is stored in + Ai [(Ap [j]) ... (Ap [j+1]-1)]. The row indices in a given column j + must be in ascending order, and no duplicate row indices may be present. + Row indices must be in the range 0 to n_row-1 (the matrix is 0-based). + + double Ax [nz] ; Input argument, not modified, of size nz = Ap [n_col]. + double Az [nz] ; Input argument, not modified, for complex versions. + + If present, these are the numerical values of the sparse matrix A. + The nonzero pattern (row indices) for column j is stored in + Ai [(Ap [j]) ... (Ap [j+1]-1)], and the corresponding real numerical + values are stored in Ax [(Ap [j]) ... (Ap [j+1]-1)]. The imaginary + values are stored in Az [(Ap [j]) ... (Ap [j+1]-1)]. The values are + transposed only if Ax and Rx are present (for the real version), and + only if all four (Ax, Az, Rx, and Rz) are present for the complex + version. These are not an error conditions; you are able to transpose + and permute just the pattern of a matrix. + + Future complex version: if Ax is present and Az is NULL, then both real + and imaginary parts will be contained in Ax[0..2*nz-1], with Ax[2*k] + and Ax[2*k+1] being the real and imaginary part of the kth entry. + + Int P [n_row] ; Input argument, not modified. + + The permutation vector P is defined as P [k] = i, where the original + row i of A is the kth row of PAQ. If you want to use the identity + permutation for P, simply pass (Int *) NULL for P. This is not an error + condition. P is a complete permutation of all the rows of A; this + routine does not support the creation of a transposed submatrix of A + (R = A (1:3,:)' where A has more than 3 rows, for example, cannot be + done; a future version might support this operation). + + Int Q [n_col] ; Input argument, not modified. + + The permutation vector Q is defined as Q [k] = j, where the original + column j of A is the kth column of PAQ. If you want to use the identity + permutation for Q, simply pass (Int *) NULL for Q. This is not an error + condition. Q is a complete permutation of all the columns of A; this + routine does not support the creation of a transposed submatrix of A. + + Int Rp [n_row+1] ; Output argument. + + The column pointers of the matrix R = (A (P,Q))' or (A (P,Q)).', in the + same form as the column pointers Ap for the matrix A. + + Int Ri [nz] ; Output argument. + + The row indices of the matrix R = (A (P,Q))' or (A (P,Q)).' , in the + same form as the row indices Ai for the matrix A. + + double Rx [nz] ; Output argument. + double Rz [nz] ; Output argument, imaginary part for complex versions. + + If present, these are the numerical values of the sparse matrix R, + in the same form as the values Ax and Az of the matrix A. + + Future complex version: if Rx is present and Rz is NULL, then both real + and imaginary parts will be contained in Rx[0..2*nz-1], with Rx[2*k] + and Rx[2*k+1] being the real and imaginary part of the kth entry. + + Int do_conjugate ; Input argument for complex versions only. + + If true, and if Ax, Az, Rx, and Rz are all present, then the linear + algebraic transpose is computed (complex conjugate). If false, the + array transpose is computed instead. +*/ diff --git a/src/sparse-matrix/umfpack/umfpack_triplet_to_col.h b/src/sparse-matrix/umfpack/umfpack_triplet_to_col.h new file mode 100644 index 0000000..8b7c149 --- /dev/null +++ b/src/sparse-matrix/umfpack/umfpack_triplet_to_col.h @@ -0,0 +1,262 @@ +/* ========================================================================== */ +/* === umfpack_triplet_to_col =============================================== */ +/* ========================================================================== */ + +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +int umfpack_di_triplet_to_col +( + int n_row, + int n_col, + int nz, + const int Ti [ ], + const int Tj [ ], + const double Tx [ ], + int Ap [ ], + int Ai [ ], + double Ax [ ], + int Map [ ] +) ; + +long umfpack_dl_triplet_to_col +( + long n_row, + long n_col, + long nz, + const long Ti [ ], + const long Tj [ ], + const double Tx [ ], + long Ap [ ], + long Ai [ ], + double Ax [ ], + long Map [ ] +) ; + +int umfpack_zi_triplet_to_col +( + int n_row, + int n_col, + int nz, + const int Ti [ ], + const int Tj [ ], + const double Tx [ ], const double Tz [ ], + int Ap [ ], + int Ai [ ], + double Ax [ ], double Az [ ], + int Map [ ] +) ; + +long umfpack_zl_triplet_to_col +( + long n_row, + long n_col, + long nz, + const long Ti [ ], + const long Tj [ ], + const double Tx [ ], const double Tz [ ], + long Ap [ ], + long Ai [ ], + double Ax [ ], double Az [ ], + long Map [ ] +) ; + +/* +double int Syntax: + + #include "umfpack.h" + int n_row, n_col, nz, *Ti, *Tj, *Ap, *Ai, status, *Map ; + double *Tx, *Ax ; + status = umfpack_di_triplet_to_col (n_row, n_col, nz, Ti, Tj, Tx, + Ap, Ai, Ax, Map) ; + +double long Syntax: + + #include "umfpack.h" + long n_row, n_col, nz, *Ti, *Tj, *Ap, *Ai, status, *Map ; + double *Tx, *Ax ; + status = umfpack_dl_triplet_to_col (n_row, n_col, nz, Ti, Tj, Tx, + Ap, Ai, Ax, Map) ; + +complex int Syntax: + + #include "umfpack.h" + int n_row, n_col, nz, *Ti, *Tj, *Ap, *Ai, status, *Map ; + double *Tx, *Tz, *Ax, *Az ; + status = umfpack_zi_triplet_to_col (n_row, n_col, nz, Ti, Tj, Tx, Tz, + Ap, Ai, Ax, Az, Map) ; + +long Syntax: + + #include "umfpack.h" + long n_row, n_col, nz, *Ti, *Tj, *Ap, *Ai, status, *Map ; + double *Tx, *Tz, *Ax, *Az ; + status = umfpack_zl_triplet_to_col (n_row, n_col, nz, Ti, Tj, Tx, Tz, + Ap, Ai, Ax, Az, Map) ; + +Purpose: + + Converts a sparse matrix from "triplet" form to compressed-column form. + Analogous to A = spconvert (Ti, Tj, Tx + Tx*1i) in MATLAB, except that + zero entries present in the triplet form are present in A. + + The triplet form of a matrix is a very simple data structure for basic + sparse matrix operations. For example, suppose you wish to factorize a + matrix A coming from a finite element method, in which A is a sum of + dense submatrices, A = E1 + E2 + E3 + ... . The entries in each element + matrix Ei can be concatenated together in the three triplet arrays, and + any overlap between the elements will be correctly summed by + umfpack_*_triplet_to_col. + + Transposing a matrix in triplet form is simple; just interchange the + use of Ti and Tj. You can construct the complex conjugate transpose by + negating Tz, for the complex versions. + + Permuting a matrix in triplet form is also simple. If you want the matrix + PAQ, or A (P,Q) in MATLAB notation, where P [k] = i means that row i of + A is the kth row of PAQ and Q [k] = j means that column j of A is the kth + column of PAQ, then do the following. First, create inverse permutations + Pinv and Qinv such that Pinv [i] = k if P [k] = i and Qinv [j] = k if + Q [k] = j. Next, for the mth triplet (Ti [m], Tj [m], Tx [m], Tz [m]), + replace Ti [m] with Pinv [Ti [m]] and replace Tj [m] with Qinv [Tj [m]]. + + If you have a column-form matrix with duplicate entries or unsorted + columns, you can sort it and sum up the duplicates by first converting it + to triplet form with umfpack_*_col_to_triplet, and then coverting it back + with umfpack_*_triplet_to_col. + + Constructing a submatrix is also easy. Just scan the triplets and remove + those entries outside the desired subset of 0...n_row-1 and 0...n_col-1, + and renumber the indices according to their position in the subset. + + You can do all these operations on a column-form matrix by first + converting it to triplet form with umfpack_*_col_to_triplet, doing the + operation on the triplet form, and then converting it back with + umfpack_*_triplet_to_col. + + The only operation not supported easily in the triplet form is the + multiplication of two sparse matrices (UMFPACK does not provide this + operation). + + You can print the input triplet form with umfpack_*_report_triplet, and + the output matrix with umfpack_*_report_matrix. + + The matrix may be singular (nz can be zero, and empty rows and/or columns + may exist). It may also be rectangular and/or complex. + +Returns: + + UMFPACK_OK if successful. + UMFPACK_ERROR_argument_missing if Ap, Ai, Ti, and/or Tj are missing. + UMFPACK_ERROR_n_nonpositive if n_row <= 0 or n_col <= 0. + UMFPACK_ERROR_nz_negative if nz < 0. + UMFPACK_ERROR_invalid_triplet if for any k, Ti [k] and/or Tj [k] are not in + the range 0 to n_row-1 or 0 to n_col-1, respectively. + UMFPACK_ERROR_out_of_memory if unable to allocate sufficient workspace. + +Arguments: + + Int n_row ; Input argument, not modified. + Int n_col ; Input argument, not modified. + + A is an n_row-by-n_col matrix. Restriction: n_row > 0 and n_col > 0. + All row and column indices in the triplet form must be in the range + 0 to n_row-1 and 0 to n_col-1, respectively. + + Int nz ; Input argument, not modified. + + The number of entries in the triplet form of the matrix. Restriction: + nz >= 0. + + Int Ti [nz] ; Input argument, not modified. + Int Tj [nz] ; Input argument, not modified. + double Tx [nz] ; Input argument, not modified. + double Tz [nz] ; Input argument, not modified, for complex versions. + + Ti, Tj, Tx, and Tz hold the "triplet" form of a sparse matrix. The kth + nonzero entry is in row i = Ti [k], column j = Tj [k], and the real part + of a_ij is Tx [k]. The imaginary part of a_ij is Tz [k], for complex + versions. The row and column indices i and j must be in the range 0 to + n_row-1 and 0 to n_col-1, respectively. Duplicate entries may be + present; they are summed in the output matrix. This is not an error + condition. The "triplets" may be in any order. Tx, Tz, Ax, and Az + are optional. For the real version, Ax is computed only if both Ax + and Tx are present (not (double *) NULL). For the complex version, Ax + and Az are computed only if Tx, Tz, Ax, and Az are all present. These + are not error conditions; the routine can create just the pattern of + the output matrix from the pattern of the triplets. + + Future complex version: if Tx is present and Tz is NULL, then both real + and imaginary parts will be contained in Tx[0..2*nz-1], with Tx[2*k] + and Tx[2*k+1] being the real and imaginary part of the kth entry. + + Int Ap [n_col+1] ; Output argument. + + Ap is an integer array of size n_col+1 on input. On output, Ap holds + the "pointers" for the column form of the sparse matrix A. Column j of + the matrix A is held in Ai [(Ap [j]) ... (Ap [j+1]-1)]. The first + entry, Ap [0], is zero, and Ap [j] <= Ap [j+1] holds for all j in the + range 0 to n_col-1. The value nz2 = Ap [n_col] is thus the total + number of entries in the pattern of the matrix A. Equivalently, the + number of duplicate triplets is nz - Ap [n_col]. + + Int Ai [nz] ; Output argument. + + Ai is an integer array of size nz on input. Note that only the first + Ap [n_col] entries are used. + + The nonzero pattern (row indices) for column j is stored in + Ai [(Ap [j]) ... (Ap [j+1]-1)]. The row indices in a given column j + are in ascending order, and no duplicate row indices are present. + Row indices are in the range 0 to n_col-1 (the matrix is 0-based). + + double Ax [nz] ; Output argument. + double Az [nz] ; Output argument for complex versions. + + Ax and Az (for the complex versions) are double arrays of size nz on + input. Note that only the first Ap [n_col] entries are used + in both arrays. + + Ax is optional; if Tx and/or Ax are not present (a (double *) NULL + pointer), then Ax is not computed. Az is also optional; if Tz and/or + Az are not present, then Az is not computed. If present, Ax holds the + numerical values of the the real part of the sparse matrix A and Az + holds the imaginary parts. The nonzero pattern (row indices) for + column j is stored in Ai [(Ap [j]) ... (Ap [j+1]-1)], and the + corresponding numerical values are stored in + Ax [(Ap [j]) ... (Ap [j+1]-1)]. The imaginary parts are stored in + Az [(Ap [j]) ... (Ap [j+1]-1)], for the complex versions. + + Future complex version: if Ax is present and Az is NULL, then both real + and imaginary parts will be returned in Ax[0..2*nz2-1], with Ax[2*k] + and Ax[2*k+1] being the real and imaginary part of the kth entry. + + int Map [nz] ; Optional output argument. + + If Map is present (a non-NULL pointer to an Int array of size nz), then + on output it holds the position of the triplets in the column-form + matrix. That is, suppose p = Map [k], and the k-th triplet is i=Ti[k], + j=Tj[k], and aij=Tx[k]. Then i=Ai[p], and aij will have been summed + into Ax[p] (or simply aij=Ax[p] if there were no duplicate entries also + in row i and column j). Also, Ap[j] <= p < Ap[j+1]. The Map array is + not computed if it is (Int *) NULL. The Map array is useful for + converting a subsequent triplet form matrix with the same pattern as the + first one, without calling this routine. If Ti and Tj do not change, + then Ap, and Ai can be reused from the prior call to + umfpack_*_triplet_to_col. You only need to recompute Ax (and Az for the + complex version). This code excerpt properly sums up all duplicate + values (for the real version): + + for (p = 0 ; p < Ap [n_col] ; p++) Ax [p] = 0 ; + for (k = 0 ; k < nz ; k++) Ax [Map [k]] += Tx [k] ; + + This feature is useful (along with the reuse of the Symbolic object) if + you need to factorize a sequence of triplet matrices with identical + nonzero pattern (the order of the triplets in the Ti,Tj,Tx arrays must + also remain unchanged). It is faster than calling this routine for + each matrix, and requires no workspace. +*/ diff --git a/src/sparse-matrix/umfpack/umfpack_wsolve.h b/src/sparse-matrix/umfpack/umfpack_wsolve.h new file mode 100644 index 0000000..46288dd --- /dev/null +++ b/src/sparse-matrix/umfpack/umfpack_wsolve.h @@ -0,0 +1,166 @@ +/* ========================================================================== */ +/* === umfpack_wsolve ======================================================= */ +/* ========================================================================== */ + +/* -------------------------------------------------------------------------- */ +/* UMFPACK Version 4.0 (Apr 11, 2002), Copyright (c) 2002 by Timothy A. */ +/* Davis. All Rights Reserved. See README for License. */ +/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */ +/* web: http://www.cise.ufl.edu/research/sparse/umfpack */ +/* -------------------------------------------------------------------------- */ + +int umfpack_di_wsolve +( + int sys, + const int Ap [ ], + const int Ai [ ], + const double Ax [ ], + double X [ ], + const double B [ ], + void *Numeric, + const double Control [UMFPACK_CONTROL], + double Info [UMFPACK_INFO], + int Wi [ ], + double W [ ] +) ; + +long umfpack_dl_wsolve +( + long sys, + const long Ap [ ], + const long Ai [ ], + const double Ax [ ], + double X [ ], + const double B [ ], + void *Numeric, + const double Control [UMFPACK_CONTROL], + double Info [UMFPACK_INFO], + long Wi [ ], + double W [ ] +) ; + +int umfpack_zi_wsolve +( + int sys, + const int Ap [ ], + const int Ai [ ], + const double Ax [ ], const double Az [ ], + double Xx [ ], double Xz [ ], + const double Bx [ ], const double Bz [ ], + void *Numeric, + const double Control [UMFPACK_CONTROL], + double Info [UMFPACK_INFO], + int Wi [ ], + double W [ ] +) ; + +long umfpack_zl_wsolve +( + long sys, + const long Ap [ ], + const long Ai [ ], + const double Ax [ ], const double Az [ ], + double Xx [ ], double Xz [ ], + const double Bx [ ], const double Bz [ ], + void *Numeric, + const double Control [UMFPACK_CONTROL], + double Info [UMFPACK_INFO], + long Wi [ ], + double W [ ] +) ; + +/* +double int Syntax: + + #include "umfpack.h" + void *Numeric ; + int status, *Ap, *Ai, *Wi, sys ; + double *B, *X, *Ax, *W, Info [UMFPACK_INFO], Control [UMFPACK_CONTROL] ; + status = umfpack_di_wsolve (sys, Ap, Ai, Ax, X, B, Numeric, + Control, Info, Wi, W) ; + +double long Syntax: + + #include "umfpack.h" + void *Numeric ; + long status, *Ap, *Ai, *Wi, sys ; + double *B, *X, *Ax, *W, Info [UMFPACK_INFO], Control [UMFPACK_CONTROL] ; + status = umfpack_dl_wsolve (sys, Ap, Ai, Ax, X, B, Numeric, + Control, Info, Wi, W) ; + +complex int Syntax: + + #include "umfpack.h" + void *Numeric ; + int status, *Ap, *Ai, *Wi, sys ; + double *Bx, *Bz, *Xx, *Xz, *Ax, *Az, *W, + Info [UMFPACK_INFO], Control [UMFPACK_CONTROL] ; + status = umfpack_zi_wsolve (sys, Ap, Ai, Ax, Az, Xx, Xz, Bx, Bz, Numeric, + Control, Info, Wi, W) ; + +complex long Syntax: + + #include "umfpack.h" + void *Numeric ; + long status, *Ap, *Ai, *Wi, sys ; + double *Bx, *Bz, *Xx, *Xz, *Ax, *Az, *W, + Info [UMFPACK_INFO], Control [UMFPACK_CONTROL] ; + status = umfpack_zl_wsolve (sys, Ap, Ai, Ax, Az, Xx, Xz, Bx, Bz, Numeric, + Control, Info, Wi, W) ; + +Purpose: + + Given LU factors computed by umfpack_*_numeric (PAQ=LU) and the + right-hand-side, B, solve a linear system for the solution X. Iterative + refinement is optionally performed. This routine is identical to + umfpack_*_solve, except that it does not dynamically allocate any workspace. + When you have many linear systems to solve, this routine is faster than + umfpack_*_solve, since the workspace (Wi, W) needs to be allocated only + once, prior to calling umfpack_*_wsolve. + +Returns: + + The status code is returned. See Info [UMFPACK_STATUS], below. + +Arguments: + + Int sys ; Input argument, not modified. + Int Ap [n+1] ; Input argument, not modified. + Int Ai [nz] ; Input argument, not modified. + double Ax [nz] ; Input argument, not modified. + double X [n] ; Output argument. + double B [n] ; Input argument, not modified. + void *Numeric ; Input argument, not modified. + double Control [UMFPACK_CONTROL] ; Input argument, not modified. + double Info [UMFPACK_INFO] ; Output argument. + + for complex versions: + double Az [nz] ; Input argument, not modified, imaginary part + double Xx [n] ; Output argument, real part. + double Xz [n] ; Output argument, imaginary part + double Bx [n] ; Input argument, not modified, real part + double Bz [n] ; Input argument, not modified, imaginary part + + The above arguments are identical to umfpack_*_solve, except that the + error code UMFPACK_ERROR_out_of_memory will not be returned in + Info [UMFPACK_STATUS], since umfpack_*_wsolve does not allocate any + memory. + + Int Wi [n] ; Workspace. + double W [c*n] ; Workspace, where c is defined below. + + The Wi and W arguments are workspace used by umfpack_*_wsolve. They + need not be initialized on input, and their contents are undefined on + output. The size of W depends on whether or not iterative refinement is + used, and which version (real or complex) is called. Iterative + refinement is performed if Ax=b, A'x=b, or A.'x=b is being solved, + Control [UMFPACK_IRSTEP] > 0, and A is nonsingular. The size of W is + given below: + + no iter. with iter. + refinement refinement + umfpack_di_wsolve n 5*n + umfpack_dl_wsolve n 5*n + umfpack_zi_wsolve 4*n 10*n + umfpack_zl_wsolve 4*n 10*n +*/ |