Mercurial > hg > octave-nkf
changeset 5512:7c8767d0ffc0
[project @ 2005-10-27 02:20:17 by jwe]
author | jwe |
---|---|
date | Thu, 27 Oct 2005 02:20:17 +0000 |
parents | e67d027ff4e3 |
children | 843fa0a80229 |
files | ChangeLog aclocal.m4 acx_include_dirs.m4 configure.in liboctave/ChangeLog liboctave/oct-sparse.h liboctave/oct-sparse.h.in liboctave/sparse-base-chol.h src/DLD-FUNCTIONS/spchol.cc |
diffstat | 9 files changed, 193 insertions(+), 159 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2005-10-26 John W. Eaton <jwe@octave.org> + + * 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 <arno@heho.snv.jussieu.fr> * configure.in [*-*-freebsd*] (SH_LDFLAGS): Properly quote.
--- a/aclocal.m4 +++ b/aclocal.m4 @@ -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 <stdlib.h> -#include <$acx_umfpack_h_include_file> +#if defined (HAVE_UFSPARSE_UMFPACK_h) +#include <ufsparse/umfpack.h> +#elif defined (HAVE_UMFPACK_UMFPACK_H) +#include <umfpack/umfpack.h> +#elif defined (HAVE_UMFPACK_H) +#include <umfpack.h> +#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};
deleted file mode 100644 --- a/acx_include_dirs.m4 +++ /dev/null @@ -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 <dbateman@free.fr> -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
--- a/configure.in +++ b/configure.in @@ -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
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,8 @@ +2005-10-26 John W. Eaton <jwe@octave.org> + + * oct-sparse.h: New file. + * oct-sparse.h.in: Delete. + 2005-10-26 David Bateman <dbateman@free.fr> * sparse-base-chol.h: Include cholmod specific code in HAVE_CHOLMOD
new file mode 100644 --- /dev/null +++ b/liboctave/oct-sparse.h @@ -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 <config.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined (HAVE_UFSPARSE_UMFPACK_h) +#include <ufsparse/umfpack.h> +#elif defined (HAVE_UMFPACK_UMFPACK_H) +#include <umfpack/umfpack.h> +#elif defined (HAVE_UMFPACK_H) +#include <umfpack.h> +#endif + +#if defined (HAVE_UFSPARSE_COLAMD_H) +#include <ufsparse/colamd.h> +#elif defined (HAVE_UMFPACK_COLAMD_H) +#include <umfpack/colamd.h> +#elif defined (HAVE_COLAMD_H) +#include <colamd.h> +#endif + +#if defined (HAVE_UFSPARSE_CCOLAMD_H) +#include <ufsparse/ccolamd.h> +#elif defined (HAVE_UMFPACK_CCOLAMD_H) +#include <umfpack/ccolamd.h> +#elif defined (HAVE_CCOLAMD_H) +#include <ccolamd.h> +#endif + +#if defined (HAVE_METIS_METIS_H) +#include <metis/metis.h> +#elif defined (HAVE_UFSPARSE_METIS_H) +#include <ufsparse/metis.h> +#elif defined (HAVE_UMFPACK_METIS_H) +#include <umfpack/metis.h> +#elif defined (HAVE_METIS_H) +#include <metis.h> +#endif + +#if defined (HAVE_UFSPARSE_CHOLMOD_H) +#include <ufsparse/cholmod.h> +#elif defined (HAVE_UMFPACK_CHOLMOD_H) +#include <umfpack/cholmod.h> +#elif defined (HAVE_CHOLMOD_H) +#include <cholmod.h> +#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
deleted file mode 100644 --- a/liboctave/oct-sparse.h.in +++ /dev/null @@ -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 <config.h> -#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
--- a/liboctave/sparse-base-chol.h +++ b/liboctave/sparse-base-chol.h @@ -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<octave_idx_type>(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;
--- a/src/DLD-FUNCTIONS/spchol.cc +++ b/src/DLD-FUNCTIONS/spchol.cc @@ -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; }