diff --git a/CMakeLists.txt b/CMakeLists.txt index 8c4229ed5..3ea81c85e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -305,7 +305,7 @@ endif() # paths so that the compiler uses GTSAM headers in our source directory instead # of any previously installed GTSAM headers. include_directories(BEFORE - gtsam/3rdparty/UFconfig + gtsam/3rdparty/SuiteSparse_config gtsam/3rdparty/CCOLAMD/Include ${METIS_INCLUDE_DIRECTORIES} ${PROJECT_SOURCE_DIR} diff --git a/gtsam/3rdparty/CCOLAMD/Demo/Makefile b/gtsam/3rdparty/CCOLAMD/Demo/Makefile new file mode 100644 index 000000000..c0ad95683 --- /dev/null +++ b/gtsam/3rdparty/CCOLAMD/Demo/Makefile @@ -0,0 +1,49 @@ +#----------------------------------------------------------------------------- +# compile the CCOLAMD demo +#----------------------------------------------------------------------------- + +default: all + +include ../../SuiteSparse_config/SuiteSparse_config.mk + +I = -I../../include + +C = $(CC) $(CF) $(I) + +LIB2 = $(LDFLAGS) -L../../lib -lccolamd -lsuitesparseconfig $(LDLIBS) + +all: library ccolamd_example ccolamd_l_example + +library: + ( cd ../../SuiteSparse_config ; $(MAKE) ) + ( cd ../Lib ; $(MAKE) ) + +#------------------------------------------------------------------------------ +# Create the demo program, run it, and compare the output +#------------------------------------------------------------------------------ + +dist: + +ccolamd_example: ccolamd_example.c + $(C) -o ccolamd_example ccolamd_example.c $(LIB2) + - ./ccolamd_example > my_ccolamd_example.out + - diff ccolamd_example.out my_ccolamd_example.out + +ccolamd_l_example: ccolamd_l_example.c + $(C) -o ccolamd_l_example ccolamd_l_example.c $(LIB2) + - ./ccolamd_l_example > my_ccolamd_l_example.out + - diff ccolamd_l_example.out my_ccolamd_l_example.out + +#------------------------------------------------------------------------------ +# Remove all but the files in the original distribution +#------------------------------------------------------------------------------ + +clean: + - $(RM) -r $(CLEAN) + +purge: distclean + +distclean: clean + - $(RM) ccolamd_example ccolamd_l_example + - $(RM) my_ccolamd_example.out my_ccolamd_l_example.out + - $(RM) -r $(PURGE) diff --git a/gtsam/3rdparty/CCOLAMD/Demo/ccolamd_example.c b/gtsam/3rdparty/CCOLAMD/Demo/ccolamd_example.c index 253fdc988..44423574e 100644 --- a/gtsam/3rdparty/CCOLAMD/Demo/ccolamd_example.c +++ b/gtsam/3rdparty/CCOLAMD/Demo/ccolamd_example.c @@ -5,8 +5,6 @@ /* ---------------------------------------------------------------------------- * CCOLAMD Copyright (C), Univ. of Florida. Authors: Timothy A. Davis, * Sivasankaran Rajamanickam, and Stefan Larimore - * See License.txt for the Version 2.1 of the GNU Lesser General Public License - * http://www.cise.ufl.edu/research/sparse * -------------------------------------------------------------------------- */ /* diff --git a/gtsam/3rdparty/CCOLAMD/Demo/ccolamd_example.out b/gtsam/3rdparty/CCOLAMD/Demo/ccolamd_example.out index dd2dc4955..b456b0f11 100644 --- a/gtsam/3rdparty/CCOLAMD/Demo/ccolamd_example.out +++ b/gtsam/3rdparty/CCOLAMD/Demo/ccolamd_example.out @@ -15,7 +15,7 @@ Column 3, with 2 entries: row 1 row 3 -ccolamd version 2.7, Jan 25, 2011: OK. +ccolamd version 2.9, Apr 1, 2016: OK. ccolamd: number of dense or empty rows ignored: 0 ccolamd: number of dense or empty columns ignored: 0 ccolamd: number of garbage collections performed: 0 @@ -38,7 +38,7 @@ Column 3, with 1 entries: row 4 Column 4, with 0 entries: -csymamd version 2.7, Jan 25, 2011: OK. +csymamd version 2.9, Apr 1, 2016: OK. csymamd: number of dense or empty rows ignored: 0 csymamd: number of dense or empty columns ignored: 0 csymamd: number of garbage collections performed: 0 diff --git a/gtsam/3rdparty/CCOLAMD/Demo/ccolamd_l_example.c b/gtsam/3rdparty/CCOLAMD/Demo/ccolamd_l_example.c index b213aad0e..b68e1d0d6 100644 --- a/gtsam/3rdparty/CCOLAMD/Demo/ccolamd_l_example.c +++ b/gtsam/3rdparty/CCOLAMD/Demo/ccolamd_l_example.c @@ -1,12 +1,10 @@ /* ========================================================================== */ -/* === ccolamd and csymamd example (UF_long integer version) ================ */ +/* === ccolamd and csymamd example (long integer version) =================== */ /* ========================================================================== */ /* ---------------------------------------------------------------------------- * CCOLAMD Copyright (C), Univ. of Florida. Authors: Timothy A. Davis, * Sivasankaran Rajamanickam, and Stefan Larimore - * See License.txt for the Version 2.1 of the GNU Lesser General Public License - * http://www.cise.ufl.edu/research/sparse * -------------------------------------------------------------------------- */ /* @@ -46,9 +44,6 @@ #define B_NNZ 4 #define B_N 5 -/* define UF_long */ -#include "UFconfig.h" - int main (void) { @@ -56,14 +51,14 @@ int main (void) /* input matrix A definition */ /* ====================================================================== */ - UF_long A [ALEN] = { + SuiteSparse_long A [ALEN] = { 0, 1, 4, /* row indices of nonzeros in column 0 */ 2, 4, /* row indices of nonzeros in column 1 */ 0, 1, 2, 3, /* row indices of nonzeros in column 2 */ 1, 3} ; /* row indices of nonzeros in column 3 */ - UF_long p [ ] = { + SuiteSparse_long p [ ] = { 0, /* column 0 is in A [0..2] */ 3, /* column 1 is in A [3..4] */ @@ -75,7 +70,7 @@ int main (void) /* input matrix B definition */ /* ====================================================================== */ - UF_long B [ ] = { /* Note: only strictly lower triangular part */ + SuiteSparse_long B [ ] = { /* Note: only strictly lower triangular part */ /* is included, since symamd ignores the */ /* diagonal and upper triangular part of B. */ @@ -85,7 +80,7 @@ int main (void) 4 /* row indices of nonzeros in column 3 */ } ; /* row indices of nonzeros in column 4 (none) */ - UF_long q [ ] = { + SuiteSparse_long q [ ] = { 0, /* column 0 is in B [0] */ 1, /* column 1 is in B [1..2] */ @@ -98,10 +93,9 @@ int main (void) /* other variable definitions */ /* ====================================================================== */ - UF_long perm [B_N+1] ; /* note the size is N+1 */ - UF_long stats [CCOLAMD_STATS] ; /* for ccolamd and csymamd output stats */ - - UF_long row, col, pp, length, ok ; + SuiteSparse_long perm [B_N+1] ; /* note the size is N+1 */ + SuiteSparse_long stats [CCOLAMD_STATS] ; /* ccolamd/csymamd output stats */ + SuiteSparse_long row, col, pp, length, ok ; /* ====================================================================== */ /* dump the input matrix A */ diff --git a/gtsam/3rdparty/CCOLAMD/Demo/ccolamd_l_example.out b/gtsam/3rdparty/CCOLAMD/Demo/ccolamd_l_example.out index fc87f5474..559c66098 100644 --- a/gtsam/3rdparty/CCOLAMD/Demo/ccolamd_l_example.out +++ b/gtsam/3rdparty/CCOLAMD/Demo/ccolamd_l_example.out @@ -15,7 +15,7 @@ Column 3, with 2 entries: row 1 row 3 -ccolamd version 2.7, Jan 25, 2011: OK. +ccolamd version 2.9, Apr 1, 2016: OK. ccolamd: number of dense or empty rows ignored: 0 ccolamd: number of dense or empty columns ignored: 0 ccolamd: number of garbage collections performed: 0 @@ -38,7 +38,7 @@ Column 3, with 1 entries: row 4 Column 4, with 0 entries: -csymamd version 2.7, Jan 25, 2011: OK. +csymamd version 2.9, Apr 1, 2016: OK. csymamd: number of dense or empty rows ignored: 0 csymamd: number of dense or empty columns ignored: 0 csymamd: number of garbage collections performed: 0 diff --git a/gtsam/3rdparty/CCOLAMD/Doc/ChangeLog b/gtsam/3rdparty/CCOLAMD/Doc/ChangeLog index 499d2fc69..85f375c7a 100644 --- a/gtsam/3rdparty/CCOLAMD/Doc/ChangeLog +++ b/gtsam/3rdparty/CCOLAMD/Doc/ChangeLog @@ -1,3 +1,37 @@ +Apr 1, 2016: version 2.9.5 + + * licensing simplified (no other change); refer to CCOLAMD/Doc/License.txt + +Feb 1, 2016: version 2.9.4 + + * update to Makefiles + +Jan 30, 2016: version 2.9.3 + + * modifications to Makefiles + +Jan 1, 2016: version 2.9.2 + + * modified Makefile to create shared libraries + No change to C code except version number. + The empty file ccolamd_global.c removed. + +Oct 10, 2014: version 2.9.1 + + modified MATLAB/ccolamd_make.m. No change to C code except version number. + +July 31, 2013: version 2.9.0 + + * changed malloc and printf pointers to use SuiteSparse_config + +Jun 1, 2012: version 2.8.0 + + * changed from UFconfig to SuiteSparse_config + +Dec 7, 2011: version 2.7.4 + + * fixed the Makefile to better align with CFLAGS and other standards + Jan 25, 2011: version 2.7.3 * minor fix to "make install" diff --git a/gtsam/3rdparty/CCOLAMD/Doc/License.txt b/gtsam/3rdparty/CCOLAMD/Doc/License.txt new file mode 100644 index 000000000..089509a6b --- /dev/null +++ b/gtsam/3rdparty/CCOLAMD/Doc/License.txt @@ -0,0 +1,21 @@ +CCOLAMD: constrained column approximate minimum degree ordering +Copyright (C) 2005-2016, Univ. of Florida. Authors: Timothy A. Davis, +Sivasankaran Rajamanickam, and Stefan Larimore. Closely based on COLAMD by +Davis, Stefan Larimore, in collaboration with Esmond Ng, and John Gilbert. +http://www.suitesparse.com + +-------------------------------------------------------------------------------- + +CCOLAMD is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +CCOLAMD is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this Module; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA diff --git a/gtsam/3rdparty/CCOLAMD/Include/ccolamd.h b/gtsam/3rdparty/CCOLAMD/Include/ccolamd.h index 55693d47d..b4ee829be 100644 --- a/gtsam/3rdparty/CCOLAMD/Include/ccolamd.h +++ b/gtsam/3rdparty/CCOLAMD/Include/ccolamd.h @@ -5,8 +5,6 @@ /* ---------------------------------------------------------------------------- * CCOLAMD Copyright (C), Univ. of Florida. Authors: Timothy A. Davis, * Sivasankaran Rajamanickam, and Stefan Larimore - * See License.txt for the Version 2.1 of the GNU Lesser General Public License - * http://www.cise.ufl.edu/research/sparse * -------------------------------------------------------------------------- */ /* @@ -32,24 +30,24 @@ extern "C" { /* All versions of CCOLAMD will include the following definitions. * As an example, to test if the version you are using is 1.3 or later: * - * if (CCOLAMD_VERSION >= CCOLAMD_VERSION_CODE (1,3)) ... + * if (CCOLAMD_VERSION >= CCOLAMD_VERSION_CODE (1,3)) ... * * This also works during compile-time: * - * #if CCOLAMD_VERSION >= CCOLAMD_VERSION_CODE (1,3) - * printf ("This is version 1.3 or later\n") ; - * #else - * printf ("This is an early version\n") ; - * #endif + * #if CCOLAMD_VERSION >= CCOLAMD_VERSION_CODE (1,3) + * printf ("This is version 1.3 or later\n") ; + * #else + * printf ("This is an early version\n") ; + * #endif */ -#define CCOLAMD_DATE "Jan 25, 2011" +#define CCOLAMD_DATE "Apr 1, 2016" #define CCOLAMD_VERSION_CODE(main,sub) ((main) * 1000 + (sub)) #define CCOLAMD_MAIN_VERSION 2 -#define CCOLAMD_SUB_VERSION 7 -#define CCOLAMD_SUBSUB_VERSION 3 +#define CCOLAMD_SUB_VERSION 9 +#define CCOLAMD_SUBSUB_VERSION 5 #define CCOLAMD_VERSION \ - CCOLAMD_VERSION_CODE(CCOLAMD_MAIN_VERSION,CCOLAMD_SUB_VERSION) + CCOLAMD_VERSION_CODE(CCOLAMD_MAIN_VERSION,CCOLAMD_SUB_VERSION) /* ========================================================================== */ /* === Knob and statistics definitions ====================================== */ @@ -94,106 +92,105 @@ extern "C" { #define CCOLAMD_NEWLY_EMPTY_COL 10 /* error codes returned in stats [3]: */ -#define CCOLAMD_OK (0) -#define CCOLAMD_OK_BUT_JUMBLED (1) -#define CCOLAMD_ERROR_A_not_present (-1) -#define CCOLAMD_ERROR_p_not_present (-2) -#define CCOLAMD_ERROR_nrow_negative (-3) -#define CCOLAMD_ERROR_ncol_negative (-4) -#define CCOLAMD_ERROR_nnz_negative (-5) -#define CCOLAMD_ERROR_p0_nonzero (-6) -#define CCOLAMD_ERROR_A_too_small (-7) -#define CCOLAMD_ERROR_col_length_negative (-8) -#define CCOLAMD_ERROR_row_index_out_of_bounds (-9) -#define CCOLAMD_ERROR_out_of_memory (-10) -#define CCOLAMD_ERROR_invalid_cmember (-11) -#define CCOLAMD_ERROR_internal_error (-999) +#define CCOLAMD_OK (0) +#define CCOLAMD_OK_BUT_JUMBLED (1) +#define CCOLAMD_ERROR_A_not_present (-1) +#define CCOLAMD_ERROR_p_not_present (-2) +#define CCOLAMD_ERROR_nrow_negative (-3) +#define CCOLAMD_ERROR_ncol_negative (-4) +#define CCOLAMD_ERROR_nnz_negative (-5) +#define CCOLAMD_ERROR_p0_nonzero (-6) +#define CCOLAMD_ERROR_A_too_small (-7) +#define CCOLAMD_ERROR_col_length_negative (-8) +#define CCOLAMD_ERROR_row_index_out_of_bounds (-9) +#define CCOLAMD_ERROR_out_of_memory (-10) +#define CCOLAMD_ERROR_invalid_cmember (-11) +#define CCOLAMD_ERROR_internal_error (-999) /* ========================================================================== */ /* === Prototypes of user-callable routines ================================= */ /* ========================================================================== */ -/* define UF_long */ -#include "UFconfig.h" +#include "SuiteSparse_config.h" -size_t ccolamd_recommended /* returns recommended value of Alen, */ - /* or 0 if input arguments are erroneous */ +size_t ccolamd_recommended /* returns recommended value of Alen, */ + /* or 0 if input arguments are erroneous */ ( - int nnz, /* nonzeros in A */ - int n_row, /* number of rows in A */ - int n_col /* number of columns in A */ + int nnz, /* nonzeros in A */ + int n_row, /* number of rows in A */ + int n_col /* number of columns in A */ ) ; -size_t ccolamd_l_recommended /* returns recommended value of Alen, */ - /* or 0 if input arguments are erroneous */ +size_t ccolamd_l_recommended /* returns recommended value of Alen, */ + /* or 0 if input arguments are erroneous */ ( - UF_long nnz, /* nonzeros in A */ - UF_long n_row, /* number of rows in A */ - UF_long n_col /* number of columns in A */ + SuiteSparse_long nnz, /* nonzeros in A */ + SuiteSparse_long n_row, /* number of rows in A */ + SuiteSparse_long n_col /* number of columns in A */ ) ; -void ccolamd_set_defaults /* sets default parameters */ -( /* knobs argument is modified on output */ - double knobs [CCOLAMD_KNOBS] /* parameter settings for ccolamd */ +void ccolamd_set_defaults /* sets default parameters */ +( /* knobs argument is modified on output */ + double knobs [CCOLAMD_KNOBS] /* parameter settings for ccolamd */ ) ; -void ccolamd_l_set_defaults /* sets default parameters */ -( /* knobs argument is modified on output */ - double knobs [CCOLAMD_KNOBS] /* parameter settings for ccolamd */ +void ccolamd_l_set_defaults /* sets default parameters */ +( /* knobs argument is modified on output */ + double knobs [CCOLAMD_KNOBS] /* parameter settings for ccolamd */ ) ; -int ccolamd /* 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 */ +int ccolamd /* 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 [CCOLAMD_KNOBS],/* parameter settings for ccolamd */ - int stats [CCOLAMD_STATS], /* ccolamd output statistics and error codes */ - int cmember [ ] /* Constraint set of A, of size n_col */ + int stats [CCOLAMD_STATS], /* ccolamd output statistics and error codes */ + int cmember [ ] /* Constraint set of A, of size n_col */ ) ; -UF_long ccolamd_l /* same as ccolamd, but with UF_long integers */ +SuiteSparse_long ccolamd_l /* as ccolamd w/ SuiteSparse_long integers */ ( - UF_long n_row, - UF_long n_col, - UF_long Alen, - UF_long A [ ], - UF_long p [ ], + SuiteSparse_long n_row, + SuiteSparse_long n_col, + SuiteSparse_long Alen, + SuiteSparse_long A [ ], + SuiteSparse_long p [ ], double knobs [CCOLAMD_KNOBS], - UF_long stats [CCOLAMD_STATS], - UF_long cmember [ ] + SuiteSparse_long stats [CCOLAMD_STATS], + SuiteSparse_long cmember [ ] ) ; -int csymamd /* return (1) if OK, (0) otherwise */ +int csymamd /* return (1) if OK, (0) otherwise */ ( - int n, /* number of rows and columns of A */ - int A [ ], /* row indices of A */ - int p [ ], /* column pointers of A */ - int perm [ ], /* output permutation, size n_col+1 */ + int n, /* number of rows and columns of A */ + int A [ ], /* row indices of A */ + int p [ ], /* column pointers of A */ + int perm [ ], /* output permutation, size n_col+1 */ double knobs [CCOLAMD_KNOBS],/* parameters (uses defaults if NULL) */ - int stats [CCOLAMD_STATS], /* output statistics and error codes */ + int stats [CCOLAMD_STATS], /* output statistics and error codes */ void * (*allocate) (size_t, size_t), /* pointer to calloc (ANSI C) or */ - /* mxCalloc (for MATLAB mexFunction) */ - void (*release) (void *), /* pointer to free (ANSI C) or */ - /* mxFree (for MATLAB mexFunction) */ - int cmember [ ], /* Constraint set of A */ - int stype /* 0: use both parts, >0: upper, <0: lower */ + /* mxCalloc (for MATLAB mexFunction) */ + void (*release) (void *), /* pointer to free (ANSI C) or */ + /* mxFree (for MATLAB mexFunction) */ + int cmember [ ], /* Constraint set of A */ + int stype /* 0: use both parts, >0: upper, <0: lower */ ) ; -UF_long csymamd_l /* same as csymamd, but with UF_long integers */ +SuiteSparse_long csymamd_l /* as csymamd, w/ SuiteSparse_long integers */ ( - UF_long n, - UF_long A [ ], - UF_long p [ ], - UF_long perm [ ], + SuiteSparse_long n, + SuiteSparse_long A [ ], + SuiteSparse_long p [ ], + SuiteSparse_long perm [ ], double knobs [CCOLAMD_KNOBS], - UF_long stats [CCOLAMD_STATS], + SuiteSparse_long stats [CCOLAMD_STATS], void * (*allocate) (size_t, size_t), void (*release) (void *), - UF_long cmember [ ], - UF_long stype + SuiteSparse_long cmember [ ], + SuiteSparse_long stype ) ; void ccolamd_report @@ -203,7 +200,7 @@ void ccolamd_report void ccolamd_l_report ( - UF_long stats [CCOLAMD_STATS] + SuiteSparse_long stats [CCOLAMD_STATS] ) ; void csymamd_report @@ -213,7 +210,7 @@ void csymamd_report void csymamd_l_report ( - UF_long stats [CCOLAMD_STATS] + SuiteSparse_long stats [CCOLAMD_STATS] ) ; @@ -227,42 +224,42 @@ void csymamd_l_report */ int ccolamd2 -( /* 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 */ +( /* 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 [CCOLAMD_KNOBS],/* parameter settings for ccolamd */ - int stats [CCOLAMD_STATS], /* ccolamd output statistics and error codes */ + int stats [CCOLAMD_STATS], /* ccolamd output statistics and error codes */ /* each Front_ array is of size n_col+1: */ - int Front_npivcol [ ], /* # pivot cols in each front */ - int Front_nrows [ ], /* # of rows in each front (incl. pivot rows) */ - int Front_ncols [ ], /* # of cols in each front (incl. pivot cols) */ - int Front_parent [ ], /* parent of each front */ - int Front_cols [ ], /* link list of pivot columns for each front */ - int *p_nfr, /* total number of frontal matrices */ - int InFront [ ], /* InFront [row] = f if row in front f */ - int cmember [ ] /* Constraint set of A */ + int Front_npivcol [ ], /* # pivot cols in each front */ + int Front_nrows [ ], /* # of rows in each front (incl. pivot rows) */ + int Front_ncols [ ], /* # of cols in each front (incl. pivot cols) */ + int Front_parent [ ], /* parent of each front */ + int Front_cols [ ], /* link list of pivot columns for each front */ + int *p_nfr, /* total number of frontal matrices */ + int InFront [ ], /* InFront [row] = f if row in front f */ + int cmember [ ] /* Constraint set of A */ ) ; -UF_long ccolamd2_l /* same as ccolamd2, but with UF_long integers */ +SuiteSparse_long ccolamd2_l /* as ccolamd2, w/ SuiteSparse_long integers */ ( - UF_long n_row, - UF_long n_col, - UF_long Alen, - UF_long A [ ], - UF_long p [ ], + SuiteSparse_long n_row, + SuiteSparse_long n_col, + SuiteSparse_long Alen, + SuiteSparse_long A [ ], + SuiteSparse_long p [ ], double knobs [CCOLAMD_KNOBS], - UF_long stats [CCOLAMD_STATS], - UF_long Front_npivcol [ ], - UF_long Front_nrows [ ], - UF_long Front_ncols [ ], - UF_long Front_parent [ ], - UF_long Front_cols [ ], - UF_long *p_nfr, - UF_long InFront [ ], - UF_long cmember [ ] + SuiteSparse_long stats [CCOLAMD_STATS], + SuiteSparse_long Front_npivcol [ ], + SuiteSparse_long Front_nrows [ ], + SuiteSparse_long Front_ncols [ ], + SuiteSparse_long Front_parent [ ], + SuiteSparse_long Front_cols [ ], + SuiteSparse_long *p_nfr, + SuiteSparse_long InFront [ ], + SuiteSparse_long cmember [ ] ) ; void ccolamd_apply_order @@ -276,11 +273,11 @@ void ccolamd_apply_order void ccolamd_l_apply_order ( - UF_long Front [ ], - const UF_long Order [ ], - UF_long Temp [ ], - UF_long nn, - UF_long nfr + SuiteSparse_long Front [ ], + const SuiteSparse_long Order [ ], + SuiteSparse_long Temp [ ], + SuiteSparse_long nn, + SuiteSparse_long nfr ) ; @@ -296,12 +293,12 @@ void ccolamd_fsize void ccolamd_l_fsize ( - UF_long nn, - UF_long MaxFsize [ ], - UF_long Fnrows [ ], - UF_long Fncols [ ], - UF_long Parent [ ], - UF_long Npiv [ ] + SuiteSparse_long nn, + SuiteSparse_long MaxFsize [ ], + SuiteSparse_long Fnrows [ ], + SuiteSparse_long Fncols [ ], + SuiteSparse_long Parent [ ], + SuiteSparse_long Npiv [ ] ) ; void ccolamd_postorder @@ -320,16 +317,16 @@ void ccolamd_postorder void ccolamd_l_postorder ( - UF_long nn, - UF_long Parent [ ], - UF_long Npiv [ ], - UF_long Fsize [ ], - UF_long Order [ ], - UF_long Child [ ], - UF_long Sibling [ ], - UF_long Stack [ ], - UF_long Front_cols [ ], - UF_long cmember [ ] + SuiteSparse_long nn, + SuiteSparse_long Parent [ ], + SuiteSparse_long Npiv [ ], + SuiteSparse_long Fsize [ ], + SuiteSparse_long Order [ ], + SuiteSparse_long Child [ ], + SuiteSparse_long Sibling [ ], + SuiteSparse_long Stack [ ], + SuiteSparse_long Front_cols [ ], + SuiteSparse_long cmember [ ] ) ; int ccolamd_post_tree @@ -342,22 +339,16 @@ int ccolamd_post_tree int Stack [ ] ) ; -UF_long ccolamd_l_post_tree +SuiteSparse_long ccolamd_l_post_tree ( - UF_long root, - UF_long k, - UF_long Child [ ], - const UF_long Sibling [ ], - UF_long Order [ ], - UF_long Stack [ ] + SuiteSparse_long root, + SuiteSparse_long k, + SuiteSparse_long Child [ ], + const SuiteSparse_long Sibling [ ], + SuiteSparse_long Order [ ], + SuiteSparse_long Stack [ ] ) ; -#ifndef EXTERN -#define EXTERN extern -#endif - -EXTERN int (*ccolamd_printf) (const char *, ...) ; - #ifdef __cplusplus } #endif diff --git a/gtsam/3rdparty/CCOLAMD/Lib/Makefile b/gtsam/3rdparty/CCOLAMD/Lib/Makefile new file mode 100644 index 000000000..c2352c90e --- /dev/null +++ b/gtsam/3rdparty/CCOLAMD/Lib/Makefile @@ -0,0 +1,71 @@ +#------------------------------------------------------------------------------- +# CCOLAMD Lib/Makefile +#------------------------------------------------------------------------------- + +LIBRARY = libccolamd +VERSION = 2.9.5 +SO_VERSION = 2 + +default: library + +include ../../SuiteSparse_config/SuiteSparse_config.mk + +# CCOLAMD depends on SuiteSparse_config +LDLIBS += -lsuitesparseconfig + +# compile and install in SuiteSparse/lib +library: + $(MAKE) install INSTALL=$(SUITESPARSE) + +I = -I../Include -I../../SuiteSparse_config + +INC = ../Include/ccolamd.h ../../SuiteSparse_config/SuiteSparse_config.h + +SRC = ../Source/ccolamd.c + +OBJ = ccolamd.o ccolamd_l.o + +ccolamd.o: $(SRC) $(INC) + $(CC) $(CF) $(I) -c ../Source/ccolamd.c + +ccolamd_l.o: $(SRC) $(INC) + $(CC) $(CF) $(I) -c ../Source/ccolamd.c -DDLONG -o ccolamd_l.o + +# creates libccolamd.a, a C-callable CCOLAMD library +$(AR_TARGET): $(OBJ) + $(ARCHIVE) $@ $^ + - $(RANLIB) $@ + +ccode: library + +clean: + - $(RM) -r $(CLEAN) + +purge: distclean + +distclean: clean + - $(RM) -r $(PURGE) + +# install CCOLAMD +install: $(AR_TARGET) $(INSTALL_LIB)/$(SO_TARGET) + +$(INSTALL_LIB)/$(SO_TARGET): $(OBJ) + @mkdir -p $(INSTALL_LIB) + @mkdir -p $(INSTALL_INCLUDE) + @mkdir -p $(INSTALL_DOC) + $(CC) $(SO_OPTS) $^ -o $@ $(LDLIBS) + ( cd $(INSTALL_LIB) ; ln -sf $(SO_TARGET) $(SO_PLAIN) ) + ( cd $(INSTALL_LIB) ; ln -sf $(SO_TARGET) $(SO_MAIN) ) + $(CP) ../Include/ccolamd.h $(INSTALL_INCLUDE) + $(CP) ../README.txt $(INSTALL_DOC)/CCOLAMD_README.txt + chmod 755 $(INSTALL_LIB)/$(SO_TARGET) + chmod 644 $(INSTALL_INCLUDE)/ccolamd.h + chmod 644 $(INSTALL_DOC)/CCOLAMD_README.txt + +uninstall: + $(RM) $(INSTALL_LIB)/$(SO_TARGET) + $(RM) $(INSTALL_LIB)/$(SO_PLAIN) + $(RM) $(INSTALL_LIB)/$(SO_MAIN) + $(RM) $(INSTALL_INCLUDE)/ccolamd.h + $(RM) $(INSTALL_DOC)/CCOLAMD_README.txt + diff --git a/gtsam/3rdparty/CCOLAMD/MATLAB/ccolamd_demo.m b/gtsam/3rdparty/CCOLAMD/MATLAB/ccolamd_demo.m index e2fd68457..2c69a502e 100644 --- a/gtsam/3rdparty/CCOLAMD/MATLAB/ccolamd_demo.m +++ b/gtsam/3rdparty/CCOLAMD/MATLAB/ccolamd_demo.m @@ -47,9 +47,8 @@ spparms ('default') ; A = sprandn (n, n, 2/n) + speye (n) ; b = (1:n)' ; -figure (1) clf ; -subplot (2,2,1) +subplot (3,4,1) spy (A) title ('original matrix') @@ -62,7 +61,7 @@ fl = luflops (L, U) ; x = Q * (U \ (L \ (P * b))) ; fprintf (1, '\nFlop count for [L,U,P] = lu (A*Q): %d\n', fl) ; fprintf (1, 'residual: %e\n', norm (A*x-b)); -subplot (2,2,2) ; +subplot (3,4,2) ; spy (L|U) ; title ('LU with ccolamd') ; @@ -76,7 +75,7 @@ fl = luflops (L, U) ; x = Q * (U \ (L \ (P * b))) ; fprintf (1, '\nFlop count for [L,U,P] = lu (A*Q): %d\n', fl) ; fprintf (1, 'residual: %e\n', norm (A*x-b)); -subplot (2,2,3) ; +subplot (3,4,3) ; spy (L|U) ; title ('LU with colamd') ; catch @@ -89,7 +88,7 @@ fl = luflops (L, U) ; x = U \ (L \ (P * b)) ; fprintf (1, '\nFlop count for [L,U,P] = lu (A*Q): %d\n', fl) ; fprintf (1, 'residual: %e\n', norm (A*x-b)); -subplot (2,2,4) ; +subplot (3,4,4) ; spy (L|U) ; title ('LU with no ordering') ; @@ -111,9 +110,7 @@ n = 1000 ; fprintf (1, 'Generating a random %d-by-%d sparse matrix.\n', n, n) ; A = sprandn (n, n, 2/n) + speye (n) ; -figure (2) -clf ; -subplot (2,2,1) +subplot (3,4,5) spy (A) title ('original matrix') @@ -121,7 +118,7 @@ fprintf (1, '\n\nUnordered matrix:\n') ; [lnz,h,parent,post,R] = symbfact (A, 'col') ; fprintf (1, 'nz in Cholesky factors of A''A: %d\n', sum (lnz)) ; fprintf (1, 'flop count for Cholesky of A''A: %d\n', sum (lnz.^2)) ; -subplot (2,2,4) ; +subplot (3,4,6) ; spy (R) ; title ('Cholesky with no ordering') ; @@ -133,7 +130,7 @@ fprintf (1, '\n\nccolamd run time: %f\n', t) ; fprintf (1, 'ccolamd ordering quality: \n') ; fprintf (1, 'nz in Cholesky factors of A(:,p)''A(:,p): %d\n', sum (lnz)) ; fprintf (1, 'flop count for Cholesky of A(:,p)''A(:,p): %d\n', sum (lnz.^2)) ; -subplot (2,2,2) ; +subplot (3,4,7) ; spy (R) ; title ('Cholesky with ccolamd') ; @@ -146,7 +143,7 @@ fprintf (1, '\n\ncolamd run time: %f\n', t) ; fprintf (1, 'colamd ordering quality: \n') ; fprintf (1, 'nz in Cholesky factors of A(:,p)''A(:,p): %d\n', sum (lnz)) ; fprintf (1, 'flop count for Cholesky of A(:,p)''A(:,p): %d\n', sum (lnz.^2)) ; -subplot (2,2,3) ; +subplot (3,4,8) ; spy (R) ; title ('Cholesky with colamd') ; catch @@ -164,9 +161,7 @@ fprintf (1, '\n-----------------------------------------------------------\n') ; fprintf (1, 'Generating a random symmetric %d-by-%d sparse matrix.\n', n, n) ; A = A+A' ; -figure (3) -clf ; -subplot (2,2,1) +subplot (3,4,9) ; spy (A) title ('original matrix') @@ -174,7 +169,7 @@ fprintf (1, '\n\nUnordered matrix:\n') ; [lnz,h,parent,post,R] = symbfact (A, 'sym') ; fprintf (1, 'nz in Cholesky factors of A: %d\n', sum (lnz)) ; fprintf (1, 'flop count for Cholesky of A: %d\n', sum (lnz.^2)) ; -subplot (2,2,4) ; +subplot (3,4,10) ; spy (R) ; title ('Cholesky with no ordering') ; @@ -186,7 +181,7 @@ fprintf (1, '\n\ncsymamd run time: %f\n', t) ; fprintf (1, 'csymamd ordering quality: \n') ; fprintf (1, 'nz in Cholesky factors of A(p,p): %d\n', sum (lnz)) ; fprintf (1, 'flop count for Cholesky of A(p,p): %d\n', sum (lnz.^2)) ; -subplot (2,2,2) ; +subplot (3,4,11) ; spy (R) ; title ('Cholesky with csymamd') ; @@ -199,7 +194,7 @@ fprintf (1, '\n\nsymamd run time: %f\n', t) ; fprintf (1, 'symamd ordering quality: \n') ; fprintf (1, 'nz in Cholesky factors of A(p,p): %d\n', sum (lnz)) ; fprintf (1, 'flop count for Cholesky of A(p,p): %d\n', sum (lnz.^2)) ; -subplot (2,2,3) ; +subplot (3,4,12) ; spy (R) ; title ('Cholesky with symamd') ; catch diff --git a/gtsam/3rdparty/CCOLAMD/MATLAB/ccolamd_make.m b/gtsam/3rdparty/CCOLAMD/MATLAB/ccolamd_make.m index 4637f3884..9a84da909 100644 --- a/gtsam/3rdparty/CCOLAMD/MATLAB/ccolamd_make.m +++ b/gtsam/3rdparty/CCOLAMD/MATLAB/ccolamd_make.m @@ -14,14 +14,33 @@ d = '' ; if (~isempty (strfind (computer, '64'))) d = '-largeArrayDims' ; end -src = '../Source/ccolamd.c ../Source/ccolamd_global.c' ; -cmd = sprintf ('mex -DDLONG -O %s -I../../UFconfig -I../Include -output ', d) ; + +% MATLAB 8.3.0 now has a -silent option to keep 'mex' from burbling too much +if (~verLessThan ('matlab', '8.3.0')) + d = ['-silent ' d] ; +end + +src = '../Source/ccolamd.c ../../SuiteSparse_config/SuiteSparse_config.c' ; +cmd = sprintf ( ... + 'mex -DDLONG -O %s -I../../SuiteSparse_config -I../Include -output ', d) ; s = [cmd 'ccolamd ccolamdmex.c ' src] ; + +if (~(ispc || ismac)) + % for POSIX timing routine + s = [s ' -lrt'] ; +end if (details) fprintf ('%s\n', s) ; end eval (s) ; + s = [cmd 'csymamd csymamdmex.c ' src] ; + +if (~(ispc || ismac)) + % for POSIX timing routine + s = [s ' -lrt'] ; +end + if (details) fprintf ('%s\n', s) ; end diff --git a/gtsam/3rdparty/CCOLAMD/MATLAB/ccolamd_test.m b/gtsam/3rdparty/CCOLAMD/MATLAB/ccolamd_test.m index e359b9fea..0514ad9c7 100644 --- a/gtsam/3rdparty/CCOLAMD/MATLAB/ccolamd_test.m +++ b/gtsam/3rdparty/CCOLAMD/MATLAB/ccolamd_test.m @@ -22,8 +22,13 @@ csymamd_default_knobs = [10 1 0] ; if (~isempty (strfind (computer, '64'))) d = '-largeArrayDims' ; end - src = '../Source/ccolamd.c ../Source/ccolamd_global.c' ; - cmd = sprintf ('mex -DDLONG -O %s -I../../UFconfig -I../Include ', d) ; + cmd = sprintf ( ... + 'mex -DDLONG -O %s -I../../SuiteSparse_config -I../Include ', d) ; + src = '../Source/ccolamd.c ../../SuiteSparse_config/SuiteSparse_config.c' ; + if (~(ispc || ismac)) + % for POSIX timing routine + src = [src ' -lrt'] ; + end eval ([cmd 'ccolamdtestmex.c ' src]) ; eval ([cmd 'csymamdtestmex.c ' src]) ; fprintf ('Done compiling.\n') ; diff --git a/gtsam/3rdparty/CCOLAMD/MATLAB/ccolamdmex.c b/gtsam/3rdparty/CCOLAMD/MATLAB/ccolamdmex.c index fbcb87873..09d21efee 100644 --- a/gtsam/3rdparty/CCOLAMD/MATLAB/ccolamdmex.c +++ b/gtsam/3rdparty/CCOLAMD/MATLAB/ccolamdmex.c @@ -5,8 +5,6 @@ /* ---------------------------------------------------------------------------- * CCOLAMD, Copyright (C), Univ. of Florida. Authors: Timothy A. Davis, * Sivasankaran Rajamanickam, and Stefan Larimore - * See License.txt for the Version 2.1 of the GNU Lesser General Public License - * http://www.cise.ufl.edu/research/sparse * -------------------------------------------------------------------------- */ /* @@ -26,7 +24,7 @@ #include "matrix.h" #include #include -#include "UFconfig.h" +#define Long SuiteSparse_long /* ========================================================================== */ /* === ccolamd mexFunction ================================================== */ @@ -44,24 +42,24 @@ void mexFunction { /* === Local variables ================================================== */ - UF_long *A ; /* ccolamd's copy of the matrix and workspace */ - UF_long *cmember ; /* ccolamd's copy of the constraint set */ - double *in_cmember ; /* input constraint set */ - UF_long *p ; /* ccolamd's copy of the column pointers */ - UF_long Alen ; /* size of A */ - UF_long cslen ; /* size of CS */ - UF_long n_col ; /* number of columns of A */ - UF_long n_row ; /* number of rows of A */ - UF_long nnz ; /* number of entries in A */ - UF_long full ; /* TRUE if input matrix full, FALSE if sparse */ + Long *A ; /* ccolamd's copy of the matrix and workspace */ + Long *cmember ; /* ccolamd's copy of the constraint set */ + double *in_cmember ; /* input constraint set */ + Long *p ; /* ccolamd's copy of the column pointers */ + Long Alen ; /* size of A */ + Long cslen ; /* size of CS */ + Long n_col ; /* number of columns of A */ + Long n_row ; /* number of rows of A */ + Long nnz ; /* number of entries in A */ + Long full ; /* TRUE if input matrix full, FALSE if sparse */ double knobs [CCOLAMD_KNOBS] ; /* ccolamd user-controllable parameters */ - double *out_perm ; /* output permutation vector */ - double *out_stats ; /* output stats vector */ - double *in_knobs ; /* input knobs vector */ - UF_long i ; /* loop counter */ - mxArray *Ainput ; /* input matrix handle */ - UF_long spumoni ; /* verbosity variable */ - UF_long stats [CCOLAMD_STATS] ; /* stats for ccolamd */ + double *out_perm ; /* output permutation vector */ + double *out_stats ; /* output stats vector */ + double *in_knobs ; /* input knobs vector */ + Long i ; /* loop counter */ + mxArray *Ainput ; /* input matrix handle */ + Long spumoni ; /* verbosity variable */ + Long stats [CCOLAMD_STATS] ;/* stats for ccolamd */ /* === Check inputs ===================================================== */ @@ -80,11 +78,11 @@ void mexFunction cslen = mxGetNumberOfElements (pargin [2]) ; if (cslen != 0) { - cmember = (UF_long *) mxCalloc (cslen, sizeof (UF_long)) ; + cmember = (Long *) mxCalloc (cslen, sizeof (Long)) ; for (i = 0 ; i < cslen ; i++) { /* convert cmember from 1-based to 0-based */ - cmember[i] = ((UF_long) in_cmember [i] - 1) ; + cmember[i] = ((Long) in_cmember [i] - 1) ; } } } @@ -157,10 +155,10 @@ void mexFunction n_col = mxGetN (Ainput) ; /* get column pointer vector */ - p = (UF_long *) mxCalloc (n_col+1, sizeof (UF_long)) ; - (void) memcpy (p, mxGetJc (Ainput), (n_col+1)*sizeof (UF_long)) ; + p = (Long *) mxCalloc (n_col+1, sizeof (Long)) ; + (void) memcpy (p, mxGetJc (Ainput), (n_col+1)*sizeof (Long)) ; nnz = p [n_col] ; - Alen = (UF_long) ccolamd_l_recommended (nnz, n_row, n_col) ; + Alen = (Long) ccolamd_l_recommended (nnz, n_row, n_col) ; if (Alen == 0) { mexErrMsgTxt ("ccolamd: problem too large") ; @@ -168,8 +166,8 @@ void mexFunction /* === Copy input matrix into workspace ================================= */ - A = (UF_long *) mxCalloc (Alen, sizeof (UF_long)) ; - (void) memcpy (A, mxGetIr (Ainput), nnz*sizeof (UF_long)) ; + A = (Long *) mxCalloc (Alen, sizeof (Long)) ; + (void) memcpy (A, mxGetIr (Ainput), nnz*sizeof (Long)) ; if (full) { diff --git a/gtsam/3rdparty/CCOLAMD/MATLAB/ccolamdtestmex.c b/gtsam/3rdparty/CCOLAMD/MATLAB/ccolamdtestmex.c index b5b04da73..18c850dc6 100644 --- a/gtsam/3rdparty/CCOLAMD/MATLAB/ccolamdtestmex.c +++ b/gtsam/3rdparty/CCOLAMD/MATLAB/ccolamdtestmex.c @@ -5,8 +5,6 @@ /* ---------------------------------------------------------------------------- * CCOLAMD Copyright (C), Univ. of Florida. Authors: Timothy A. Davis, * Sivasankaran Rajamanickam, and Stefan Larimore - * See License.txt for the Version 2.1 of the GNU Lesser General Public License - * http://www.cise.ufl.edu/research/sparse * -------------------------------------------------------------------------- */ /* @@ -43,7 +41,7 @@ #include "matrix.h" #include #include -#include "UFconfig.h" +#define Long SuiteSparse_long /* Here only for testing */ #undef MIN @@ -61,15 +59,15 @@ static void dump_matrix ( - UF_long A [ ], - UF_long p [ ], - UF_long n_row, - UF_long n_col, - UF_long Alen, - UF_long limit + Long A [ ], + Long p [ ], + Long n_row, + Long n_col, + Long Alen, + Long limit ) { - UF_long col, k, row ; + Long col, k, row ; mexPrintf ("dump matrix: nrow %d ncol %d Alen %d\n", n_row, n_col, Alen) ; @@ -102,24 +100,24 @@ void mexFunction { /* === Local variables ================================================== */ - UF_long *A ; /* ccolamd's copy of the matrix and workspace */ - UF_long *p ; /* ccolamd's copy of the column pointers */ - UF_long Alen ; /* size of A */ - UF_long n_col ; /* number of columns of A */ - UF_long n_row ; /* number of rows of A */ - UF_long nnz ; /* number of entries in A */ - UF_long full ; /* TRUE if input matrix full, FALSE if sparse */ + Long *A ; /* ccolamd's copy of the matrix and workspace */ + Long *p ; /* ccolamd's copy of the column pointers */ + Long Alen ; /* size of A */ + Long n_col ; /* number of columns of A */ + Long n_row ; /* number of rows of A */ + Long nnz ; /* number of entries in A */ + Long full ; /* TRUE if input matrix full, FALSE if sparse */ double knobs [CCOLAMD_KNOBS] ; /* ccolamd user-controllable parameters */ - double *out_perm ; /* output permutation vector */ - double *out_stats ; /* output stats vector */ - double *in_knobs ; /* input knobs vector */ - UF_long i ; /* loop counter */ - mxArray *Ainput ; /* input matrix handle */ - UF_long spumoni ; /* verbosity variable */ - UF_long stats2 [CCOLAMD_STATS] ; /* stats for ccolamd */ + double *out_perm ; /* output permutation vector */ + double *out_stats ; /* output stats vector */ + double *in_knobs ; /* input knobs vector */ + Long i ; /* loop counter */ + mxArray *Ainput ; /* input matrix handle */ + Long spumoni ; /* verbosity variable */ + Long stats2 [CCOLAMD_STATS] ; /* stats for ccolamd */ - UF_long *cp, *cp_end, result, col, length, ok ; - UF_long *stats ; + Long *cp, *cp_end, result, col, length, ok ; + Long *stats ; stats = stats2 ; /* === Check inputs ===================================================== */ @@ -199,10 +197,10 @@ void mexFunction n_col = mxGetN (Ainput) ; /* get column pointer vector so we can find nnz */ - p = (UF_long *) mxCalloc (n_col+1, sizeof (UF_long)) ; - (void) memcpy (p, mxGetJc (Ainput), (n_col+1)*sizeof (UF_long)) ; + p = (Long *) mxCalloc (n_col+1, sizeof (Long)) ; + (void) memcpy (p, mxGetJc (Ainput), (n_col+1)*sizeof (Long)) ; nnz = p [n_col] ; - Alen = (UF_long) ccolamd_l_recommended (nnz, n_row, n_col) ; + Alen = (Long) ccolamd_l_recommended (nnz, n_row, n_col) ; if (Alen == 0) { mexErrMsgTxt ("ccolamd: problem too large") ; @@ -230,8 +228,8 @@ void mexFunction /* === Copy input matrix into workspace ================================= */ - A = (UF_long *) mxCalloc (Alen, sizeof (UF_long)) ; - (void) memcpy (A, mxGetIr (Ainput), nnz*sizeof (UF_long)) ; + A = (Long *) mxCalloc (Alen, sizeof (Long)) ; + (void) memcpy (A, mxGetIr (Ainput), nnz*sizeof (Long)) ; if (full) { @@ -261,7 +259,7 @@ void mexFunction */ /* jumble appropriately */ - switch ((UF_long) in_knobs [6]) + switch ((Long) in_knobs [6]) { case 0 : @@ -359,7 +357,7 @@ void mexFunction mexPrintf ("ccolamdtest: A not present\n") ; } result = 0 ; /* A not present */ - A = (UF_long *) NULL ; + A = (Long *) NULL ; break ; case 8 : @@ -368,7 +366,7 @@ void mexFunction mexPrintf ("ccolamdtest: p not present\n") ; } result = 0 ; /* p not present */ - p = (UF_long *) NULL ; + p = (Long *) NULL ; break ; case 9 : @@ -456,7 +454,7 @@ void mexFunction mexPrintf ("ccolamdtest: stats not present\n") ; } result = 0 ; /* stats not present */ - stats = (UF_long *) NULL ; + stats = (Long *) NULL ; break ; case 13 : diff --git a/gtsam/3rdparty/CCOLAMD/MATLAB/csymamd.m b/gtsam/3rdparty/CCOLAMD/MATLAB/csymamd.m index 901040df6..4308f9934 100644 --- a/gtsam/3rdparty/CCOLAMD/MATLAB/csymamd.m +++ b/gtsam/3rdparty/CCOLAMD/MATLAB/csymamd.m @@ -34,10 +34,10 @@ function [p, stats] = csymamd (S, knobs, cmember) %#ok % p = csymamd(S) is about the same as p = symamd(S). knobs and its default % values differ. % -% Authors: S. Larimore, T. Davis (Univ of Florida), and S. Rajamanickam, in +% Authors: S. Larimore, T. Davis, and S. Rajamanickam, in % collaboration with J. Gilbert and E. Ng. Supported by the National % Science Foundation (DMS-9504974, DMS-9803599, CCR-0203270), and a grant -% from Sandia National Lab. See http://www.cise.ufl.edu/research/sparse +% from Sandia National Lab. See http://www.suitesparse.com % for ccolamd, csymamd, amd, colamd, symamd, and other related orderings. % % See also AMD, CCOLAMD, COLAMD, SYMAMD, SYMRCM. diff --git a/gtsam/3rdparty/CCOLAMD/MATLAB/csymamdmex.c b/gtsam/3rdparty/CCOLAMD/MATLAB/csymamdmex.c index e52d92619..41a3b4346 100644 --- a/gtsam/3rdparty/CCOLAMD/MATLAB/csymamdmex.c +++ b/gtsam/3rdparty/CCOLAMD/MATLAB/csymamdmex.c @@ -5,8 +5,6 @@ /* ---------------------------------------------------------------------------- * CCOLAMD, Copyright (C), Univ. of Florida. Authors: Timothy A. Davis, * Sivasankaran Rajamanickam, and Stefan Larimore - * See License.txt for the Version 2.1 of the GNU Lesser General Public License - * http://www.cise.ufl.edu/research/sparse * -------------------------------------------------------------------------- */ /* @@ -25,7 +23,7 @@ #include "mex.h" #include "matrix.h" #include -#include "UFconfig.h" +#define Long SuiteSparse_long /* ========================================================================== */ /* === csymamd mexFunction ================================================== */ @@ -43,23 +41,23 @@ void mexFunction { /* === Local variables ================================================== */ - UF_long *A ; /* row indices of input matrix A */ - UF_long *perm ; /* column ordering of M and ordering of A */ - UF_long *cmember ; /* csymamd's copy of the constraint set */ - double *in_cmember ; /* input constraint set */ - UF_long *p ; /* column pointers of input matrix A */ - UF_long cslen ; /* size of constraint set */ - UF_long n_col ; /* number of columns of A */ - UF_long n_row ; /* number of rows of A */ - UF_long full ; /* TRUE if input matrix full, FALSE if sparse */ + Long *A ; /* row indices of input matrix A */ + Long *perm ; /* column ordering of M and ordering of A */ + Long *cmember ; /* csymamd's copy of the constraint set */ + double *in_cmember ; /* input constraint set */ + Long *p ; /* column pointers of input matrix A */ + Long cslen ; /* size of constraint set */ + Long n_col ; /* number of columns of A */ + Long n_row ; /* number of rows of A */ + Long full ; /* TRUE if input matrix full, FALSE if sparse */ double knobs [CCOLAMD_KNOBS] ; /* csymamd user-controllable parameters */ - double *out_perm ; /* output permutation vector */ - double *out_stats ; /* output stats vector */ - double *in_knobs ; /* input knobs vector */ - UF_long i ; /* loop counter */ - mxArray *Ainput ; /* input matrix handle */ - UF_long spumoni ; /* verbosity variable */ - UF_long stats [CCOLAMD_STATS] ; /* stats for symamd */ + double *out_perm ; /* output permutation vector */ + double *out_stats ; /* output stats vector */ + double *in_knobs ; /* input knobs vector */ + Long i ; /* loop counter */ + mxArray *Ainput ; /* input matrix handle */ + Long spumoni ; /* verbosity variable */ + Long stats [CCOLAMD_STATS] ;/* stats for symamd */ /* === Check inputs ===================================================== */ @@ -78,11 +76,11 @@ void mexFunction cslen = mxGetNumberOfElements (pargin [2]) ; if (cslen != 0) { - cmember = (UF_long *) mxCalloc (cslen, sizeof (UF_long)) ; + cmember = (Long *) mxCalloc (cslen, sizeof (Long)) ; for (i = 0 ; i < cslen ; i++) { /* convert cmember from 1-based to 0-based */ - cmember[i] = ((UF_long) in_cmember [i] - 1) ; + cmember[i] = ((Long) in_cmember [i] - 1) ; } } } @@ -153,9 +151,9 @@ void mexFunction mexErrMsgTxt ("csymamd: cmember must be of length equal to #cols of A"); } - A = (UF_long *) mxGetIr (Ainput) ; - p = (UF_long *) mxGetJc (Ainput) ; - perm = (UF_long *) mxCalloc (n_col+1, sizeof (UF_long)) ; + A = (Long *) mxGetIr (Ainput) ; + p = (Long *) mxGetJc (Ainput) ; + perm = (Long *) mxCalloc (n_col+1, sizeof (Long)) ; /* === Order the rows and columns of A (does not destroy A) ============= */ diff --git a/gtsam/3rdparty/CCOLAMD/MATLAB/csymamdtestmex.c b/gtsam/3rdparty/CCOLAMD/MATLAB/csymamdtestmex.c index 428b41185..60b0d6c04 100644 --- a/gtsam/3rdparty/CCOLAMD/MATLAB/csymamdtestmex.c +++ b/gtsam/3rdparty/CCOLAMD/MATLAB/csymamdtestmex.c @@ -5,8 +5,6 @@ /* ---------------------------------------------------------------------------- * CCOLAMD Copyright (C), Univ. of Florida. Authors: Timothy A. Davis, * Sivasankaran Rajamanickam, and Stefan Larimore - * See License.txt for the Version 2.1 of the GNU Lesser General Public License - * http://www.cise.ufl.edu/research/sparse * -------------------------------------------------------------------------- */ /* @@ -37,7 +35,7 @@ #include "matrix.h" #include #include -#include "UFconfig.h" +#define Long SuiteSparse_long #ifdef MIN #undef MIN @@ -47,15 +45,15 @@ static void dump_matrix ( - UF_long A [ ], - UF_long p [ ], - UF_long n_row, - UF_long n_col, - UF_long Alen, - UF_long limit + Long A [ ], + Long p [ ], + Long n_row, + Long n_col, + Long Alen, + Long limit ) { - UF_long col, k, row ; + Long col, k, row ; mexPrintf ("dump matrix: nrow %d ncol %d Alen %d\n", n_row, n_col, Alen) ; @@ -100,23 +98,23 @@ void mexFunction { /* === Local variables ================================================== */ - UF_long *perm ; /* column ordering of M and ordering of A */ - UF_long *A ; /* row indices of input matrix A */ - UF_long *p ; /* column pointers of input matrix A */ - UF_long n_col ; /* number of columns of A */ - UF_long n_row ; /* number of rows of A */ - UF_long full ; /* TRUE if input matrix full, FALSE if sparse */ + Long *perm ; /* column ordering of M and ordering of A */ + Long *A ; /* row indices of input matrix A */ + Long *p ; /* column pointers of input matrix A */ + Long n_col ; /* number of columns of A */ + Long n_row ; /* number of rows of A */ + Long full ; /* TRUE if input matrix full, FALSE if sparse */ double knobs [CCOLAMD_KNOBS] ; /* ccolamd user-controllable parameters */ - double *out_perm ; /* output permutation vector */ - double *out_stats ; /* output stats vector */ - double *in_knobs ; /* input knobs vector */ - UF_long i ; /* loop counter */ - mxArray *Ainput ; /* input matrix handle */ - UF_long spumoni ; /* verbosity variable */ - UF_long stats2 [CCOLAMD_STATS] ;/* stats for csymamd */ + double *out_perm ; /* output permutation vector */ + double *out_stats ; /* output stats vector */ + double *in_knobs ; /* input knobs vector */ + Long i ; /* loop counter */ + mxArray *Ainput ; /* input matrix handle */ + Long spumoni ; /* verbosity variable */ + Long stats2 [CCOLAMD_STATS] ;/* stats for csymamd */ - UF_long *cp, *cp_end, result, nnz, col, length, ok ; - UF_long *stats ; + Long *cp, *cp_end, result, nnz, col, length, ok ; + Long *stats ; stats = stats2 ; /* === Check inputs ===================================================== */ @@ -192,8 +190,8 @@ void mexFunction } /* p = mxGetJc (Ainput) ; */ - p = (UF_long *) mxCalloc (n_col+1, sizeof (UF_long)) ; - (void) memcpy (p, mxGetJc (Ainput), (n_col+1)*sizeof (UF_long)) ; + p = (Long *) mxCalloc (n_col+1, sizeof (Long)) ; + (void) memcpy (p, mxGetJc (Ainput), (n_col+1)*sizeof (Long)) ; nnz = p [n_col] ; if (spumoni) @@ -202,10 +200,10 @@ void mexFunction } /* A = mxGetIr (Ainput) ; */ - A = (UF_long *) mxCalloc (nnz+1, sizeof (UF_long)) ; - (void) memcpy (A, mxGetIr (Ainput), nnz*sizeof (UF_long)) ; + A = (Long *) mxCalloc (nnz+1, sizeof (Long)) ; + (void) memcpy (A, mxGetIr (Ainput), nnz*sizeof (Long)) ; - perm = (UF_long *) mxCalloc (n_col+1, sizeof (UF_long)) ; + perm = (Long *) mxCalloc (n_col+1, sizeof (Long)) ; /* === Jumble matrix ==================================================== */ @@ -230,7 +228,7 @@ void mexFunction */ /* jumble appropriately */ - switch ((UF_long) in_knobs [3]) + switch ((Long) in_knobs [3]) { case 0 : @@ -321,7 +319,7 @@ void mexFunction mexPrintf ("csymamdtest: A not present\n") ; } result = 0 ; /* A not present */ - A = (UF_long *) NULL ; + A = (Long *) NULL ; break ; case 8 : @@ -330,7 +328,7 @@ void mexFunction mexPrintf ("csymamdtest: p not present\n") ; } result = 0 ; /* p not present */ - p = (UF_long *) NULL ; + p = (Long *) NULL ; break ; case 9 : @@ -418,7 +416,7 @@ void mexFunction mexPrintf ("csymamdtest: stats not present\n") ; } result = 0 ; /* stats not present */ - stats = (UF_long *) NULL ; + stats = (Long *) NULL ; break ; case 13 : diff --git a/gtsam/3rdparty/CCOLAMD/Makefile b/gtsam/3rdparty/CCOLAMD/Makefile new file mode 100644 index 000000000..f04181d60 --- /dev/null +++ b/gtsam/3rdparty/CCOLAMD/Makefile @@ -0,0 +1,51 @@ +#------------------------------------------------------------------------------ +# CCOLAMD Makefile +#------------------------------------------------------------------------------ + +SUITESPARSE ?= $(realpath $(CURDIR)/..) +export SUITESPARSE + +default: all + +include ../SuiteSparse_config/SuiteSparse_config.mk + +demos: all + +# Compile all C code +all: + ( cd Lib ; $(MAKE) ) + ( cd Demo ; $(MAKE) ) + +# compile just the C-callable libraries (not Demos) +library: + ( cd Lib ; $(MAKE) ) + +# remove object files, but keep the compiled programs and library archives +clean: + ( cd Lib ; $(MAKE) clean ) + ( cd Demo ; $(MAKE) clean ) + ( cd MATLAB ; $(RM) $(CLEAN) ) + +# clean, and then remove compiled programs and library archives +purge: + ( cd Lib ; $(MAKE) purge ) + ( cd Demo ; $(MAKE) purge ) + ( cd MATLAB ; $(RM) $(CLEAN) ; $(RM) *.mex* ) + +distclean: purge + +# get ready for distribution +dist: purge + ( cd Demo ; $(MAKE) dist ) + +ccode: library + +lib: library + +# install CCOLAMD +install: + ( cd Lib ; $(MAKE) install ) + +# uninstall CCOLAMD +uninstall: + ( cd Lib ; $(MAKE) uninstall ) diff --git a/gtsam/3rdparty/CCOLAMD/README.txt b/gtsam/3rdparty/CCOLAMD/README.txt index ccc5a19a5..6d8f1ce83 100644 --- a/gtsam/3rdparty/CCOLAMD/README.txt +++ b/gtsam/3rdparty/CCOLAMD/README.txt @@ -1,8 +1,8 @@ CCOLAMD: constrained column approximate minimum degree ordering -Copyright (C) 2005-2011, Univ. of Florida. Authors: Timothy A. Davis, +Copyright (C) 2005-2016, Univ. of Florida. Authors: Timothy A. Davis, Sivasankaran Rajamanickam, and Stefan Larimore. Closely based on COLAMD by Davis, Stefan Larimore, in collaboration with Esmond Ng, and John Gilbert. -http://www.cise.ufl.edu/research/sparse +http://www.suitesparse.com ------------------------------------------------------------------------------- The CCOLAMD column approximate minimum degree ordering algorithm computes @@ -14,7 +14,8 @@ available as a MATLAB-callable function. It constructs a matrix M such that M'*M has the same pattern as A, and then uses CCOLAMD to compute a column ordering of M. -Requires UFconfig, in the ../UFconfig directory relative to this directory. +Requires SuiteSparse_config, in the ../SuiteSparse_config directory relative to +this directory. To compile and install the ccolamd m-files and mexFunctions, just cd to CCOLAMD/MATLAB and type ccolamd_install in the MATLAB command window. @@ -22,47 +23,27 @@ A short demo will run. Optionally, type ccolamd_test to run an extensive tests. Type "make" in Unix in the CCOLAMD directory to compile the C-callable library and to run a short demo. -If you have MATLAB 7.2 or earlier, you must first edit UFconfig/UFconfig.h to -remove the "-largeArrayDims" option from the MEX command (or just use -ccolamd_install.m inside MATLAB). - Other "make" targets: - make mex compiles MATLAB mexFunctions only - make libccolamd.a compiles a C-callable library containing ccolamd - make clean removes all files not in the distribution, except for - libccolamd.a + make library compiles a C-callable library containing ccolamd + make clean removes all files not in the distribution + but keeps the compiled libraries. make distclean removes all files not in the distribution + make install installs the library in /usr/local/lib and + /usr/local/include + make uninstall uninstalls the library from /usr/local/lib and + /usr/local/include To use ccolamd and csymamd within an application written in C, all you need are ccolamd.c and ccolamd.h, which are the C-callable ccolamd/csymamd codes. See ccolamd.c for more information on how to call ccolamd from a C program. It contains a complete description of the C-interface to CCOLAMD and CSYMAMD. - Copyright (c) 1998-2007 by the University of Florida. - All Rights Reserved. - Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. +See CCOLAMD/Doc/License.txt for the license. ------------------------------------------------------------------------------- -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -------------------------------------------------------------------------------- - - Related papers: T. A. Davis and W. W. Hager, Rajamanickam, Multiple-rank updates @@ -86,21 +67,18 @@ Related papers: "An approximate minimum degree column ordering algorithm", S. I. Larimore, MS Thesis, Dept. of Computer and Information Science and Engineering, University of Florida, Gainesville, FL, - 1998. CISE Tech Report TR-98-016. Available at - ftp://ftp.cise.ufl.edu/cis/tech-reports/tr98/tr98-016.ps - via anonymous ftp. + 1998. CISE Tech Report TR-98-016. Approximate Deficiency for Ordering the Columns of a Matrix, J. L. Kern, Senior Thesis, Dept. of Computer and Information Science and Engineering, University of Florida, Gainesville, FL, - 1999. Available at http://www.cise.ufl.edu/~davis/Kern/kern.ps + 1999. Authors: Timothy A. Davis, Sivasankaran Rajamanickam, and Stefan Larimore. Closely based on COLAMD by Stefan I. Larimore and Timothy A. Davis, - University of Florida, in collaboration with John Gilbert, Xerox PARC - (now at UC Santa Barbara), and Esmong Ng, Lawrence Berkeley National - Laboratory (much of this work he did while at Oak Ridge National - Laboratory). + in collaboration with John Gilbert, Xerox PARC (now at UC Santa + Barbara), and Esmong Ng, Lawrence Berkeley National Laboratory (much of + this work he did while at Oak Ridge National Laboratory). CCOLAMD files: @@ -122,7 +100,6 @@ CCOLAMD files: ./Doc: ChangeLog change log - lesser.txt license ./Include: ccolamd.h include file @@ -147,4 +124,3 @@ CCOLAMD files: ./Source: ccolamd.c primary source code - ccolamd_global.c globally defined function pointers (malloc, free, ...) diff --git a/gtsam/3rdparty/CCOLAMD/Source/ccolamd.c b/gtsam/3rdparty/CCOLAMD/Source/ccolamd.c index 1c35ffa41..9a08e3ea8 100644 --- a/gtsam/3rdparty/CCOLAMD/Source/ccolamd.c +++ b/gtsam/3rdparty/CCOLAMD/Source/ccolamd.c @@ -5,8 +5,6 @@ /* ---------------------------------------------------------------------------- * CCOLAMD, Copyright (C) Univ. of Florida. Authors: Timothy A. Davis, * Sivasankaran Rajamanickam, and Stefan Larimore - * See License.txt for the Version 2.1 of the GNU Lesser General Public License - * http://www.cise.ufl.edu/research/sparse * -------------------------------------------------------------------------- */ /* @@ -58,39 +56,13 @@ * COLAMD is also available under alternate licenses, contact T. Davis * for details. * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 - * USA - * - * Permission is hereby granted to use or copy this program under the - * terms of the GNU LGPL, 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 this code or any modified - * version of this 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. + * See CCOLAMD/Doc/License.txt for the license. * * Availability: * * The CCOLAMD/CSYMAMD library is available at * - * http://www.cise.ufl.edu/research/sparse/ccolamd/ - * - * This is the http://www.cise.ufl.edu/research/sparse/ccolamd/ccolamd.c - * file. + * http://www.suitesparse.com * * See the ChangeLog file for changes since Version 1.0. */ @@ -99,10 +71,10 @@ /* === Description of user-callable routines ================================ */ /* ========================================================================== */ -/* CCOLAMD includes both int and UF_long versions of all its routines. The - * description below is for the int version. For UF_long, all int arguments - * become UF_long integers. UF_long is normally defined as long, except for - * WIN64 */ +/* CCOLAMD includes both int and SuiteSparse_long versions of all its routines. + * The description below is for the int version. For SuiteSparse_long, all + * int arguments become SuiteSparse_long integers. SuiteSparse_long is + * normally defined as long, except for WIN64 */ /* ---------------------------------------------------------------------------- * ccolamd_recommended: @@ -112,8 +84,8 @@ * * #include "ccolamd.h" * size_t ccolamd_recommended (int nnz, int n_row, int n_col) ; - * size_t ccolamd_l_recommended (UF_long nnz, UF_long n_row, - * UF_long n_col) ; + * size_t ccolamd_l_recommended (SuiteSparse_long nnz, + * SuiteSparse_long n_row, SuiteSparse_long n_col) ; * * Purpose: * @@ -209,9 +181,12 @@ * double knobs [CCOLAMD_KNOBS], int stats [CCOLAMD_STATS], * int *cmember) ; * - * UF_long ccolamd_l (UF_long n_row, UF_long n_col, UF_long Alen, - * UF_long *A, UF_long *p, double knobs [CCOLAMD_KNOBS], - * UF_long stats [CCOLAMD_STATS], UF_long *cmember) ; + * SuiteSparse_long ccolamd_l (SuiteSparse_long n_row, + * SuiteSparse_long n_col, SuiteSparse_long Alen, + * SuiteSparse_long *A, SuiteSparse_long *p, + * double knobs [CCOLAMD_KNOBS], + * SuiteSparse_long stats [CCOLAMD_STATS], + * SuiteSparse_long *cmember) ; * * Purpose: * @@ -385,9 +360,7 @@ * * Example: * - * See - * http://www.cise.ufl.edu/research/sparse/ccolamd/ccolamd_example.c - * for a complete example. + * See ccolamd_example.c for a complete example. * * To order the columns of a 5-by-4 matrix with 11 nonzero entries in * the following nonzero pattern @@ -423,10 +396,12 @@ * void (*allocate) (size_t, size_t), void (*release) (void *), * int *cmember, int stype) ; * - * UF_long csymamd_l (UF_long n, UF_long *A, UF_long *p, UF_long *perm, - * double knobs [CCOLAMD_KNOBS], UF_long stats [CCOLAMD_STATS], - * void (*allocate) (size_t, size_t), void (*release) (void *), - * UF_long *cmember, UF_long stype) ; + * SuiteSparse_long csymamd_l (SuiteSparse_long n, + * SuiteSparse_long *A, SuiteSparse_long *p, + * SuiteSparse_long *perm, double knobs [CCOLAMD_KNOBS], + * SuiteSparse_long stats [CCOLAMD_STATS], void (*allocate) + * (size_t, size_t), void (*release) (void *), + * SuiteSparse_long *cmember, SuiteSparse_long stype) ; * * Purpose: * @@ -562,7 +537,7 @@ * * #include "ccolamd.h" * ccolamd_report (int stats [CCOLAMD_STATS]) ; - * ccolamd_l_report (UF_long stats [CCOLAMD_STATS]) ; + * ccolamd_l_report (SuiteSparse_long stats [CCOLAMD_STATS]) ; * * Purpose: * @@ -583,7 +558,7 @@ * * #include "ccolamd.h" * csymamd_report (int stats [CCOLAMD_STATS]) ; - * csymamd_l_report (UF_long stats [CCOLAMD_STATS]) ; + * csymamd_l_report (SuiteSparse_long stats [CCOLAMD_STATS]) ; * * Purpose: * @@ -617,12 +592,11 @@ #include "ccolamd.h" +#include #include #include #ifdef MATLAB_MEX_FILE -#include -typedef uint16_t char16_t; #include "mex.h" #include "matrix.h" #endif @@ -636,17 +610,14 @@ typedef uint16_t char16_t; #endif /* ========================================================================== */ -/* === int or UF_long ======================================================= */ +/* === int or SuiteSparse_long ============================================== */ /* ========================================================================== */ -/* define UF_long */ -#include "UFconfig.h" - #ifdef DLONG -#define Int UF_long -#define ID UF_long_id -#define Int_MAX UF_long_max +#define Int SuiteSparse_long +#define ID SuiteSparse_long_id +#define Int_MAX SuiteSparse_long_max #define CCOLAMD_recommended ccolamd_l_recommended #define CCOLAMD_set_defaults ccolamd_l_set_defaults @@ -811,9 +782,6 @@ typedef struct CColamd_Row_struct #define INDEX(i) (i) #endif -/* All output goes through the PRINTF macro. */ -#define PRINTF(params) { if (ccolamd_printf != NULL) (void) ccolamd_printf params ; } - /* ========================================================================== */ /* === Debugging prototypes and definitions ================================= */ @@ -827,11 +795,11 @@ typedef struct CColamd_Row_struct PRIVATE Int ccolamd_debug ; /* debug print statements */ -#define DEBUG0(params) { PRINTF (params) ; } -#define DEBUG1(params) { if (ccolamd_debug >= 1) PRINTF (params) ; } -#define DEBUG2(params) { if (ccolamd_debug >= 2) PRINTF (params) ; } -#define DEBUG3(params) { if (ccolamd_debug >= 3) PRINTF (params) ; } -#define DEBUG4(params) { if (ccolamd_debug >= 4) PRINTF (params) ; } +#define DEBUG0(params) { SUITESPARSE_PRINTF (params) ; } +#define DEBUG1(params) { if (ccolamd_debug >= 1) SUITESPARSE_PRINTF (params) ; } +#define DEBUG2(params) { if (ccolamd_debug >= 2) SUITESPARSE_PRINTF (params) ; } +#define DEBUG3(params) { if (ccolamd_debug >= 3) SUITESPARSE_PRINTF (params) ; } +#define DEBUG4(params) { if (ccolamd_debug >= 4) SUITESPARSE_PRINTF (params) ; } #ifdef MATLAB_MEX_FILE #define ASSERT(expression) (mxAssert ((expression), "")) @@ -3752,12 +3720,12 @@ PRIVATE void print_report Int i1, i2, i3 ; - PRINTF (("\n%s version %d.%d, %s: ", method, + SUITESPARSE_PRINTF (("\n%s version %d.%d, %s: ", method, CCOLAMD_MAIN_VERSION, CCOLAMD_SUB_VERSION, CCOLAMD_DATE)) ; if (!stats) { - PRINTF (("No statistics available.\n")) ; + SUITESPARSE_PRINTF (("No statistics available.\n")) ; return ; } @@ -3767,11 +3735,11 @@ PRIVATE void print_report if (stats [CCOLAMD_STATUS] >= 0) { - PRINTF(("OK. ")) ; + SUITESPARSE_PRINTF(("OK. ")) ; } else { - PRINTF(("ERROR. ")) ; + SUITESPARSE_PRINTF(("ERROR. ")) ; } switch (stats [CCOLAMD_STATUS]) @@ -3779,91 +3747,105 @@ PRIVATE void print_report case CCOLAMD_OK_BUT_JUMBLED: - PRINTF(("Matrix has unsorted or duplicate row indices.\n")) ; + SUITESPARSE_PRINTF(( + "Matrix has unsorted or duplicate row indices.\n")) ; - PRINTF(("%s: duplicate or out-of-order row indices: "ID"\n", - method, i3)) ; + SUITESPARSE_PRINTF(( + "%s: duplicate or out-of-order row indices: "ID"\n", + method, i3)) ; - PRINTF(("%s: last seen duplicate or out-of-order row: "ID"\n", - method, INDEX (i2))) ; + SUITESPARSE_PRINTF(( + "%s: last seen duplicate or out-of-order row: "ID"\n", + method, INDEX (i2))) ; - PRINTF(("%s: last seen in column: "ID"", - method, INDEX (i1))) ; + SUITESPARSE_PRINTF(( + "%s: last seen in column: "ID"", + method, INDEX (i1))) ; /* no break - fall through to next case instead */ case CCOLAMD_OK: - PRINTF(("\n")) ; + SUITESPARSE_PRINTF(("\n")) ; - PRINTF(("%s: number of dense or empty rows ignored: "ID"\n", - method, stats [CCOLAMD_DENSE_ROW])) ; + SUITESPARSE_PRINTF(( + "%s: number of dense or empty rows ignored: "ID"\n", + method, stats [CCOLAMD_DENSE_ROW])) ; - PRINTF(("%s: number of dense or empty columns ignored: "ID"\n", - method, stats [CCOLAMD_DENSE_COL])) ; + SUITESPARSE_PRINTF(( + "%s: number of dense or empty columns ignored: "ID"\n", + method, stats [CCOLAMD_DENSE_COL])) ; - PRINTF(("%s: number of garbage collections performed: "ID"\n", - method, stats [CCOLAMD_DEFRAG_COUNT])) ; + SUITESPARSE_PRINTF(( + "%s: number of garbage collections performed: "ID"\n", + method, stats [CCOLAMD_DEFRAG_COUNT])) ; break ; case CCOLAMD_ERROR_A_not_present: - PRINTF(("Array A (row indices of matrix) not present.\n")) ; + SUITESPARSE_PRINTF(( + "Array A (row indices of matrix) not present.\n")) ; break ; case CCOLAMD_ERROR_p_not_present: - PRINTF(("Array p (column pointers for matrix) not present.\n")) ; + SUITESPARSE_PRINTF(( + "Array p (column pointers for matrix) not present.\n")) ; break ; case CCOLAMD_ERROR_nrow_negative: - PRINTF(("Invalid number of rows ("ID").\n", i1)) ; + SUITESPARSE_PRINTF(("Invalid number of rows ("ID").\n", i1)) ; break ; case CCOLAMD_ERROR_ncol_negative: - PRINTF(("Invalid number of columns ("ID").\n", i1)) ; + SUITESPARSE_PRINTF(("Invalid number of columns ("ID").\n", i1)) ; break ; case CCOLAMD_ERROR_nnz_negative: - PRINTF(("Invalid number of nonzero entries ("ID").\n", i1)) ; + SUITESPARSE_PRINTF(( + "Invalid number of nonzero entries ("ID").\n", i1)) ; break ; case CCOLAMD_ERROR_p0_nonzero: - PRINTF(("Invalid column pointer, p [0] = "ID", must be 0.\n", i1)) ; + SUITESPARSE_PRINTF(( + "Invalid column pointer, p [0] = "ID", must be 0.\n", i1)) ; break ; case CCOLAMD_ERROR_A_too_small: - PRINTF(("Array A too small.\n")) ; - PRINTF((" Need Alen >= "ID", but given only Alen = "ID".\n", - i1, i2)) ; + SUITESPARSE_PRINTF(("Array A too small.\n")) ; + SUITESPARSE_PRINTF(( + " Need Alen >= "ID", but given only Alen = "ID".\n", + i1, i2)) ; break ; case CCOLAMD_ERROR_col_length_negative: - PRINTF(("Column "ID" has a negative number of entries ("ID").\n", - INDEX (i1), i2)) ; + SUITESPARSE_PRINTF(( + "Column "ID" has a negative number of entries ("ID").\n", + INDEX (i1), i2)) ; break ; case CCOLAMD_ERROR_row_index_out_of_bounds: - PRINTF(("Row index (row "ID") out of bounds ("ID" to "ID") in" - "column "ID".\n", INDEX (i2), INDEX (0), INDEX (i3-1), - INDEX (i1))) ; + SUITESPARSE_PRINTF(( + "Row index (row "ID") out of bounds ("ID" to "ID") in" + "column "ID".\n", INDEX (i2), INDEX (0), INDEX (i3-1), + INDEX (i1))) ; break ; case CCOLAMD_ERROR_out_of_memory: - PRINTF(("Out of memory.\n")) ; + SUITESPARSE_PRINTF(("Out of memory.\n")) ; break ; case CCOLAMD_ERROR_invalid_cmember: - PRINTF(("cmember invalid\n")) ; + SUITESPARSE_PRINTF(("cmember invalid\n")) ; break ; } } diff --git a/gtsam/3rdparty/CMakeLists.txt b/gtsam/3rdparty/CMakeLists.txt index 8534a8d7e..b890bc4af 100644 --- a/gtsam/3rdparty/CMakeLists.txt +++ b/gtsam/3rdparty/CMakeLists.txt @@ -1,6 +1,6 @@ # install CCOLAMD headers install(FILES CCOLAMD/Include/ccolamd.h DESTINATION include/gtsam/3rdparty/CCOLAMD) -install(FILES UFconfig/UFconfig.h DESTINATION include/gtsam/3rdparty/UFconfig) +install(FILES SuiteSparse_config/SuiteSparse_config.h DESTINATION include/gtsam/3rdparty/SuiteSparse_config) if(NOT GTSAM_USE_SYSTEM_EIGEN) # Find plain .h files diff --git a/gtsam/3rdparty/SuiteSparse_config/Makefile b/gtsam/3rdparty/SuiteSparse_config/Makefile new file mode 100644 index 000000000..96db5772f --- /dev/null +++ b/gtsam/3rdparty/SuiteSparse_config/Makefile @@ -0,0 +1,70 @@ +#------------------------------------------------------------------------------- +# SuiteSparse_config Makefile +#------------------------------------------------------------------------------- + +SUITESPARSE ?= $(realpath $(CURDIR)/..) +export SUITESPARSE + +# version of SuiteSparse_config is also version of SuiteSparse meta-package +LIBRARY = libsuitesparseconfig +VERSION = 4.5.2 +SO_VERSION = 4 + +default: library + +include SuiteSparse_config.mk + +ccode: all + +all: library + +# compile and install in SuiteSparse/lib +library: $(AR_TARGET) + $(MAKE) install INSTALL=$(SUITESPARSE) + +OBJ = SuiteSparse_config.o + +SuiteSparse_config.o: SuiteSparse_config.c SuiteSparse_config.h + $(CC) $(CF) -c SuiteSparse_config.c + +$(AR_TARGET): $(OBJ) + $(ARCHIVE) $(AR_TARGET) SuiteSparse_config.o + $(RANLIB) $(AR_TARGET) + +distclean: purge + +purge: clean + ( cd xerbla ; $(MAKE) purge ) + - $(RM) -r $(PURGE) + +clean: + ( cd xerbla ; $(MAKE) clean ) + - $(RM) -r $(CLEAN) + +# install SuiteSparse_config +install: $(AR_TARGET) $(INSTALL_LIB)/$(SO_TARGET) + +$(INSTALL_LIB)/$(SO_TARGET): $(OBJ) + @mkdir -p $(INSTALL_LIB) + @mkdir -p $(INSTALL_INCLUDE) + @mkdir -p $(INSTALL_DOC) + $(CC) $(SO_OPTS) $^ -o $@ $(LDLIBS) + ( cd $(INSTALL_LIB) ; ln -sf $(SO_TARGET) $(SO_PLAIN) ) + ( cd $(INSTALL_LIB) ; ln -sf $(SO_TARGET) $(SO_MAIN) ) + $(CP) SuiteSparse_config.h $(INSTALL_INCLUDE) + $(CP) README.txt $(INSTALL_DOC)/SUITESPARSECONFIG_README.txt + chmod 755 $(INSTALL_LIB)/$(SO_TARGET) + chmod 755 $(INSTALL_LIB)/$(SO_PLAIN) + chmod 644 $(INSTALL_INCLUDE)/SuiteSparse_config.h + chmod 644 $(INSTALL_DOC)/SUITESPARSECONFIG_README.txt + +# uninstall SuiteSparse_config +uninstall: + $(RM) $(INSTALL_LIB)/$(SO_TARGET) + $(RM) $(INSTALL_LIB)/$(SO_PLAIN) + $(RM) $(INSTALL_LIB)/$(SO_MAIN) + $(RM) $(INSTALL_INCLUDE)/SuiteSparse_config.h + $(RM) $(INSTALL_DOC)/SUITESPARSECONFIG_README.txt + ( cd xerbla ; $(MAKE) uninstall ) + + diff --git a/gtsam/3rdparty/SuiteSparse_config/README.txt b/gtsam/3rdparty/SuiteSparse_config/README.txt new file mode 100644 index 000000000..a76a5fab6 --- /dev/null +++ b/gtsam/3rdparty/SuiteSparse_config/README.txt @@ -0,0 +1,51 @@ +SuiteSparse_config, 2016, Timothy A. Davis, http://www.suitesparse.com +(formerly the UFconfig package) + +This directory contains a default SuiteSparse_config.mk file. It tries to +detect your system (Linux, SunOS, or Mac), which compiler to use (icc or cc), +which BLAS and LAPACK library to use (OpenBLAS or MKL), and whether or not to +compile with CUDA. + +For alternatives, see the comments in the SuiteSparse_config.mk file. + +License: No licensing restrictions apply to this file or to the +SuiteSparse_config directory. + +-------------------------------------------------------------------------------- + +SuiteSparse_config contains configuration settings for all many of the software +packages that I develop or co-author. Note that older versions of some of +these packages do not require SuiteSparse_config. + + Package Description + ------- ----------- + AMD approximate minimum degree ordering + CAMD constrained AMD + COLAMD column approximate minimum degree ordering + CCOLAMD constrained approximate minimum degree ordering + UMFPACK sparse LU factorization, with the BLAS + CXSparse int/long/real/complex version of CSparse + CHOLMOD sparse Cholesky factorization, update/downdate + KLU sparse LU factorization, BLAS-free + BTF permutation to block triangular form + LDL concise sparse LDL' + LPDASA LP Dual Active Set Algorithm + RBio read/write files in Rutherford/Boeing format + SPQR sparse QR factorization (full name: SuiteSparseQR) + +SuiteSparse_config is not required by these packages: + + CSparse a Concise Sparse matrix package + MATLAB_Tools toolboxes for use in MATLAB + +In addition, the xerbla/ directory contains Fortan and C versions of the +BLAS/LAPACK xerbla routine, which is called when an invalid input is passed to +the BLAS or LAPACK. The xerbla provided here does not print any message, so +the entire Fortran I/O library does not need to be linked into a C application. +Most versions of the BLAS contain xerbla, but those from K. Goto do not. Use +this if you need too. + +If you edit this directory (SuiteSparse_config.mk in particular) then you +must do "make purge ; make" in the parent directory to recompile all of +SuiteSparse. Otherwise, the changes will not necessarily be applied. + diff --git a/gtsam/3rdparty/SuiteSparse_config/SuiteSparse_config.c b/gtsam/3rdparty/SuiteSparse_config/SuiteSparse_config.c new file mode 100644 index 000000000..b491539fe --- /dev/null +++ b/gtsam/3rdparty/SuiteSparse_config/SuiteSparse_config.c @@ -0,0 +1,531 @@ +/* ========================================================================== */ +/* === SuiteSparse_config =================================================== */ +/* ========================================================================== */ + +/* SuiteSparse configuration : memory manager and printf functions. */ + +/* Copyright (c) 2013, Timothy A. Davis. No licensing restrictions + * apply to this file or to the SuiteSparse_config directory. + * Author: Timothy A. Davis. + */ + +#include +#include + +#ifndef NPRINT +#include +#endif + +#ifdef MATLAB_MEX_FILE +#include "mex.h" +#include "matrix.h" +#endif + +#ifndef NULL +#define NULL ((void *) 0) +#endif + +#include "SuiteSparse_config.h" + +/* -------------------------------------------------------------------------- */ +/* SuiteSparse_config : a global extern struct */ +/* -------------------------------------------------------------------------- */ + +/* The SuiteSparse_config struct is available to all SuiteSparse functions and + to all applications that use those functions. It must be modified with + care, particularly in a multithreaded context. Normally, the application + will initialize this object once, via SuiteSparse_start, possibily followed + by application-specific modifications if the applications wants to use + alternative memory manager functions. + + The user can redefine these global pointers at run-time to change the + memory manager and printf function used by SuiteSparse. + + If -DNMALLOC is defined at compile-time, then no memory-manager is + specified. You must define them at run-time, after calling + SuiteSparse_start. + + If -DPRINT is defined a compile time, then printf is disabled, and + SuiteSparse will not use printf. + */ + +struct SuiteSparse_config_struct SuiteSparse_config = +{ + + /* memory management functions */ + #ifndef NMALLOC + #ifdef MATLAB_MEX_FILE + /* MATLAB mexFunction: */ + mxMalloc, mxCalloc, mxRealloc, mxFree, + #else + /* standard ANSI C: */ + malloc, calloc, realloc, free, + #endif + #else + /* no memory manager defined; you must define one at run-time: */ + NULL, NULL, NULL, NULL, + #endif + + /* printf function */ + #ifndef NPRINT + #ifdef MATLAB_MEX_FILE + /* MATLAB mexFunction: */ + mexPrintf, + #else + /* standard ANSI C: */ + printf, + #endif + #else + /* printf is disabled */ + NULL, + #endif + + SuiteSparse_hypot, + SuiteSparse_divcomplex + +} ; + +/* -------------------------------------------------------------------------- */ +/* SuiteSparse_start */ +/* -------------------------------------------------------------------------- */ + +/* All applications that use SuiteSparse should call SuiteSparse_start prior + to using any SuiteSparse function. Only a single thread should call this + function, in a multithreaded application. Currently, this function is + optional, since all this function currently does is to set the four memory + function pointers to NULL (which tells SuiteSparse to use the default + functions). In a multi- threaded application, only a single thread should + call this function. + + Future releases of SuiteSparse might enforce a requirement that + SuiteSparse_start be called prior to calling any SuiteSparse function. + */ + +void SuiteSparse_start ( void ) +{ + + /* memory management functions */ + #ifndef NMALLOC + #ifdef MATLAB_MEX_FILE + /* MATLAB mexFunction: */ + SuiteSparse_config.malloc_func = mxMalloc ; + SuiteSparse_config.calloc_func = mxCalloc ; + SuiteSparse_config.realloc_func = mxRealloc ; + SuiteSparse_config.free_func = mxFree ; + #else + /* standard ANSI C: */ + SuiteSparse_config.malloc_func = malloc ; + SuiteSparse_config.calloc_func = calloc ; + SuiteSparse_config.realloc_func = realloc ; + SuiteSparse_config.free_func = free ; + #endif + #else + /* no memory manager defined; you must define one after calling + SuiteSparse_start */ + SuiteSparse_config.malloc_func = NULL ; + SuiteSparse_config.calloc_func = NULL ; + SuiteSparse_config.realloc_func = NULL ; + SuiteSparse_config.free_func = NULL ; + #endif + + /* printf function */ + #ifndef NPRINT + #ifdef MATLAB_MEX_FILE + /* MATLAB mexFunction: */ + SuiteSparse_config.printf_func = mexPrintf ; + #else + /* standard ANSI C: */ + SuiteSparse_config.printf_func = printf ; + #endif + #else + /* printf is disabled */ + SuiteSparse_config.printf_func = NULL ; + #endif + + /* math functions */ + SuiteSparse_config.hypot_func = SuiteSparse_hypot ; + SuiteSparse_config.divcomplex_func = SuiteSparse_divcomplex ; +} + +/* -------------------------------------------------------------------------- */ +/* SuiteSparse_finish */ +/* -------------------------------------------------------------------------- */ + +/* This currently does nothing, but in the future, applications should call + SuiteSparse_start before calling any SuiteSparse function, and then + SuiteSparse_finish after calling the last SuiteSparse function, just before + exiting. In a multithreaded application, only a single thread should call + this function. + + Future releases of SuiteSparse might use this function for any + SuiteSparse-wide cleanup operations or finalization of statistics. + */ + +void SuiteSparse_finish ( void ) +{ + /* do nothing */ ; +} + +/* -------------------------------------------------------------------------- */ +/* SuiteSparse_malloc: malloc wrapper */ +/* -------------------------------------------------------------------------- */ + +void *SuiteSparse_malloc /* pointer to allocated block of memory */ +( + size_t nitems, /* number of items to malloc */ + size_t size_of_item /* sizeof each item */ +) +{ + void *p ; + size_t size ; + if (nitems < 1) nitems = 1 ; + if (size_of_item < 1) size_of_item = 1 ; + size = nitems * size_of_item ; + + if (size != ((double) nitems) * size_of_item) + { + /* size_t overflow */ + p = NULL ; + } + else + { + p = (void *) (SuiteSparse_config.malloc_func) (size) ; + } + return (p) ; +} + + +/* -------------------------------------------------------------------------- */ +/* SuiteSparse_calloc: calloc wrapper */ +/* -------------------------------------------------------------------------- */ + +void *SuiteSparse_calloc /* pointer to allocated block of memory */ +( + size_t nitems, /* number of items to calloc */ + size_t size_of_item /* sizeof each item */ +) +{ + void *p ; + size_t size ; + if (nitems < 1) nitems = 1 ; + if (size_of_item < 1) size_of_item = 1 ; + size = nitems * size_of_item ; + + if (size != ((double) nitems) * size_of_item) + { + /* size_t overflow */ + p = NULL ; + } + else + { + p = (void *) (SuiteSparse_config.calloc_func) (nitems, size_of_item) ; + } + return (p) ; +} + +/* -------------------------------------------------------------------------- */ +/* SuiteSparse_realloc: realloc wrapper */ +/* -------------------------------------------------------------------------- */ + +/* If p is non-NULL on input, it points to a previously allocated object of + size nitems_old * size_of_item. The object is reallocated to be of size + nitems_new * size_of_item. If p is NULL on input, then a new object of that + size is allocated. On success, a pointer to the new object is returned, + and ok is returned as 1. If the allocation fails, ok is set to 0 and a + pointer to the old (unmodified) object is returned. + */ + +void *SuiteSparse_realloc /* pointer to reallocated block of memory, or + to original block if the realloc failed. */ +( + size_t nitems_new, /* new number of items in the object */ + size_t nitems_old, /* old number of items in the object */ + size_t size_of_item, /* sizeof each item */ + void *p, /* old object to reallocate */ + int *ok /* 1 if successful, 0 otherwise */ +) +{ + size_t size ; + if (nitems_old < 1) nitems_old = 1 ; + if (nitems_new < 1) nitems_new = 1 ; + if (size_of_item < 1) size_of_item = 1 ; + size = nitems_new * size_of_item ; + + if (size != ((double) nitems_new) * size_of_item) + { + /* size_t overflow */ + (*ok) = 0 ; + } + else if (p == NULL) + { + /* a fresh object is being allocated */ + p = SuiteSparse_malloc (nitems_new, size_of_item) ; + (*ok) = (p != NULL) ; + } + else if (nitems_old == nitems_new) + { + /* the object does not change; do nothing */ + (*ok) = 1 ; + } + else + { + /* change the size of the object from nitems_old to nitems_new */ + void *pnew ; + pnew = (void *) (SuiteSparse_config.realloc_func) (p, size) ; + if (pnew == NULL) + { + if (nitems_new < nitems_old) + { + /* the attempt to reduce the size of the block failed, but + the old block is unchanged. So pretend to succeed. */ + (*ok) = 1 ; + } + else + { + /* out of memory */ + (*ok) = 0 ; + } + } + else + { + /* success */ + p = pnew ; + (*ok) = 1 ; + } + } + return (p) ; +} + +/* -------------------------------------------------------------------------- */ +/* SuiteSparse_free: free wrapper */ +/* -------------------------------------------------------------------------- */ + +void *SuiteSparse_free /* always returns NULL */ +( + void *p /* block to free */ +) +{ + if (p) + { + (SuiteSparse_config.free_func) (p) ; + } + return (NULL) ; +} + + +/* -------------------------------------------------------------------------- */ +/* SuiteSparse_tic: return current wall clock time */ +/* -------------------------------------------------------------------------- */ + +/* Returns the number of seconds (tic [0]) and nanoseconds (tic [1]) since some + * unspecified but fixed time in the past. If no timer is installed, zero is + * returned. A scalar double precision value for 'tic' could be used, but this + * might cause loss of precision because clock_getttime returns the time from + * some distant time in the past. Thus, an array of size 2 is used. + * + * The timer is enabled by default. To disable the timer, compile with + * -DNTIMER. If enabled on a POSIX C 1993 system, the timer requires linking + * with the -lrt library. + * + * example: + * + * double tic [2], r, s, t ; + * SuiteSparse_tic (tic) ; // start the timer + * // do some work A + * t = SuiteSparse_toc (tic) ; // t is time for work A, in seconds + * // do some work B + * s = SuiteSparse_toc (tic) ; // s is time for work A and B, in seconds + * SuiteSparse_tic (tic) ; // restart the timer + * // do some work C + * r = SuiteSparse_toc (tic) ; // s is time for work C, in seconds + * + * A double array of size 2 is used so that this routine can be more easily + * ported to non-POSIX systems. The caller does not rely on the POSIX + * include file. + */ + +#ifdef SUITESPARSE_TIMER_ENABLED + +#include + +void SuiteSparse_tic +( + double tic [2] /* output, contents undefined on input */ +) +{ + /* POSIX C 1993 timer, requires -librt */ + struct timespec t ; + clock_gettime (CLOCK_MONOTONIC, &t) ; + tic [0] = (double) (t.tv_sec) ; + tic [1] = (double) (t.tv_nsec) ; +} + +#else + +void SuiteSparse_tic +( + double tic [2] /* output, contents undefined on input */ +) +{ + /* no timer installed */ + tic [0] = 0 ; + tic [1] = 0 ; +} + +#endif + + +/* -------------------------------------------------------------------------- */ +/* SuiteSparse_toc: return time since last tic */ +/* -------------------------------------------------------------------------- */ + +/* Assuming SuiteSparse_tic is accurate to the nanosecond, this function is + * accurate down to the nanosecond for 2^53 nanoseconds since the last call to + * SuiteSparse_tic, which is sufficient for SuiteSparse (about 104 days). If + * additional accuracy is required, the caller can use two calls to + * SuiteSparse_tic and do the calculations differently. + */ + +double SuiteSparse_toc /* returns time in seconds since last tic */ +( + double tic [2] /* input, not modified from last call to SuiteSparse_tic */ +) +{ + double toc [2] ; + SuiteSparse_tic (toc) ; + return ((toc [0] - tic [0]) + 1e-9 * (toc [1] - tic [1])) ; +} + + +/* -------------------------------------------------------------------------- */ +/* SuiteSparse_time: return current wallclock time in seconds */ +/* -------------------------------------------------------------------------- */ + +/* This function might not be accurate down to the nanosecond. */ + +double SuiteSparse_time /* returns current wall clock time in seconds */ +( + void +) +{ + double toc [2] ; + SuiteSparse_tic (toc) ; + return (toc [0] + 1e-9 * toc [1]) ; +} + + +/* -------------------------------------------------------------------------- */ +/* SuiteSparse_version: return the current version of SuiteSparse */ +/* -------------------------------------------------------------------------- */ + +int SuiteSparse_version +( + int version [3] +) +{ + if (version != NULL) + { + version [0] = SUITESPARSE_MAIN_VERSION ; + version [1] = SUITESPARSE_SUB_VERSION ; + version [2] = SUITESPARSE_SUBSUB_VERSION ; + } + return (SUITESPARSE_VERSION) ; +} + +/* -------------------------------------------------------------------------- */ +/* SuiteSparse_hypot */ +/* -------------------------------------------------------------------------- */ + +/* There is an equivalent routine called hypot in , which conforms + * to ANSI C99. However, SuiteSparse does not assume that ANSI C99 is + * available. You can use the ANSI C99 hypot routine with: + * + * #include + *i SuiteSparse_config.hypot_func = hypot ; + * + * Default value of the SuiteSparse_config.hypot_func pointer is + * SuiteSparse_hypot, defined below. + * + * s = hypot (x,y) computes s = sqrt (x*x + y*y) but does so more accurately. + * The NaN cases for the double relops x >= y and x+y == x are safely ignored. + * + * Source: Algorithm 312, "Absolute value and square root of a complex number," + * P. Friedland, Comm. ACM, vol 10, no 10, October 1967, page 665. + */ + +double SuiteSparse_hypot (double x, double y) +{ + double s, r ; + x = fabs (x) ; + y = fabs (y) ; + if (x >= y) + { + if (x + y == x) + { + s = x ; + } + else + { + r = y / x ; + s = x * sqrt (1.0 + r*r) ; + } + } + else + { + if (y + x == y) + { + s = y ; + } + else + { + r = x / y ; + s = y * sqrt (1.0 + r*r) ; + } + } + return (s) ; +} + +/* -------------------------------------------------------------------------- */ +/* SuiteSparse_divcomplex */ +/* -------------------------------------------------------------------------- */ + +/* c = a/b where c, a, and b are complex. The real and imaginary parts are + * passed as separate arguments to this routine. The NaN case is ignored + * for the double relop br >= bi. Returns 1 if the denominator is zero, + * 0 otherwise. + * + * This uses ACM Algo 116, by R. L. Smith, 1962, which tries to avoid + * underflow and overflow. + * + * c can be the same variable as a or b. + * + * Default value of the SuiteSparse_config.divcomplex_func pointer is + * SuiteSparse_divcomplex. + */ + +int SuiteSparse_divcomplex +( + double ar, double ai, /* real and imaginary parts of a */ + double br, double bi, /* real and imaginary parts of b */ + double *cr, double *ci /* real and imaginary parts of c */ +) +{ + double tr, ti, r, den ; + if (fabs (br) >= fabs (bi)) + { + r = bi / br ; + den = br + r * bi ; + tr = (ar + ai * r) / den ; + ti = (ai - ar * r) / den ; + } + else + { + r = br / bi ; + den = r * br + bi ; + tr = (ar * r + ai) / den ; + ti = (ai * r - ar) / den ; + } + *cr = tr ; + *ci = ti ; + return (den == 0.) ; +} diff --git a/gtsam/3rdparty/SuiteSparse_config/SuiteSparse_config.h b/gtsam/3rdparty/SuiteSparse_config/SuiteSparse_config.h new file mode 100644 index 000000000..49296fc5a --- /dev/null +++ b/gtsam/3rdparty/SuiteSparse_config/SuiteSparse_config.h @@ -0,0 +1,248 @@ +/* ========================================================================== */ +/* === SuiteSparse_config =================================================== */ +/* ========================================================================== */ + +/* Configuration file for SuiteSparse: a Suite of Sparse matrix packages + * (AMD, COLAMD, CCOLAMD, CAMD, CHOLMOD, UMFPACK, CXSparse, and others). + * + * SuiteSparse_config.h provides the definition of the long integer. On most + * systems, a C program can be compiled in LP64 mode, in which long's and + * pointers are both 64-bits, and int's are 32-bits. Windows 64, however, uses + * the LLP64 model, in which int's and long's are 32-bits, and long long's and + * pointers are 64-bits. + * + * SuiteSparse packages that include long integer versions are + * intended for the LP64 mode. However, as a workaround for Windows 64 + * (and perhaps other systems), the long integer can be redefined. + * + * If _WIN64 is defined, then the __int64 type is used instead of long. + * + * The long integer can also be defined at compile time. For example, this + * could be added to SuiteSparse_config.mk: + * + * CFLAGS = -O -D'SuiteSparse_long=long long' \ + * -D'SuiteSparse_long_max=9223372036854775801' -D'SuiteSparse_long_idd="lld"' + * + * This file defines SuiteSparse_long as either long (on all but _WIN64) or + * __int64 on Windows 64. The intent is that a SuiteSparse_long is always a + * 64-bit integer in a 64-bit code. ptrdiff_t might be a better choice than + * long; it is always the same size as a pointer. + * + * This file also defines the SUITESPARSE_VERSION and related definitions. + * + * Copyright (c) 2012, Timothy A. Davis. No licensing restrictions apply + * to this file or to the SuiteSparse_config directory. + * Author: Timothy A. Davis. + */ + +#ifndef SUITESPARSE_CONFIG_H +#define SUITESPARSE_CONFIG_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +/* ========================================================================== */ +/* === SuiteSparse_long ===================================================== */ +/* ========================================================================== */ + +#ifndef SuiteSparse_long + +#ifdef _WIN64 + +#define SuiteSparse_long __int64 +#define SuiteSparse_long_max _I64_MAX +#define SuiteSparse_long_idd "I64d" + +#else + +#define SuiteSparse_long long +#define SuiteSparse_long_max LONG_MAX +#define SuiteSparse_long_idd "ld" + +#endif +#define SuiteSparse_long_id "%" SuiteSparse_long_idd +#endif + +/* ========================================================================== */ +/* === SuiteSparse_config parameters and functions ========================== */ +/* ========================================================================== */ + +/* SuiteSparse-wide parameters are placed in this struct. It is meant to be + an extern, globally-accessible struct. It is not meant to be updated + frequently by multiple threads. Rather, if an application needs to modify + SuiteSparse_config, it should do it once at the beginning of the application, + before multiple threads are launched. + + The intent of these function pointers is that they not be used in your + application directly, except to assign them to the desired user-provided + functions. Rather, you should use the + */ + +struct SuiteSparse_config_struct +{ + void *(*malloc_func) (size_t) ; /* pointer to malloc */ + void *(*calloc_func) (size_t, size_t) ; /* pointer to calloc */ + void *(*realloc_func) (void *, size_t) ; /* pointer to realloc */ + void (*free_func) (void *) ; /* pointer to free */ + int (*printf_func) (const char *, ...) ; /* pointer to printf */ + double (*hypot_func) (double, double) ; /* pointer to hypot */ + int (*divcomplex_func) (double, double, double, double, double *, double *); +} ; + +extern struct SuiteSparse_config_struct SuiteSparse_config ; + +void SuiteSparse_start ( void ) ; /* called to start SuiteSparse */ + +void SuiteSparse_finish ( void ) ; /* called to finish SuiteSparse */ + +void *SuiteSparse_malloc /* pointer to allocated block of memory */ +( + size_t nitems, /* number of items to malloc (>=1 is enforced) */ + size_t size_of_item /* sizeof each item */ +) ; + +void *SuiteSparse_calloc /* pointer to allocated block of memory */ +( + size_t nitems, /* number of items to calloc (>=1 is enforced) */ + size_t size_of_item /* sizeof each item */ +) ; + +void *SuiteSparse_realloc /* pointer to reallocated block of memory, or + to original block if the realloc failed. */ +( + size_t nitems_new, /* new number of items in the object */ + size_t nitems_old, /* old number of items in the object */ + size_t size_of_item, /* sizeof each item */ + void *p, /* old object to reallocate */ + int *ok /* 1 if successful, 0 otherwise */ +) ; + +void *SuiteSparse_free /* always returns NULL */ +( + void *p /* block to free */ +) ; + +void SuiteSparse_tic /* start the timer */ +( + double tic [2] /* output, contents undefined on input */ +) ; + +double SuiteSparse_toc /* return time in seconds since last tic */ +( + double tic [2] /* input: from last call to SuiteSparse_tic */ +) ; + +double SuiteSparse_time /* returns current wall clock time in seconds */ +( + void +) ; + +/* returns sqrt (x^2 + y^2), computed reliably */ +double SuiteSparse_hypot (double x, double y) ; + +/* complex division of c = a/b */ +int SuiteSparse_divcomplex +( + double ar, double ai, /* real and imaginary parts of a */ + double br, double bi, /* real and imaginary parts of b */ + double *cr, double *ci /* real and imaginary parts of c */ +) ; + +/* determine which timer to use, if any */ +#ifndef NTIMER +#ifdef _POSIX_C_SOURCE +#if _POSIX_C_SOURCE >= 199309L +#define SUITESPARSE_TIMER_ENABLED +#endif +#endif +#endif + +/* SuiteSparse printf macro */ +#define SUITESPARSE_PRINTF(params) \ +{ \ + if (SuiteSparse_config.printf_func != NULL) \ + { \ + (void) (SuiteSparse_config.printf_func) params ; \ + } \ +} + +/* ========================================================================== */ +/* === SuiteSparse version ================================================== */ +/* ========================================================================== */ + +/* SuiteSparse is not a package itself, but a collection of packages, some of + * which must be used together (UMFPACK requires AMD, CHOLMOD requires AMD, + * COLAMD, CAMD, and CCOLAMD, etc). A version number is provided here for the + * collection itself. The versions of packages within each version of + * SuiteSparse are meant to work together. Combining one package from one + * version of SuiteSparse, with another package from another version of + * SuiteSparse, may or may not work. + * + * SuiteSparse contains the following packages: + * + * SuiteSparse_config version 4.5.2 (version always the same as SuiteSparse) + * AMD version 2.4.5 + * BTF version 1.2.5 + * CAMD version 2.4.5 + * CCOLAMD version 2.9.5 + * CHOLMOD version 3.0.10 + * COLAMD version 2.9.5 + * CSparse version 3.1.8 + * CXSparse version 3.1.8 + * GPUQREngine version 1.0.4 + * KLU version 1.3.7 + * LDL version 2.2.5 + * RBio version 2.2.5 + * SPQR version 2.0.6 + * SuiteSparse_GPURuntime version 1.0.4 + * UMFPACK version 5.7.5 + * MATLAB_Tools various packages & M-files + * xerbla version 1.0.2 + * + * Other package dependencies: + * BLAS required by CHOLMOD and UMFPACK + * LAPACK required by CHOLMOD + * METIS 5.1.0 required by CHOLMOD (optional) and KLU (optional) + * CUBLAS, CUDART NVIDIA libraries required by CHOLMOD and SPQR when + * they are compiled with GPU acceleration. + */ + + +int SuiteSparse_version /* returns SUITESPARSE_VERSION */ +( + /* output, not defined on input. Not used if NULL. Returns + the three version codes in version [0..2]: + version [0] is SUITESPARSE_MAIN_VERSION + version [1] is SUITESPARSE_SUB_VERSION + version [2] is SUITESPARSE_SUBSUB_VERSION + */ + int version [3] +) ; + +/* Versions prior to 4.2.0 do not have the above function. The following + code fragment will work with any version of SuiteSparse: + + #ifdef SUITESPARSE_HAS_VERSION_FUNCTION + v = SuiteSparse_version (NULL) ; + #else + v = SUITESPARSE_VERSION ; + #endif +*/ +#define SUITESPARSE_HAS_VERSION_FUNCTION + +#define SUITESPARSE_DATE "Apr 1, 2016" +#define SUITESPARSE_VER_CODE(main,sub) ((main) * 1000 + (sub)) +#define SUITESPARSE_MAIN_VERSION 4 +#define SUITESPARSE_SUB_VERSION 5 +#define SUITESPARSE_SUBSUB_VERSION 2 +#define SUITESPARSE_VERSION \ + SUITESPARSE_VER_CODE(SUITESPARSE_MAIN_VERSION,SUITESPARSE_SUB_VERSION) + +#ifdef __cplusplus +} +#endif +#endif diff --git a/gtsam/3rdparty/SuiteSparse_config/SuiteSparse_config.mk b/gtsam/3rdparty/SuiteSparse_config/SuiteSparse_config.mk new file mode 100644 index 000000000..40ad6b9af --- /dev/null +++ b/gtsam/3rdparty/SuiteSparse_config/SuiteSparse_config.mk @@ -0,0 +1,600 @@ +#=============================================================================== +# SuiteSparse_config.mk: common configuration file for the SuiteSparse +#=============================================================================== + +# This file contains all configuration settings for all packages in SuiteSparse, +# except for CSparse (which is stand-alone) and the packages in MATLAB_Tools. + +SUITESPARSE_VERSION = 4.5.2 + +#=============================================================================== +# Options you can change without editing this file: +#=============================================================================== + + # To list the options you can modify at the 'make' command line, type + # 'make config', which also lists their default values. You can then + # change them with 'make OPTION=value'. For example, to use an INSTALL + # path of /my/path, and to use your own BLAS and LAPACK libraries, do: + # + # make install INSTALL=/my/path BLAS=-lmyblas LAPACK=-lmylapackgoeshere + # + # which will install the package into /my/path/lib and /my/path/include, + # and use -lmyblas -lmylapackgoes here when building the demo program. + +#=============================================================================== +# Defaults for any system +#=============================================================================== + + #--------------------------------------------------------------------------- + # SuiteSparse root directory + #--------------------------------------------------------------------------- + + # Most Makefiles are in SuiteSparse/Pkg/Lib or SuiteSparse/Pkg/Demo, so + # the top-level of SuiteSparse is in ../.. unless otherwise specified. + # This is true for all but the SuiteSparse_config package. + SUITESPARSE ?= $(realpath $(CURDIR)/../..) + + #--------------------------------------------------------------------------- + # installation location + #--------------------------------------------------------------------------- + + # For "make install" and "make uninstall", the default location is + # SuiteSparse/lib, SuiteSparse/include, and + # SuiteSparse/share/doc/suitesparse-x.y.z + # If you do this: + # make install INSTALL=/usr/local + # then the libraries are installed in /usr/local/lib, include files in + # /usr/local/include, and documentation in + # /usr/local/share/doc/suitesparse-x.y.z. + # You can instead specify the install location of each of these 3 components + # separately, via (for example): + # make install INSTALL_LIB=/yada/mylibs INSTALL_INCLUDE=/yoda/myinc \ + # INSTALL_DOC=/solo/mydox + # which puts the libraries in /yada/mylibs, include files in /yoda/myinc, + # and documentation in /solo/mydox. + INSTALL ?= $(SUITESPARSE) + INSTALL_LIB ?= $(INSTALL)/lib + INSTALL_INCLUDE ?= $(INSTALL)/include + INSTALL_DOC ?= $(INSTALL)/share/doc/suitesparse-$(SUITESPARSE_VERSION) + + #--------------------------------------------------------------------------- + # optimization level + #--------------------------------------------------------------------------- + + OPTIMIZATION ?= -O3 + + #--------------------------------------------------------------------------- + # statement coverage for */Tcov + #--------------------------------------------------------------------------- + + ifeq ($(TCOV),yes) + # Each package has a */Tcov directory for extensive testing, including + # statement coverage. The Tcov tests require Linux and gcc, and use + # the vanilla BLAS. For those tests, the packages use 'make TCOV=yes', + # which overrides the following settings: + MKLROOT = + AUTOCC = no + CC = gcc + CXX = g++ + BLAS = -lrefblas -lgfortran -lstdc++ + LAPACK = -llapack + CFLAGS += --coverage + OPTIMIZATION = -g + LDFLAGS += --coverage + endif + + #--------------------------------------------------------------------------- + # CFLAGS for the C/C++ compiler + #--------------------------------------------------------------------------- + + # The CF macro is used by SuiteSparse Makefiles as a combination of + # CFLAGS, CPPFLAGS, TARGET_ARCH, and system-dependent settings. + CF ?= $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) $(OPTIMIZATION) -fexceptions -fPIC + + #--------------------------------------------------------------------------- + # OpenMP is used in CHOLMOD + #--------------------------------------------------------------------------- + + # with gcc, enable OpenMP directives via -fopenmp + # This is not supported on Darwin, so this string is cleared, below. + CFOPENMP ?= -fopenmp + + #--------------------------------------------------------------------------- + # compiler + #--------------------------------------------------------------------------- + + # By default, look for the Intel compilers. If present, they are used + # instead of $(CC), $(CXX), and $(F77). To disable this feature and + # use the $(CC), $(CXX), and $(F77) compilers, use 'make AUTOCC=no' + + AUTOCC ?= yes + + ifneq ($(AUTOCC),no) + ifneq ($(shell which icc 2>/dev/null),) + # use the Intel icc compiler for C codes, and -qopenmp for OpenMP + CC = icc -D_GNU_SOURCE + CXX = $(CC) + CFOPENMP = -qopenmp -I$(MKLROOT)/include + endif + ifneq ($(shell which ifort 2>/dev/null),) + # use the Intel ifort compiler for Fortran codes + F77 = ifort + endif + endif + + #--------------------------------------------------------------------------- + # code formatting (for Tcov only) + #--------------------------------------------------------------------------- + + PRETTY ?= grep -v "^\#" | indent -bl -nce -bli0 -i4 -sob -l120 + + #--------------------------------------------------------------------------- + # required libraries + #--------------------------------------------------------------------------- + + # SuiteSparse requires the BLAS, LAPACK, and -lm (Math) libraries. + # It places its shared *.so libraries in SuiteSparse/lib. + # Linux also requires the -lrt library (see below) + LDLIBS ?= -lm + LDFLAGS += -L$(INSTALL_LIB) + + # See http://www.openblas.net for a recent and freely available optimzed + # BLAS. LAPACK is at http://www.netlib.org/lapack/ . You can use the + # standard Fortran LAPACK along with OpenBLAS to obtain very good + # performance. This script can also detect if the Intel MKL BLAS is + # installed. + + LAPACK ?= -llapack + + ifndef BLAS + ifdef MKLROOT + # use the Intel MKL for BLAS and LAPACK + # using static linking: + # BLAS = -Wl,--start-group \ + # $(MKLROOT)/lib/intel64/libmkl_intel_lp64.a \ + # $(MKLROOT)/lib/intel64/libmkl_core.a \ + # $(MKLROOT)/lib/intel64/libmkl_intel_thread.a \ + # -Wl,--end-group -lpthread -lm + # using dynamic linking: + BLAS = -lmkl_intel_lp64 -lmkl_core -lmkl_intel_thread -lpthread -lm + LAPACK = + else + # use the OpenBLAS at http://www.openblas.net + BLAS = -lopenblas + endif + endif + + # For ACML, use this instead: + # make BLAS='-lacml -lgfortran' + + #--------------------------------------------------------------------------- + # shell commands + #--------------------------------------------------------------------------- + + # ranlib, and ar, for generating libraries. If you don't need ranlib, + # just change it to RANLAB = echo + RANLIB ?= ranlib + ARCHIVE ?= $(AR) $(ARFLAGS) + CP ?= cp -f + MV ?= mv -f + + #--------------------------------------------------------------------------- + # Fortran compiler (not required for 'make' or 'make library') + #--------------------------------------------------------------------------- + + # A Fortran compiler is optional. Only required for the optional Fortran + # interfaces to AMD and UMFPACK. Not needed by 'make' or 'make install' + F77 ?= gfortran + F77FLAGS ?= $(FFLAGS) $(OPTIMIZATION) + + #--------------------------------------------------------------------------- + # NVIDIA CUDA configuration for CHOLMOD and SPQR + #--------------------------------------------------------------------------- + + # CUDA is detected automatically, and used if found. To disable CUDA, + # use CUDA=no + + ifneq ($(CUDA),no) + CUDA_PATH = $(shell which nvcc 2>/dev/null | sed "s/\/bin\/nvcc//") + endif + + ifeq ($(wildcard $(CUDA_PATH)),) + # CUDA is not present + CUDA_PATH = + GPU_BLAS_PATH = + GPU_CONFIG = + CUDART_LIB = + CUBLAS_LIB = + CUDA_INC_PATH = + CUDA_INC = + NVCC = echo + NVCCFLAGS = + else + # with CUDA for CHOLMOD and SPQR + GPU_BLAS_PATH = $(CUDA_PATH) + # GPU_CONFIG must include -DGPU_BLAS to compile SuiteSparse for the + # GPU. You can add additional GPU-related flags to it as well. + # with 4 cores (default): + GPU_CONFIG = -DGPU_BLAS + # For example, to compile CHOLMOD for 10 CPU cores when using the GPU: + # GPU_CONFIG = -DGPU_BLAS -DCHOLMOD_OMP_NUM_THREADS=10 + CUDART_LIB = $(CUDA_PATH)/lib64/libcudart.so + CUBLAS_LIB = $(CUDA_PATH)/lib64/libcublas.so + CUDA_INC_PATH = $(CUDA_PATH)/include/ + CUDA_INC = -I$(CUDA_INC_PATH) + NVCC = $(CUDA_PATH)/bin/nvcc + NVCCFLAGS = -Xcompiler -fPIC -O3 \ + -gencode=arch=compute_20,code=sm_20 \ + -gencode=arch=compute_30,code=sm_30 \ + -gencode=arch=compute_35,code=sm_35 \ + -gencode=arch=compute_50,code=sm_50 \ + -gencode=arch=compute_50,code=compute_50 + endif + + #--------------------------------------------------------------------------- + # UMFPACK configuration: + #--------------------------------------------------------------------------- + + # Configuration for UMFPACK. See UMFPACK/Source/umf_config.h for details. + # + # -DNBLAS do not use the BLAS. UMFPACK will be very slow. + # -D'LONGBLAS=long' or -DLONGBLAS='long long' defines the integers used by + # LAPACK and the BLAS (defaults to 'int') + # -DNSUNPERF do not use the Sun Perf. Library on Solaris + # -DNRECIPROCAL do not multiply by the reciprocal + # -DNO_DIVIDE_BY_ZERO do not divide by zero + # -DNCHOLMOD do not use CHOLMOD as a ordering method. If -DNCHOLMOD is + # included in UMFPACK_CONFIG, then UMFPACK does not rely on + # CHOLMOD, CAMD, CCOLAMD, COLAMD, and METIS. + + UMFPACK_CONFIG ?= + + # For example, uncomment this line to compile UMFPACK without CHOLMOD: + # UMFPACK_CONFIG = -DNCHOLMOD + # or use 'make UMFPACK_CONFIG=-DNCHOLMOD' + + #--------------------------------------------------------------------------- + # CHOLMOD configuration + #--------------------------------------------------------------------------- + + # CHOLMOD Library Modules, which appear in -lcholmod + # Core requires: none + # Check requires: Core + # Cholesky requires: Core, AMD, COLAMD. optional: Partition, Supernodal + # MatrixOps requires: Core + # Modify requires: Core + # Partition requires: Core, CCOLAMD, METIS. optional: Cholesky + # Supernodal requires: Core, BLAS, LAPACK + # + # CHOLMOD test/demo Modules (these do not appear in -lcholmod): + # Tcov requires: Core, Check, Cholesky, MatrixOps, Modify, Supernodal + # optional: Partition + # Valgrind same as Tcov + # Demo requires: Core, Check, Cholesky, MatrixOps, Supernodal + # optional: Partition + # + # Configuration flags: + # -DNCHECK do not include the Check module. + # -DNCHOLESKY do not include the Cholesky module. + # -DNPARTITION do not include the Partition module. + # also do not include METIS. + # -DNCAMD do not use CAMD & CCOLAMD in Parition Module. + # -DNMATRIXOPS do not include the MatrixOps module. + # -DNMODIFY do not include the Modify module. + # -DNSUPERNODAL do not include the Supernodal module. + # + # -DNPRINT do not print anything. + # -D'LONGBLAS=long' or -DLONGBLAS='long long' defines the integers used by + # LAPACK and the BLAS (defaults to 'int') + # -DNSUNPERF for Solaris only. If defined, do not use the Sun + # Performance Library + # -DGPU_BLAS enable the use of the CUDA BLAS + + CHOLMOD_CONFIG ?= $(GPU_CONFIG) + + #--------------------------------------------------------------------------- + # SuiteSparseQR configuration: + #--------------------------------------------------------------------------- + + # The SuiteSparseQR library can be compiled with the following options: + # + # -DNPARTITION do not include the CHOLMOD partition module + # -DNEXPERT do not include the functions in SuiteSparseQR_expert.cpp + # -DHAVE_TBB enable the use of Intel's Threading Building Blocks + # -DGPU_BLAS enable the use of the CUDA BLAS + + SPQR_CONFIG ?= $(GPU_CONFIG) + + # to compile with Intel's TBB, use TBB=-ltbb SPQR_CONFIG=-DHAVE_TBB + TBB ?= + + # TODO: this *mk file should auto-detect the presence of Intel's TBB, + # and set the compiler flags accordingly. + +#=============================================================================== +# System-dependent configurations +#=============================================================================== + + #--------------------------------------------------------------------------- + # determine what system we are on + #--------------------------------------------------------------------------- + + # To disable these auto configurations, use 'make UNAME=custom' + + ifndef UNAME + ifeq ($(OS),Windows_NT) + # Cygwin Make on Windows has an $(OS) variable, but not uname. + # Note that this option is untested. + UNAME = Windows + else + # Linux and Darwin (Mac OSX) have been tested. + UNAME := $(shell uname) + endif + endif + + #--------------------------------------------------------------------------- + # Linux + #--------------------------------------------------------------------------- + + ifeq ($(UNAME),Linux) + # add the realtime library, librt, and SuiteSparse/lib + LDLIBS += -lrt -Wl,-rpath=$(INSTALL_LIB) + endif + + #--------------------------------------------------------------------------- + # Mac + #--------------------------------------------------------------------------- + + ifeq ($(UNAME), Darwin) + # To compile on the Mac, you must install Xcode. Then do this at the + # command line in the Terminal, before doing 'make': + # xcode-select --install + CF += -fno-common + BLAS = -framework Accelerate + LAPACK = -framework Accelerate + # OpenMP is not yet supported by default in clang + CFOPENMP = + endif + + #--------------------------------------------------------------------------- + # Solaris + #--------------------------------------------------------------------------- + + ifeq ($(UNAME), SunOS) + # Using the Sun compiler and the Sun Performance Library + # This hasn't been tested recently. + # I leave it here in case you need it. It likely needs updating. + CF += -fast -KPIC -xc99=%none -xlibmieee -xlibmil -m64 -Xc + F77FLAGS = -O -fast -KPIC -dalign -xlibmil -m64 + BLAS = -xlic_lib=sunperf + LAPACK = + # Using the GCC compiler and the reference BLAS + ## CC = gcc + ## CXX = g++ + ## MAKE = gmake + ## BLAS = -lrefblas -lgfortran + ## LAPACK = -llapack + endif + + #--------------------------------------------------------------------------- + # IBM AIX + #--------------------------------------------------------------------------- + + ifeq ($(UNAME), AIX) + # hasn't been tested for a very long time... + # I leave it here in case you need it. It likely needs updating. + CF += -O4 -qipa -qmaxmem=16384 -q64 -qproto -DBLAS_NO_UNDERSCORE + F77FLAGS = -O4 -qipa -qmaxmem=16384 -q64 + BLAS = -lessl + LAPACK = + endif + +#=============================================================================== +# finalize the CF compiler flags +#=============================================================================== + + CF += $(CFOPENMP) + +#=============================================================================== +# internal configuration +#=============================================================================== + + # The user should not have to change these definitions, and they are + # not displayed by 'make config' + + #--------------------------------------------------------------------------- + # for removing files not in the distribution + #--------------------------------------------------------------------------- + + # remove object files, but keep compiled libraries via 'make clean' + CLEAN = *.o *.obj *.ln *.bb *.bbg *.da *.tcov *.gcov gmon.out *.bak *.d \ + *.gcda *.gcno *.aux *.bbl *.blg *.log *.toc *.dvi *.lof *.lot + + # also remove compiled libraries, via 'make distclean' + PURGE = *.so* *.a *.dll *.dylib *.dSYM + + # location of TCOV test output + TCOV_TMP ?= /tmp + +#=============================================================================== +# Building the shared and static libraries +#=============================================================================== + +# How to build/install shared and static libraries for Mac and Linux/Unix. +# This assumes that LIBRARY and VERSION have already been defined by the +# Makefile that includes this file. + +SO_OPTS = $(LDFLAGS) + +ifeq ($(UNAME),Windows) + # Cygwin Make on Windows (untested) + AR_TARGET = $(LIBRARY).lib + SO_PLAIN = $(LIBRARY).dll + SO_MAIN = $(LIBRARY).$(SO_VERSION).dll + SO_TARGET = $(LIBRARY).$(VERSION).dll + SO_INSTALL_NAME = echo +else + # Mac or Linux/Unix + AR_TARGET = $(LIBRARY).a + ifeq ($(UNAME),Darwin) + # Mac + SO_PLAIN = $(LIBRARY).dylib + SO_MAIN = $(LIBRARY).$(SO_VERSION).dylib + SO_TARGET = $(LIBRARY).$(VERSION).dylib + SO_OPTS += -dynamiclib -compatibility_version $(SO_VERSION) \ + -current_version $(VERSION) \ + -shared -undefined dynamic_lookup + # When a Mac *.dylib file is moved, this command is required + # to change its internal name to match its location in the filesystem: + SO_INSTALL_NAME = install_name_tool -id + else + # Linux and other variants of Unix + SO_PLAIN = $(LIBRARY).so + SO_MAIN = $(LIBRARY).so.$(SO_VERSION) + SO_TARGET = $(LIBRARY).so.$(VERSION) + SO_OPTS += -shared -Wl,-soname -Wl,$(SO_MAIN) -Wl,--no-undefined + # Linux/Unix *.so files can be moved without modification: + SO_INSTALL_NAME = echo + endif +endif + +#=============================================================================== +# Configure CHOLMOD/Partition module with METIS, CAMD, and CCOLAMD +#=============================================================================== + +# By default, SuiteSparse uses METIS 5.1.0 in the SuiteSparse/metis-5.1.0 +# directory. SuiteSparse's interface to METIS is only through the +# SuiteSparse/CHOLMOD/Partition module, which also requires SuiteSparse/CAMD +# and SuiteSparse/CCOLAMD. +# +# If you wish to use your own pre-installed copy of METIS, use the MY_METIS_LIB +# and MY_METIS_INC options passed to 'make'. For example: +# make MY_METIS_LIB=-lmetis +# make MY_METIS_LIB=/home/myself/mylibraries/libmetis.so +# make MY_METIS_LIB='-L/home/myself/mylibraries -lmetis' +# If you need to tell the compiler where to find the metis.h include file, +# then add MY_METIS_INC=/home/myself/metis-5.1.0/include as well, which points +# to the directory containing metis.h. If metis.h is already installed in +# a location known to the compiler (/usr/local/include/metis.h for example) +# then you do not need to add MY_METIS_INC. + +I_WITH_PARTITION = +LIB_WITH_PARTITION = +CONFIG_PARTITION = -DNPARTITION -DNCAMD +# check if CAMD/CCOLAMD and METIS are requested and available +ifeq (,$(findstring -DNCAMD, $(CHOLMOD_CONFIG))) + # CAMD and CCOLAMD are requested. See if they are available in + # SuiteSparse/CAMD and SuiteSparse/CCOLAMD + ifneq (, $(wildcard $(SUITESPARSE)/CAMD)) + ifneq (, $(wildcard $(SUITESPARSE)/CCOLAMD)) + # CAMD and CCOLAMD are requested and available + LIB_WITH_PARTITION = -lccolamd -lcamd + I_WITH_PARTITION = -I$(SUITESPARSE)/CCOLAMD/Include -I$(SUITESPARSE)/CAMD/Include + CONFIG_PARTITION = -DNPARTITION + # check if METIS is requested and available + ifeq (,$(findstring -DNPARTITION, $(CHOLMOD_CONFIG))) + # METIS is requested. See if it is available. + ifneq (,$(MY_METIS_LIB)) + # METIS 5.1.0 is provided elsewhere, and we are not using + # SuiteSparse/metis-5.1.0. To do so, we link with + # $(MY_METIS_LIB) and add the -I$(MY_METIS_INC) option for + # the compiler. The latter can be empty if you have METIS + # installed in a place where the compiler can find the + # metis.h include file by itself without any -I option + # (/usr/local/include/metis.h for example). + LIB_WITH_PARTITION += $(MY_METIS_LIB) + ifneq (,$(MY_METIS_INC)) + I_WITH_PARTITION += -I$(MY_METIS_INC) + endif + CONFIG_PARTITION = + else + # see if METIS is in SuiteSparse/metis-5.1.0 + ifneq (, $(wildcard $(SUITESPARSE)/metis-5.1.0)) + # SuiteSparse/metis5.1.0 is available + ifeq ($(UNAME), Darwin) + LIB_WITH_PARTITION += $(SUITESPARSE)/lib/libmetis.dylib + else + LIB_WITH_PARTITION += -lmetis + endif + I_WITH_PARTITION += -I$(SUITESPARSE)/metis-5.1.0/include + CONFIG_PARTITION = + endif + endif + endif + endif + endif +endif + +#=============================================================================== +# display configuration +#=============================================================================== + +ifeq ($(LIBRARY),) + # placeholders, for 'make config' in the top-level SuiteSparse + LIBRARY=PackageNameWillGoHere + VERSION=x.y.z + SO_VERSION=x +endif + +# 'make config' lists the primary installation options +config: + @echo ' ' + @echo '----------------------------------------------------------------' + @echo 'SuiteSparse package compilation options:' + @echo '----------------------------------------------------------------' + @echo ' ' + @echo 'SuiteSparse Version: ' '$(SUITESPARSE_VERSION)' + @echo 'SuiteSparse top folder: ' '$(SUITESPARSE)' + @echo 'Package: LIBRARY= ' '$(LIBRARY)' + @echo 'Version: VERSION= ' '$(VERSION)' + @echo 'SO version: SO_VERSION= ' '$(SO_VERSION)' + @echo 'System: UNAME= ' '$(UNAME)' + @echo 'Install directory: INSTALL= ' '$(INSTALL)' + @echo 'Install libraries in: INSTALL_LIB= ' '$(INSTALL_LIB)' + @echo 'Install include files in: INSTALL_INCLUDE=' '$(INSTALL_INCLUDE)' + @echo 'Install documentation in: INSTALL_DOC= ' '$(INSTALL_DOC)' + @echo 'Optimization level: OPTIMIZATION= ' '$(OPTIMIZATION)' + @echo 'BLAS library: BLAS= ' '$(BLAS)' + @echo 'LAPACK library: LAPACK= ' '$(LAPACK)' + @echo 'Intel TBB library: TBB= ' '$(TBB)' + @echo 'Other libraries: LDLIBS= ' '$(LDLIBS)' + @echo 'static library: AR_TARGET= ' '$(AR_TARGET)' + @echo 'shared library (full): SO_TARGET= ' '$(SO_TARGET)' + @echo 'shared library (main): SO_MAIN= ' '$(SO_MAIN)' + @echo 'shared library (short): SO_PLAIN= ' '$(SO_PLAIN)' + @echo 'shared library options: SO_OPTS= ' '$(SO_OPTS)' + @echo 'shared library name tool: SO_INSTALL_NAME=' '$(SO_INSTALL_NAME)' + @echo 'ranlib, for static libs: RANLIB= ' '$(RANLIB)' + @echo 'static library command: ARCHIVE= ' '$(ARCHIVE)' + @echo 'copy file: CP= ' '$(CP)' + @echo 'move file: MV= ' '$(MV)' + @echo 'remove file: RM= ' '$(RM)' + @echo 'pretty (for Tcov tests): PRETTY= ' '$(PRETTY)' + @echo 'C compiler: CC= ' '$(CC)' + @echo 'C++ compiler: CXX= ' '$(CXX)' + @echo 'CUDA compiler: NVCC= ' '$(NVCC)' + @echo 'CUDA root directory: CUDA_PATH= ' '$(CUDA_PATH)' + @echo 'OpenMP flags: CFOPENMP= ' '$(CFOPENMP)' + @echo 'C/C++ compiler flags: CF= ' '$(CF)' + @echo 'LD flags: LDFLAGS= ' '$(LDFLAGS)' + @echo 'Fortran compiler: F77= ' '$(F77)' + @echo 'Fortran flags: F77FLAGS= ' '$(F77FLAGS)' + @echo 'Intel MKL root: MKLROOT= ' '$(MKLROOT)' + @echo 'Auto detect Intel icc: AUTOCC= ' '$(AUTOCC)' + @echo 'UMFPACK config: UMFPACK_CONFIG= ' '$(UMFPACK_CONFIG)' + @echo 'CHOLMOD config: CHOLMOD_CONFIG= ' '$(CHOLMOD_CONFIG)' + @echo 'SuiteSparseQR config: SPQR_CONFIG= ' '$(SPQR_CONFIG)' + @echo 'CUDA library: CUDART_LIB= ' '$(CUDART_LIB)' + @echo 'CUBLAS library: CUBLAS_LIB= ' '$(CUBLAS_LIB)' + @echo 'METIS and CHOLMOD/Partition configuration:' + @echo 'Your METIS library: MY_METIS_LIB= ' '$(MY_METIS_LIB)' + @echo 'Your metis.h is in: MY_METIS_INC= ' '$(MY_METIS_INC)' + @echo 'METIS is used via the CHOLMOD/Partition module, configured as follows.' + @echo 'If the next line has -DNPARTITION then METIS will not be used:' + @echo 'CHOLMOD Partition config: ' '$(CONFIG_PARTITION)' + @echo 'CHOLMOD Partition libs: ' '$(LIB_WITH_PARTITION)' + @echo 'CHOLMOD Partition include:' '$(I_WITH_PARTITION)' +ifeq ($(TCOV),yes) + @echo 'TCOV=yes, for extensive testing only (gcc, g++, vanilla BLAS)' +endif + diff --git a/gtsam/3rdparty/SuiteSparse_config/xerbla/Makefile b/gtsam/3rdparty/SuiteSparse_config/xerbla/Makefile new file mode 100644 index 000000000..420c50e88 --- /dev/null +++ b/gtsam/3rdparty/SuiteSparse_config/xerbla/Makefile @@ -0,0 +1,73 @@ +# Makefile for null-output xerbla, both C and Fortran versions. +# By default, the C version (libcerbla.a and *.so) is compiled and installed. +# Set the USE_FORTRAN option to 1 to create the Fortran instead (libxerbla): + USE_FORTRAN = 0 +# USE_FORTRAN = 1 + +VERSION = 1.0.2 +SO_VERSION = 1 + +default: library + +# compile and install in SuiteSparse/lib +library: + $(MAKE) install INSTALL=$(SUITESPARSE) + +all: library + +ifeq ($(USE_FORTRAN),0) + LIBRARY = libcerbla +else + LIBRARY = libxerbla +endif + +include ../SuiteSparse_config.mk + +ifeq ($(USE_FORTRAN),0) + COMPILE = $(CC) $(CF) -c xerbla.c + DEPENDS = xerbla.c xerbla.h +else + COMPILE = $(F77) $(F77FLAGS) -c xerbla.f + DEPENDS = xerbla.f +endif + +ccode: all + +fortran: all + +$(AR_TARGET): $(DEPENDS) + $(COMPILE) + $(ARCHIVE) $(AR_TARGET) xerbla.o + - $(RANLIB) $(AR_TARGET) + - $(RM) xerbla.o + +# install libcerbla / libxerbla +install: $(AR_TARGET) $(INSTALL_LIB)/$(SO_TARGET) + +$(INSTALL_LIB)/$(SO_TARGET): $(DEPENDS) + @mkdir -p $(INSTALL_LIB) + @mkdir -p $(INSTALL_INCLUDE) + @mkdir -p $(INSTALL_DOC) + $(COMPILE) + $(CC) $(SO_OPTS) xerbla.o -o $@ + - $(RM) xerbla.o + ( cd $(INSTALL_LIB) ; ln -sf $(SO_TARGET) $(SO_PLAIN) ) + ( cd $(INSTALL_LIB) ; ln -sf $(SO_TARGET) $(SO_MAIN) ) + $(CP) xerbla.h $(INSTALL_INCLUDE) + chmod 755 $(INSTALL_LIB)/$(SO_TARGET) + chmod 644 $(INSTALL_INCLUDE)/xerbla.h + +# uninstall libcerbla / libxerbla +uninstall: + $(RM) $(INSTALL_LIB)/$(SO_TARGET) + $(RM) $(INSTALL_LIB)/$(SO_PLAIN) + $(RM) $(INSTALL_INCLUDE)/xerbla.h + +distclean: purge + +purge: clean + - $(RM) -r $(PURGE) + +clean: + - $(RM) -r $(CLEAN) + diff --git a/gtsam/3rdparty/UFconfig/xerbla/xerbla.c b/gtsam/3rdparty/SuiteSparse_config/xerbla/xerbla.c similarity index 100% rename from gtsam/3rdparty/UFconfig/xerbla/xerbla.c rename to gtsam/3rdparty/SuiteSparse_config/xerbla/xerbla.c diff --git a/gtsam/3rdparty/UFconfig/xerbla/xerbla.f b/gtsam/3rdparty/SuiteSparse_config/xerbla/xerbla.f similarity index 100% rename from gtsam/3rdparty/UFconfig/xerbla/xerbla.f rename to gtsam/3rdparty/SuiteSparse_config/xerbla/xerbla.f diff --git a/gtsam/3rdparty/UFconfig/xerbla/xerbla.h b/gtsam/3rdparty/SuiteSparse_config/xerbla/xerbla.h similarity index 100% rename from gtsam/3rdparty/UFconfig/xerbla/xerbla.h rename to gtsam/3rdparty/SuiteSparse_config/xerbla/xerbla.h diff --git a/gtsam/3rdparty/UFconfig/README.txt b/gtsam/3rdparty/UFconfig/README.txt deleted file mode 100644 index d9edc239a..000000000 --- a/gtsam/3rdparty/UFconfig/README.txt +++ /dev/null @@ -1,35 +0,0 @@ -UFconfig contains configuration settings for all many of the software packages -that I develop or co-author. Note that older versions of some of these packages -do not require UFconfig. - - Package Description - ------- ----------- - AMD approximate minimum degree ordering - CAMD constrained AMD - COLAMD column approximate minimum degree ordering - CCOLAMD constrained approximate minimum degree ordering - UMFPACK sparse LU factorization, with the BLAS - CXSparse int/long/real/complex version of CSparse - CHOLMOD sparse Cholesky factorization, update/downdate - KLU sparse LU factorization, BLAS-free - BTF permutation to block triangular form - LDL concise sparse LDL' - LPDASA LP Dual Active Set Algorithm - SuiteSparseQR sparse QR factorization - -UFconfig is not required by: - - CSparse a Concise Sparse matrix package - RBio read/write files in Rutherford/Boeing format - UFcollection tools for managing the UF Sparse Matrix Collection - LINFACTOR simple m-file to show how to use LU and CHOL to solve Ax=b - MESHND 2D and 3D mesh generation and nested dissection ordering - MATLAB_Tools misc collection of m-files - SSMULT sparse matrix times sparse matrix, for use in MATLAB - -In addition, the xerbla/ directory contains Fortan and C versions of the -BLAS/LAPACK xerbla routine, which is called when an invalid input is passed to -the BLAS or LAPACK. The xerbla provided here does not print any message, so -the entire Fortran I/O library does not need to be linked into a C application. -Most versions of the BLAS contain xerbla, but those from K. Goto do not. Use -this if you need too. diff --git a/gtsam/3rdparty/UFconfig/UFconfig.c b/gtsam/3rdparty/UFconfig/UFconfig.c deleted file mode 100644 index 8b8d45ef7..000000000 --- a/gtsam/3rdparty/UFconfig/UFconfig.c +++ /dev/null @@ -1,71 +0,0 @@ -/* ========================================================================== */ -/* === UFconfig ============================================================= */ -/* ========================================================================== */ - -/* Copyright (c) 2009, University of Florida. No licensing restrictions - * apply to this file or to the UFconfig directory. Author: Timothy A. Davis. - */ - -#include "UFconfig.h" - -/* -------------------------------------------------------------------------- */ -/* UFmalloc: malloc wrapper */ -/* -------------------------------------------------------------------------- */ - -void *UFmalloc /* pointer to allocated block of memory */ -( - size_t nitems, /* number of items to malloc (>=1 is enforced) */ - size_t size_of_item, /* sizeof each item */ - int *ok, /* TRUE if successful, FALSE otherwise */ - UFconfig *config /* SuiteSparse-wide configuration */ -) -{ - void *p ; - if (nitems < 1) nitems = 1 ; - if (nitems * size_of_item != ((double) nitems) * size_of_item) - { - /* Int overflow */ - *ok = 0 ; - return (NULL) ; - } - if (!config || config->malloc_memory == NULL) - { - /* use malloc by default */ - p = (void *) malloc (nitems * size_of_item) ; - } - else - { - /* use the pointer to malloc in the config */ - p = (void *) (config->malloc_memory) (nitems * size_of_item) ; - } - *ok = (p != NULL) ; - return (p) ; -} - - -/* -------------------------------------------------------------------------- */ -/* UFfree: free wrapper */ -/* -------------------------------------------------------------------------- */ - -void *UFfree /* always returns NULL */ -( - void *p, /* block to free */ - UFconfig *config /* SuiteSparse-wide configuration */ -) -{ - if (p) - { - if (!config || config->free_memory == NULL) - { - /* use free by default */ - free (p) ; - } - else - { - /* use the pointer to free in the config */ - (config->free_memory) (p) ; - } - } - return (NULL) ; -} - diff --git a/gtsam/3rdparty/UFconfig/UFconfig.h b/gtsam/3rdparty/UFconfig/UFconfig.h deleted file mode 100644 index 795f5668c..000000000 --- a/gtsam/3rdparty/UFconfig/UFconfig.h +++ /dev/null @@ -1,152 +0,0 @@ -/* ========================================================================== */ -/* === UFconfig.h =========================================================== */ -/* ========================================================================== */ - -/* Configuration file for SuiteSparse: a Suite of Sparse matrix packages - * (AMD, COLAMD, CCOLAMD, CAMD, CHOLMOD, UMFPACK, CXSparse, and others). - * - * UFconfig.h provides the definition of the long integer. On most systems, - * a C program can be compiled in LP64 mode, in which long's and pointers are - * both 64-bits, and int's are 32-bits. Windows 64, however, uses the LLP64 - * model, in which int's and long's are 32-bits, and long long's and pointers - * are 64-bits. - * - * SuiteSparse packages that include long integer versions are - * intended for the LP64 mode. However, as a workaround for Windows 64 - * (and perhaps other systems), the long integer can be redefined. - * - * If _WIN64 is defined, then the __int64 type is used instead of long. - * - * The long integer can also be defined at compile time. For example, this - * could be added to UFconfig.mk: - * - * CFLAGS = -O -D'UF_long=long long' -D'UF_long_max=9223372036854775801' \ - * -D'UF_long_idd="lld"' - * - * This file defines UF_long as either long (on all but _WIN64) or - * __int64 on Windows 64. The intent is that a UF_long is always a 64-bit - * integer in a 64-bit code. ptrdiff_t might be a better choice than long; - * it is always the same size as a pointer. - * - * This file also defines the SUITESPARSE_VERSION and related definitions. - * - * Copyright (c) 2007, University of Florida. No licensing restrictions - * apply to this file or to the UFconfig directory. Author: Timothy A. Davis. - */ - -#ifndef _UFCONFIG_H -#define _UFCONFIG_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -/* ========================================================================== */ -/* === UF_long ============================================================== */ -/* ========================================================================== */ - -#ifndef UF_long - -#ifdef _WIN64 - -#define UF_long __int64 -#define UF_long_max _I64_MAX -#define UF_long_idd "I64d" - -#else - -#define UF_long long -#define UF_long_max LONG_MAX -#define UF_long_idd "ld" - -#endif -#define UF_long_id "%" UF_long_idd -#endif - -/* ========================================================================== */ -/* === UFconfig parameters and functions ==================================== */ -/* ========================================================================== */ - -/* SuiteSparse-wide parameters will be placed in this struct. So far, they - are only used by RBio. */ - -typedef struct UFconfig_struct -{ - void *(*malloc_memory) (size_t) ; /* pointer to malloc */ - void *(*realloc_memory) (void *, size_t) ; /* pointer to realloc */ - void (*free_memory) (void *) ; /* pointer to free */ - void *(*calloc_memory) (size_t, size_t) ; /* pointer to calloc */ - -} UFconfig ; - -void *UFmalloc /* pointer to allocated block of memory */ -( - size_t nitems, /* number of items to malloc (>=1 is enforced) */ - size_t size_of_item, /* sizeof each item */ - int *ok, /* TRUE if successful, FALSE otherwise */ - UFconfig *config /* SuiteSparse-wide configuration */ -) ; - -void *UFfree /* always returns NULL */ -( - void *p, /* block to free */ - UFconfig *config /* SuiteSparse-wide configuration */ -) ; - - -/* ========================================================================== */ -/* === SuiteSparse version ================================================== */ -/* ========================================================================== */ - -/* SuiteSparse is not a package itself, but a collection of packages, some of - * which must be used together (UMFPACK requires AMD, CHOLMOD requires AMD, - * COLAMD, CAMD, and CCOLAMD, etc). A version number is provided here for the - * collection itself. The versions of packages within each version of - * SuiteSparse are meant to work together. Combining one packge from one - * version of SuiteSparse, with another package from another version of - * SuiteSparse, may or may not work. - * - * SuiteSparse Version 3.6.1 contains the following packages: - * - * AMD version 2.2.2 - * BTF version 1.1.2 - * CAMD version 2.2.2 - * CCOLAMD version 2.7.3 - * CHOLMOD version 1.7.3 - * COLAMD version 2.7.3 - * CSparse version 2.2.5 - * CSparse3 version 3.0.1 - * CXSparse version 2.2.5 - * KLU version 1.1.2 - * LDL version 2.0.3 - * RBio version 2.0.1 - * SPQR version 1.2.2 (also called SuiteSparseQR) - * UFcollection version 1.5.0 - * UFconfig version number is the same as SuiteSparse - * UMFPACK version 5.5.1 - * LINFACTOR version 1.1.0 - * MESHND version 1.1.1 - * SSMULT version 2.0.2 - * MATLAB_Tools no specific version number - * - * Other package dependencies: - * BLAS required by CHOLMOD and UMFPACK - * LAPACK required by CHOLMOD - * METIS 4.0.1 required by CHOLMOD (optional) and KLU (optional) - */ - -#define SUITESPARSE_DATE "May 10, 2011" -#define SUITESPARSE_VER_CODE(main,sub) ((main) * 1000 + (sub)) -#define SUITESPARSE_MAIN_VERSION 3 -#define SUITESPARSE_SUB_VERSION 6 -#define SUITESPARSE_SUBSUB_VERSION 1 -#define SUITESPARSE_VERSION \ - SUITESPARSE_VER_CODE(SUITESPARSE_MAIN_VERSION,SUITESPARSE_SUB_VERSION) - -#ifdef __cplusplus -} -#endif -#endif diff --git a/gtsam/3rdparty/UFconfig/UFconfig.mk b/gtsam/3rdparty/UFconfig/UFconfig.mk deleted file mode 100644 index 60c951b6a..000000000 --- a/gtsam/3rdparty/UFconfig/UFconfig.mk +++ /dev/null @@ -1,386 +0,0 @@ -#=============================================================================== -# UFconfig.mk: common configuration file for the SuiteSparse -#=============================================================================== - -# This file contains all configuration settings for all packages authored or -# co-authored by Tim Davis at the University of Florida: -# -# Package Version Description -# ------- ------- ----------- -# AMD 1.2 or later approximate minimum degree ordering -# COLAMD 2.4 or later column approximate minimum degree ordering -# CCOLAMD 1.0 or later constrained column approximate minimum degree ordering -# CAMD any constrained approximate minimum degree ordering -# UMFPACK 4.5 or later sparse LU factorization, with the BLAS -# CHOLMOD any sparse Cholesky factorization, update/downdate -# KLU 0.8 or later sparse LU factorization, BLAS-free -# BTF 0.8 or later permutation to block triangular form -# LDL 1.2 or later concise sparse LDL' -# LPDASA any linear program solve (dual active set algorithm) -# CXSparse any extended version of CSparse (int/long, real/complex) -# SuiteSparseQR any sparse QR factorization -# -# The UFconfig directory and the above packages should all appear in a single -# directory, in order for the Makefile's within each package to find this file. -# -# To enable an option of the form "# OPTION = ...", edit this file and -# delete the "#" in the first column of the option you wish to use. - -#------------------------------------------------------------------------------ -# Generic configuration -#------------------------------------------------------------------------------ - -# C compiler and compiler flags: These will normally not give you optimal -# performance. You should select the optimization parameters that are best -# for your system. On Linux, use "CFLAGS = -O3 -fexceptions" for example. -CC = cc -CFLAGS = -O3 -fexceptions - -# C++ compiler (also uses CFLAGS) -CPLUSPLUS = g++ - -# ranlib, and ar, for generating libraries -RANLIB = ranlib -AR = ar cr - -# copy, delete, and rename a file -CP = cp -f -RM = rm -f -MV = mv -f - -# Fortran compiler (not normally required) -F77 = f77 -F77FLAGS = -O -F77LIB = - -# C and Fortran libraries -LIB = -lm - -# For compiling MATLAB mexFunctions (MATLAB 7.5 or later) -MEX = mex -O -largeArrayDims -lmwlapack -lmwblas - -# For compiling MATLAB mexFunctions (MATLAB 7.3 and 7.4) -# MEX = mex -O -largeArrayDims -lmwlapack - -# For MATLAB 7.2 or earlier, you must use one of these options: -# MEX = mex -O -lmwlapack -# MEX = mex -O - -# Which version of MAKE you are using (default is "make") -# MAKE = make -# MAKE = gmake - -# For "make install" -INSTALL_LIB = /usr/local/lib -INSTALL_INCLUDE = /usr/local/include - -#------------------------------------------------------------------------------ -# BLAS and LAPACK configuration: -#------------------------------------------------------------------------------ - -# UMFPACK and CHOLMOD both require the BLAS. CHOLMOD also requires LAPACK. -# See Kazushige Goto's BLAS at http://www.cs.utexas.edu/users/flame/goto/ or -# http://www.tacc.utexas.edu/~kgoto/ for the best BLAS to use with CHOLMOD. -# LAPACK is at http://www.netlib.org/lapack/ . You can use the standard -# Fortran LAPACK along with Goto's BLAS to obtain very good performance. -# CHOLMOD gets a peak numeric factorization rate of 3.6 Gflops on a 3.2 GHz -# Pentium 4 (512K cache, 4GB main memory) with the Goto BLAS, and 6 Gflops -# on a 2.5Ghz dual-core AMD Opteron. - -# These settings will probably not work, since there is no fixed convention for -# naming the BLAS and LAPACK library (*.a or *.so) files. - -# This is probably slow ... it might connect to the Standard Reference BLAS: -BLAS = -lblas -lgfortran -LAPACK = -llapack - -# NOTE: this next option for the "Goto BLAS" has nothing to do with a "goto" -# statement. Rather, the Goto BLAS is written by Dr. Kazushige Goto. -# Using the Goto BLAS: -# BLAS = -lgoto -lgfortran -lgfortranbegin - -# Using non-optimized versions: -# BLAS = -lblas_plain -lgfortran -lgfortranbegin -# LAPACK = -llapack_plain - -# BLAS = -lblas_plain -lgfortran -lgfortranbegin -# LAPACK = -llapack - -# The BLAS might not contain xerbla, an error-handling routine for LAPACK and -# the BLAS. Also, the standard xerbla requires the Fortran I/O library, and -# stops the application program if an error occurs. A C version of xerbla -# distributed with this software (UFconfig/xerbla/libcerbla.a) includes a -# Fortran-callable xerbla routine that prints nothing and does not stop the -# application program. This is optional. -# XERBLA = ../../UFconfig/xerbla/libcerbla.a - -# If you wish to use the XERBLA in LAPACK and/or the BLAS instead, -# use this option: -XERBLA = - -# If you wish to use the Fortran UFconfig/xerbla/xerbla.f instead, use this: -# XERBLA = ../../UFconfig/xerbla/libxerbla.a - -#------------------------------------------------------------------------------ -# METIS, optionally used by CHOLMOD -#------------------------------------------------------------------------------ - -# If you do not have METIS, or do not wish to use it in CHOLMOD, you must -# compile CHOLMOD with the -DNPARTITION flag. You must also use the -# "METIS =" option, below. - -# The path is relative to where it is used, in CHOLMOD/Lib, CHOLMOD/MATLAB, etc. -# You may wish to use an absolute path. METIS is optional. Compile -# CHOLMOD with -DNPARTITION if you do not wish to use METIS. -METIS_PATH = ../../metis-4.0 -METIS = ../../metis-4.0/libmetis.a - -# If you use CHOLMOD_CONFIG = -DNPARTITION then you must use the following -# options: -# METIS_PATH = -# METIS = - -#------------------------------------------------------------------------------ -# UMFPACK configuration: -#------------------------------------------------------------------------------ - -# Configuration flags for UMFPACK. See UMFPACK/Source/umf_config.h for details. -# -# -DNBLAS do not use the BLAS. UMFPACK will be very slow. -# -D'LONGBLAS=long' or -DLONGBLAS='long long' defines the integers used by -# LAPACK and the BLAS (defaults to 'int') -# -DNSUNPERF do not use the Sun Perf. Library (default is use it on Solaris) -# -DNPOSIX do not use POSIX routines sysconf and times. -# -DGETRUSAGE use getrusage -# -DNO_TIMER do not use any timing routines -# -DNRECIPROCAL do not multiply by the reciprocal -# -DNO_DIVIDE_BY_ZERO do not divide by zero - -UMFPACK_CONFIG = - -#------------------------------------------------------------------------------ -# CHOLMOD configuration -#------------------------------------------------------------------------------ - -# CHOLMOD Library Modules, which appear in libcholmod.a: -# Core requires: none -# Check requires: Core -# Cholesky requires: Core, AMD, COLAMD. optional: Partition, Supernodal -# MatrixOps requires: Core -# Modify requires: Core -# Partition requires: Core, CCOLAMD, METIS. optional: Cholesky -# Supernodal requires: Core, BLAS, LAPACK -# -# CHOLMOD test/demo Modules (all are GNU GPL, do not appear in libcholmod.a): -# Tcov requires: Core, Check, Cholesky, MatrixOps, Modify, Supernodal -# optional: Partition -# Valgrind same as Tcov -# Demo requires: Core, Check, Cholesky, MatrixOps, Supernodal -# optional: Partition -# -# Configuration flags: -# -DNCHECK do not include the Check module. License GNU LGPL -# -DNCHOLESKY do not include the Cholesky module. License GNU LGPL -# -DNPARTITION do not include the Partition module. License GNU LGPL -# also do not include METIS. -# -DNGPL do not include any GNU GPL Modules in the CHOLMOD library: -# -DNMATRIXOPS do not include the MatrixOps module. License GNU GPL -# -DNMODIFY do not include the Modify module. License GNU GPL -# -DNSUPERNODAL do not include the Supernodal module. License GNU GPL -# -# -DNPRINT do not print anything. -# -D'LONGBLAS=long' or -DLONGBLAS='long long' defines the integers used by -# LAPACK and the BLAS (defaults to 'int') -# -DNSUNPERF for Solaris only. If defined, do not use the Sun -# Performance Library - -CHOLMOD_CONFIG = - -#------------------------------------------------------------------------------ -# SuiteSparseQR configuration: -#------------------------------------------------------------------------------ - -# The SuiteSparseQR library can be compiled with the following options: -# -# -DNPARTITION do not include the CHOLMOD partition module -# -DNEXPERT do not include the functions in SuiteSparseQR_expert.cpp -# -DTIMING enable timing and flop counts -# -DHAVE_TBB enable the use of Intel's Threading Building Blocks (TBB) - -# default, without timing, without TBB: -SPQR_CONFIG = -# with timing and TBB: -# SPQR_CONFIG = -DTIMING -DHAVE_TBB -# with timing -# SPQR_CONFIG = -DTIMING - -# This is needed for IBM AIX: (but not for and C codes, just C++) -# SPQR_CONFIG = -DBLAS_NO_UNDERSCORE - -# with TBB, you must select this: -# TBB = -ltbb -# without TBB: -TBB = - -# with timing, you must include the timing library: -# RTLIB = -lrt -# without timing -RTLIB = - -#------------------------------------------------------------------------------ -# Linux -#------------------------------------------------------------------------------ - -# Using default compilers: -# CC = gcc -# CFLAGS = -O3 -fexceptions - -# alternatives: -# CFLAGS = -g -fexceptions \ - -Wall -W -Wshadow -Wmissing-prototypes -Wstrict-prototypes \ - -Wredundant-decls -Wnested-externs -Wdisabled-optimization -ansi \ - -funit-at-a-time -# CFLAGS = -O3 -fexceptions \ - -Wall -W -Werror -Wshadow -Wmissing-prototypes -Wstrict-prototypes \ - -Wredundant-decls -Wnested-externs -Wdisabled-optimization -ansi -# CFLAGS = -O3 -fexceptions -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -# CFLAGS = -O3 -# CFLAGS = -O3 -g -fexceptions -# CFLAGS = -g -fexceptions \ - -Wall -W -Wshadow \ - -Wredundant-decls -Wdisabled-optimization -ansi - -# consider: -# -fforce-addr -fmove-all-movables -freduce-all-givs -ftsp-ordering -# -frename-registers -ffast-math -funroll-loops - -# Using the Goto BLAS: -# BLAS = -lgoto -lfrtbegin -lg2c $(XERBLA) -lpthread - -# Using Intel's icc and ifort compilers: -# (does not work for mexFunctions unless you add a mexopts.sh file) -# F77 = ifort -# CC = icc -# CFLAGS = -O3 -xN -vec_report=0 -# CFLAGS = -g -# old (broken): CFLAGS = -ansi -O3 -ip -tpp7 -xW -vec_report0 - -# 64bit: -# F77FLAGS = -O -m64 -# CFLAGS = -O3 -fexceptions -m64 -# BLAS = -lgoto64 -lfrtbegin -lg2c -lpthread $(XERBLA) -# LAPACK = -llapack64 - - -# SUSE Linux 10.1, AMD Opteron, with GOTO Blas -# F77 = gfortran -# BLAS = -lgoto_opteron64 -lgfortran - -# SUSE Linux 10.1, Intel Pentium, with GOTO Blas -# F77 = gfortran -# BLAS = -lgoto -lgfortran - -#------------------------------------------------------------------------------ -# Mac -#------------------------------------------------------------------------------ - -# As recommended by macports, http://suitesparse.darwinports.com/ -# I've tested them myself on Mac OSX 10.6.1 (Snow Leopard), on my MacBook Air. -# F77 = gfortran -# CFLAGS = -O3 -fno-common -no-cpp-precomp -fexceptions -# BLAS = -framework Accelerate -# LAPACK = -framework Accelerate - -# Using netlib.org LAPACK and BLAS compiled by gfortran, with and without -# optimzation: -# BLAS = -lblas_plain -lgfortran -# LAPACK = -llapack_plain -# BLAS = -lblas_optimized -lgfortran -# LAPACK = -llapack_optimized - -#------------------------------------------------------------------------------ -# Solaris -#------------------------------------------------------------------------------ - -# 32-bit -# CFLAGS = -KPIC -dalign -xc99=%none -Xc -xlibmieee -xO5 -xlibmil -m32 - -# 64-bit -# CFLAGS = -fast -KPIC -xc99=%none -xlibmieee -xlibmil -m64 -Xc - -# FFLAGS = -fast -KPIC -dalign -xlibmil -m64 - -# The Sun Performance Library includes both LAPACK and the BLAS: -# BLAS = -xlic_lib=sunperf -# LAPACK = - - -#------------------------------------------------------------------------------ -# Compaq Alpha -#------------------------------------------------------------------------------ - -# 64-bit mode only -# CFLAGS = -O2 -std1 -# BLAS = -ldxml -# LAPACK = - -#------------------------------------------------------------------------------ -# Macintosh -#------------------------------------------------------------------------------ - -# CC = gcc -# CFLAGS = -O3 -fno-common -no-cpp-precomp -fexceptions -# LIB = -lstdc++ -# BLAS = -framework Accelerate -# LAPACK = -framework Accelerate - -#------------------------------------------------------------------------------ -# IBM RS 6000 -#------------------------------------------------------------------------------ - -# BLAS = -lessl -# LAPACK = - -# 32-bit mode: -# CFLAGS = -O4 -qipa -qmaxmem=16384 -qproto -# F77FLAGS = -O4 -qipa -qmaxmem=16384 - -# 64-bit mode: -# CFLAGS = -O4 -qipa -qmaxmem=16384 -q64 -qproto -# F77FLAGS = -O4 -qipa -qmaxmem=16384 -q64 -# AR = ar -X64 - -#------------------------------------------------------------------------------ -# SGI IRIX -#------------------------------------------------------------------------------ - -# BLAS = -lscsl -# LAPACK = - -# 32-bit mode -# CFLAGS = -O - -# 64-bit mode (32 bit int's and 64-bit long's): -# CFLAGS = -64 -# F77FLAGS = -64 - -# SGI doesn't have ranlib -# RANLIB = echo - -#------------------------------------------------------------------------------ -# AMD Opteron (64 bit) -#------------------------------------------------------------------------------ - -# BLAS = -lgoto_opteron64 -lg2c -# LAPACK = -llapack_opteron64 - -# SUSE Linux 10.1, AMD Opteron -# F77 = gfortran -# BLAS = -lgoto_opteron64 -lgfortran -# LAPACK = -llapack_opteron64 - -#------------------------------------------------------------------------------ -# remove object files and profile output -#------------------------------------------------------------------------------ - -CLEAN = *.o *.obj *.ln *.bb *.bbg *.da *.tcov *.gcov gmon.out *.bak *.d *.gcda *.gcno diff --git a/gtsam/CMakeLists.txt b/gtsam/CMakeLists.txt index d3229427e..1801e30b4 100644 --- a/gtsam/CMakeLists.txt +++ b/gtsam/CMakeLists.txt @@ -26,7 +26,7 @@ set (3rdparty_srcs ${eigen_headers} # Set by 3rdparty/CMakeLists.txt ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/CCOLAMD/Source/ccolamd.c ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/CCOLAMD/Source/ccolamd_global.c - ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/UFconfig/UFconfig.c) + ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/SuiteSparse_config/SuiteSparse_config.c) gtsam_assign_source_folders("${3rdparty_srcs}") # Create MSVC structure # To exclude a source from the library build (in any subfolder) diff --git a/gtsam/inference/Ordering.cpp b/gtsam/inference/Ordering.cpp index 3e3b40f8f..931610639 100644 --- a/gtsam/inference/Ordering.cpp +++ b/gtsam/inference/Ordering.cpp @@ -53,10 +53,10 @@ Ordering Ordering::ColamdConstrained(const VariableIndex& variableIndex, gttic(Ordering_COLAMDConstrained); gttic(Prepare); - size_t nEntries = variableIndex.nEntries(), nFactors = + const size_t nEntries = variableIndex.nEntries(), nFactors = variableIndex.nFactors(), nVars = variableIndex.size(); // Convert to compressed column major format colamd wants it in (== MATLAB format!) - size_t Alen = ccolamd_recommended((int) nEntries, (int) nFactors, + const size_t Alen = ccolamd_recommended((int) nEntries, (int) nFactors, (int) nVars); /* colamd arg 3: size of the array A */ vector A = vector(Alen); /* colamd arg 4: row indices of A, of size Alen */ vector p = vector(nVars + 1); /* colamd arg 5: column pointers of A, of size n_col+1 */ @@ -66,13 +66,10 @@ Ordering Ordering::ColamdConstrained(const VariableIndex& variableIndex, int count = 0; vector keys(nVars); // Array to store the keys in the order we add them so we can retrieve them in permuted order size_t index = 0; - BOOST_FOREACH(const VariableIndex::value_type key_factors, variableIndex) { + for (auto key_factors: variableIndex) { // Arrange factor indices into COLAMD format const VariableIndex::Factors& column = key_factors.second; - size_t lastFactorId = numeric_limits::max(); - BOOST_FOREACH(size_t factorIndex, column) { - if (lastFactorId != numeric_limits::max()) - assert(factorIndex > lastFactorId); + for(size_t factorIndex: column) { A[count++] = (int) factorIndex; // copy sparse column } p[index + 1] = count; // column j (base 1) goes from A[j-1] to A[j]-1 @@ -106,8 +103,8 @@ Ordering Ordering::ColamdConstrained(const VariableIndex& variableIndex, // ccolamd_report(stats); - gttic(Fill_Ordering); // Convert elimination ordering in p to an ordering + gttic(Fill_Ordering); Ordering result; result.resize(nVars); for (size_t j = 0; j < nVars; ++j) @@ -128,13 +125,13 @@ Ordering Ordering::ColamdConstrainedLast(const VariableIndex& variableIndex, // Build a mapping to look up sorted Key indices by Key FastMap keyIndices; size_t j = 0; - BOOST_FOREACH(const VariableIndex::value_type key_factors, variableIndex) + for (auto key_factors: variableIndex) keyIndices.insert(keyIndices.end(), make_pair(key_factors.first, j++)); // If at least some variables are not constrained to be last, constrain the // ones that should be constrained. int group = (constrainLast.size() != n ? 1 : 0); - BOOST_FOREACH(Key key, constrainLast) { + for (Key key: constrainLast) { cmember[keyIndices.at(key)] = group; if (forceOrder) ++group; @@ -155,13 +152,13 @@ Ordering Ordering::ColamdConstrainedFirst(const VariableIndex& variableIndex, // Build a mapping to look up sorted Key indices by Key FastMap keyIndices; size_t j = 0; - BOOST_FOREACH(const VariableIndex::value_type key_factors, variableIndex) + for (auto key_factors: variableIndex) keyIndices.insert(keyIndices.end(), make_pair(key_factors.first, j++)); // If at least some variables are not constrained to be last, constrain the // ones that should be constrained. int group = 0; - BOOST_FOREACH(Key key, constrainFirst) { + for (Key key: constrainFirst) { cmember[keyIndices.at(key)] = group; if (forceOrder) ++group; @@ -169,7 +166,7 @@ Ordering Ordering::ColamdConstrainedFirst(const VariableIndex& variableIndex, if (!forceOrder && !constrainFirst.empty()) ++group; - BOOST_FOREACH(int& c, cmember) + for(int& c: cmember) if (c == none) c = group; @@ -186,12 +183,12 @@ Ordering Ordering::ColamdConstrained(const VariableIndex& variableIndex, // Build a mapping to look up sorted Key indices by Key FastMap keyIndices; size_t j = 0; - BOOST_FOREACH(const VariableIndex::value_type key_factors, variableIndex) + for (auto key_factors: variableIndex) keyIndices.insert(keyIndices.end(), make_pair(key_factors.first, j++)); // Assign groups typedef FastMap::value_type key_group; - BOOST_FOREACH(const key_group& p, groups) { + for(const key_group& p: groups) { // FIXME: check that no groups are skipped cmember[keyIndices.at(p.first)] = p.second; } diff --git a/gtsam/inference/tests/testOrdering.cpp b/gtsam/inference/tests/testOrdering.cpp index c209d086b..52528ad7f 100644 --- a/gtsam/inference/tests/testOrdering.cpp +++ b/gtsam/inference/tests/testOrdering.cpp @@ -172,6 +172,7 @@ TEST(Ordering, csr_format_3) { } /* ************************************************************************* */ +#ifdef GTSAM_SUPPORT_NESTED_DISSECTION TEST(Ordering, csr_format_4) { SymbolicFactorGraph sfg; @@ -206,8 +207,9 @@ TEST(Ordering, csr_format_4) { Ordering metOrder2 = Ordering::Metis(sfg); } - +#endif /* ************************************************************************* */ +#ifdef GTSAM_SUPPORT_NESTED_DISSECTION TEST(Ordering, metis) { SymbolicFactorGraph sfg; @@ -228,8 +230,9 @@ TEST(Ordering, metis) { Ordering metis = Ordering::Metis(sfg); } - +#endif /* ************************************************************************* */ +#ifdef GTSAM_SUPPORT_NESTED_DISSECTION TEST(Ordering, MetisLoop) { // create linear graph @@ -261,7 +264,7 @@ TEST(Ordering, MetisLoop) { } #endif } - +#endif /* ************************************************************************* */ TEST(Ordering, Create) { @@ -280,6 +283,7 @@ TEST(Ordering, Create) { EXPECT(assert_equal(expected, actual)); } +#ifdef GTSAM_SUPPORT_NESTED_DISSECTION // METIS { Ordering actual = Ordering::Create(Ordering::METIS, sfg); @@ -289,6 +293,7 @@ TEST(Ordering, Create) { Ordering expected = Ordering(list_of(5)(3)(4)(1)(0)(2)); EXPECT(assert_equal(expected, actual)); } +#endif // CUSTOM CHECK_EXCEPTION(Ordering::Create(Ordering::CUSTOM, sfg), runtime_error); diff --git a/gtsam/symbolic/tests/testSymbolicBayesTree.cpp b/gtsam/symbolic/tests/testSymbolicBayesTree.cpp index 82d8fb3ec..13849895d 100644 --- a/gtsam/symbolic/tests/testSymbolicBayesTree.cpp +++ b/gtsam/symbolic/tests/testSymbolicBayesTree.cpp @@ -726,6 +726,7 @@ TEST(SymbolicBayesTree, COLAMDvsMETIS) { EXPECT(assert_equal(expected, actual)); } +#ifdef GTSAM_SUPPORT_NESTED_DISSECTION // METIS { Ordering ordering = Ordering::Create(Ordering::METIS, sfg); @@ -759,6 +760,7 @@ TEST(SymbolicBayesTree, COLAMDvsMETIS) { SymbolicBayesTree actual = *sfg.eliminateMultifrontal(ordering); EXPECT(assert_equal(expected, actual)); } +#endif } /* ************************************************************************* */