Mercurial > hg > octave-nkf
comparison m4/acinclude.m4 @ 16318:eb572251b7c6
check for correct SuiteSparse functions if --enable-64
* configure.ac (UMFPACK_TAG): New macro. Use it to check for
appropriate cholmod, cxsparse, and umfpack functions that depend on
index size.
* acinclude.m4 (OCTAVE_UMFPACK_SEPARATE_SPLIT): Use correct umfpack
names and integer sizes in test.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 15 Mar 2013 14:37:32 -0400 |
parents | 6aafe87a3144 |
children | e380d1317c72 |
comparison
equal
deleted
inserted
replaced
16317:ce5231908ea2 | 16318:eb572251b7c6 |
---|---|
1790 dnl | 1790 dnl |
1791 AC_DEFUN([OCTAVE_UMFPACK_SEPARATE_SPLIT], [ | 1791 AC_DEFUN([OCTAVE_UMFPACK_SEPARATE_SPLIT], [ |
1792 AC_MSG_CHECKING([for UMFPACK separate complex matrix and rhs split]) | 1792 AC_MSG_CHECKING([for UMFPACK separate complex matrix and rhs split]) |
1793 AC_CACHE_VAL([octave_cv_umfpack_separate_split], | 1793 AC_CACHE_VAL([octave_cv_umfpack_separate_split], |
1794 [AC_RUN_IFELSE([AC_LANG_SOURCE([[ | 1794 [AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
1795 #include <stdint.h> | |
1795 #include <stdlib.h> | 1796 #include <stdlib.h> |
1796 #include <math.h> | 1797 #include <math.h> |
1797 #if defined (HAVE_SUITESPARSE_UMFPACK_H) | 1798 #if defined (HAVE_SUITESPARSE_UMFPACK_H) |
1798 # include <suitesparse/umfpack.h> | 1799 # include <suitesparse/umfpack.h> |
1799 #elif defined (HAVE_UFSPARSE_UMFPACK_H) | 1800 #elif defined (HAVE_UFSPARSE_UMFPACK_H) |
1801 #elif defined (HAVE_UMFPACK_UMFPACK_H) | 1802 #elif defined (HAVE_UMFPACK_UMFPACK_H) |
1802 # include <umfpack/umfpack.h> | 1803 # include <umfpack/umfpack.h> |
1803 #elif defined (HAVE_UMFPACK_H) | 1804 #elif defined (HAVE_UMFPACK_H) |
1804 # include <umfpack.h> | 1805 # include <umfpack.h> |
1805 #endif | 1806 #endif |
1806 int n = 5; | 1807 #ifdef USE_64_BIT_IDX_T |
1807 int Ap[] = {0, 2, 5, 9, 10, 12}; | 1808 typedef uint64_t idx_type; |
1808 int Ai[] = {0, 1, 0, 2, 4, 1, 2, 3, 4, 2, 1, 4}; | 1809 #define UMFPACK_NAME(name) umfpack_zl_ ## name |
1810 #else | |
1811 typedef int idx_type; | |
1812 #define UMFPACK_NAME(name) umfpack_zi_ ## name | |
1813 #endif | |
1814 idx_type n = 5; | |
1815 idx_type Ap[] = {0, 2, 5, 9, 10, 12}; | |
1816 idx_type Ai[] = {0, 1, 0, 2, 4, 1, 2, 3, 4, 2, 1, 4}; | |
1809 double Ax[] = {2., 0., 3., 0., 3., 0., -1., 0., 4., 0., 4., 0., | 1817 double Ax[] = {2., 0., 3., 0., 3., 0., -1., 0., 4., 0., 4., 0., |
1810 -3., 0., 1., 0., 2., 0., 2., 0., 6., 0., 1., 0.}; | 1818 -3., 0., 1., 0., 2., 0., 2., 0., 6., 0., 1., 0.}; |
1811 double br[] = {8., 45., -3., 3., 19.}; | 1819 double br[] = {8., 45., -3., 3., 19.}; |
1812 double bi[] = {0., 0., 0., 0., 0.}; | 1820 double bi[] = {0., 0., 0., 0., 0.}; |
1813 int main (void) | 1821 int main (void) |
1814 { | 1822 { |
1815 double *null = (double *) NULL ; | 1823 double *null = (double *) NULL ; |
1816 double *x = (double *)malloc (2 * n * sizeof(double)); | 1824 double *x = (double *)malloc (2 * n * sizeof(double)); |
1817 int i ; | 1825 idx_type i ; |
1818 void *Symbolic, *Numeric ; | 1826 void *Symbolic, *Numeric ; |
1819 (void) umfpack_zi_symbolic (n, n, Ap, Ai, Ax, null, &Symbolic, null, null) ; | 1827 (void) UMFPACK_NAME (symbolic) (n, n, Ap, Ai, Ax, null, &Symbolic, null, null) ; |
1820 (void) umfpack_zi_numeric (Ap, Ai, Ax, null, Symbolic, &Numeric, null, null) ; | 1828 (void) UMFPACK_NAME (numeric) (Ap, Ai, Ax, null, Symbolic, &Numeric, null, null) ; |
1821 umfpack_zi_free_symbolic (&Symbolic) ; | 1829 UMFPACK_NAME (free_symbolic) (&Symbolic) ; |
1822 (void) umfpack_zi_solve (0, Ap, Ai, Ax, null, x, null, br, bi, | 1830 (void) UMFPACK_NAME (solve) (0, Ap, Ai, Ax, null, x, null, br, bi, |
1823 Numeric, null, null) ; | 1831 Numeric, null, null) ; |
1824 umfpack_zi_free_numeric (&Numeric) ; | 1832 UMFPACK_NAME (free_numeric) (&Numeric) ; |
1825 for (i = 0; i < n; i++, x+=2) | 1833 for (i = 0; i < n; i++, x+=2) |
1826 if (fabs (*x - i - 1.) > 1.e-13) | 1834 if (fabs (*x - i - 1.) > 1.e-13) |
1827 return (1); | 1835 return (1); |
1828 return (0) ; | 1836 return (0) ; |
1829 } | 1837 } |