# HG changeset patch # User jwe # Date 1130379617 0 # Node ID 7c8767d0ffc09b667ae6fc29d0e7b2e54c44a217 # Parent e67d027ff4e3ab577bff9d2f776b95b382dcdf2b [project @ 2005-10-27 02:20:17 by jwe] diff -r e67d027ff4e3 -r 7c8767d0ffc0 ChangeLog --- a/ChangeLog Wed Oct 26 21:13:57 2005 +0000 +++ b/ChangeLog Thu Oct 27 02:20:17 2005 +0000 @@ -1,3 +1,13 @@ +2005-10-26 John W. Eaton + + * aclocal.m4 (OCTAVE_UMFPACK_SEPERATE_SPLIT): + Use new method of finding umfpack.h. + * configure.in: Use AC_CHECK_HEADERS instead of + ACX_CHECK_HEADER_IN_DIRS. + (AC_CONFIG_FILES): Delete liboctave/oct-sparse.h from the list. + + * acx_include_dirs.m4: Delete. + 2005-10-26 Arno J. Klaassen * configure.in [*-*-freebsd*] (SH_LDFLAGS): Properly quote. diff -r e67d027ff4e3 -r 7c8767d0ffc0 aclocal.m4 --- a/aclocal.m4 Wed Oct 26 21:13:57 2005 +0000 +++ b/aclocal.m4 Thu Oct 27 02:20:17 2005 +0000 @@ -865,18 +865,20 @@ dnl that as umfpack.h can be in three different places, rather than dnl include it, just declare the functions needed. dnl -dnl Assumes that -dnl -dnl ACX_CHECK_HEADER_IN_DIRS(umfpack.h, [umfpack ufsparse]) -dnl -dnl has already been called. +dnl Assumes that the check for umfpack has already been performed. dnl AC_DEFUN([OCTAVE_UMFPACK_SEPERATE_SPLIT], [AC_MSG_CHECKING([for UMFPACK seperate complex matrix and rhs split]) AC_CACHE_VAL(octave_cv_umfpack_seperate_split, [AC_TRY_RUN([ #include -#include <$acx_umfpack_h_include_file> +#if defined (HAVE_UFSPARSE_UMFPACK_h) +#include +#elif defined (HAVE_UMFPACK_UMFPACK_H) +#include +#elif defined (HAVE_UMFPACK_H) +#include +#endif int n = 5; int Ap[] = {0, 2, 5, 9, 10, 12}; int Ai[] = {0, 1, 0, 2, 4, 1, 2, 3, 4, 2, 1, 4}; diff -r e67d027ff4e3 -r 7c8767d0ffc0 acx_include_dirs.m4 --- a/acx_include_dirs.m4 Wed Oct 26 21:13:57 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -dnl @synopsis ACX_CHECK_HEADER_IN_DIRS (HEADER, DIR-LIST, [ -dnl ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND[, MESSAGE]]]) -dnl -dnl This macro looks for a header file in the include directories -dnl and in the sub-directories specified by DIR-LIST. -dnl -dnl This macro requires autoconf 2.50 or later. -dnl -dnl @version $Id: acx_include_dirs.m4,v 1.3 2005-10-21 12:30:29 jwe Exp $ -dnl @author David Bateman -dnl -AC_DEFUN([ACX_CHECK_HEADER_IN_DIRS], [ -AC_PREREQ(2.50) -acx_include_ok=no -acx_include_dir= - -# First check the header in the base directory -AC_CHECK_HEADER($1, [acx_include_ok=yes]) - -# Now check the other directories -if test x"$acx_include_ok" = xno; then - for dir in $2; do - AC_CHECK_HEADER(${dir}/$1, [acx_include_ok=yes; acx_include_dir=${dir}; break]) - done -fi - -# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: -if test x"$acx_include_ok" = xyes; then - acx_header=HEADER_`echo $1 | sed -e 's/[[^a-zA-Z0-9_]]/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` - acx_header_name_for_variable=`echo $1 | sed -e 's/[[^a-zA-Z0-9_]]/_/g'` - eval acx_${acx_header_name_for_variable}_include_dir=$acx_include_dir - if test -n "$acx_include_dir"; then - eval acx_${acx_header_name_for_variable}_include_file=$acx_include_dir/$1 - else - eval acx_${acx_header_name_for_variable}_include_file=$1 - fi - ifelse([$3],,AC_DEFINE(${acx_header}, - [`eval echo '${'acx_${acx_header_name_for_variable}_include_file'}'`/$1], - [$5]),[$3]) -ifelse([$4],,,[ -else - $4 -]) -fi -])dnl ACX_CHECK_HEADER_IN_DIRS diff -r e67d027ff4e3 -r 7c8767d0ffc0 configure.in --- a/configure.in Wed Oct 26 21:13:57 2005 +0000 +++ b/configure.in Thu Oct 27 02:20:17 2005 +0000 @@ -29,7 +29,7 @@ EXTERN_CXXFLAGS="$CXXFLAGS" AC_INIT -AC_REVISION($Revision: 1.488 $) +AC_REVISION($Revision: 1.489 $) AC_PREREQ(2.57) AC_CONFIG_SRCDIR([src/octave.cc]) AC_CONFIG_HEADER(config.h) @@ -741,18 +741,18 @@ if test "$with_umfpack" = "yes" && test "$with_amd" = "yes"; then with_umfpack=no - ACX_CHECK_HEADER_IN_DIRS(umfpack.h, [umfpack ufsparse],[ - AC_CHECK_LIB(umfpack, umfpack_zi_get_determinant, [ - UMFPACK_LIBS="-lumfpack"; with_umfpack=yes], [ + AC_CHECK_HEADERS([ufsparse/umfpack.h umfpack/umfpack.h umfpack.h], [ + AC_CHECK_LIB(umfpack, umfpack_zi_get_determinant, [ + UMFPACK_LIBS="-lumfpack"; with_umfpack=yes], [ + ## Invalidate the cache. + $as_unset ac_cv_lib_umfpack_umfpack_zi_get_determinant + AC_CHECK_LIB(umfpack, umfpack_zi_get_determinant, [ + UMFPACK_LIBS="-lumfpack"; with_umfpack=yes], [ + ## Invalidate the cache. $as_unset ac_cv_lib_umfpack_umfpack_zi_get_determinant AC_CHECK_LIB(umfpack, umfpack_zi_get_determinant, [ - UMFPACK_LIBS="-lumfpack"; with_umfpack=yes], [ - - ## Invalidate the cache. - $as_unset ac_cv_lib_umfpack_umfpack_zi_get_determinant - AC_CHECK_LIB(umfpack, umfpack_zi_get_determinant, [ - UMFPACK_LIBS="-lumfpack -lcblas"; with_umfpack=yes], [], $AMD_LIBS -lcblas $BLAS_LIBS)], $AMD_LIBS $BLAS_LIBS $FLIBS)], $AMD_LIBS) + UMFPACK_LIBS="-lumfpack -lcblas"; with_umfpack=yes], [], $AMD_LIBS -lcblas $BLAS_LIBS)], $AMD_LIBS $BLAS_LIBS $FLIBS)], $AMD_LIBS) if test "$with_umfpack" = yes; then AC_DEFINE(HAVE_UMFPACK, 1, [Define if the UMFPACK library is used.]) @@ -765,7 +765,8 @@ LIBS=$OLD_LIBS else warn_umfpack="UMFPACK not found. This will result in some lack of functionality for sparse matrices." - fi],[ + fi + break], [ warn_umfpack="UMFPACK not found. This will result in some lack of functionality for sparse matrices."]) fi @@ -780,7 +781,7 @@ if test "$with_colamd" = "yes"; then with_colamd=no - ACX_CHECK_HEADER_IN_DIRS(colamd.h, [umfpack ufsparse],[ + AC_CHECK_HEADERS([ufsparse/colamd.h umfpack/colamd.h colamd.h], [ AC_CHECK_LIB(colamd, colamd, [COLAMD_LIBS="-lcolamd"; with_colamd=yes]) if test "$with_colamd" = yes; then @@ -790,7 +791,8 @@ AC_DEFINE(HAVE_COLAMD, 1, [Define if the COLAMD library is used.]) else warn_colamd="COLAMD not found. This will result in some lack of functionality for sparse matrices." - fi],[ + fi + break], [ warn_colamd="COLAMD not found. This will result in some lack of functionality for sparse matrices."]) fi @@ -805,7 +807,7 @@ if test "$with_ccolamd" = "yes"; then with_ccolamd=no - ACX_CHECK_HEADER_IN_DIRS(ccolamd.h, [umfpack ufsparse],[ + AC_CHECK_HEADERS([ufsparse/ccolamd.h umfpack/ccolamd.h ccolamd.h], [ AC_CHECK_LIB(ccolamd, ccolamd, [CCOLAMD_LIBS="-lccolamd"; with_ccolamd=yes]) if test "$with_ccolamd" = yes; then @@ -815,7 +817,8 @@ AC_DEFINE(HAVE_CCOLAMD, 1, [Define if the CCOLAMD library is used.]) else warn_ccolamd="CCOLAMD not found. This will result in some lack of functionality for sparse matrices." - fi],[ + fi + break], [ warn_colamd="CCOLAMD not found. This will result in some lack of functionality for sparse matrices."]) fi @@ -833,13 +836,14 @@ if test "$with_cholmod" = "yes" && test "$with_colamd" = "yes" && test "$with_ccolamd" = "yes" && test "$with_amd" = "yes"; then with_cholmod=no - ACX_CHECK_HEADER_IN_DIRS(cholmod.h, [umfpack ufsparse],[ + AC_CHECK_HEADERS([ufsparse/cholmod.h umfpack/cholmod.h cholmod.h], [ if test x"$acx_include_dir" != x; then CHOLMOD_INCLUDE=$acx_include_dir/cholmod.h fi - ACX_CHECK_HEADER_IN_DIRS(metis.h, [metis umfpack ufsparse],[ - AC_CHECK_LIB(metis, METIS_NodeND, with_metis=yes, with_metis=no)], + AC_CHECK_HEADERS([metis/metis.h ufsparse/metis.h umfpack/metis.h metis.h], [ + AC_CHECK_LIB(metis, METIS_NodeND, with_metis=yes, with_metis=no) + break], with_metis=no) if test "$with_metis" = yes; then @@ -866,7 +870,8 @@ AC_DEFINE(HAVE_CHOLMOD, 1, [Define if the CHOLMOD library is used.]) else warn_cholmod="CHOLMOD not found. This will result in some lack of functionality for sparse matrices." - fi],[ + fi + break], [ warn_colamd="CHOLMOD not found. This will result in some lack of functionality for sparse matrices."]) fi @@ -1752,7 +1757,7 @@ dlfcn/Makefile doc/Makefile doc/faq/Makefile \ doc/interpreter/Makefile doc/liboctave/Makefile \ doc/refcard/Makefile emacs/Makefile examples/Makefile \ - liboctave/Makefile liboctave/oct-sparse.h liboctave/oct-types.h \ + liboctave/Makefile liboctave/oct-types.h \ src/Makefile libcruft/Makefile libcruft/Makerules \ libcruft/amos/Makefile libcruft/blas/Makefile \ libcruft/daspk/Makefile libcruft/dasrt/Makefile diff -r e67d027ff4e3 -r 7c8767d0ffc0 liboctave/ChangeLog --- a/liboctave/ChangeLog Wed Oct 26 21:13:57 2005 +0000 +++ b/liboctave/ChangeLog Thu Oct 27 02:20:17 2005 +0000 @@ -1,3 +1,8 @@ +2005-10-26 John W. Eaton + + * oct-sparse.h: New file. + * oct-sparse.h.in: Delete. + 2005-10-26 David Bateman * sparse-base-chol.h: Include cholmod specific code in HAVE_CHOLMOD diff -r e67d027ff4e3 -r 7c8767d0ffc0 liboctave/oct-sparse.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/liboctave/oct-sparse.h Thu Oct 27 02:20:17 2005 +0000 @@ -0,0 +1,91 @@ +/* + +Copyright (C) 2005 David Bateman + +This file is part of Octave. + +Octave is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 2, or (at your option) any +later version. + +Octave 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 General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with Octave; see the file COPYING. If not, write to the Free +Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301, USA. + +*/ + +#if !defined (oct_sparse_h) +#define oct_sparse_h 1 + +#ifdef HAVE_CONFIG_H +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined (HAVE_UFSPARSE_UMFPACK_h) +#include +#elif defined (HAVE_UMFPACK_UMFPACK_H) +#include +#elif defined (HAVE_UMFPACK_H) +#include +#endif + +#if defined (HAVE_UFSPARSE_COLAMD_H) +#include +#elif defined (HAVE_UMFPACK_COLAMD_H) +#include +#elif defined (HAVE_COLAMD_H) +#include +#endif + +#if defined (HAVE_UFSPARSE_CCOLAMD_H) +#include +#elif defined (HAVE_UMFPACK_CCOLAMD_H) +#include +#elif defined (HAVE_CCOLAMD_H) +#include +#endif + +#if defined (HAVE_METIS_METIS_H) +#include +#elif defined (HAVE_UFSPARSE_METIS_H) +#include +#elif defined (HAVE_UMFPACK_METIS_H) +#include +#elif defined (HAVE_METIS_H) +#include +#endif + +#if defined (HAVE_UFSPARSE_CHOLMOD_H) +#include +#elif defined (HAVE_UMFPACK_CHOLMOD_H) +#include +#elif defined (HAVE_CHOLMOD_H) +#include +#endif + +#if (defined (HAVE_UFSPARSE_CHOLMOD_H) \ + || defined (HAVE_UMFPACK_CHOLMOD_H) \ + || defined (HAVE_CHOLMOD_H)) +#ifdef IDX_TYPE_LONG +#define CHOLMOD_NAME(name) cholmod_l_ ## name +#else +#define CHOLMOD_NAME(name) cholmod_ ## name +#endif +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff -r e67d027ff4e3 -r 7c8767d0ffc0 liboctave/oct-sparse.h.in --- a/liboctave/oct-sparse.h.in Wed Oct 26 21:13:57 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,76 +0,0 @@ -/* - -Copyright (C) 2005 David Bateman - -This file is part of Octave. - -Octave is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) any -later version. - -Octave 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 General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with Octave; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301, USA. - -*/ - -#if !defined (oct_sparse_h) -#define oct_sparse_h 1 - -#ifdef HAVE_CONFIG_H -#include -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef HAVE_UMFPACK -/* External UMFPACK functions in C */ -#include <@UMFPACK_INCLUDE@> -#endif - -#ifdef HAVE_COLAMD -/* External COLAMD functions in C */ -#include <@COLAMD_INCLUDE@> -#endif - -#ifdef HAVE_CCOLAMD -/* External COLAMD functions in C */ -#include <@CCOLAMD_INCLUDE@> -#endif - -#ifdef HAVE_METIS -/* External METIS functions in C */ -#include <@METIS_INCLUDE@> -#endif - -#ifdef HAVE_CHOLMOD -/* External CHOLMOD functions in C */ -#include <@CHOLMOD_INCLUDE@> - -#ifndef FALSE -#define FALSE 0 -#endif -#ifndef TRUE -#define TRUE 1 -#endif - -#ifdef IDX_TYPE_LONG -#define CHOLMOD_NAME(name) cholmod_l_ ## name -#else -#define CHOLMOD_NAME(name) cholmod_ ## name -#endif -#endif - -#ifdef __cplusplus -} -#endif -#endif diff -r e67d027ff4e3 -r 7c8767d0ffc0 liboctave/sparse-base-chol.h --- a/liboctave/sparse-base-chol.h Wed Oct 26 21:13:57 2005 +0000 +++ b/liboctave/sparse-base-chol.h Thu Oct 27 02:20:17 2005 +0000 @@ -35,15 +35,13 @@ sparse_base_chol { protected: +#ifdef HAVE_CHOLMOD class sparse_base_chol_rep { public: -#ifdef HAVE_CHOLMOD sparse_base_chol_rep (void) : count (1), Lsparse (NULL), is_pd (false), minor_p (0) { } -#else - sparse_base_chol_rep (void) : count (1), is_pd (false), minor_p (0) { } -#endif + sparse_base_chol_rep (const chol_type& a, const bool natural) : count (1) { init (a, natural); } @@ -52,14 +50,11 @@ const bool natural) : count (1) { info = init (a, natural); } -#ifdef HAVE_CHOLMOD ~sparse_base_chol_rep (void) { CHOLMOD_NAME(free_sparse) (&Lsparse, &Common); } cholmod_sparse * L (void) const { return Lsparse; } -#else - ~sparse_base_chol_rep (void) { } -#endif + octave_idx_type P (void) const { return (minor_p == static_cast(Lsparse->ncol) ? 0 : minor_p + 1); } @@ -75,11 +70,10 @@ int count; private: -#ifdef HAVE_CHOLMOD cholmod_sparse *Lsparse; cholmod_common Common; -#endif + bool is_pd; octave_idx_type minor_p; @@ -95,6 +89,49 @@ // No assignment sparse_base_chol_rep& operator = (const sparse_base_chol_rep& a); }; +#else + class sparse_base_chol_rep + { + public: + sparse_base_chol_rep (void) : count (1), is_pd (false), minor_p (0) { } + + sparse_base_chol_rep (const chol_type& a, + const bool natural) : count (1) + { init (a, natural); } + + sparse_base_chol_rep (const chol_type& a, octave_idx_type& info, + const bool natural) : count (1) + { info = init (a, natural); } + + ~sparse_base_chol_rep (void) { } + + octave_idx_type P (void) const { return 0; } + + ColumnVector perm (void) const { return perms + 1; } + + p_type Q (void) const; + + bool is_positive_definite (void) const { return is_pd; } + + double rcond (void) const { return cond; } + + int count; + + private: + bool is_pd; + + octave_idx_type minor_p; + + ColumnVector perms; + + double cond; + + octave_idx_type init (const chol_type& a, bool natural = true); + + // No assignment + sparse_base_chol_rep& operator = (const sparse_base_chol_rep& a); + }; +#endif private: sparse_base_chol_rep *rep; diff -r e67d027ff4e3 -r 7c8767d0ffc0 src/DLD-FUNCTIONS/spchol.cc --- a/src/DLD-FUNCTIONS/spchol.cc Wed Oct 26 21:13:57 2005 +0000 +++ b/src/DLD-FUNCTIONS/spchol.cc Thu Oct 27 02:20:17 2005 +0000 @@ -392,6 +392,8 @@ return retval; } +#ifdef HAVE_CHOLMOD + cholmod_common Common; cholmod_common *cm = &Common; CHOLMOD_NAME(start) (cm); @@ -660,7 +662,11 @@ retval(0) = tmp; } - symbfact_error: + symbfact_error: +#else + error ("symbfact: not available in this version of Octave"); +#endif + return retval; }