Codebase list gsl / f6853f9
Import Debian changes 1.12+dfsg-1 gsl (1.12+dfsg-1) unstable; urgency=low * New upstream version released today * doc/*: As before, removed the 'non-free' documentation to create a source package that complies with Debian's interpretation of what is free. Dirk Eddelbuettel 5 years ago
284 changed file(s) with 12255 addition(s) and 4156 deletion(s). Raw diff Collapse all Expand all
0 2008-09-26 Brian Gough <bjg@network-theory.co.uk>
1
2 * configure.ac: handle test for SSE in cross-compilation (fall
3 back to checking if the ldmxcsr instruction compiles)
4
5 2008-07-03 Brian Gough <bjg@hp2.network-theory.co.uk>
6
7 * Makefile.am: added gsl_inline.h and build.h
8
9 * gsl_mode.h gsl_pow_int.h: use new inline declarations
10
11 * gsl_minmax.h: new header file for minmax functions, use new
12 inline declarations
13
14 * gsl_math.h: moved minmax functions to separate header file
15
16 * configure.ac: test for C99 inline as well
17
18 * build.h gsl_inline.h: added new header to handle GNU-style and
19 C99 inlines
20
021 2008-03-17 Brian Gough <bjg@network-theory.co.uk>
122
223 * configure.ac: remove hack to disable search for Fortran, Java,
9797
9898 to allow C++ exceptions to be handled.
9999
100 3) With gcc-2.95/2.96 the tests fail in the eigen/ directory. This is
100 3) With gcc-4.3.2 the tests in the poly/ directory fail due to a
101 compiler optimization bug which is fixed in later versions of GCC
102 (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38478).
103
104 FAIL: y.real, gsl_complex_poly_complex_eval ({-2.31 + 0.44i, 4.21 - 3.19i, 0.93 + 1.04i, -0.42 + 0.68i}, 0.49 + 0.95i) (-1.68450788000000018 observed vs 1.82462012000000007 expected) [9]
105 FAIL: y.imag, gsl_complex_poly_complex_eval ({-2.31 + 0.44i, 4.21 - 3.19i, 0.93 + 1.04i, -0.42 + 0.68i}, 0.49 + 0.95i) (-0.30943988 observed vs 2.30389411999999982 expected) [10]
106
107 With gcc-2.95/2.96 the tests fail in the eigen/ directory. This is
101108 due to a compiler optimization bug which causes errors in the
102109 manipulation of complex numbers.
103110
104 This is fixed in more recent versions of gcc. Do not use the library
105 if you encounter this problem---install a newer version of gcc.
111 If you encounter these problems, install a different version of gcc.
106112
107113 4) Attempts to run 'strip' on the static library libgsl.a will probably
108114 produce a broken library (it is known to happen with GNU binutils
139145 setenv CFLAGS '-O -qmaxmem=8192'
140146 ./configure --disable-shared
141147 make
148
149 If you compile with higher optimisation -O3 you will also need
150 -qstrict. The -O3 flag causes the -nostrict option to be
151 enabled. This affects the accuracy of the results and causes some of
152 the tests to fail.
142153
143154 If you get the error,
144155
55
66 SUBLIBS = block/libgslblock.la blas/libgslblas.la bspline/libgslbspline.la complex/libgslcomplex.la cheb/libgslcheb.la dht/libgsldht.la diff/libgsldiff.la deriv/libgslderiv.la eigen/libgsleigen.la err/libgslerr.la fft/libgslfft.la fit/libgslfit.la histogram/libgslhistogram.la ieee-utils/libgslieeeutils.la integration/libgslintegration.la interpolation/libgslinterpolation.la linalg/libgsllinalg.la matrix/libgslmatrix.la min/libgslmin.la monte/libgslmonte.la multifit/libgslmultifit.la multimin/libgslmultimin.la multiroots/libgslmultiroots.la ntuple/libgslntuple.la ode-initval/libgslodeiv.la permutation/libgslpermutation.la combination/libgslcombination.la poly/libgslpoly.la qrng/libgslqrng.la randist/libgslrandist.la rng/libgslrng.la roots/libgslroots.la siman/libgslsiman.la sort/libgslsort.la specfunc/libgslspecfunc.la statistics/libgslstatistics.la sum/libgslsum.la sys/libgslsys.la test/libgsltest.la utils/libutils.la vector/libgslvector.la cdf/libgslcdf.la wavelet/libgslwavelet.la
77
8 pkginclude_HEADERS = gsl_math.h gsl_pow_int.h gsl_nan.h gsl_machine.h gsl_mode.h gsl_precision.h gsl_types.h gsl_version.h
8 pkginclude_HEADERS = gsl_math.h gsl_pow_int.h gsl_nan.h gsl_machine.h gsl_mode.h gsl_precision.h gsl_types.h gsl_version.h gsl_minmax.h gsl_inline.h
99
1010 bin_SCRIPTS = gsl-config
1111
1818 libgsl_la_SOURCES = version.c
1919 libgsl_la_LIBADD = $(SUBLIBS)
2020 libgsl_la_LDFLAGS = -version-info $(GSL_LT_VERSION)
21 noinst_HEADERS = templates_on.h templates_off.h
21 noinst_HEADERS = templates_on.h templates_off.h build.h
2222
2323 MINGW32_HOST = @MINGW32_HOST@
2424 if MINGW32_HOST
4747 $(srcdir)/gsl-config.in $(srcdir)/gsl.pc.in \
4848 $(srcdir)/gsl.spec.in $(srcdir)/gsl_version.h.in \
4949 $(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \
50 THANKS TODO config.guess config.sub install-sh ltmain.sh \
51 mdate-sh missing mkinstalldirs
50 THANKS TODO config.guess config.sub depcomp install-sh \
51 ltmain.sh mdate-sh missing mkinstalldirs
5252 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
5353 am__aclocal_m4_deps = $(top_srcdir)/configure.ac
5454 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
182182 LIBOBJS = @LIBOBJS@
183183 LIBS = @LIBS@
184184 LIBTOOL = @LIBTOOL@
185 LIPO = @LIPO@
185186 LN_S = @LN_S@
186187 LTLIBOBJS = @LTLIBOBJS@
187188 MAINT = @MAINT@
189190 MKDIR_P = @MKDIR_P@
190191 NM = @NM@
191192 NMEDIT = @NMEDIT@
193 OBJDUMP = @OBJDUMP@
192194 OBJEXT = @OBJEXT@
195 OTOOL = @OTOOL@
196 OTOOL64 = @OTOOL64@
193197 PACKAGE = @PACKAGE@
194198 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
195199 PACKAGE_NAME = @PACKAGE_NAME@
254258 top_srcdir = @top_srcdir@
255259 SUBDIRS = gsl utils sys test err const complex cheb block vector matrix permutation combination sort ieee-utils cblas blas linalg eigen specfunc dht qrng rng randist fft poly fit multifit statistics siman sum integration interpolation histogram ode-initval roots multiroots min multimin monte ntuple diff deriv cdf wavelet bspline doc
256260 SUBLIBS = block/libgslblock.la blas/libgslblas.la bspline/libgslbspline.la complex/libgslcomplex.la cheb/libgslcheb.la dht/libgsldht.la diff/libgsldiff.la deriv/libgslderiv.la eigen/libgsleigen.la err/libgslerr.la fft/libgslfft.la fit/libgslfit.la histogram/libgslhistogram.la ieee-utils/libgslieeeutils.la integration/libgslintegration.la interpolation/libgslinterpolation.la linalg/libgsllinalg.la matrix/libgslmatrix.la min/libgslmin.la monte/libgslmonte.la multifit/libgslmultifit.la multimin/libgslmultimin.la multiroots/libgslmultiroots.la ntuple/libgslntuple.la ode-initval/libgslodeiv.la permutation/libgslpermutation.la combination/libgslcombination.la poly/libgslpoly.la qrng/libgslqrng.la randist/libgslrandist.la rng/libgslrng.la roots/libgslroots.la siman/libgslsiman.la sort/libgslsort.la specfunc/libgslspecfunc.la statistics/libgslstatistics.la sum/libgslsum.la sys/libgslsys.la test/libgsltest.la utils/libutils.la vector/libgslvector.la cdf/libgslcdf.la wavelet/libgslwavelet.la
257 pkginclude_HEADERS = gsl_math.h gsl_pow_int.h gsl_nan.h gsl_machine.h gsl_mode.h gsl_precision.h gsl_types.h gsl_version.h
261 pkginclude_HEADERS = gsl_math.h gsl_pow_int.h gsl_nan.h gsl_machine.h gsl_mode.h gsl_precision.h gsl_types.h gsl_version.h gsl_minmax.h gsl_inline.h
258262 bin_SCRIPTS = gsl-config
259263 pkgconfigdir = $(libdir)/pkgconfig
260264 pkgconfig_DATA = gsl.pc
263267 libgsl_la_SOURCES = version.c
264268 libgsl_la_LIBADD = $(SUBLIBS) $(am__append_1)
265269 libgsl_la_LDFLAGS = -version-info $(GSL_LT_VERSION) $(am__append_2)
266 noinst_HEADERS = templates_on.h templates_off.h
270 noinst_HEADERS = templates_on.h templates_off.h build.h
267271 MINGW32_HOST = @MINGW32_HOST@
268272 m4datadir = $(datadir)/aclocal
269273 m4data_DATA = gsl.m4
0 * What is new in gsl-1.11:
0 * What is new in gsl-1.12:
1
2 ** Upgraded to latest libtool, autoconf and automake (libtool-2.2.6,
3 autoconf-2.63, automake-1.10.2)
4
5 ** Improved the convergence of gsl_sf_gamma_inc_P for x/a ~=~ 1 and
6 large x,a. Fixes problems with large arguments in cdf functions
7 such as gsl_cdf_chisq_Pinv(x,nu) [bug 24704].
8
9 ** Fixed gsl_ran_gamma_knuth to handle the case of a >= UINT_MAX [bug
10 #24897]
11
12 ** Added gsl_bspline_eval_deriv to compute bspline derivatives
13 (Rhys Ulerich)
14
15 ** Added a faster simplex mininimser gsl_multimin_fminimizer_nmsimplex2
16 which is O(N) instead of O(N^2) [bug #24418]
17
18 ** Improved the original chi-squared formula in gsl_monte_vegas to
19 avoid catastrophic cancellation [bug #24510]. The previous formula
20 could return incorrect or negative values for relative errors <
21 1e-8, which could occur when integrating very smooth functions.
22
23 ** Added new auxiliary functions gsl_cheb_order, gsl_cheb_size,
24 gsl_cheb_coeffs for Chebyshev series [bug #21830]
25
26 ** Updated license of the reference manual to GNU FDL version 1.3.
27
28 ** Fixed a bug where the gsl_isinf function would return +1 for -Inf
29 on systems where isinf(-Inf) returns the non-standard value +1.
30 [bug #24489]
31
32 ** Added missing functions gsl_vector_complex_{isnonneg,add,sub,mul,
33 div,scale,add_constant} and gsl_matrix_complex_float_isnonneg [bug
34 #22478]
35
36 ** Cross compilation should now work for x86 hosts.
37
38 ** Fixed a bug in gsl_interp_accel_find() where values lying on the
39 upper boundary between interpolation points could return the index
40 from the lower side. [bug #24211]
41
42 ** Fixed gsl_linalg_solve_cyc_tridiag so that its output respects the
43 solution vector's stride. Previously the x_stride value was ignored
44 causing the output to be incorrect for non-unit stride. [bug #24162]
45
46 ** Corrected a bug in the series calculation of gsl_sf_ellint_Kcomp
47 for k close to 1. [bug #24146]
48
49 ** Extended gsl_linalg_QRPT_update to handle rectangular matrices.
50 Corrected definition of the update formula in the manual for
51 both gsl_linalg_QR_update and gsl_linalg_QRPT_update.
52
53 ** Added routine gsl_linalg_cholesky_invert
54
55 ** Fixed a bug the simplex algorithm which caused the second highest
56 point to be incorrectly equal to the first when the first value was
57 the highest, which could cause suboptimal convergence. [bug #23192]
58
59 ** Fixed a problem with convergence for inverse gamma and chisq
60 distribitions, gsl_cdf_gamma_{P,Q}inv and gsl_cdf_chisq_{P,Q}inv.
61 [bug #23101]
62
63 ** Improved the handling of constant regions in Vegas by eliminating
64 spurious excess precision when computing box variances.
65
66 ** Fixed a potential division by zero in gsl_monte_miser when the
67 left/right weight factors decrease below 1.
68
69 ** Fixed incorrect dimensions check in gsl_matrix_sub{row,column}
70
71 * What was new in gsl-1.11:
172
273 ** The GSL repository and bug database are now hosted at Savannah
374 http://savannah.gnu.org/projects/gsl/
445445 gsl_cdf_hypergeometric_{P,Q}
446446
447447 * Claude Dion <claude.dion@tp.umu.se> documentation bug reports
448
449 * Michael Kuklik <mkuklik@gmail.com> bug report for simplex
450
451 * Paul Accisano, bug report and fix for cyclic solver
452
453 * Thomas Weber <thomas.weber.mail@gmail.com> bug and patch for interp
454 accelerator
455
456 * Lori A. Pritchett-Sheats bug report for vegas chisq.
457
458 * Frank Wang <frank.wang@validusre.bm> bug report for gsl_ran_gamma_knuth.
3939
4040 * Cumulative Distribution functions for discrete random distributions
4141
42
43 Changes for Release 2.0
44
45 Break binary compatibility, but keep source compatibility.
46
47 * Add a 'void *' to all workspaces, to allow for future changes.
48
49 * Disable deprecated functions
50
51 * Fix up the workspace_alloc functions so they have consistent names
52 (add functions where needed, don't remove)
53
54 * Standardize function names, in particular VERB vs NOUN (e.g. _invert
55 vs _inverse). Also adopt a convection for functions which can operate
56 in place vs use of workspace (e.g linalg_solve functions).
57
58
59
4260 Other tasks:
4361
4462 * Remove use of long double internally, e.g. as an accumulator in
7391 the outermost layer which may have been missed. Everything should be
7492 of the form #define foo(x) (....) so there is no possibility of bad
7593 parsing. Need a perl script to check this!
76
77 * Clean up the ordering of lines in the Makefile.am's so that they are
78 all consistent. At the moment the lines are in any order.
7994
8095 * Eliminate use of volatile where it has been used to force rounding
8196 (integration/). It is better to write the code to avoid dependence on
138153 * Go through the matrix and vector functions systematically and decide
139154 what should be provided outside of BLAS.
140155
141 * Standardize function names, in particular VERB vs NOUN (e.g. _invert
142 vs _inverse). Also adopt a convection for functions which can operate
143 in place vs use of workspace (e.g linalg_solve functions).
144
145156 * Change from gsl-ref.texi to gsl.texi since it is the main file?
146157 Also, put under dir section "Math" (which seems to be the appropriate
147158 one for Debian, as Octave, Gnuplot etc are in that)
174185 of size_t for vectors and matrices, or at least vectors and matrices
175186 of size_t in addition to long, int, etc.
176187
177 * Fix up the workspace_alloc functions so they have consistent names
178188
189
654654 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
655655 ])
656656
657 # serial 54 LT_INIT
657 # serial 56 LT_INIT
658658
659659
660660 # LT_PREREQ(VERSION)
674674 m4_defun([_LT_CHECK_BUILDDIR],
675675 [case `pwd` in
676676 *\ * | *\ *)
677 AC_MSG_WARN([Libtool does not cope well with whitespace in \`pwd\`]) ;;
677 AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;;
678678 esac
679679 ])
680680
772772 _LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl
773773 dnl
774774 AC_REQUIRE([LT_CMD_MAX_LEN])dnl
775 AC_REQUIRE([AC_OBJEXT])dnl
776775 _LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl
777 AC_REQUIRE([AC_EXEEXT])dnl
778776 _LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl
779777 dnl
780778 m4_require([_LT_FILEUTILS_DEFAULTS])dnl
993991 # lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...])
994992 # ---------------------------------------------------
995993 m4_define([lt_decl_varnames_tagged],
996 [_$0(m4_quote(m4_default([$1], [[, ]])),
997 m4_quote(m4_if([$2], [],
998 m4_quote(lt_decl_tag_varnames),
999 m4_quote(m4_shift($@)))),
1000 m4_split(m4_normalize(m4_quote(_LT_TAGS))))])
1001 m4_define([_lt_decl_varnames_tagged], [lt_combine([$1], [$2], [_], $3)])
994 [m4_assert([$# <= 2])dnl
995 _$0(m4_quote(m4_default([$1], [[, ]])),
996 m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]),
997 m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))])
998 m4_define([_lt_decl_varnames_tagged],
999 [m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])])
10021000
10031001
10041002 # lt_decl_all_varnames([SEPARATOR], [VARNAME1...])
12961294 #! $SHELL
12971295
12981296 # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
1299 # Generated automatically by $as_me (GNU $PACKAGE$TIMESTAMP) $VERSION
1297 # Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION
13001298 # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
13011299 # NOTE: Changes made to this file will be lost: look at ltmain.sh.
13021300 #
15061504 rhapsody* | darwin*)
15071505 AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:])
15081506 AC_CHECK_TOOL([NMEDIT], [nmedit], [:])
1507 AC_CHECK_TOOL([LIPO], [lipo], [:])
1508 AC_CHECK_TOOL([OTOOL], [otool], [:])
1509 AC_CHECK_TOOL([OTOOL64], [otool64], [:])
15091510 _LT_DECL([], [DSYMUTIL], [1],
15101511 [Tool to manipulate archived DWARF debug symbol files on Mac OS X])
15111512 _LT_DECL([], [NMEDIT], [1],
15121513 [Tool to change global to local symbols on Mac OS X])
1514 _LT_DECL([], [LIPO], [1],
1515 [Tool to manipulate fat objects and archives on Mac OS X])
1516 _LT_DECL([], [OTOOL], [1],
1517 [ldd/readelf like tool for Mach-O binaries on Mac OS X])
1518 _LT_DECL([], [OTOOL64], [1],
1519 [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4])
15131520
15141521 AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod],
15151522 [lt_cv_apple_cc_single_mod=no
15181525 # by either setting the environment variable LT_MULTI_MODULE
15191526 # non-empty at configure time, or by adding -multi_module to the
15201527 # link flags.
1528 rm -rf libconftest.dylib*
15211529 echo "int foo(void){return 1;}" > conftest.c
1530 echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
1531 -dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD
15221532 $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
1523 -dynamiclib ${wl}-single_module conftest.c
1524 if test -f libconftest.dylib; then
1533 -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
1534 _lt_result=$?
1535 if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then
15251536 lt_cv_apple_cc_single_mod=yes
1526 rm -rf libconftest.dylib*
1537 else
1538 cat conftest.err >&AS_MESSAGE_LOG_FD
15271539 fi
1528 rm conftest.c
1540 rm -rf libconftest.dylib*
1541 rm -f conftest.*
15291542 fi])
15301543 AC_CACHE_CHECK([for -exported_symbols_list linker flag],
15311544 [lt_cv_ld_exported_symbols_list],
15431556 _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
15441557 darwin1.*)
15451558 _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
1546 darwin*) # darwin 5.x on
1559 darwin*) # darwin 5.x on
15471560 # if running on 10.5 or later, the deployment target defaults
15481561 # to the OS version, if on x86, and 10.4, the deployment
1549 # target defaults to 10.4. Don't you love it?
1562 # target defaults to 10.4. Don't you love it?
15501563 case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
15511564 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*)
15521565 _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
15881601 _LT_TAGVAR(whole_archive_flag_spec, $1)=''
15891602 _LT_TAGVAR(link_all_deplibs, $1)=yes
15901603 _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined"
1591 if test "$GCC" = "yes"; then
1604 case $cc_basename in
1605 ifort*) _lt_dar_can_shared=yes ;;
1606 *) _lt_dar_can_shared=$GCC ;;
1607 esac
1608 if test "$_lt_dar_can_shared" = "yes"; then
15921609 output_verbose_link_cmd=echo
15931610 _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
15941611 _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
18051822 # _LT_ENABLE_LOCK
18061823 # ---------------
18071824 m4_defun([_LT_ENABLE_LOCK],
1808 [AC_REQUIRE([AC_OBJEXT])dnl
1809 AC_ARG_ENABLE([libtool-lock],
1825 [AC_ARG_ENABLE([libtool-lock],
18101826 [AS_HELP_STRING([--disable-libtool-lock],
18111827 [avoid locking (might break parallel builds)])])
18121828 test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
19952011 # ----------------------------------------------------------------
19962012 # Check whether the given compiler option works
19972013 AC_DEFUN([_LT_COMPILER_OPTION],
1998 [AC_REQUIRE([AC_OBJEXT])dnl
1999 m4_require([_LT_FILEUTILS_DEFAULTS])dnl
2014 [m4_require([_LT_FILEUTILS_DEFAULTS])dnl
20002015 m4_require([_LT_DECL_SED])dnl
20012016 AC_CACHE_CHECK([$1], [$2],
20022017 [$2=no
21122127 lt_cv_sys_max_cmd_len=-1;
21132128 ;;
21142129
2115 cygwin* | mingw*)
2130 cygwin* | mingw* | cegcc*)
21162131 # On Win9x/ME, this test blows up -- it succeeds, but takes
21172132 # about 5 minutes as the teststring grows exponentially.
21182133 # Worse, since 9x/ME are not pre-emptively multitasking,
22802295 # endif
22812296 #endif
22822297
2283 #ifdef __cplusplus
2284 extern "C" void exit (int);
2285 #endif
2286
22872298 void fnord() { int i=42;}
22882299 int main ()
22892300 {
22992310 else
23002311 puts (dlerror ());
23012312
2302 exit (status);
2313 return status;
23032314 }]
23042315 _LT_EOF
23052316 if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
23382349 lt_cv_dlopen_self=yes
23392350 ;;
23402351
2341 mingw* | pw32*)
2352 mingw* | pw32* | cegcc*)
23422353 lt_cv_dlopen="LoadLibrary"
23432354 lt_cv_dlopen_libs=
23442355 ;;
24482459 # Check to see if options -c and -o are simultaneously supported by compiler.
24492460 # This macro does not hard code the compiler like AC_PROG_CC_C_O.
24502461 m4_defun([_LT_COMPILER_C_O],
2451 [AC_REQUIRE([AC_OBJEXT])dnl
2452 m4_require([_LT_DECL_SED])dnl
2462 [m4_require([_LT_DECL_SED])dnl
24532463 m4_require([_LT_FILEUTILS_DEFAULTS])dnl
24542464 m4_require([_LT_TAG_COMPILER])dnl
24552465 AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
26362646 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
26372647 m4_require([_LT_DECL_EGREP])dnl
26382648 m4_require([_LT_FILEUTILS_DEFAULTS])dnl
2649 m4_require([_LT_DECL_OBJDUMP])dnl
26392650 m4_require([_LT_DECL_SED])dnl
26402651 AC_MSG_CHECKING([dynamic linker characteristics])
26412652 m4_if([$1],
27662777 ;;
27672778
27682779 amigaos*)
2769 if test "$host_cpu" = m68k; then
2780 case $host_cpu in
2781 powerpc)
2782 # Since July 2007 AmigaOS4 officially supports .so libraries.
2783 # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
2784 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
2785 ;;
2786 m68k)
27702787 library_names_spec='$libname.ixlibrary $libname.a'
27712788 # Create ${libname}_ixlibrary.a entries in /sys/libs.
27722789 finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
2773 else
2774 dynamic_linker=no
2775 fi
2790 ;;
2791 esac
27762792 ;;
27772793
27782794 beos*)
27952811 # libtool to hard-code these into programs
27962812 ;;
27972813
2798 cygwin* | mingw* | pw32*)
2814 cygwin* | mingw* | pw32* | cegcc*)
27992815 version_type=windows
28002816 shrext_cmds=".dll"
28012817 need_version=no
28022818 need_lib_prefix=no
28032819
28042820 case $GCC,$host_os in
2805 yes,cygwin* | yes,mingw* | yes,pw32*)
2821 yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
28062822 library_names_spec='$libname.dll.a'
28072823 # DLL is installed to $(libdir)/../bin by postinstall_cmds
28082824 postinstall_cmds='base_file=`basename \${file}`~
28252841 soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
28262842 sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
28272843 ;;
2828 mingw*)
2844 mingw* | cegcc*)
28292845 # MinGW DLLs use traditional 'lib' prefix
28302846 soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
28312847 sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
32513267 version_type=linux
32523268 need_lib_prefix=no
32533269 need_version=no
3254 library_name_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
3270 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
32553271 shlibpath_var=LD_LIBRARY_PATH
32563272 shlibpath_overrides_runpath=no
32573273 hardcode_into_libs=yes
32753291 if test "$GCC" = yes; then
32763292 variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
32773293 fi
3278
3294
32793295 if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
32803296 sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
32813297 fi
35523568 # -- PORTME fill in with the dynamic library characteristics
35533569 m4_defun([_LT_CHECK_MAGIC_METHOD],
35543570 [m4_require([_LT_DECL_EGREP])
3571 m4_require([_LT_DECL_OBJDUMP])
35553572 AC_CACHE_CHECK([how to recognize dependent libraries],
35563573 lt_cv_deplibs_check_method,
35573574 [lt_cv_file_magic_cmd='$MAGIC_CMD'
36003617 lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
36013618 lt_cv_file_magic_cmd='$OBJDUMP -f'
36023619 fi
3620 ;;
3621
3622 cegcc)
3623 # use the weaker test based on 'objdump'. See mingw*.
3624 lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
3625 lt_cv_file_magic_cmd='$OBJDUMP -f'
36033626 ;;
36043627
36053628 darwin* | rhapsody*)
37543777 # find the pathname to a BSD- or MS-compatible name lister
37553778 AC_DEFUN([LT_PATH_NM],
37563779 [AC_REQUIRE([AC_PROG_CC])dnl
3757 AC_REQUIRE([AC_OBJEXT])dnl
37583780 AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM,
37593781 [if test -n "$NM"; then
37603782 # Let the user override the test.
38903912 m4_defun([_LT_CMD_GLOBAL_SYMBOLS],
38913913 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
38923914 AC_REQUIRE([AC_PROG_CC])dnl
3893 AC_REQUIRE([AC_OBJEXT])dnl
38943915 AC_REQUIRE([LT_PATH_NM])dnl
38953916 AC_REQUIRE([LT_PATH_LD])dnl
38963917 m4_require([_LT_DECL_SED])dnl
39153936 aix*)
39163937 symcode='[[BCDT]]'
39173938 ;;
3918 cygwin* | mingw* | pw32*)
3939 cygwin* | mingw* | pw32* | cegcc*)
39193940 symcode='[[ABCDGISTW]]'
39203941 ;;
39213942 hpux*)
41424163 _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
41434164 fi
41444165 ;;
4166
41454167 amigaos*)
4146 if test "$host_cpu" = m68k; then
4147 # FIXME: we need at least 68020 code to build shared libraries, but
4148 # adding the `-m68020' flag to GCC prevents building anything better,
4149 # like `-m68040'.
4150 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
4151 fi
4152 ;;
4168 case $host_cpu in
4169 powerpc)
4170 # see comment about AmigaOS4 .so support
4171 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
4172 ;;
4173 m68k)
4174 # FIXME: we need at least 68020 code to build shared libraries, but
4175 # adding the `-m68020' flag to GCC prevents building anything better,
4176 # like `-m68040'.
4177 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
4178 ;;
4179 esac
4180 ;;
4181
41534182 beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
41544183 # PIC is the default for these OSes.
41554184 ;;
4156 mingw* | cygwin* | os2* | pw32*)
4185 mingw* | cygwin* | os2* | pw32* | cegcc*)
41574186 # This hack is so that the source file can tell whether it is being
41584187 # built for inclusion in a dll (and should export symbols for example).
41594188 # Although the cygwin gcc ignores -fPIC, still need this for old-style
41804209 fi
41814210 ;;
41824211 hpux*)
4183 # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
4184 # not for PA HP-UX.
4212 # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
4213 # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag
4214 # sets the default TLS model and affects inlining.
41854215 case $host_cpu in
4186 hppa*64*|ia64*)
4216 hppa*64*)
41874217 ;;
41884218 *)
41894219 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
42814311 _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
42824312 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
42834313 ;;
4284 icpc* | ecpc* )
4285 # Intel C++
4314 ecpc* )
4315 # old Intel C++ for x86_64 which still supported -KPIC.
42864316 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
42874317 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
4318 _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
4319 ;;
4320 icpc* )
4321 # Intel C++, used to be incompatible with GCC.
4322 # ICC 10 doesn't accept -KPIC any more.
4323 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4324 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
42884325 _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
42894326 ;;
42904327 pgCC* | pgcpp*)
44344471 ;;
44354472
44364473 amigaos*)
4437 if test "$host_cpu" = m68k; then
4438 # FIXME: we need at least 68020 code to build shared libraries, but
4439 # adding the `-m68020' flag to GCC prevents building anything better,
4440 # like `-m68040'.
4441 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
4442 fi
4474 case $host_cpu in
4475 powerpc)
4476 # see comment about AmigaOS4 .so support
4477 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
4478 ;;
4479 m68k)
4480 # FIXME: we need at least 68020 code to build shared libraries, but
4481 # adding the `-m68020' flag to GCC prevents building anything better,
4482 # like `-m68040'.
4483 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
4484 ;;
4485 esac
44434486 ;;
44444487
44454488 beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
44464489 # PIC is the default for these OSes.
44474490 ;;
44484491
4449 mingw* | cygwin* | pw32* | os2*)
4492 mingw* | cygwin* | pw32* | os2* | cegcc*)
44504493 # This hack is so that the source file can tell whether it is being
44514494 # built for inclusion in a dll (and should export symbols for example).
44524495 # Although the cygwin gcc ignores -fPIC, still need this for old-style
44624505 ;;
44634506
44644507 hpux*)
4465 # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
4466 # not for PA HP-UX.
4508 # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
4509 # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag
4510 # sets the default TLS model and affects inlining.
44674511 case $host_cpu in
4468 hppa*64*|ia64*)
4512 hppa*64*)
44694513 # +Z the default
44704514 ;;
44714515 *)
45154559 fi
45164560 ;;
45174561
4518 mingw* | cygwin* | pw32* | os2*)
4562 mingw* | cygwin* | pw32* | os2* | cegcc*)
45194563 # This hack is so that the source file can tell whether it is being
45204564 # built for inclusion in a dll (and should export symbols for example).
45214565 m4_if([$1], [GCJ], [],
45464590
45474591 linux* | k*bsd*-gnu)
45484592 case $cc_basename in
4549 icc* | ecc* | ifort*)
4593 # old Intel for x86_64 which still supported -KPIC.
4594 ecc*)
45504595 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
45514596 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
45524597 _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
45534598 ;;
4599 # icc used to be incompatible with GCC.
4600 # ICC 10 doesn't accept -KPIC any more.
4601 icc* | ifort*)
4602 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4603 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
4604 _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
4605 ;;
4606 # Lahey Fortran 8.1.
4607 lf95*)
4608 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4609 _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared'
4610 _LT_TAGVAR(lt_prog_compiler_static, $1)='--static'
4611 ;;
45544612 pgcc* | pgf77* | pgf90* | pgf95*)
45554613 # Portland Group compilers (*not* the Pentium gcc compiler,
45564614 # which looks to be a dead project)
47324790 pw32*)
47334791 _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
47344792 ;;
4735 cygwin* | mingw*)
4793 cygwin* | mingw* | cegcc*)
47364794 _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
47374795 ;;
47384796 *)
47844842 extract_expsyms_cmds=
47854843
47864844 case $host_os in
4787 cygwin* | mingw* | pw32*)
4845 cygwin* | mingw* | pw32* | cegcc*)
47884846 # FIXME: the MSVC++ port hasn't been tested in a loooong time
47894847 # When not using gcc, we currently assume that we are using
47904848 # Microsoft Visual C++.
48464904 ;;
48474905
48484906 amigaos*)
4849 if test "$host_cpu" = m68k; then
4850 _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
4851 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
4852 _LT_TAGVAR(hardcode_minus_L, $1)=yes
4853 fi
4854
4855 # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
4856 # that the semantics of dynamic libraries on AmigaOS, at least up
4857 # to version 4, is to share data among multiple programs linked
4858 # with the same dynamic library. Since this doesn't match the
4859 # behavior of shared libraries on other platforms, we can't use
4860 # them.
4861 _LT_TAGVAR(ld_shlibs, $1)=no
4907 case $host_cpu in
4908 powerpc)
4909 # see comment about AmigaOS4 .so support
4910 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
4911 _LT_TAGVAR(archive_expsym_cmds, $1)=''
4912 ;;
4913 m68k)
4914 _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
4915 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
4916 _LT_TAGVAR(hardcode_minus_L, $1)=yes
4917 ;;
4918 esac
48624919 ;;
48634920
48644921 beos*)
48724929 fi
48734930 ;;
48744931
4875 cygwin* | mingw* | pw32*)
4932 cygwin* | mingw* | pw32* | cegcc*)
48764933 # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
48774934 # as there is no search path for DLLs.
48784935 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
49384995 tmp_addflag=' -i_dynamic -nofor_main' ;;
49394996 ifc* | ifort*) # Intel Fortran compiler
49404997 tmp_addflag=' -nofor_main' ;;
4998 lf95*) # Lahey Fortran 8.1
4999 _LT_TAGVAR(whole_archive_flag_spec, $1)=
5000 tmp_sharedflag='--shared' ;;
49415001 xl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below)
49425002 tmp_sharedflag='-qmkshrobj'
49435003 tmp_addflag= ;;
51695229 fi
51705230 fi
51715231
5232 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
51725233 # It seems that -bexpall does not export symbols beginning with
51735234 # underscore (_), so it is better to generate a list of symbols to export.
51745235 _LT_TAGVAR(always_export_symbols, $1)=yes
52055266 ;;
52065267
52075268 amigaos*)
5208 if test "$host_cpu" = m68k; then
5209 _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
5210 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
5211 _LT_TAGVAR(hardcode_minus_L, $1)=yes
5212 fi
5213 # see comment about different semantics on the GNU ld section
5214 _LT_TAGVAR(ld_shlibs, $1)=no
5269 case $host_cpu in
5270 powerpc)
5271 # see comment about AmigaOS4 .so support
5272 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
5273 _LT_TAGVAR(archive_expsym_cmds, $1)=''
5274 ;;
5275 m68k)
5276 _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
5277 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
5278 _LT_TAGVAR(hardcode_minus_L, $1)=yes
5279 ;;
5280 esac
52155281 ;;
52165282
52175283 bsdi[[45]]*)
52185284 _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic
52195285 ;;
52205286
5221 cygwin* | mingw* | pw32*)
5287 cygwin* | mingw* | pw32* | cegcc*)
52225288 # When not using gcc, we currently assume that we are using
52235289 # Microsoft Visual C++.
52245290 # hardcode_libdir_flag_spec is actually meaningless, as there is
53225388 _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
53235389 ;;
53245390 ia64*)
5325 _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
5391 _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
53265392 ;;
53275393 *)
53285394 _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
61036169 fi
61046170 fi
61056171
6172 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
61066173 # It seems that -bexpall does not export symbols beginning with
61076174 # underscore (_), so it is better to generate a list of symbols to
61086175 # export.
61616228 esac
61626229 ;;
61636230
6164 cygwin* | mingw* | pw32*)
6231 cygwin* | mingw* | pw32* | cegcc*)
61656232 # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
61666233 # as there is no search path for DLLs.
61676234 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
74227489 CC=${GCJ-"gcj"}
74237490 compiler=$CC
74247491 _LT_TAGVAR(compiler, $1)=$CC
7492 _LT_TAGVAR(LD, $1)="$LD"
74257493 _LT_CC_BASENAME([$compiler])
74267494
74277495 # GCJ did not exist at the time GCC didn't implicitly link libc in.
75387606 _LT_DECL([], [FGREP], [1], [A literal string matcher])
75397607 dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too
75407608 AC_SUBST([GREP])
7609 ])
7610
7611
7612 # _LT_DECL_OBJDUMP
7613 # --------------
7614 # If we don't have a new enough Autoconf to choose the best objdump
7615 # available, choose the one first in the user's PATH.
7616 m4_defun([_LT_DECL_OBJDUMP],
7617 [AC_CHECK_TOOL(OBJDUMP, objdump, false)
7618 test -z "$OBJDUMP" && OBJDUMP=objdump
7619 _LT_DECL([], [OBJDUMP], [1], [An object symbol dumper])
7620 AC_SUBST([OBJDUMP])
75417621 ])
75427622
75437623
76327712 xsi_shell=no
76337713 ( _lt_dummy="a/b/c"
76347714 test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \
7635 = c,a/b,, ) >/dev/null 2>&1 \
7715 = c,a/b,, \
7716 && eval 'test $(( 1 + 1 )) -eq 2 \
7717 && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
76367718 && xsi_shell=yes
76377719 AC_MSG_RESULT([$xsi_shell])
76387720 _LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell'])
76767758 [case $xsi_shell in
76777759 yes)
76787760 cat << \_LT_EOF >> "$cfgfile"
7761
76797762 # func_dirname file append nondir_replacement
76807763 # Compute the dirname of FILE. If nonempty, add APPEND to the result,
76817764 # otherwise set result to NONDIR_REPLACEMENT.
77437826 *) func_lo2o_result=${1} ;;
77447827 esac
77457828 }
7829
7830 # func_xform libobj-or-source
7831 func_xform ()
7832 {
7833 func_xform_result=${1%.*}.lo
7834 }
7835
7836 # func_arith arithmetic-term...
7837 func_arith ()
7838 {
7839 func_arith_result=$(( $[*] ))
7840 }
7841
7842 # func_len string
7843 # STRING may not start with a hyphen.
7844 func_len ()
7845 {
7846 func_len_result=${#1}
7847 }
7848
77467849 _LT_EOF
77477850 ;;
77487851 *) # Bourne compatible functions.
77497852 cat << \_LT_EOF >> "$cfgfile"
7853
77507854 # func_dirname file append nondir_replacement
77517855 # Compute the dirname of FILE. If nonempty, add APPEND to the result,
77527856 # otherwise set result to NONDIR_REPLACEMENT.
77677871 func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
77687872 }
77697873
7770 # func_dirname_and_basename file append nondir_replacement
7771 # perform func_basename and func_dirname in a single function
7772 # call:
7773 # dirname: Compute the dirname of FILE. If nonempty,
7774 # add APPEND to the result, otherwise set result
7775 # to NONDIR_REPLACEMENT.
7776 # value returned in "$func_dirname_result"
7777 # basename: Compute filename of FILE.
7778 # value retuned in "$func_basename_result"
7779 # Implementation must be kept synchronized with func_dirname
7780 # and func_basename. For efficiency, we do not delegate to
7781 # those functions but instead duplicate the functionality here.
7782 func_dirname_and_basename ()
7783 {
7784 # Extract subdirectory from the argument.
7785 func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
7786 if test "X$func_dirname_result" = "X${1}"; then
7787 func_dirname_result="${3}"
7788 else
7789 func_dirname_result="$func_dirname_result${2}"
7790 fi
7791 func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
7792 }
7874 dnl func_dirname_and_basename
7875 dnl A portable version of this function is already defined in general.m4sh
7876 dnl so there is no need for it here.
77937877
77947878 # func_stripname prefix suffix name
77957879 # strip PREFIX and SUFFIX off of NAME.
78237907 {
78247908 func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"`
78257909 }
7910
7911 # func_xform libobj-or-source
7912 func_xform ()
7913 {
7914 func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[[^.]]*$/.lo/'`
7915 }
7916
7917 # func_arith arithmetic-term...
7918 func_arith ()
7919 {
7920 func_arith_result=`expr "$[@]"`
7921 }
7922
7923 # func_len string
7924 # STRING may not start with a hyphen.
7925 func_len ()
7926 {
7927 func_len_result=`expr "$[1]" : ".*" 2>/dev/null || echo $max_cmd_len`
7928 }
7929
78267930 _LT_EOF
78277931 esac
78287932
78477951 {
78487952 eval "$[1]=\$$[1]\$[2]"
78497953 }
7954
78507955 _LT_EOF
78517956 ;;
78527957 esac
78617966 # unlimited permission to copy and/or distribute it, with or without
78627967 # modifications, as long as this notice is preserved.
78637968
7864 # serial 4 ltoptions.m4
7969 # serial 6 ltoptions.m4
78657970
78667971 # This is to help aclocal find these macros, as it can't see m4_define.
78677972 AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
79768081 [enable_win32_dll=yes
79778082
79788083 case $host in
7979 *-*-cygwin* | *-*-mingw* | *-*-pw32*)
8084 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-cegcc*)
79808085 AC_CHECK_TOOL(AS, as, false)
79818086 AC_CHECK_TOOL(DLLTOOL, dlltool, false)
79828087 AC_CHECK_TOOL(OBJDUMP, objdump, false)
79948099 ])# win32-dll
79958100
79968101 AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
7997 [_LT_SET_OPTION([LT_INIT], [win32-dll])
8102 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
8103 _LT_SET_OPTION([LT_INIT], [win32-dll])
79988104 AC_DIAGNOSE([obsolete],
79998105 [$0: Remove this warning and the call to _LT_SET_OPTION when you
80008106 put the `win32-dll' option into LT_INIT's first parameter.])
80428148
80438149 # Old names:
80448150 AC_DEFUN([AC_ENABLE_SHARED],
8045 [_LT_SET_OPTION([LT_INIT], [shared])
8151 [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
80468152 ])
80478153
80488154 AC_DEFUN([AC_DISABLE_SHARED],
80968202
80978203 # Old names:
80988204 AC_DEFUN([AC_ENABLE_STATIC],
8099 [_LT_SET_OPTION([LT_INIT], [static])
8205 [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
81008206 ])
81018207
81028208 AC_DEFUN([AC_DISABLE_STATIC],
81508256
81518257 # Old names:
81528258 AU_DEFUN([AC_ENABLE_FAST_INSTALL],
8153 [_LT_SET_OPTION([LT_INIT], [fast-install])
8259 [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
81548260 AC_DIAGNOSE([obsolete],
81558261 [$0: Remove this warning and the call to _LT_SET_OPTION when you put
81568262 the `fast-install' option into LT_INIT's first parameter.])
82168322
82178323 # ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*-
82188324 #
8219 # Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
8220 # Written by Gary V. Vaughan, 2004
8325 # Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
8326 # Written by Gary V. Vaughan, 2004
82218327 #
82228328 # This file is free software; the Free Software Foundation gives
82238329 # unlimited permission to copy and/or distribute it, with or without
82248330 # modifications, as long as this notice is preserved.
82258331
8226 # serial 5 ltsugar.m4
8332 # serial 6 ltsugar.m4
82278333
82288334 # This is to help aclocal find these macros, as it can't see m4_define.
82298335 AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
82798385 # Produce a SEP delimited list of all paired combinations of elements of
82808386 # PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list
82818387 # has the form PREFIXmINFIXSUFFIXn.
8388 # Needed until we can rely on m4_combine added in Autoconf 2.62.
82828389 m4_define([lt_combine],
8283 [m4_if([$2], [], [],
8284 [m4_if([$4], [], [],
8285 [lt_join(m4_quote(m4_default([$1], [[, ]])),
8286 lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_prefix, [$2],
8287 [m4_foreach(_Lt_suffix, lt_car([m4_shiftn(3, $@)]),
8288 [_Lt_prefix[]$3[]_Lt_suffix ])])))))])])dnl
8289 ])
8390 [m4_if(m4_eval([$# > 3]), [1],
8391 [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
8392 [[m4_foreach([_Lt_prefix], [$2],
8393 [m4_foreach([_Lt_suffix],
8394 ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
8395 [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
82908396
82918397
82928398 # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
83498455
83508456 # Generated from ltversion.in.
83518457
8352 # serial 2599 ltversion.m4
8458 # serial 3012 ltversion.m4
83538459 # This file is part of GNU Libtool
83548460
8355 m4_define([LT_PACKAGE_VERSION], [2.2])
8356 m4_define([LT_PACKAGE_REVISION], [1.2599])
8461 m4_define([LT_PACKAGE_VERSION], [2.2.6])
8462 m4_define([LT_PACKAGE_REVISION], [1.3012])
83578463
83588464 AC_DEFUN([LTVERSION_VERSION],
8359 [macro_version='2.2'
8360 macro_revision='1.2599'
8465 [macro_version='2.2.6'
8466 macro_revision='1.3012'
83618467 _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
83628468 _LT_DECL(, macro_revision, 0)
83638469 ])
83718477 # unlimited permission to copy and/or distribute it, with or without
83728478 # modifications, as long as this notice is preserved.
83738479
8374 # serial 3
8480 # serial 4 lt~obsolete.m4
83758481
83768482 # These exist entirely to fool aclocal when bootstrapping libtool.
83778483 #
44
55 libtoolize --automake
66 aclocal
7 autoheader
78 automake --add-missing --gnu
89 autoconf
910 echo "Now use ./configure --enable-maintainer-mode"
11
22 pkginclude_HEADERS = gsl_blas.h gsl_blas_types.h
33
4 INCLUDES= -I$(top_srcdir)
4 INCLUDES = -I$(top_srcdir)
55
66 libgslblas_la_SOURCES = blas.c
77
125125 LIBOBJS = @LIBOBJS@
126126 LIBS = @LIBS@
127127 LIBTOOL = @LIBTOOL@
128 LIPO = @LIPO@
128129 LN_S = @LN_S@
129130 LTLIBOBJS = @LTLIBOBJS@
130131 MAINT = @MAINT@
132133 MKDIR_P = @MKDIR_P@
133134 NM = @NM@
134135 NMEDIT = @NMEDIT@
136 OBJDUMP = @OBJDUMP@
135137 OBJEXT = @OBJEXT@
138 OTOOL = @OTOOL@
139 OTOOL64 = @OTOOL64@
136140 PACKAGE = @PACKAGE@
137141 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
138142 PACKAGE_NAME = @PACKAGE_NAME@
0 2008-07-03 Brian Gough <bjg@hp2.network-theory.co.uk>
1
2 * Makefile.am (INCLUDES): remove top_builddir
3
04 2005-05-21 Brian Gough <bjg@network-theory.co.uk>
15
26 * Makefile.am (pkginclude_HEADERS): removed unused file
33
44 pkginclude_HEADERS = gsl_block.h gsl_block_char.h gsl_block_complex_double.h gsl_block_complex_float.h gsl_block_complex_long_double.h gsl_block_double.h gsl_block_float.h gsl_block_int.h gsl_block_long.h gsl_block_long_double.h gsl_block_short.h gsl_block_uchar.h gsl_block_uint.h gsl_block_ulong.h gsl_block_ushort.h gsl_check_range.h
55
6 INCLUDES= -I$(top_builddir) -I$(top_srcdir)
6 INCLUDES = -I$(top_srcdir)
77
88 TESTS = $(check_PROGRAMS)
99
131131 LIBOBJS = @LIBOBJS@
132132 LIBS = @LIBS@
133133 LIBTOOL = @LIBTOOL@
134 LIPO = @LIPO@
134135 LN_S = @LN_S@
135136 LTLIBOBJS = @LTLIBOBJS@
136137 MAINT = @MAINT@
138139 MKDIR_P = @MKDIR_P@
139140 NM = @NM@
140141 NMEDIT = @NMEDIT@
142 OBJDUMP = @OBJDUMP@
141143 OBJEXT = @OBJEXT@
144 OTOOL = @OTOOL@
145 OTOOL64 = @OTOOL64@
142146 PACKAGE = @PACKAGE@
143147 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
144148 PACKAGE_NAME = @PACKAGE_NAME@
203207 top_srcdir = @top_srcdir@
204208 noinst_LTLIBRARIES = libgslblock.la
205209 pkginclude_HEADERS = gsl_block.h gsl_block_char.h gsl_block_complex_double.h gsl_block_complex_float.h gsl_block_complex_long_double.h gsl_block_double.h gsl_block_float.h gsl_block_int.h gsl_block_long.h gsl_block_long_double.h gsl_block_short.h gsl_block_uchar.h gsl_block_uint.h gsl_block_ulong.h gsl_block_ushort.h gsl_check_range.h
206 INCLUDES = -I$(top_builddir) -I$(top_srcdir)
210 INCLUDES = -I$(top_srcdir)
207211 TESTS = $(check_PROGRAMS)
208212 test_LDADD = libgslblock.la ../ieee-utils/libgslieeeutils.la ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la ../utils/libutils.la
209213 test_SOURCES = test.c
0 2008-12-09 Brian Gough <bjg@network-theory.co.uk>
1
2 * bspline.c (gsl_bspline_deriv_alloc): add size to derivative
3 struct
4
5 2008-12-08 Brian Gough <bjg@network-theory.co.uk>
6
7 * gsl_bspline.h: preserve binary compatibility in workspaces
8
9 2008-07-03 Brian Gough <bjg@hp2.network-theory.co.uk>
10
11 * Makefile.am (INCLUDES): use top_srcdir instead of top_builddir
12
013 2006-11-02 Brian Gough <bjg@network-theory.co.uk>
114
215 * added test program
11
22 pkginclude_HEADERS = gsl_bspline.h
33
4 INCLUDES= -I$(top_builddir)
4 INCLUDES = -I$(top_srcdir)
55
66 libgslbspline_la_SOURCES = bspline.c
7
8 noinst_HEADERS = bspline.h
79
810 check_PROGRAMS = test
911
3434 host_triplet = @host@
3535 check_PROGRAMS = test$(EXEEXT)
3636 subdir = bspline
37 DIST_COMMON = $(pkginclude_HEADERS) $(srcdir)/Makefile.am \
38 $(srcdir)/Makefile.in ChangeLog TODO
37 DIST_COMMON = $(noinst_HEADERS) $(pkginclude_HEADERS) \
38 $(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog TODO
3939 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
4040 am__aclocal_m4_deps = $(top_srcdir)/configure.ac
4141 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
7878 am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
7979 am__installdirs = "$(DESTDIR)$(pkgincludedir)"
8080 pkgincludeHEADERS_INSTALL = $(INSTALL_HEADER)
81 HEADERS = $(pkginclude_HEADERS)
81 HEADERS = $(noinst_HEADERS) $(pkginclude_HEADERS)
8282 ETAGS = etags
8383 CTAGS = ctags
8484 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
135135 LIBOBJS = @LIBOBJS@
136136 LIBS = @LIBS@
137137 LIBTOOL = @LIBTOOL@
138 LIPO = @LIPO@
138139 LN_S = @LN_S@
139140 LTLIBOBJS = @LTLIBOBJS@
140141 MAINT = @MAINT@
142143 MKDIR_P = @MKDIR_P@
143144 NM = @NM@
144145 NMEDIT = @NMEDIT@
146 OBJDUMP = @OBJDUMP@
145147 OBJEXT = @OBJEXT@
148 OTOOL = @OTOOL@
149 OTOOL64 = @OTOOL64@
146150 PACKAGE = @PACKAGE@
147151 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
148152 PACKAGE_NAME = @PACKAGE_NAME@
207211 top_srcdir = @top_srcdir@
208212 noinst_LTLIBRARIES = libgslbspline.la
209213 pkginclude_HEADERS = gsl_bspline.h
210 INCLUDES = -I$(top_builddir)
214 INCLUDES = -I$(top_srcdir)
211215 libgslbspline_la_SOURCES = bspline.c
216 noinst_HEADERS = bspline.h
212217 TESTS = $(check_PROGRAMS)
213218 test_LDADD = libgslbspline.la ../linalg/libgsllinalg.la ../permutation/libgslpermutation.la ../blas/libgslblas.la ../matrix/libgslmatrix.la ../vector/libgslvector.la ../block/libgslblock.la ../complex/libgslcomplex.la ../cblas/libgslcblas.la ../ieee-utils/libgslieeeutils.la ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la ../utils/libutils.la
214219 test_SOURCES = test.c
00 Add functions:
1
2 gsl_bspline_eval_deriv (see pppack bsplvd) to compute B-spline derivatives
31
42 gsl_bspline_smooth to fit smoothing splines to data more efficiently
53 than the standard least squares inversion (see pppack l2appr and
00 /* bspline/bspline.c
1 *
1 *
22 * Copyright (C) 2006, 2007, 2008 Patrick Alken
3 *
3 * Copyright (C) 2008 Rhys Ulerich
4 *
45 * This program is free software; you can redistribute it and/or modify
56 * it under the terms of the GNU General Public License as published by
67 * the Free Software Foundation; either version 3 of the License, or (at
78 * your option) any later version.
8 *
9 *
910 * This program is distributed in the hope that it will be useful, but
1011 * WITHOUT ANY WARRANTY; without even the implied warranty of
1112 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1213 * General Public License for more details.
13 *
14 *
1415 * You should have received a copy of the GNU General Public License
1516 * along with this program; if not, write to the Free Software
1617 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
2627 *
2728 * [1] Carl de Boor, "A Practical Guide to Splines", Springer
2829 * Verlag, 1978.
30 *
31 * The bspline_pppack_* internal routines contain code adapted from
32 *
33 * [2] "PPPACK - Piecewise Polynomial Package",
34 * http://www.netlib.org/pppack/
35 *
2936 */
3037
31 static int bspline_eval_all(const double x, gsl_vector *B, size_t *idx,
32 gsl_bspline_workspace *w);
33
34 static inline size_t bspline_find_interval(const double x, int *flag,
35 gsl_bspline_workspace *w);
38 #include "bspline.h"
3639
3740 /*
3841 gsl_bspline_alloc()
4649 */
4750
4851 gsl_bspline_workspace *
49 gsl_bspline_alloc(const size_t k, const size_t nbreak)
52 gsl_bspline_alloc (const size_t k, const size_t nbreak)
5053 {
5154 if (k == 0)
5255 {
53 GSL_ERROR_NULL("k must be at least 1", GSL_EINVAL);
56 GSL_ERROR_NULL ("k must be at least 1", GSL_EINVAL);
5457 }
5558 else if (nbreak < 2)
5659 {
57 GSL_ERROR_NULL("nbreak must be at least 2", GSL_EINVAL);
60 GSL_ERROR_NULL ("nbreak must be at least 2", GSL_EINVAL);
5861 }
5962 else
6063 {
6164 gsl_bspline_workspace *w;
6265
63 w = (gsl_bspline_workspace *)
64 calloc(1, sizeof(gsl_bspline_workspace));
66 w = (gsl_bspline_workspace *) malloc (sizeof (gsl_bspline_workspace));
67
6568 if (w == 0)
66 {
67 GSL_ERROR_NULL("failed to allocate space for workspace", GSL_ENOMEM);
68 }
69 {
70 GSL_ERROR_NULL ("failed to allocate space for workspace",
71 GSL_ENOMEM);
72 }
6973
7074 w->k = k;
7175 w->km1 = k - 1;
7377 w->l = nbreak - 1;
7478 w->n = w->l + k - 1;
7579
76 w->knots = gsl_vector_alloc(w->n + k);
80 w->knots = gsl_vector_alloc (w->n + k);
7781 if (w->knots == 0)
78 {
79 gsl_bspline_free(w);
80 GSL_ERROR_NULL("failed to allocate space for knots vector", GSL_ENOMEM);
81 }
82
83 w->deltal = gsl_vector_alloc(k);
84 w->deltar = gsl_vector_alloc(k);
85 if (!w->deltal || !w->deltar)
86 {
87 gsl_bspline_free(w);
88 GSL_ERROR_NULL("failed to allocate space for delta vectors", GSL_ENOMEM);
89 }
90
91 w->B = gsl_vector_alloc(k);
82 {
83 free (w);
84 GSL_ERROR_NULL ("failed to allocate space for knots vector",
85 GSL_ENOMEM);
86 }
87
88 w->deltal = gsl_vector_alloc (k);
89 if (w->deltal == 0)
90 {
91 free (w->knots);
92 free (w);
93 GSL_ERROR_NULL ("failed to allocate space for deltal vector",
94 GSL_ENOMEM);
95 }
96
97 w->deltar = gsl_vector_alloc (k);
98 if (w->deltar == 0)
99 {
100 free (w->deltal);
101 free (w->knots);
102 free (w);
103 GSL_ERROR_NULL ("failed to allocate space for deltar vector",
104 GSL_ENOMEM);
105 }
106
107
108 w->B = gsl_vector_alloc (k);
92109 if (w->B == 0)
93 {
94 gsl_bspline_free(w);
95 GSL_ERROR_NULL("failed to allocate space for temporary spline vector", GSL_ENOMEM);
96 }
97
98 return (w);
99 }
100 } /* gsl_bspline_alloc() */
110 {
111 free (w->deltar);;
112 free (w->deltal);
113 free (w->knots);
114 free (w);
115 GSL_ERROR_NULL
116 ("failed to allocate space for temporary spline vector",
117 GSL_ENOMEM);
118 }
119
120 return w;
121 }
122 } /* gsl_bspline_alloc() */
123
124 /*
125 gsl_bspline_deriv_alloc()
126 Allocate space for a bspline derivative workspace. The size of the
127 workspace is O(2k^2)
128
129 Inputs: k - spline order (cubic = 4)
130
131 Return: pointer to workspace
132 */
133
134 gsl_bspline_deriv_workspace *
135 gsl_bspline_deriv_alloc (const size_t k)
136 {
137 if (k == 0)
138 {
139 GSL_ERROR_NULL ("k must be at least 1", GSL_EINVAL);
140 }
141 else
142 {
143 gsl_bspline_deriv_workspace *dw;
144
145 dw =
146 (gsl_bspline_deriv_workspace *)
147 malloc (sizeof (gsl_bspline_deriv_workspace));
148
149 if (dw == 0)
150 {
151 GSL_ERROR_NULL ("failed to allocate space for workspace",
152 GSL_ENOMEM);
153 }
154
155 dw->A = gsl_matrix_alloc (k, k);
156 if (dw->A == 0)
157 {
158 free (dw);
159 GSL_ERROR_NULL
160 ("failed to allocate space for derivative work matrix",
161 GSL_ENOMEM);
162 }
163
164 dw->dB = gsl_matrix_alloc (k, k + 1);
165 if (dw->dB == 0)
166 {
167 free (dw->A);
168 free (dw);
169 GSL_ERROR_NULL
170 ("failed to allocate space for temporary derivative matrix",
171 GSL_ENOMEM);
172 }
173
174 dw->k = k;
175
176 return dw;
177 }
178 } /* gsl_bspline_deriv_alloc() */
101179
102180 /* Return number of coefficients */
103181 size_t
120198 return w->nbreak;
121199 }
122200
201 /* Return the location of the i-th breakpoint*/
123202 double
124203 gsl_bspline_breakpoint (size_t i, gsl_bspline_workspace * w)
125204 {
126205 size_t j = i + w->k - 1;
127 return gsl_vector_get(w->knots, j);
206 return gsl_vector_get (w->knots, j);
128207 }
129208
130209 /*
131210 gsl_bspline_free()
132 Free a bspline workspace
211 Free a gsl_bspline_workspace.
133212
134213 Inputs: w - workspace to free
135214
137216 */
138217
139218 void
140 gsl_bspline_free(gsl_bspline_workspace *w)
141 {
142 if (w->knots)
143 gsl_vector_free(w->knots);
144
145 if (w->deltal)
146 gsl_vector_free(w->deltal);
147
148 if (w->deltar)
149 gsl_vector_free(w->deltar);
150
151 if (w->B)
152 gsl_vector_free(w->B);
153
154 free(w);
155 } /* gsl_bspline_free() */
219 gsl_bspline_free (gsl_bspline_workspace * w)
220 {
221 gsl_vector_free (w->knots);
222 gsl_vector_free (w->deltal);
223 gsl_vector_free (w->deltar);
224 gsl_vector_free (w->B);
225 free (w);
226 } /* gsl_bspline_free() */
227
228 /*
229 gsl_bspline_deriv_free()
230 Free a gsl_bspline_deriv_workspace.
231
232 Inputs: dw - workspace to free
233
234 Return: none
235 */
236
237 void
238 gsl_bspline_deriv_free (gsl_bspline_deriv_workspace * dw)
239 {
240 gsl_matrix_free (dw->A);
241 gsl_matrix_free (dw->dB);
242 free (dw);
243 } /* gsl_bspline_deriv_free() */
156244
157245 /*
158246 gsl_bspline_knots()
159247 Compute the knots from the given breakpoints:
160248
161 knots(1:k) = breakpts(1)
162 knots(k+1:k+l-1) = breakpts(i), i = 2 .. l
163 knots(n+1:n+k) = breakpts(l + 1)
249 knots(1:k) = breakpts(1)
250 knots(k+1:k+l-1) = breakpts(i), i = 2 .. l
251 knots(n+1:n+k) = breakpts(l + 1)
164252
165253 where l is the number of polynomial pieces (l = nbreak - 1) and
166 n = k + l - 1
254 n = k + l - 1
167255 (using matlab syntax for the arrays)
168256
169257 The repeated knots at the beginning and end of the interval
177265 */
178266
179267 int
180 gsl_bspline_knots(const gsl_vector *breakpts, gsl_bspline_workspace *w)
268 gsl_bspline_knots (const gsl_vector * breakpts, gsl_bspline_workspace * w)
181269 {
182270 if (breakpts->size != w->nbreak)
183271 {
184 GSL_ERROR("breakpts vector has wrong size", GSL_EBADLEN);
272 GSL_ERROR ("breakpts vector has wrong size", GSL_EBADLEN);
185273 }
186274 else
187275 {
188 size_t i; /* looping */
189
190 for (i = 0; i < w->k; ++i)
191 gsl_vector_set(w->knots, i, gsl_vector_get(breakpts, 0));
192
193 for (i = 1; i < w->l; ++i)
194 {
195 gsl_vector_set(w->knots, w->k - 1 + i,
196 gsl_vector_get(breakpts, i));
197 }
198
199 for (i = w->n; i < w->n + w->k; ++i)
200 gsl_vector_set(w->knots, i, gsl_vector_get(breakpts, w->l));
276 size_t i; /* looping */
277
278 for (i = 0; i < w->k; i++)
279 gsl_vector_set (w->knots, i, gsl_vector_get (breakpts, 0));
280
281 for (i = 1; i < w->l; i++)
282 {
283 gsl_vector_set (w->knots, w->k - 1 + i,
284 gsl_vector_get (breakpts, i));
285 }
286
287 for (i = w->n; i < w->n + w->k; i++)
288 gsl_vector_set (w->knots, i, gsl_vector_get (breakpts, w->l));
201289
202290 return GSL_SUCCESS;
203291 }
204 } /* gsl_bspline_knots() */
292 } /* gsl_bspline_knots() */
205293
206294 /*
207295 gsl_bspline_knots_uniform()
227315 */
228316
229317 int
230 gsl_bspline_knots_uniform(const double a, const double b,
231 gsl_bspline_workspace *w)
232 {
233 size_t i; /* looping */
234 double delta; /* interval spacing */
318 gsl_bspline_knots_uniform (const double a, const double b,
319 gsl_bspline_workspace * w)
320 {
321 size_t i; /* looping */
322 double delta; /* interval spacing */
235323 double x;
236324
237325 delta = (b - a) / (double) w->l;
238326
239 for (i = 0; i < w->k; ++i)
240 gsl_vector_set(w->knots, i, a);
327 for (i = 0; i < w->k; i++)
328 gsl_vector_set (w->knots, i, a);
241329
242330 x = a + delta;
243 for (i = 0; i < w->l - 1; ++i)
244 {
245 gsl_vector_set(w->knots, w->k + i, x);
331 for (i = 0; i < w->l - 1; i++)
332 {
333 gsl_vector_set (w->knots, w->k + i, x);
246334 x += delta;
247335 }
248336
249 for (i = w->n; i < w->n + w->k; ++i)
250 gsl_vector_set(w->knots, i, b);
337 for (i = w->n; i < w->n + w->k; i++)
338 gsl_vector_set (w->knots, i, b);
251339
252340 return GSL_SUCCESS;
253 } /* gsl_bspline_knots_uniform() */
341 } /* gsl_bspline_knots_uniform() */
254342
255343 /*
256344 gsl_bspline_eval()
257345 Evaluate the basis functions B_i(x) for all i. This is
258 basically a wrapper function for bspline_eval_all()
259 which formats the output in a nice way.
346 a wrapper function for gsl_bspline_eval_nonzero() which
347 formats the output in a nice way.
260348
261349 Inputs: x - point for evaluation
262350 B - (output) where to store B_i(x) values
271359 */
272360
273361 int
274 gsl_bspline_eval(const double x, gsl_vector *B,
275 gsl_bspline_workspace *w)
362 gsl_bspline_eval (const double x, gsl_vector * B, gsl_bspline_workspace * w)
276363 {
277364 if (B->size != w->n)
278365 {
279 GSL_ERROR("B vector length does not match n", GSL_EBADLEN);
366 GSL_ERROR ("vector B not of length n", GSL_EBADLEN);
280367 }
281368 else
282369 {
283 size_t i; /* looping */
284 size_t idx = 0;
285 size_t start; /* first non-zero spline */
370 size_t i; /* looping */
371 size_t istart; /* first non-zero spline for x */
372 size_t iend; /* last non-zero spline for x, knot for x */
373 int error; /* error handling */
286374
287375 /* find all non-zero B_i(x) values */
288 bspline_eval_all(x, w->B, &idx, w);
376 error = gsl_bspline_eval_nonzero (x, w->B, &istart, &iend, w);
377 if (error)
378 {
379 return error;
380 }
289381
290382 /* store values in appropriate part of given vector */
291
292 start = idx - w->k + 1;
293 for (i = 0; i < start; ++i)
294 gsl_vector_set(B, i, 0.0);
295
296 for (i = start; i <= idx; ++i)
297 gsl_vector_set(B, i, gsl_vector_get(w->B, i - start));
298
299 for (i = idx + 1; i < w->n; ++i)
300 gsl_vector_set(B, i, 0.0);
383 for (i = 0; i < istart; i++)
384 gsl_vector_set (B, i, 0.0);
385
386 for (i = istart; i <= iend; i++)
387 gsl_vector_set (B, i, gsl_vector_get (w->B, i - istart));
388
389 for (i = iend + 1; i < w->n; i++)
390 gsl_vector_set (B, i, 0.0);
301391
302392 return GSL_SUCCESS;
303393 }
304 } /* gsl_bspline_eval() */
394 } /* gsl_bspline_eval() */
395
396 /*
397 gsl_bspline_eval_nonzero()
398 Evaluate all non-zero B-spline functions at point x.
399 These are the B_i(x) for i in [istart, iend].
400 Always B_i(x) = 0 for i < istart and for i > iend.
401
402 Inputs: x - point at which to evaluate splines
403 Bk - (output) where to store B-spline values (length k)
404 istart - (output) B-spline function index of
405 first non-zero basis for given x
406 iend - (output) B-spline function index of
407 last non-zero basis for given x.
408 This is also the knot index corresponding to x.
409 w - bspline workspace
410
411 Return: success or error
412
413 Notes: 1) the w->knots vector must be initialized before calling
414 this function
415
416 2) On output, B contains
417
418 [B_{istart,k}, B_{istart+1,k},
419 ..., B_{iend-1,k}, B_{iend,k}]
420
421 evaluated at the given x.
422 */
423
424 int
425 gsl_bspline_eval_nonzero (const double x, gsl_vector * Bk, size_t * istart,
426 size_t * iend, gsl_bspline_workspace * w)
427 {
428 if (Bk->size != w->k)
429 {
430 GSL_ERROR ("Bk vector length does not match order k", GSL_EBADLEN);
431 }
432 else
433 {
434 size_t i; /* spline index */
435 size_t j; /* looping */
436 int flag = 0; /* interval search flag */
437 int error = 0; /* error flag */
438
439 i = bspline_find_interval (x, &flag, w);
440 error = bspline_process_interval_for_eval (x, &i, flag, w);
441 if (error)
442 {
443 return error;
444 }
445
446 *istart = i - w->k + 1;
447 *iend = i;
448
449 bspline_pppack_bsplvb (w->knots, w->k, 1, x, *iend, &j, w->deltal,
450 w->deltar, Bk);
451
452 return GSL_SUCCESS;
453 }
454 } /* gsl_bspline_eval_nonzero() */
455
456 /*
457 gsl_bspline_deriv_eval()
458 Evaluate d^j/dx^j B_i(x) for all i, 0 <= j <= nderiv.
459 This is a wrapper function for gsl_bspline_deriv_eval_nonzero()
460 which formats the output in a nice way.
461
462 Inputs: x - point for evaluation
463 nderiv - number of derivatives to compute, inclusive.
464 dB - (output) where to store d^j/dx^j B_i(x)
465 values. the size of this matrix is
466 (n = nbreak + k - 2 = l + k - 1 = w->n)
467 by (nderiv + 1)
468 w - bspline derivative workspace
469
470 Return: success or error
471
472 Notes: 1) The w->knots vector must be initialized prior to calling
473 this function (see gsl_bspline_knots())
474
475 2) based on PPPACK's bsplvd
476 */
477
478 int
479 gsl_bspline_deriv_eval (const double x, const size_t nderiv, gsl_matrix * dB,
480 gsl_bspline_workspace * w,
481 gsl_bspline_deriv_workspace * dw)
482 {
483 if (dB->size1 != w->n)
484 {
485 GSL_ERROR ("dB matrix first dimension not of length n", GSL_EBADLEN);
486 }
487 else if (dB->size2 < nderiv + 1)
488 {
489 GSL_ERROR
490 ("dB matrix second dimension must be at least length nderiv+1",
491 GSL_EBADLEN);
492 }
493 else if (dw->k < w->k)
494 {
495 GSL_ERROR ("derivative workspace is too small", GSL_EBADLEN);
496 }
497 else
498 {
499 size_t i; /* looping */
500 size_t j; /* looping */
501 size_t istart; /* first non-zero spline for x */
502 size_t iend; /* last non-zero spline for x, knot for x */
503 int error; /* error handling */
504
505 /* find all non-zero d^j/dx^j B_i(x) values */
506 error =
507 gsl_bspline_deriv_eval_nonzero (x, nderiv, dw->dB, &istart, &iend, w,
508 dw);
509 if (error)
510 {
511 return error;
512 }
513
514 /* store values in appropriate part of given matrix */
515 for (j = 0; j <= nderiv; j++)
516 {
517 for (i = 0; i < istart; i++)
518 gsl_matrix_set (dB, i, j, 0.0);
519
520 for (i = istart; i <= iend; i++)
521 gsl_matrix_set (dB, i, j, gsl_matrix_get (dw->dB, i - istart, j));
522
523 for (i = iend + 1; i < w->n; i++)
524 gsl_matrix_set (dB, i, j, 0.0);
525 }
526
527 return GSL_SUCCESS;
528 }
529 } /* gsl_bspline_deriv_eval() */
530
531 /*
532 gsl_bspline_deriv_eval_nonzero()
533 At point x evaluate all requested, non-zero B-spline function
534 derivatives and store them in dB. These are the
535 d^j/dx^j B_i(x) with i in [istart, iend] and j in [0, nderiv].
536 Always d^j/dx^j B_i(x) = 0 for i < istart and for i > iend.
537
538 Inputs: x - point at which to evaluate splines
539 nderiv - number of derivatives to request, inclusive
540 dB - (output) where to store dB-spline derivatives
541 (size k by nderiv + 1)
542 istart - (output) B-spline function index of
543 first non-zero basis for given x
544 iend - (output) B-spline function index of
545 last non-zero basis for given x.
546 This is also the knot index corresponding to x.
547 w - bspline derivative workspace
548
549 Return: success or error
550
551 Notes: 1) the w->knots vector must be initialized before calling
552 this function
553
554 2) On output, dB contains
555
556 [[B_{istart, k}, ..., d^nderiv/dx^nderiv B_{istart ,k}],
557 [B_{istart+1,k}, ..., d^nderiv/dx^nderiv B_{istart+1,k}],
558 ...
559 [B_{iend-1, k}, ..., d^nderiv/dx^nderiv B_{iend-1, k}],
560 [B_{iend, k}, ..., d^nderiv/dx^nderiv B_{iend, k}]]
561
562 evaluated at x. B_{istart, k} is stored in dB(0,0).
563 Each additional column contains an additional derivative.
564
565 3) Note that the zero-th column of the result contains the
566 0th derivative, which is simply a function evaluation.
567
568 4) based on PPPACK's bsplvd
569 */
570
571 int
572 gsl_bspline_deriv_eval_nonzero (const double x, const size_t nderiv,
573 gsl_matrix * dB, size_t * istart,
574 size_t * iend, gsl_bspline_workspace * w,
575 gsl_bspline_deriv_workspace * dw)
576 {
577 if (dB->size1 != w->k)
578 {
579 GSL_ERROR ("dB matrix first dimension not of length k", GSL_EBADLEN);
580 }
581 else if (dB->size2 < nderiv + 1)
582 {
583 GSL_ERROR
584 ("dB matrix second dimension must be at least length nderiv+1",
585 GSL_EBADLEN);
586 }
587 else if (dw->k < w->k)
588 {
589 GSL_ERROR ("derivative workspace is too small", GSL_EBADLEN);
590 }
591 else
592 {
593 size_t i; /* spline index */
594 size_t j; /* looping */
595 int flag = 0; /* interval search flag */
596 int error = 0; /* error flag */
597 size_t min_nderivk;
598
599 i = bspline_find_interval (x, &flag, w);
600 error = bspline_process_interval_for_eval (x, &i, flag, w);
601 if (error)
602 {
603 return error;
604 }
605
606 *istart = i - w->k + 1;
607 *iend = i;
608
609 bspline_pppack_bsplvd (w->knots, w->k, x, *iend,
610 w->deltal, w->deltar, dw->A, dB, nderiv);
611
612 /* An order k b-spline has at most k-1 nonzero derivatives
613 so we need to zero all requested higher order derivatives */
614 min_nderivk = GSL_MIN_INT (nderiv, w->k - 1);
615 for (j = min_nderivk + 1; j <= nderiv; j++)
616 {
617 for (i = 0; i < w->k; i++)
618 {
619 gsl_matrix_set (dB, i, j, 0.0);
620 }
621 }
622
623 return GSL_SUCCESS;
624 }
625 } /* gsl_bspline_deriv_eval_nonzero() */
305626
306627 /****************************************
307628 * INTERNAL ROUTINES *
308629 ****************************************/
309630
310631 /*
311 bspline_eval_all()
312 Evaluate all non-zero B-splines B_i(x) using algorithm (8)
313 of chapter X of [1]
314
315 The idea is something like this. Given x \in [t_i, t_{i+1}]
316 with t_i < t_{i+1} and the t_i are knots, the values of the
317 B-splines not automatically zero fit into a triangular
318 array as follows:
319 0
320 0
321 0 B_{i-2,3}
322 B_{i-1,2}
323 B_{i,1} B_{i-1,3} ...
324 B_{i,2}
325 0 B_{i,3}
326 0
327 0
328
329 where B_{i,k} is the ith B-spline of order k. The boundary 0s
330 indicate that those B-splines not in the table vanish at x.
331
332 To compute the non-zero B-splines of a given order k, we use
333 Eqs. (4) and (5) of chapter X of [1]:
334
335 (4) B_{i,1}(x) = { 1, t_i <= x < t_{i+1}
336 0, else }
337
338 (5) B_{i,k}(x) = (x - t_i)
339 ----------------- B_{i,k-1}(x)
340 (t_{i+k-1} - t_i)
341
342 t_{i+k} - x
343 + ----------------- B_{i+1,k-1}(x)
344 t_{i+k} - t_{i+1}
345
346 So (4) gives us the first column of the table and we can use
347 the recurrence relation (5) to get the rest of the columns.
348
349 Inputs: x - point at which to evaluate splines
350 B - (output) where to store B-spline values (length k)
351 idx - (output) B-spline function index of last output
352 value (B_{idx}(x) is stored in the last slot of 'B')
353 w - bspline workspace
354
355 Return: success or error
356
357 Notes: 1) the w->knots vector must be initialized before calling
358 this function
359
360 2) On output, B contains:
361
362 B = [B_{i-k+1,k}, B_{i-k+2,k}, ..., B_{i-1,k}, B_{i,k}]
363
364 where 'i' is stored in 'idx' on output
365
366 3) based on PPPACK bsplvb
367 */
368
369 static int
370 bspline_eval_all(const double x, gsl_vector *B, size_t *idx,
371 gsl_bspline_workspace *w)
372 {
373 if (B->size != w->k)
374 {
375 GSL_ERROR("B vector not of length k", GSL_EBADLEN);
376 }
377 else
378 {
379 size_t i; /* spline index */
380 size_t j; /* looping */
381 size_t ii; /* looping */
382 int flag = 0; /* error flag */
383 double saved;
384 double term;
385
386 i = bspline_find_interval(x, &flag, w);
387
388 if (flag == -1)
389 {
390 GSL_ERROR("x outside of knot interval", GSL_EINVAL);
391 }
392 else if (flag == 1)
393 {
394 if (x <= gsl_vector_get(w->knots, i) + GSL_DBL_EPSILON)
395 {
396 --i;
397 }
398 else
399 {
400 GSL_ERROR("x outside of knot interval", GSL_EINVAL);
401 }
402 }
403
404 if (gsl_vector_get(w->knots, i) == gsl_vector_get(w->knots, i + 1))
405 {
406 GSL_ERROR("knot(i) = knot(i+1) will result in division by zero",
407 GSL_EINVAL);
408 }
409
410 *idx = i;
411
412 gsl_vector_set(B, 0, 1.0);
413
414 for (j = 0; j < w->k - 1; ++j)
415 {
416 gsl_vector_set(w->deltar, j,
417 gsl_vector_get(w->knots, i + j + 1) - x);
418 gsl_vector_set(w->deltal, j,
419 x - gsl_vector_get(w->knots, i - j));
420
421 saved = 0.0;
422
423 for (ii = 0; ii <= j; ++ii)
424 {
425 term = gsl_vector_get(B, ii) /
426 (gsl_vector_get(w->deltar, ii) +
427 gsl_vector_get(w->deltal, j - ii));
428
429 gsl_vector_set(B, ii,
430 saved +
431 gsl_vector_get(w->deltar, ii) * term);
432
433 saved = gsl_vector_get(w->deltal, j - ii) * term;
434 }
435
436 gsl_vector_set(B, j + 1, saved);
437 }
438
439 return GSL_SUCCESS;
440 }
441 } /* bspline_eval_all() */
442
443 /*
444632 bspline_find_interval()
445 Find knot interval such that
446
447 t_i <= x < t_{i + 1}
448
633 Find knot interval such that t_i <= x < t_{i + 1}
449634 where the t_i are knot values.
450635
451636 Inputs: x - x value
456641
457642 Notes: The error conditions are reported as follows:
458643
459 Condition Return value Flag
460 --------- ------------ ----
461 x < t_0 0 -1
462 t_i <= x < t_{i+1} i 0
463 t_i < x = t_{i+1} = t_{n+k-1} i 0
464 t_{n+k-1} < x l+k-1 +1
644 Condition Return value Flag
645 --------- ------------ ----
646 x < t_0 0 -1
647 t_i <= x < t_{i+1} i 0
648 t_i < x = t_{i+1} = t_{n+k-1} i 0
649 t_{n+k-1} < x l+k-1 +1
465650 */
466651
467652 static inline size_t
468 bspline_find_interval(const double x, int *flag,
469 gsl_bspline_workspace *w)
653 bspline_find_interval (const double x, int *flag, gsl_bspline_workspace * w)
470654 {
471655 size_t i;
472656
473 if (x < gsl_vector_get(w->knots, 0))
657 if (x < gsl_vector_get (w->knots, 0))
474658 {
475659 *flag = -1;
476660 return 0;
477661 }
478662
479663 /* find i such that t_i <= x < t_{i+1} */
480 for (i = w->k - 1; i < w->k + w->l - 1; ++i)
481 {
482 const double ti = gsl_vector_get(w->knots, i);
483 const double tip1 = gsl_vector_get(w->knots, i + 1);
664 for (i = w->k - 1; i < w->k + w->l - 1; i++)
665 {
666 const double ti = gsl_vector_get (w->knots, i);
667 const double tip1 = gsl_vector_get (w->knots, i + 1);
484668
485669 if (tip1 < ti)
486 {
487 GSL_ERROR("knots vector is not increasing", GSL_EINVAL);
488 }
670 {
671 GSL_ERROR ("knots vector is not increasing", GSL_EINVAL);
672 }
489673
490674 if (ti <= x && x < tip1)
491 break;
492
493 if (ti < x && x == tip1 &&
494 tip1 == gsl_vector_get(w->knots, w->k + w->l - 1))
495 break;
675 break;
676
677 if (ti < x && x == tip1 && tip1 == gsl_vector_get (w->knots, w->k + w->l
678 - 1))
679 break;
496680 }
497681
498682 if (i == w->k + w->l - 1)
501685 *flag = 0;
502686
503687 return i;
504 } /* bspline_find_interval() */
688 } /* bspline_find_interval() */
689
690 /*
691 bspline_process_interval_for_eval()
692 Consumes an x location, left knot from bspline_find_interval, flag
693 from bspline_find_interval, and a workspace. Checks that x lies within
694 the splines' knots, enforces some endpoint continuity requirements, and
695 avoids divide by zero errors in the underlying bspline_pppack_* functions.
696 */
697 static inline int
698 bspline_process_interval_for_eval (const double x, size_t * i, const int flag,
699 gsl_bspline_workspace * w)
700 {
701 if (flag == -1)
702 {
703 GSL_ERROR ("x outside of knot interval", GSL_EINVAL);
704 }
705 else if (flag == 1)
706 {
707 if (x <= gsl_vector_get (w->knots, *i) + GSL_DBL_EPSILON)
708 {
709 *i -= 1;
710 }
711 else
712 {
713 GSL_ERROR ("x outside of knot interval", GSL_EINVAL);
714 }
715 }
716
717 if (gsl_vector_get (w->knots, *i) == gsl_vector_get (w->knots, *i + 1))
718 {
719 GSL_ERROR ("knot(i) = knot(i+1) will result in division by zero",
720 GSL_EINVAL);
721 }
722
723 return GSL_SUCCESS;
724 } /* bspline_process_interval_for_eval */
725
726 /********************************************************************
727 * PPPACK ROUTINES
728 *
729 * The routines herein deliberately avoid using the bspline workspace,
730 * choosing instead to pass all work areas explicitly. This allows
731 * others to more easily adapt these routines to low memory or
732 * parallel scenarios.
733 ********************************************************************/
734
735 /*
736 bspline_pppack_bsplvb()
737 calculates the value of all possibly nonzero b-splines at x of order
738 jout = max( jhigh , (j+1)*(index-1) ) with knot sequence t.
739
740 Parameters:
741 t - knot sequence, of length left + jout , assumed to be
742 nondecreasing. assumption t(left).lt.t(left + 1).
743 division by zero will result if t(left) = t(left+1)
744 jhigh -
745 index - integers which determine the order jout = max(jhigh,
746 (j+1)*(index-1)) of the b-splines whose values at x
747 are to be returned. index is used to avoid
748 recalculations when several columns of the triangular
749 array of b-spline values are needed (e.g., in bsplpp
750 or in bsplvd ). precisely,
751
752 if index = 1 ,
753 the calculation starts from scratch and the entire
754 triangular array of b-spline values of orders
755 1,2,...,jhigh is generated order by order , i.e.,
756 column by column .
757
758 if index = 2 ,
759 only the b-spline values of order j+1, j+2, ..., jout
760 are generated, the assumption being that biatx, j,
761 deltal, deltar are, on entry, as they were on exit
762 at the previous call.
763
764 in particular, if jhigh = 0, then jout = j+1, i.e.,
765 just the next column of b-spline values is generated.
766 x - the point at which the b-splines are to be evaluated.
767 left - an integer chosen (usually) so that
768 t(left) .le. x .le. t(left+1).
769 j - (output) a working scalar for indexing
770 deltal - (output) a working area which must be of length at least jout
771 deltar - (output) a working area which must be of length at least jout
772 biatx - (output) array of length jout, with biatx(i)
773 containing the value at x of the polynomial of order
774 jout which agrees with the b-spline b(left-jout+i,jout,t)
775 on the interval (t(left), t(left+1)) .
776
777 Method:
778 the recurrence relation
779
780 x - t(i) t(i+j+1) - x
781 b(i,j+1)(x) = -----------b(i,j)(x) + ---------------b(i+1,j)(x)
782 t(i+j)-t(i) t(i+j+1)-t(i+1)
783
784 is used (repeatedly) to generate the (j+1)-vector b(left-j,j+1)(x),
785 ...,b(left,j+1)(x) from the j-vector b(left-j+1,j)(x),...,
786 b(left,j)(x), storing the new values in biatx over the old. the
787 facts that
788
789 b(i,1) = 1 if t(i) .le. x .lt. t(i+1)
790
791 and that
792
793 b(i,j)(x) = 0 unless t(i) .le. x .lt. t(i+j)
794
795 are used. the particular organization of the calculations follows
796 algorithm (8) in chapter x of [1].
797
798 Notes:
799
800 (1) This is a direct translation of PPPACK's bsplvb routine with
801 j, deltal, deltar rewritten as input parameters and
802 utilizing zero-based indexing.
803
804 (2) This routine contains no error checking. Please use routines
805 like gsl_bspline_eval().
806 */
807
808 static void
809 bspline_pppack_bsplvb (const gsl_vector * t,
810 const size_t jhigh,
811 const size_t index,
812 const double x,
813 const size_t left,
814 size_t * j,
815 gsl_vector * deltal,
816 gsl_vector * deltar, gsl_vector * biatx)
817 {
818 size_t i; /* looping */
819 double saved;
820 double term;
821
822 if (index == 1)
823 {
824 *j = 0;
825 gsl_vector_set (biatx, 0, 1.0);
826 }
827
828 for ( /* NOP */ ; *j < jhigh - 1; *j += 1)
829 {
830 gsl_vector_set (deltar, *j, gsl_vector_get (t, left + *j + 1) - x);
831 gsl_vector_set (deltal, *j, x - gsl_vector_get (t, left - *j));
832
833 saved = 0.0;
834
835 for (i = 0; i <= *j; i++)
836 {
837 term = gsl_vector_get (biatx, i) / (gsl_vector_get (deltar, i)
838 + gsl_vector_get (deltal,
839 *j - i));
840
841 gsl_vector_set (biatx, i,
842 saved + gsl_vector_get (deltar, i) * term);
843
844 saved = gsl_vector_get (deltal, *j - i) * term;
845 }
846
847 gsl_vector_set (biatx, *j + 1, saved);
848 }
849
850 return;
851 } /* gsl_bspline_pppack_bsplvb */
852
853 /*
854 bspline_pppack_bsplvd()
855 calculates value and derivs of all b-splines which do not vanish at x
856
857 Parameters:
858 t - the knot array, of length left+k (at least)
859 k - the order of the b-splines to be evaluated
860 x - the point at which these values are sought
861 left - an integer indicating the left endpoint of the interval
862 of interest. the k b-splines whose support contains the
863 interval (t(left), t(left+1)) are to be considered.
864 it is assumed that t(left) .lt. t(left+1)
865 division by zero will result otherwise (in bsplvb).
866 also, the output is as advertised only if
867 t(left) .le. x .le. t(left+1) .
868 deltal - a working area which must be of length at least k
869 deltar - a working area which must be of length at least k
870 a - an array of order (k,k), to contain b-coeffs of the
871 derivatives of a certain order of the k b-splines
872 of interest.
873 dbiatx - an array of order (k,nderiv). its entry (i,m) contains
874 value of (m)th derivative of (left-k+i)-th b-spline
875 of order k for knot sequence t, i=1,...,k, m=0,...,nderiv.
876 nderiv - an integer indicating that values of b-splines and
877 their derivatives up to AND INCLUDING the nderiv-th
878 are asked for. (nderiv is replaced internally by the
879 integer mhigh in (1,k) closest to it.)
880
881 Method:
882 values at x of all the relevant b-splines of order k,k-1,..., k+1-nderiv
883 are generated via bsplvb and stored temporarily in dbiatx. then, the
884 b-coeffs of the required derivatives of the b-splines of interest are
885 generated by differencing, each from the preceeding one of lower order,
886 and combined with the values of b-splines of corresponding order in
887 dbiatx to produce the desired values .
888
889 Notes:
890
891 (1) This is a direct translation of PPPACK's bsplvd routine with
892 deltal, deltar rewritten as input parameters (to later feed them
893 to bspline_pppack_bsplvb) and utilizing zero-based indexing.
894
895 (2) This routine contains no error checking.
896 */
897
898 static void
899 bspline_pppack_bsplvd (const gsl_vector * t,
900 const size_t k,
901 const double x,
902 const size_t left,
903 gsl_vector * deltal,
904 gsl_vector * deltar,
905 gsl_matrix * a,
906 gsl_matrix * dbiatx, const size_t nderiv)
907 {
908 int i, ideriv, il, j, jlow, jp1mid, kmm, ldummy, m, mhigh;
909 double factor, fkmm, sum;
910
911 size_t bsplvb_j;
912 gsl_vector_view dbcol = gsl_matrix_column (dbiatx, 0);
913
914 mhigh = GSL_MIN_INT (nderiv, k - 1);
915 bspline_pppack_bsplvb (t, k - mhigh, 1, x, left, &bsplvb_j, deltal, deltar,
916 &dbcol.vector);
917 if (mhigh > 0)
918 {
919 /* the first column of dbiatx always contains the b-spline
920 values for the current order. these are stored in column
921 k-current order before bsplvb is called to put values
922 for the next higher order on top of it. */
923 ideriv = mhigh;
924 for (m = 1; m <= mhigh; m++)
925 {
926 for (j = ideriv, jp1mid = 0; j < (int) k; j++, jp1mid++)
927 {
928 gsl_matrix_set (dbiatx, j, ideriv,
929 gsl_matrix_get (dbiatx, jp1mid, 0));
930 }
931 ideriv--;
932 bspline_pppack_bsplvb (t, k - ideriv, 2, x, left, &bsplvb_j, deltal,
933 deltar, &dbcol.vector);
934 }
935
936 /* at this point, b(left-k+i, k+1-j)(x) is in dbiatx(i,j)
937 for i=j,...,k-1 and j=0,...,mhigh. in particular, the
938 first column of dbiatx is already in final form. to obtain
939 corresponding derivatives of b-splines in subsequent columns,
940 generate their b-repr. by differencing, then evaluate at x. */
941 jlow = 0;
942 for (i = 0; i < (int) k; i++)
943 {
944 for (j = jlow; j < (int) k; j++)
945 {
946 gsl_matrix_set (a, j, i, 0.0);
947 }
948 jlow = i;
949 gsl_matrix_set (a, i, i, 1.0);
950 }
951
952 /* at this point, a(.,j) contains the b-coeffs for the j-th of the
953 k b-splines of interest here. */
954 for (m = 1; m <= mhigh; m++)
955 {
956 kmm = k - m;
957 fkmm = (float) kmm;
958 il = left;
959 i = k - 1;
960
961 /* for j=1,...,k, construct b-coeffs of (m)th derivative
962 of b-splines from those for preceding derivative by
963 differencing and store again in a(.,j) . the fact that
964 a(i,j) = 0 for i .lt. j is used. */
965 for (ldummy = 0; ldummy < kmm; ldummy++)
966 {
967 factor =
968 fkmm / (gsl_vector_get (t, il + kmm) -
969 gsl_vector_get (t, il));
970 /* the assumption that t(left).lt.t(left+1) makes
971 denominator in factor nonzero. */
972 for (j = 0; j <= i; j++)
973 {
974 gsl_matrix_set (a, i, j, factor * (gsl_matrix_get (a, i, j)
975 - gsl_matrix_get (a,
976 i - 1,
977 j)));
978 }
979 il--;
980 i--;
981 }
982
983 /* for i=1,...,k, combine b-coeffs a(.,i) with b-spline values
984 stored in dbiatx(.,m) to get value of (m)th derivative
985 of i-th b-spline (of interest here) at x, and store in
986 dbiatx(i,m). storage of this value over the value of a
987 b-spline of order m there is safe since the remaining
988 b-spline derivatives of the same order do not use this
989 value due to the fact that a(j,i) = 0 for j .lt. i . */
990 for (i = 0; i < (int) k; i++)
991 {
992 sum = 0;
993 jlow = GSL_MAX_INT (i, m);
994 for (j = jlow; j < (int) k; j++)
995 {
996 sum +=
997 gsl_matrix_get (a, j, i) * gsl_matrix_get (dbiatx, j, m);
998 }
999 gsl_matrix_set (dbiatx, i, m, sum);
1000 }
1001 }
1002 }
1003
1004 return;
1005
1006 } /* bspline_pppack_bsplvd */
0 static inline size_t
1 bspline_find_interval (const double x, int *flag, gsl_bspline_workspace * w);
2
3 static inline int
4 bspline_process_interval_for_eval (const double x, size_t * i, int flag,
5 gsl_bspline_workspace * w);
6
7 static void
8 bspline_pppack_bsplvb (const gsl_vector * t,
9 const size_t jhigh,
10 const size_t index,
11 const double x,
12 const size_t left,
13 size_t * j,
14 gsl_vector * deltal,
15 gsl_vector * deltar, gsl_vector * biatx);
16
17 static void
18 bspline_pppack_bsplvd (const gsl_vector * t,
19 const size_t k,
20 const double x,
21 const size_t left,
22 gsl_vector * deltal,
23 gsl_vector * deltar,
24 gsl_matrix * a,
25 gsl_matrix * dbiatx, const size_t nderiv);
00 /* bspline/gsl_bspline.h
1 *
1 *
22 * Copyright (C) 2006 Patrick Alken
3 *
3 * Copyright (C) 2008 Rhys Ulerich
4 *
45 * This program is free software; you can redistribute it and/or modify
56 * it under the terms of the GNU General Public License as published by
67 * the Free Software Foundation; either version 3 of the License, or (at
78 * your option) any later version.
8 *
9 *
910 * This program is distributed in the hope that it will be useful, but
1011 * WITHOUT ANY WARRANTY; without even the implied warranty of
1112 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1213 * General Public License for more details.
13 *
14 *
1415 * You should have received a copy of the GNU General Public License
1516 * along with this program; if not, write to the Free Software
1617 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
2223 #include <stdlib.h>
2324 #include <gsl/gsl_math.h>
2425 #include <gsl/gsl_vector.h>
26 #include <gsl/gsl_matrix.h>
2527
2628 #undef __BEGIN_DECLS
2729 #undef __END_DECLS
3739
3840 typedef struct
3941 {
40 size_t k; /* spline order */
41 size_t km1; /* k - 1 (polynomial order) */
42 size_t l; /* number of polynomial pieces on interval */
43 size_t nbreak; /* number of breakpoints (l + 1) */
44 size_t n; /* number of bspline basis functions (l + k - 1) */
42 size_t k; /* spline order */
43 size_t km1; /* k - 1 (polynomial order) */
44 size_t l; /* number of polynomial pieces on interval */
45 size_t nbreak; /* number of breakpoints (l + 1) */
46 size_t n; /* number of bspline basis functions (l + k - 1) */
4547
46 gsl_vector *knots; /* knots vector */
47 gsl_vector *deltal; /* left delta */
48 gsl_vector *deltar; /* right delta */
49 gsl_vector *B; /* temporary spline results */
48 gsl_vector *knots; /* knots vector */
49 gsl_vector *deltal; /* left delta */
50 gsl_vector *deltar; /* right delta */
51 gsl_vector *B; /* temporary spline results */
5052 } gsl_bspline_workspace;
53
54 typedef struct
55 {
56 size_t k; /* spline order */
57 gsl_matrix *A; /* work matrix */
58 gsl_matrix *dB; /* temporary derivative results */
59 } gsl_bspline_deriv_workspace;
5160
5261 gsl_bspline_workspace *
5362 gsl_bspline_alloc(const size_t k, const size_t nbreak);
5463
5564 void gsl_bspline_free(gsl_bspline_workspace *w);
5665
57 size_t gsl_bspline_ncoeffs (gsl_bspline_workspace * w);
58 size_t gsl_bspline_order (gsl_bspline_workspace * w);
59 size_t gsl_bspline_nbreak (gsl_bspline_workspace * w);
60 double gsl_bspline_breakpoint (size_t i, gsl_bspline_workspace * w);
66 size_t gsl_bspline_ncoeffs(gsl_bspline_workspace * w);
67 size_t gsl_bspline_order(gsl_bspline_workspace * w);
68 size_t gsl_bspline_nbreak(gsl_bspline_workspace * w);
69 double gsl_bspline_breakpoint(size_t i, gsl_bspline_workspace * w);
6170
6271 int
6372 gsl_bspline_knots(const gsl_vector *breakpts, gsl_bspline_workspace *w);
6675 gsl_bspline_workspace *w);
6776
6877 int
69 gsl_bspline_eval(const double x, gsl_vector *B,
78 gsl_bspline_eval(const double x, gsl_vector *B,
7079 gsl_bspline_workspace *w);
80
81 int
82 gsl_bspline_eval_nonzero(const double x,
83 gsl_vector *Bk,
84 size_t *istart,
85 size_t *iend,
86 gsl_bspline_workspace *w);
87
88 gsl_bspline_deriv_workspace *
89 gsl_bspline_deriv_alloc(const size_t k);
90
91 void
92 gsl_bspline_deriv_free(gsl_bspline_deriv_workspace *w);
93
94 int
95 gsl_bspline_deriv_eval(const double x,
96 const size_t nderiv,
97 gsl_matrix *dB,
98 gsl_bspline_workspace *w,
99 gsl_bspline_deriv_workspace *dw);
100
101 int
102 gsl_bspline_deriv_eval_nonzero(const double x,
103 const size_t nderiv,
104 gsl_matrix *dB,
105 size_t *istart,
106 size_t *iend,
107 gsl_bspline_workspace *w,
108 gsl_bspline_deriv_workspace *dw);
71109
72110 __END_DECLS
73111
00 /* bspline/test.c
1 *
1 *
22 * Copyright (C) 2006, 2007 Brian Gough
3 *
3 * Copyright (C) 2008 Rhys Ulerich
4 *
45 * This program is free software; you can redistribute it and/or modify
56 * it under the terms of the GNU General Public License as published by
67 * the Free Software Foundation; either version 3 of the License, or (at
78 * your option) any later version.
8 *
9 *
910 * This program is distributed in the hope that it will be useful, but
1011 * WITHOUT ANY WARRANTY; without even the implied warranty of
1112 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1213 * General Public License for more details.
13 *
14 *
1415 * You should have received a copy of the GNU General Public License
1516 * along with this program; if not, write to the Free Software
1617 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
2122 #include <gsl/gsl_errno.h>
2223 #include <gsl/gsl_bspline.h>
2324 #include <gsl/gsl_ieee_utils.h>
25 #include <gsl/gsl_nan.h>
2426
2527 void
26 test_bspline (gsl_bspline_workspace * bw)
28 test_bspline(gsl_bspline_workspace * bw, gsl_bspline_deriv_workspace * dbw)
2729 {
2830 gsl_vector *B;
31 gsl_matrix *dB;
2932 size_t i, j;
3033 size_t n = 100;
31 size_t ncoeffs = gsl_bspline_ncoeffs (bw);
32 size_t order = gsl_bspline_order (bw);
33 size_t nbreak = gsl_bspline_nbreak (bw);
34 double a = gsl_bspline_breakpoint (0, bw);
35 double b = gsl_bspline_breakpoint (nbreak - 1, bw);
36
37 B = gsl_vector_alloc (ncoeffs);
38
34 size_t ncoeffs = gsl_bspline_ncoeffs(bw);
35 size_t order = gsl_bspline_order(bw);
36 size_t nbreak = gsl_bspline_nbreak(bw);
37 double a = gsl_bspline_breakpoint(0, bw);
38 double b = gsl_bspline_breakpoint(nbreak - 1, bw);
39
40 B = gsl_vector_alloc(ncoeffs);
41 dB = gsl_matrix_alloc(ncoeffs, 1);
42
43 /* Ensure B-splines form a partition of unity */
3944 for (i = 0; i < n; i++)
4045 {
4146 double xi = a + (b - a) * (i / (n - 1.0));
4247 double sum = 0;
43 gsl_bspline_eval (xi, B, bw);
48 gsl_bspline_eval(xi, B, bw);
4449
4550 for (j = 0; j < ncoeffs; j++)
4651 {
47 double Bj = gsl_vector_get (B, j);
52 double Bj = gsl_vector_get(B, j);
4853 int s = (Bj < 0 || Bj > 1);
49 gsl_test (s,
50 "basis-spline coefficient %u is in range [0,1] for x=%g",
51 j, xi);
54 gsl_test(s,
55 "basis-spline coefficient %u is in range [0,1] for x=%g",
56 j, xi);
5257 sum += Bj;
5358 }
5459
55 gsl_test_rel (sum, 1.0, order * GSL_DBL_EPSILON,
56 "basis-spline order %u is normalized for x=%g", order,
57 xi);
58 }
59
60 gsl_vector_free (B);
60 gsl_test_rel(sum, 1.0, order * GSL_DBL_EPSILON,
61 "basis-spline order %u is normalized for x=%g", order,
62 xi);
63 }
64
65 /* Ensure B-splines 0th derivatives agree with regular evaluation */
66 for (i = 0; i < n; i++)
67 {
68 double xi = a + (b - a) * (i / (n - 1.0));
69 gsl_bspline_eval(xi, B, bw);
70 gsl_bspline_deriv_eval(xi, 0, dB, bw, dbw);
71
72 for (j = 0; j < ncoeffs; j++)
73 {
74 gsl_test_abs(gsl_matrix_get(dB, j, 0), gsl_vector_get(B, j),
75 GSL_DBL_EPSILON,
76 "b-spline order %d basis #%d evaluation and 0th derivative consistent for x=%g",
77 order, j, xi);
78 }
79
80 }
81
82 gsl_vector_free(B);
83 gsl_matrix_free(dB);
6184 }
6285
63
64
6586 int
66 main (int argc, char **argv)
87 main(int argc, char **argv)
6788 {
6889 size_t order, breakpoints, i;
6990
70 gsl_ieee_env_setup ();
91 gsl_ieee_env_setup();
7192
7293 argc = 0; /* prevent warnings about unused parameters */
7394 argv = 0;
7798 for (breakpoints = 2; breakpoints < 100; breakpoints++)
7899 {
79100 double a = -1.23 * order, b = 45.6 * order;
80 gsl_bspline_workspace *bw = gsl_bspline_alloc (order, breakpoints);
81 gsl_bspline_knots_uniform (a, b, bw);
82 test_bspline (bw);
83 gsl_bspline_free (bw);
101 gsl_bspline_workspace *bw = gsl_bspline_alloc(order, breakpoints);
102 gsl_bspline_deriv_workspace *dbw = gsl_bspline_deriv_alloc(order);
103 gsl_bspline_knots_uniform(a, b, bw);
104 test_bspline(bw, dbw);
105 gsl_bspline_deriv_free(dbw);
106 gsl_bspline_free(bw);
84107 }
85108 }
86109
90113 for (breakpoints = 2; breakpoints < 100; breakpoints++)
91114 {
92115 double a = -1.23 * order, b = 45.6 * order;
93 gsl_bspline_workspace *bw = gsl_bspline_alloc (order, breakpoints);
94 gsl_vector *k = gsl_vector_alloc (breakpoints);
116 gsl_bspline_workspace *bw = gsl_bspline_alloc(order, breakpoints);
117 gsl_bspline_deriv_workspace *dbw = gsl_bspline_deriv_alloc(order);
118 gsl_vector *k = gsl_vector_alloc(breakpoints);
95119 for (i = 0; i < breakpoints; i++)
96120 {
97121 double f, x;
98 f = sqrt (i / (breakpoints - 1.0));
122 f = sqrt(i / (breakpoints - 1.0));
99123 x = (1 - f) * a + f * b;
100 gsl_vector_set (k, i, x);
124 gsl_vector_set(k, i, x);
101125 };
102 gsl_bspline_knots (k, bw);
103 test_bspline (bw);
104 gsl_vector_free (k);
105 gsl_bspline_free (bw);
106 }
107 }
108
109 exit (gsl_test_summary ());
126 gsl_bspline_knots(k, bw);
127 test_bspline(bw, dbw);
128 gsl_vector_free(k);
129 gsl_bspline_deriv_free(dbw);
130 gsl_bspline_free(bw);
131 }
132 }
133
134 /* Spot check known 0th, 1st, 2nd derivative
135 evaluations for a particular k = 2 case. */
136 {
137 size_t i, j; /* looping */
138
139 const double xloc[4] = { 0.0, 1.0, 6.0, 7.0};
140 const double deriv[4][3] =
141 {
142 { -1.0/2.0, 1.0/2.0, 0.0 },
143 { -1.0/2.0, 1.0/2.0, 0.0 },
144 { 0.0, -1.0/5.0, 1.0/5.0 },
145 { 0.0, -1.0/5.0, 1.0/5.0 }
146 };
147
148 gsl_bspline_workspace *bw = gsl_bspline_alloc(2, 3);
149 gsl_bspline_deriv_workspace *dbw = gsl_bspline_deriv_alloc(2);
150 gsl_matrix *dB = gsl_matrix_alloc(gsl_bspline_ncoeffs(bw),
151 gsl_bspline_order(bw) + 1);
152
153 gsl_vector *breakpts = gsl_vector_alloc(3);
154 gsl_vector_set(breakpts, 0, 0.0);
155 gsl_vector_set(breakpts, 1, 2.0);
156 gsl_vector_set(breakpts, 2, 7.0);
157 gsl_bspline_knots(breakpts, bw);
158
159
160 for (i = 0; i < 4; ++i) /* at each location */
161 {
162 /* Initialize dB with poison to ensure we overwrite it */
163 gsl_matrix_set_all(dB, GSL_NAN);
164
165 gsl_bspline_deriv_eval(xloc[i], gsl_bspline_order(bw), dB, bw, dbw);
166 for (j = 0; j < gsl_bspline_ncoeffs(bw) ; ++j)
167 {
168 /* check basis function 1st deriv */
169 gsl_test_abs(gsl_matrix_get(dB, j, 1), deriv[i][j], GSL_DBL_EPSILON,
170 "b-spline k=%d basis #%d derivative %d at x = %f",
171 gsl_bspline_order(bw), j, 1, xloc[i]);
172 }
173 for (j = 0; j < gsl_bspline_ncoeffs(bw); ++j)
174 {
175 /* check k order basis function has k-th deriv equal to 0 */
176 gsl_test_abs(gsl_matrix_get(dB, j, gsl_bspline_order(bw)), 0.0,
177 GSL_DBL_EPSILON,
178 "b-spline k=%d basis #%d derivative %d at x = %f",
179 gsl_bspline_order(bw), j, gsl_bspline_order(bw),
180 xloc[i]);
181 }
182 }
183
184 gsl_matrix_free(dB);
185 gsl_bspline_deriv_free(dbw);
186 gsl_bspline_free(bw);
187 gsl_vector_free(breakpts);
188 }
189
190 /* Spot check known 0th, 1st, 2nd derivative
191 evaluations for a particular k = 3 case. */
192 {
193 size_t i, j; /* looping */
194 const double xloc[5] = { 0.0, 5.0, 9.0, 12.0, 15.0 };
195 const double eval[5][6] =
196 {
197 { 4./25., 69./100., 3./ 20. , 0. , 0. , 0. },
198 { 0. , 4./21. , 143./210. , 9./70., 0. , 0. },
199 { 0. , 0. , 3./ 10. , 7./10., 0. , 0. },
200 { 0. , 0. , 0. , 3./4. , 1./4., 0. },
201 { 0. , 0. , 0. , 1./3. , 5./9., 1./9. }
202 };
203 const double deriv[5][6] =
204 {
205 { -4./25., 3./50., 1./ 10., 0. , 0. , 0. },
206 { 0. , -2./21., 1./105., 3./35., 0. , 0. },
207 { 0. , 0. , -1./5. , 1./ 5., 0. , 0. },
208 { 0. , 0. , 0. , -1./ 6., 1./6. , 0. },
209 { 0. , 0. , 0. , -1./ 9., 1./27., 2./27. }
210 };
211 const double deriv2[5][6] =
212 {
213 { 2./25., -17./150., 1.0/30.0 , 0.0 , 0. , 0. },
214 { 0. , 1./ 42., -11.0/210.0, 1.0/35.0, 0. , 0. },
215 { 0. , 0. , 1.0/15.0 ,-11.0/90.0, 1./18. , 0. },
216 { 0. , 0. , 0.0 , 1.0/54.0, -7./162., 2./81. },
217 { 0. , 0. , 0.0 , 1.0/54.0, -7./162., 2./81. }
218 };
219
220 gsl_bspline_workspace *bw = gsl_bspline_alloc(3, 5);
221 gsl_bspline_deriv_workspace *dbw = gsl_bspline_deriv_alloc(3);
222
223 gsl_matrix *dB = gsl_matrix_alloc(gsl_bspline_ncoeffs(bw),
224 gsl_bspline_order(bw) + 1);
225
226 gsl_vector *breakpts = gsl_vector_alloc(5);
227 gsl_vector_set(breakpts, 0, -3.0);
228 gsl_vector_set(breakpts, 1, 2.0);
229 gsl_vector_set(breakpts, 2, 9.0);
230 gsl_vector_set(breakpts, 3, 12.0);
231 gsl_vector_set(breakpts, 4, 21.0);
232 gsl_bspline_knots(breakpts, bw);
233
234 for (i = 0; i < 5; ++i) /* at each location */
235 {
236 /* Initialize dB with poison to ensure we overwrite it */
237 gsl_matrix_set_all(dB, GSL_NAN);
238 gsl_bspline_deriv_eval(xloc[i], gsl_bspline_order(bw), dB, bw, dbw);
239
240 /* check basis function evaluation */
241 for (j = 0; j < gsl_bspline_ncoeffs(bw); ++j)
242 {
243 gsl_test_abs(gsl_matrix_get(dB, j, 0), eval[i][j], GSL_DBL_EPSILON,
244 "b-spline k=%d basis #%d derivative %d at x = %f",
245 gsl_bspline_order(bw), j, 0, xloc[i]);
246 }
247 /* check 1st derivative evaluation */
248 for (j = 0; j < gsl_bspline_ncoeffs(bw); ++j)
249 {
250 gsl_test_abs(gsl_matrix_get(dB, j, 1), deriv[i][j], GSL_DBL_EPSILON,
251 "b-spline k=%d basis #%d derivative %d at x = %f",
252 gsl_bspline_order(bw), j, 1, xloc[i]);
253 }
254 /* check 2nd derivative evaluation */
255 for (j = 0; j < gsl_bspline_ncoeffs(bw); ++j)
256 {
257 gsl_test_abs(gsl_matrix_get(dB, j, 2), deriv2[i][j], GSL_DBL_EPSILON,
258 "b-spline k=%d basis #%d derivative %d at x = %f",
259 gsl_bspline_order(bw), j, 2, xloc[i]);
260 }
261 }
262
263 gsl_matrix_free(dB);
264 gsl_bspline_deriv_free(dbw);
265 gsl_bspline_free(bw);
266 gsl_vector_free(breakpts);
267 }
268
269 exit(gsl_test_summary());
110270 }
0 /* Compile subsequent inline functions as static functions */
1
2 #ifdef __GSL_BUILD_H__
3 #error build.h must not be included multiple times
4 #endif
5
6 #define __GSL_BUILD_H__
7
8 #ifdef COMPILE_INLINE_STATIC
9 #ifndef HIDE_INLINE_STATIC /* skip if inline functions are hidden */
10
11 #undef __GSL_INLINE_H__
12 #define __GSL_INLINE_H__ /* first, ignore the gsl_inline.h header file */
13
14 #undef INLINE_DECL
15 #define INLINE_DECL /* disable inline in declarations */
16
17 #undef INLINE_FUN
18 #define INLINE_FUN /* disable inline in definitions */
19
20 #ifndef HAVE_INLINE /* enable compilation of definitions in .h files */
21 #define HAVE_INLINE
22 #endif
23
24 /* Compile range checking code for inline functions used in the library */
25 #undef GSL_RANGE_CHECK
26 #define GSL_RANGE_CHECK 1
27
28 /* Use the global variable gsl_check_range to enable/disable range checking at
29 runtime */
30 #undef GSL_RANGE_COND
31 #define GSL_RANGE_COND(x) (gsl_check_range && (x))
32
33 #endif
34 #else
35 #error must be called with COMPILE_INLINE_STATIC
36 #endif
77
88 pkginclude_HEADERS = gsl_cblas.h
99
10 INCLUDES= -I$(top_srcdir)
10 INCLUDES = -I$(top_srcdir)
1111
1212 libgslcblas_la_SOURCES = sasum.c saxpy.c scasum.c scnrm2.c scopy.c sdot.c sdsdot.c sgbmv.c sgemm.c sgemv.c sger.c snrm2.c srot.c srotg.c srotm.c srotmg.c ssbmv.c sscal.c sspmv.c sspr.c sspr2.c sswap.c ssymm.c ssymv.c ssyr.c ssyr2.c ssyr2k.c ssyrk.c stbmv.c stbsv.c stpmv.c stpsv.c strmm.c strmv.c strsm.c strsv.c dasum.c daxpy.c dcopy.c ddot.c dgbmv.c dgemm.c dgemv.c dger.c dnrm2.c drot.c drotg.c drotm.c drotmg.c dsbmv.c dscal.c dsdot.c dspmv.c dspr.c dspr2.c dswap.c dsymm.c dsymv.c dsyr.c dsyr2.c dsyr2k.c dsyrk.c dtbmv.c dtbsv.c dtpmv.c dtpsv.c dtrmm.c dtrmv.c dtrsm.c dtrsv.c dzasum.c dznrm2.c caxpy.c ccopy.c cdotc_sub.c cdotu_sub.c cgbmv.c cgemm.c cgemv.c cgerc.c cgeru.c chbmv.c chemm.c chemv.c cher.c cher2.c cher2k.c cherk.c chpmv.c chpr.c chpr2.c cscal.c csscal.c cswap.c csymm.c csyr2k.c csyrk.c ctbmv.c ctbsv.c ctpmv.c ctpsv.c ctrmm.c ctrmv.c ctrsm.c ctrsv.c zaxpy.c zcopy.c zdotc_sub.c zdotu_sub.c zdscal.c zgbmv.c zgemm.c zgemv.c zgerc.c zgeru.c zhbmv.c zhemm.c zhemv.c zher.c zher2.c zher2k.c zherk.c zhpmv.c zhpr.c zhpr2.c zscal.c zswap.c zsymm.c zsyr2k.c zsyrk.c ztbmv.c ztbsv.c ztpmv.c ztpsv.c ztrmm.c ztrmv.c ztrsm.c ztrsv.c icamax.c idamax.c isamax.c izamax.c xerbla.c
1313
171171 LIBOBJS = @LIBOBJS@
172172 LIBS = @LIBS@
173173 LIBTOOL = @LIBTOOL@
174 LIPO = @LIPO@
174175 LN_S = @LN_S@
175176 LTLIBOBJS = @LTLIBOBJS@
176177 MAINT = @MAINT@
178179 MKDIR_P = @MKDIR_P@
179180 NM = @NM@
180181 NMEDIT = @NMEDIT@
182 OBJDUMP = @OBJDUMP@
181183 OBJEXT = @OBJEXT@
184 OTOOL = @OTOOL@
185 OTOOL64 = @OTOOL64@
182186 PACKAGE = @PACKAGE@
183187 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
184188 PACKAGE_NAME = @PACKAGE_NAME@
0 2008-12-03 Brian Gough <bjg@network-theory.co.uk>
1
2 * gammainv.c (gsl_cdf_gamma_Pinv): keep iterating if P is still
3 changing (fix for bug 24704)
4
5 * test.c (test_chisqinv): added test cases for bug 24704
6
7 2008-07-03 Brian Gough <bjg@hp2.network-theory.co.uk>
8
9 * Makefile.am (INCLUDES): use top_srcdir instead of top_builddir
10
11 2008-04-29 Brian Gough <bjg@network-theory.co.uk>
12
13 * gammainv.c (gsl_cdf_gamma_Pinv, gsl_cdf_gamma_Qinv): restrict
14 the range of the gaussian approximation
15
016 2008-02-20 Brian Gough <bjg@network-theory.co.uk>
117
218 * beta_inc.c (beta_inc_AXPY): add some handling for large
22
33 pkginclude_HEADERS= gsl_cdf.h
44
5 INCLUDES= -I$(top_builddir)
5 INCLUDES = -I$(top_srcdir)
66
77 libgslcdf_la_SOURCES = beta.c betainv.c cauchy.c cauchyinv.c chisq.c chisqinv.c exponential.c exponentialinv.c exppow.c fdist.c fdistinv.c flat.c flatinv.c gamma.c gammainv.c gauss.c gaussinv.c gumbel1.c gumbel1inv.c gumbel2.c gumbel2inv.c laplace.c laplaceinv.c logistic.c logisticinv.c lognormal.c lognormalinv.c pareto.c paretoinv.c rayleigh.c rayleighinv.c tdist.c tdistinv.c weibull.c weibullinv.c binomial.c poisson.c geometric.c nbinomial.c pascal.c hypergeometric.c
88
141141 LIBOBJS = @LIBOBJS@
142142 LIBS = @LIBS@
143143 LIBTOOL = @LIBTOOL@
144 LIPO = @LIPO@
144145 LN_S = @LN_S@
145146 LTLIBOBJS = @LTLIBOBJS@
146147 MAINT = @MAINT@
148149 MKDIR_P = @MKDIR_P@
149150 NM = @NM@
150151 NMEDIT = @NMEDIT@
152 OBJDUMP = @OBJDUMP@
151153 OBJEXT = @OBJEXT@
154 OTOOL = @OTOOL@
155 OTOOL64 = @OTOOL64@
152156 PACKAGE = @PACKAGE@
153157 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
154158 PACKAGE_NAME = @PACKAGE_NAME@
213217 top_srcdir = @top_srcdir@
214218 noinst_LTLIBRARIES = libgslcdf.la
215219 pkginclude_HEADERS = gsl_cdf.h
216 INCLUDES = -I$(top_builddir)
220 INCLUDES = -I$(top_srcdir)
217221 libgslcdf_la_SOURCES = beta.c betainv.c cauchy.c cauchyinv.c chisq.c chisqinv.c exponential.c exponentialinv.c exppow.c fdist.c fdistinv.c flat.c flatinv.c gamma.c gammainv.c gauss.c gaussinv.c gumbel1.c gumbel1inv.c gumbel2.c gumbel2inv.c laplace.c laplaceinv.c logistic.c logisticinv.c lognormal.c lognormalinv.c pareto.c paretoinv.c rayleigh.c rayleighinv.c tdist.c tdistinv.c weibull.c weibullinv.c binomial.c poisson.c geometric.c nbinomial.c pascal.c hypergeometric.c
218222 noinst_HEADERS = beta_inc.c rat_eval.h test_auto.c error.h
219223 TESTS = $(check_PROGRAMS)
4141
4242 /* Consider, small, large and intermediate cases separately. The
4343 boundaries at 0.05 and 0.95 have not been optimised, but seem ok
44 for an initial approximation. */
44 for an initial approximation.
45
46 BJG: These approximations aren't really valid, the relevant
47 criterion is P*gamma(a+1) < 1. Need to rework these routines and
48 use a single bisection style solver for all the inverse
49 functions.
50 */
4551
4652 if (P < 0.05)
4753 {
5662 else
5763 {
5864 double xg = gsl_cdf_ugaussian_Pinv (P);
59 double x0 = (xg < -sqrt (a)) ? a : sqrt (a) * xg + a;
65 double x0 = (xg < -0.5*sqrt (a)) ? a : sqrt (a) * xg + a;
6066 x = x0;
6167 }
6268
8490 double step1 = -((a - 1) / x - 1) * lambda * lambda / 4.0;
8591
8692 double step = step0;
87 if (fabs (step1) < fabs (step0))
93 if (fabs (step1) < 0.5 * fabs (step0))
8894 step += step1;
8995
9096 if (x + step > 0)
94100 x /= 2.0;
95101 }
96102
97 if (fabs (step0) > 1e-10 * x)
103 if (fabs (step0) > 1e-10 * x || fabs(step0 * phi) > 1e-10 * P)
98104 goto start;
99105 }
100106
139145 else
140146 {
141147 double xg = gsl_cdf_ugaussian_Qinv (Q);
142 double x0 = (xg < -sqrt (a)) ? a : sqrt (a) * xg + a;
148 double x0 = (xg < -0.5*sqrt (a)) ? a : sqrt (a) * xg + a;
143149 x = x0;
144150 }
145151
167173 double step1 = -((a - 1) / x - 1) * lambda * lambda / 4.0;
168174
169175 double step = step0;
170 if (fabs (step1) < fabs (step0))
176 if (fabs (step1) < 0.5 * fabs (step0))
171177 step += step1;
172178
173179 if (x + step > 0)
12411241 TEST (gsl_cdf_chisq_Pinv, (9.99999999999998341e-1, 13.0), 100.0, 0.01);
12421242 TEST (gsl_cdf_chisq_Pinv, (1e0, 13.0), GSL_POSINF, 0.0);
12431243
1244 TEST (gsl_cdf_chisq_Pinv, (1.93238145206123590e-01, 1.5), 0.211980092931799521729407, TEST_TOL6);
1245 TEST (gsl_cdf_chisq_Pinv, (4.83e-8, 19.19), 1.632280186860266704532868343, TEST_TOL6);
1246
1247 /* Test cases for bug 24704 */
1248 TEST (gsl_cdf_chisq_Pinv, (0.05, 1263131.0), 1260517.771133388726131469059, TEST_TOL6);
1249 TEST (gsl_cdf_chisq_Pinv, (0.05, 2526262.0), 2522565.864973351096735720202, TEST_TOL6);
1250
12441251 TEST (gsl_cdf_chisq_Qinv, (0.0, 13.0), GSL_POSINF, TEST_TOL6);
12451252 TEST (gsl_cdf_chisq_Qinv, (1.65902608070858809e-15, 13.0), 100.0, TEST_TOL6);
12461253 TEST (gsl_cdf_chisq_Qinv, (9.52102560780915127e-2, 13.0), 20.0, TEST_TOL6);
0 2008-11-18 Brian Gough <bjg@network-theory.co.uk>
1
2 * gsl_chebyshev.h: added auxiliary functions
3
4 * init.c (gsl_cheb_order, gsl_cheb_size, gsl_cheb_coeffs): added
5 auxiliary functions
6
7 2008-07-03 Brian Gough <bjg@hp2.network-theory.co.uk>
8
9 * Makefile.am (INCLUDES): use top_srcdir instead of top_builddir
10
011 2007-01-29 Brian Gough <bjg@network-theory.co.uk>
112
213 * eval.c (gsl_cheb_eval_mode_e): compute error consistently with
11
22 pkginclude_HEADERS = gsl_chebyshev.h
33
4 INCLUDES= -I$(top_builddir)
4 INCLUDES = -I$(top_srcdir)
55
66 libgslcheb_la_SOURCES = deriv.c eval.c init.c integ.c
77
131131 LIBOBJS = @LIBOBJS@
132132 LIBS = @LIBS@
133133 LIBTOOL = @LIBTOOL@
134 LIPO = @LIPO@
134135 LN_S = @LN_S@
135136 LTLIBOBJS = @LTLIBOBJS@
136137 MAINT = @MAINT@
138139 MKDIR_P = @MKDIR_P@
139140 NM = @NM@
140141 NMEDIT = @NMEDIT@
142 OBJDUMP = @OBJDUMP@
141143 OBJEXT = @OBJEXT@
144 OTOOL = @OTOOL@
145 OTOOL64 = @OTOOL64@
142146 PACKAGE = @PACKAGE@
143147 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
144148 PACKAGE_NAME = @PACKAGE_NAME@
203207 top_srcdir = @top_srcdir@
204208 noinst_LTLIBRARIES = libgslcheb.la
205209 pkginclude_HEADERS = gsl_chebyshev.h
206 INCLUDES = -I$(top_builddir)
210 INCLUDES = -I$(top_srcdir)
207211 libgslcheb_la_SOURCES = deriv.c eval.c init.c integ.c
208212 TESTS = $(check_PROGRAMS)
209213 test_LDADD = libgslcheb.la ../ieee-utils/libgslieeeutils.la ../test/libgsltest.la ../sys/libgslsys.la ../err/libgslerr.la ../utils/libutils.la
3838 deriv->a = f->a;
3939 deriv->b = f->b;
4040
41 #ifdef ERR
42 deriv->err = n * n * f->c[n-1]; /* error in derivative is n^2 c_n */
43 #endif
41 /* error in derivative is n^2 c_n */
42 /* deriv->err = n * n * f->c[n-1];*/
4443
4544 /* FIXME: should probably set deriv->f[] as well */
4645
8181 int gsl_cheb_init(gsl_cheb_series * cs, const gsl_function * func,
8282 const double a, const double b);
8383
84 /* Return the order, size of coefficient array and coefficient array ptr */
85 size_t gsl_cheb_order (const gsl_cheb_series * cs);
86 size_t gsl_cheb_size (const gsl_cheb_series * cs);
87 double *gsl_cheb_coeffs (const gsl_cheb_series * cs);
8488
8589 /* Evaluate a Chebyshev series at a given point.
8690 * No errors can occur for a struct obtained from gsl_cheb_new().
9494 return GSL_SUCCESS;
9595 }
9696
97 size_t
98 gsl_cheb_order (const gsl_cheb_series * cs)
99 {
100 return cs->order;
101 }
97102
103 size_t
104 gsl_cheb_size (const gsl_cheb_series * cs)
105 {
106 return (cs->order + 1);
107 }
98108
109 double *
110 gsl_cheb_coeffs (const gsl_cheb_series * cs)
111 {
112 return cs->c;
113 }
99114
100
7474
7575 gsl_cheb_init(cs, &F_T0, -1.0, 1.0);
7676
77 {
78 size_t expected = 40;
79 size_t order = gsl_cheb_order (cs);
80 size_t size = gsl_cheb_size (cs);
81 double * p = gsl_cheb_coeffs (cs);
82 gsl_test(order != expected, "gsl_cheb_order");
83 gsl_test(size != expected + 1, "gsl_cheb_size");
84 gsl_test(p != cs->c, "gsl_cheb_coeffs");
85 }
86
7787 for (i = 0; i<cs->order; i++)
7888 {
7989 double c_exp = (i == 0) ? 2.0 : 0.0;
0 2008-07-03 Brian Gough <bjg@hp2.network-theory.co.uk>
1
2 * gsl_combination.h: added gsl_inline.h, use INLINE_DECL and
3 GSL_RANGE_COND for gsl_combination_get
4
5 * combination.c: moved gsl_combination_get to inline.c
6
7 * inline.c: separate file for inline function object code
8
9 * Makefile.am (INCLUDES): use top_srcdir only, remove top_builddir
10
011 2003-07-30 Brian Gough <bjg@network-theory.co.uk>
112
213 * init.c (gsl_combination_alloc): set c->data to NULL when k=0
11
22 pkginclude_HEADERS = gsl_combination.h
33
4 INCLUDES= -I$(top_builddir) -I$(top_srcdir)
4 INCLUDES = -I$(top_srcdir)
55
6 libgslcombination_la_SOURCES = init.c file.c combination.c
6 libgslcombination_la_SOURCES = init.c file.c combination.c inline.c
77
88 noinst_HEADERS =
99
4545 CONFIG_CLEAN_FILES =
4646 LTLIBRARIES = $(noinst_LTLIBRARIES)
4747 libgslcombination_la_LIBADD =
48 am_libgslcombination_la_OBJECTS = init.lo file.lo combination.lo
48 am_libgslcombination_la_OBJECTS = init.lo file.lo combination.lo \
49 inline.lo
4950 libgslcombination_la_OBJECTS = $(am_libgslcombination_la_OBJECTS)
5051 am_test_OBJECTS = test.$(OBJEXT)
5152 test_OBJECTS = $(am_test_OBJECTS)
132133 LIBOBJS = @LIBOBJS@
133134 LIBS = @LIBS@
134135 LIBTOOL = @LIBTOOL@
136 LIPO = @LIPO@
135137 LN_S = @LN_S@
136138 LTLIBOBJS = @LTLIBOBJS@
137139 MAINT = @MAINT@
139141 MKDIR_P = @MKDIR_P@
140142 NM = @NM@
141143 NMEDIT = @NMEDIT@
144 OBJDUMP = @OBJDUMP@
142145 OBJEXT = @OBJEXT@
146 OTOOL = @OTOOL@
147 OTOOL64 = @OTOOL64@
143148 PACKAGE = @PACKAGE@
144149 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
145150 PACKAGE_NAME = @PACKAGE_NAME@
204209 top_srcdir = @top_srcdir@
205210 noinst_LTLIBRARIES = libgslcombination.la
206211 pkginclude_HEADERS = gsl_combination.h
207 INCLUDES = -I$(top_builddir) -I$(top_srcdir)
208 libgslcombination_la_SOURCES = init.c file.c combination.c
212 INCLUDES = -I$(top_srcdir)
213 libgslcombination_la_SOURCES = init.c file.c combination.c inline.c
209214 noinst_HEADERS =
210215 TESTS = $(check_PROGRAMS)
211216 test_SOURCES = test.c
3838 {
3939 return c->data ;
4040 }
41
42 #ifndef HIDE_INLINE_STATIC
43 size_t
44 gsl_combination_get (const gsl_combination * c, const size_t i)
45 {
46 if (gsl_check_range)
47 {
48 if (i >= c->k) /* size_t is unsigned, can't be negative */
49 {
50 GSL_ERROR_VAL ("index out of range", GSL_EINVAL, 0);
51 }
52 }
53
54 return c->data[i];
55 }
56 #endif
57
5841
5942 int
6043 gsl_combination_valid (gsl_combination * c)
2323 #include <stdlib.h>
2424 #include <gsl/gsl_errno.h>
2525 #include <gsl/gsl_types.h>
26 #include <gsl/gsl_inline.h>
2627 #include <gsl/gsl_check_range.h>
2728
2829 #undef __BEGIN_DECLS
6263 size_t gsl_combination_k (const gsl_combination * c);
6364 size_t * gsl_combination_data (const gsl_combination * c);
6465
65 size_t gsl_combination_get (const gsl_combination * c, const size_t i);
66
6766 int gsl_combination_valid (gsl_combination * c);
6867 int gsl_combination_next (gsl_combination * c);
6968 int gsl_combination_prev (gsl_combination * c);
7069
70 INLINE_DECL size_t gsl_combination_get (const gsl_combination * c, const size_t i);
71
7172 #ifdef HAVE_INLINE
7273
73 extern inline
74 INLINE_FUN
7475 size_t
7576 gsl_combination_get (const gsl_combination * c, const size_t i)
7677 {
7778 #if GSL_RANGE_CHECK
78 if (i >= c->k)
79 if (GSL_RANGE_COND(i >= c->k)) /* size_t is unsigned, can't be negative */
7980 {
8081 GSL_ERROR_VAL ("index out of range", GSL_EINVAL, 0);
8182 }
0 /* combination/inline.c
1 *
2 * Copyright (C) 2008 Brian Gough
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 3 of the License, or (at
7 * your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18
19 /* Compile all the inline functions */
20
21 #define COMPILE_INLINE_STATIC
22 #include "build.h"
23 #include <gsl/gsl_combination.h>
0 2008-07-03 Brian Gough <bjg@hp2.network-theory.co.uk>
1
2 * math.c: handle inline functions separately
3
4 * gsl_complex_math.h: add declarations for inline functions
5
6 * inline.c: separate file for inline functions
7
8 * Makefile.am (INCLUDES): use top_srcdir
9
010 2007-09-14 Brian Gough <bjg@network-theory.co.uk>
111
212 * test.c: add a margin of safety on tests for released versions,
11
22 pkginclude_HEADERS = gsl_complex.h gsl_complex_math.h
33
4 #INCLUDES = -I$(top_builddir) -I$(top_srcdir)
54 INCLUDES = -I$(top_srcdir)
65
7 libgslcomplex_la_SOURCES = math.c
6 libgslcomplex_la_SOURCES = math.c inline.c
87
98 TESTS = $(check_PROGRAMS)
109 check_PROGRAMS = test
4545 CONFIG_CLEAN_FILES =
4646 LTLIBRARIES = $(noinst_LTLIBRARIES)
4747 libgslcomplex_la_LIBADD =
48 am_libgslcomplex_la_OBJECTS = math.lo
48 am_libgslcomplex_la_OBJECTS = math.lo inline.lo
4949 libgslcomplex_la_OBJECTS = $(am_libgslcomplex_la_OBJECTS)
5050 am_test_OBJECTS = test.$(OBJEXT)
5151 test_OBJECTS = $(am_test_OBJECTS)
131131 LIBOBJS = @LIBOBJS@
132132 LIBS = @LIBS@
133133 LIBTOOL = @LIBTOOL@
134 LIPO = @LIPO@
134135 LN_S = @LN_S@
135136 LTLIBOBJS = @LTLIBOBJS@
136137 MAINT = @MAINT@
138139 MKDIR_P = @MKDIR_P@
139140 NM = @NM@
140141 NMEDIT = @NMEDIT@
142 OBJDUMP = @OBJDUMP@
141143 OBJEXT = @OBJEXT@
144 OTOOL = @OTOOL@
145 OTOOL64 = @OTOOL64@
142146 PACKAGE = @PACKAGE@
143147 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
144148 PACKAGE_NAME = @PACKAGE_NAME@
203207 top_srcdir = @top_srcdir@
204208 noinst_LTLIBRARIES = libgslcomplex.la
205209 pkginclude_HEADERS = gsl_complex.h gsl_complex_math.h
206
207 #INCLUDES = -I$(top_builddir) -I$(top_srcdir)
208210 INCLUDES = -I$(top_srcdir)
209 libgslcomplex_la_SOURCES = math.c
211 libgslcomplex_la_SOURCES = math.c inline.c
210212 TESTS = $(check_PROGRAMS)
211213 test_SOURCES = test.c results.h results1.h results2.h results_real.h
212214 test_LDADD = libgslcomplex.la ../err/libgslerr.la ../ieee-utils/libgslieeeutils.la ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la ../utils/libutils.la
1818
1919 #ifndef __GSL_COMPLEX_MATH_H__
2020 #define __GSL_COMPLEX_MATH_H__
21 #include <gsl/gsl_inline.h>
2122 #include <gsl/gsl_complex.h>
2223
2324 #undef __BEGIN_DECLS
3435
3536 /* Complex numbers */
3637
37 gsl_complex gsl_complex_rect (double x, double y); /* r= real+i*imag */
3838 gsl_complex gsl_complex_polar (double r, double theta); /* r= r e^(i theta) */
3939
40 INLINE_DECL gsl_complex gsl_complex_rect (double x, double y); /* r= real+i*imag */
41
4042 #ifdef HAVE_INLINE
41 extern inline gsl_complex
43 INLINE_FUN gsl_complex
4244 gsl_complex_rect (double x, double y)
4345 { /* return z = x + i y */
4446 gsl_complex z;
0 /* complex/inline.c
1 *
2 * Copyright (C) 2008 Brian Gough
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 3 of the License, or (at
7 * your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18
19 /* Compile all the inline functions */
20
21 #define COMPILE_INLINE_STATIC
22 #include "build.h"
23 #include <gsl/gsl_complex_math.h>
5050 * Complex numbers
5151 **********************************************************************/
5252
53 #ifndef HIDE_INLINE_STATIC
54 gsl_complex
55 gsl_complex_rect (double x, double y)
56 { /* return z = x + i y */
57 gsl_complex z;
58 GSL_SET_COMPLEX (&z, x, y);
59 return z;
60 }
61 #endif
62
6353 gsl_complex
6454 gsl_complex_polar (double r, double theta)
6555 { /* return z = r exp(i theta) */
0 #! /bin/sh
1 # Attempt to guess a canonical system name.
2 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
3 # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
4 # Inc.
5
6 timestamp='2007-05-17'
7
8 # This file is free software; you can redistribute it and/or modify it
9 # under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
12 #
13 # This program is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
21 # 02110-1301, USA.
22 #
23 # As a special exception to the GNU General Public License, if you
24 # distribute this file as part of a program that contains a
25 # configuration script generated by Autoconf, you may include it under
26 # the same distribution terms that you use for the rest of that program.
27
28
29 # Originally written by Per Bothner <per@bothner.com>.
30 # Please send patches to <config-patches@gnu.org>. Submit a context
31 # diff and a properly formatted ChangeLog entry.
32 #
33 # This script attempts to guess a canonical system name similar to
34 # config.sub. If it succeeds, it prints the system name on stdout, and
35 # exits with 0. Otherwise, it exits with 1.
36 #
37 # The plan is that this can be called by configure scripts if you
38 # don't specify an explicit build system type.
39
40 me=`echo "$0" | sed -e 's,.*/,,'`
41
42 usage="\
43 Usage: $0 [OPTION]
44
45 Output the configuration name of the system \`$me' is run on.
46
47 Operation modes:
48 -h, --help print this help, then exit
49 -t, --time-stamp print date of last modification, then exit
50 -v, --version print version number, then exit
51
52 Report bugs and patches to <config-patches@gnu.org>."
53
54 version="\
55 GNU config.guess ($timestamp)
56
57 Originally written by Per Bothner.
58 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
59 Free Software Foundation, Inc.
60
61 This is free software; see the source for copying conditions. There is NO
62 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
63
64 help="
65 Try \`$me --help' for more information."
66
67 # Parse command line
68 while test $# -gt 0 ; do
69 case $1 in
70 --time-stamp | --time* | -t )
71 echo "$timestamp" ; exit ;;
72 --version | -v )
73 echo "$version" ; exit ;;
74 --help | --h* | -h )
75 echo "$usage"; exit ;;
76 -- ) # Stop option processing
77 shift; break ;;
78 - ) # Use stdin as input.
79 break ;;
80 -* )
81 echo "$me: invalid option $1$help" >&2
82 exit 1 ;;
83 * )
84 break ;;
85 esac
86 done
87
88 if test $# != 0; then
89 echo "$me: too many arguments$help" >&2
90 exit 1
91 fi
92
93 trap 'exit 1' 1 2 15
94
95 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a
96 # compiler to aid in system detection is discouraged as it requires
97 # temporary files to be created and, as you can see below, it is a
98 # headache to deal with in a portable fashion.
99
100 # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
101 # use `HOST_CC' if defined, but it is deprecated.
102
103 # Portable tmp directory creation inspired by the Autoconf team.
104
105 set_cc_for_build='
106 trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
107 trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
108 : ${TMPDIR=/tmp} ;
109 { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
110 { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
111 { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
112 { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
113 dummy=$tmp/dummy ;
114 tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
115 case $CC_FOR_BUILD,$HOST_CC,$CC in
116 ,,) echo "int x;" > $dummy.c ;
117 for c in cc gcc c89 c99 ; do
118 if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
119 CC_FOR_BUILD="$c"; break ;
120 fi ;
121 done ;
122 if test x"$CC_FOR_BUILD" = x ; then
123 CC_FOR_BUILD=no_compiler_found ;
124 fi
125 ;;
126 ,,*) CC_FOR_BUILD=$CC ;;
127 ,*,*) CC_FOR_BUILD=$HOST_CC ;;
128 esac ; set_cc_for_build= ;'
129
130 # This is needed to find uname on a Pyramid OSx when run in the BSD universe.
131 # (ghazi@noc.rutgers.edu 1994-08-24)
132 if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
133 PATH=$PATH:/.attbin ; export PATH
134 fi
135
136 UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
137 UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
138 UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
139 UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
140
141 # Note: order is significant - the case branches are not exclusive.
142
143 case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
144 *:NetBSD:*:*)
145 # NetBSD (nbsd) targets should (where applicable) match one or
146 # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
147 # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
148 # switched to ELF, *-*-netbsd* would select the old
149 # object file format. This provides both forward
150 # compatibility and a consistent mechanism for selecting the
151 # object file format.
152 #
153 # Note: NetBSD doesn't particularly care about the vendor
154 # portion of the name. We always set it to "unknown".
155 sysctl="sysctl -n hw.machine_arch"
156 UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
157 /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
158 case "${UNAME_MACHINE_ARCH}" in
159 armeb) machine=armeb-unknown ;;
160 arm*) machine=arm-unknown ;;
161 sh3el) machine=shl-unknown ;;
162 sh3eb) machine=sh-unknown ;;
163 sh5el) machine=sh5le-unknown ;;
164 *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
165 esac
166 # The Operating System including object format, if it has switched
167 # to ELF recently, or will in the future.
168 case "${UNAME_MACHINE_ARCH}" in
169 arm*|i386|m68k|ns32k|sh3*|sparc|vax)
170 eval $set_cc_for_build
171 if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
172 | grep __ELF__ >/dev/null
173 then
174 # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
175 # Return netbsd for either. FIX?
176 os=netbsd
177 else
178 os=netbsdelf
179 fi
180 ;;
181 *)
182 os=netbsd
183 ;;
184 esac
185 # The OS release
186 # Debian GNU/NetBSD machines have a different userland, and
187 # thus, need a distinct triplet. However, they do not need
188 # kernel version information, so it can be replaced with a
189 # suitable tag, in the style of linux-gnu.
190 case "${UNAME_VERSION}" in
191 Debian*)
192 release='-gnu'
193 ;;
194 *)
195 release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
196 ;;
197 esac
198 # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
199 # contains redundant information, the shorter form:
200 # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
201 echo "${machine}-${os}${release}"
202 exit ;;
203 *:OpenBSD:*:*)
204 UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
205 echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
206 exit ;;
207 *:ekkoBSD:*:*)
208 echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
209 exit ;;
210 *:SolidBSD:*:*)
211 echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
212 exit ;;
213 macppc:MirBSD:*:*)
214 echo powerpc-unknown-mirbsd${UNAME_RELEASE}
215 exit ;;
216 *:MirBSD:*:*)
217 echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
218 exit ;;
219 alpha:OSF1:*:*)
220 case $UNAME_RELEASE in
221 *4.0)
222 UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
223 ;;
224 *5.*)
225 UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
226 ;;
227 esac
228 # According to Compaq, /usr/sbin/psrinfo has been available on
229 # OSF/1 and Tru64 systems produced since 1995. I hope that
230 # covers most systems running today. This code pipes the CPU
231 # types through head -n 1, so we only detect the type of CPU 0.
232 ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
233 case "$ALPHA_CPU_TYPE" in
234 "EV4 (21064)")
235 UNAME_MACHINE="alpha" ;;
236 "EV4.5 (21064)")
237 UNAME_MACHINE="alpha" ;;
238 "LCA4 (21066/21068)")
239 UNAME_MACHINE="alpha" ;;
240 "EV5 (21164)")
241 UNAME_MACHINE="alphaev5" ;;
242 "EV5.6 (21164A)")
243 UNAME_MACHINE="alphaev56" ;;
244 "EV5.6 (21164PC)")
245 UNAME_MACHINE="alphapca56" ;;
246 "EV5.7 (21164PC)")
247 UNAME_MACHINE="alphapca57" ;;
248 "EV6 (21264)")
249 UNAME_MACHINE="alphaev6" ;;
250 "EV6.7 (21264A)")
251 UNAME_MACHINE="alphaev67" ;;
252 "EV6.8CB (21264C)")
253 UNAME_MACHINE="alphaev68" ;;
254 "EV6.8AL (21264B)")
255 UNAME_MACHINE="alphaev68" ;;
256 "EV6.8CX (21264D)")
257 UNAME_MACHINE="alphaev68" ;;
258 "EV6.9A (21264/EV69A)")
259 UNAME_MACHINE="alphaev69" ;;
260 "EV7 (21364)")
261 UNAME_MACHINE="alphaev7" ;;
262 "EV7.9 (21364A)")
263 UNAME_MACHINE="alphaev79" ;;
264 esac
265 # A Pn.n version is a patched version.
266 # A Vn.n version is a released version.
267 # A Tn.n version is a released field test version.
268 # A Xn.n version is an unreleased experimental baselevel.
269 # 1.2 uses "1.2" for uname -r.
270 echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
271 exit ;;
272 Alpha\ *:Windows_NT*:*)
273 # How do we know it's Interix rather than the generic POSIX subsystem?
274 # Should we change UNAME_MACHINE based on the output of uname instead
275 # of the specific Alpha model?
276 echo alpha-pc-interix
277 exit ;;
278 21064:Windows_NT:50:3)
279 echo alpha-dec-winnt3.5
280 exit ;;
281 Amiga*:UNIX_System_V:4.0:*)
282 echo m68k-unknown-sysv4
283 exit ;;
284 *:[Aa]miga[Oo][Ss]:*:*)
285 echo ${UNAME_MACHINE}-unknown-amigaos
286 exit ;;
287 *:[Mm]orph[Oo][Ss]:*:*)
288 echo ${UNAME_MACHINE}-unknown-morphos
289 exit ;;
290 *:OS/390:*:*)
291 echo i370-ibm-openedition
292 exit ;;
293 *:z/VM:*:*)
294 echo s390-ibm-zvmoe
295 exit ;;
296 *:OS400:*:*)
297 echo powerpc-ibm-os400
298 exit ;;
299 arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
300 echo arm-acorn-riscix${UNAME_RELEASE}
301 exit ;;
302 arm:riscos:*:*|arm:RISCOS:*:*)
303 echo arm-unknown-riscos
304 exit ;;
305 SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
306 echo hppa1.1-hitachi-hiuxmpp
307 exit ;;
308 Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
309 # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
310 if test "`(/bin/universe) 2>/dev/null`" = att ; then
311 echo pyramid-pyramid-sysv3
312 else
313 echo pyramid-pyramid-bsd
314 fi
315 exit ;;
316 NILE*:*:*:dcosx)
317 echo pyramid-pyramid-svr4
318 exit ;;
319 DRS?6000:unix:4.0:6*)
320 echo sparc-icl-nx6
321 exit ;;
322 DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
323 case `/usr/bin/uname -p` in
324 sparc) echo sparc-icl-nx7; exit ;;
325 esac ;;
326 sun4H:SunOS:5.*:*)
327 echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
328 exit ;;
329 sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
330 echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
331 exit ;;
332 i86pc:SunOS:5.*:* | ix86xen:SunOS:5.*:*)
333 echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
334 exit ;;
335 sun4*:SunOS:6*:*)
336 # According to config.sub, this is the proper way to canonicalize
337 # SunOS6. Hard to guess exactly what SunOS6 will be like, but
338 # it's likely to be more like Solaris than SunOS4.
339 echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
340 exit ;;
341 sun4*:SunOS:*:*)
342 case "`/usr/bin/arch -k`" in
343 Series*|S4*)
344 UNAME_RELEASE=`uname -v`
345 ;;
346 esac
347 # Japanese Language versions have a version number like `4.1.3-JL'.
348 echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
349 exit ;;
350 sun3*:SunOS:*:*)
351 echo m68k-sun-sunos${UNAME_RELEASE}
352 exit ;;
353 sun*:*:4.2BSD:*)
354 UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
355 test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
356 case "`/bin/arch`" in
357 sun3)
358 echo m68k-sun-sunos${UNAME_RELEASE}
359 ;;
360 sun4)
361 echo sparc-sun-sunos${UNAME_RELEASE}
362 ;;
363 esac
364 exit ;;
365 aushp:SunOS:*:*)
366 echo sparc-auspex-sunos${UNAME_RELEASE}
367 exit ;;
368 # The situation for MiNT is a little confusing. The machine name
369 # can be virtually everything (everything which is not
370 # "atarist" or "atariste" at least should have a processor
371 # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
372 # to the lowercase version "mint" (or "freemint"). Finally
373 # the system name "TOS" denotes a system which is actually not
374 # MiNT. But MiNT is downward compatible to TOS, so this should
375 # be no problem.
376 atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
377 echo m68k-atari-mint${UNAME_RELEASE}
378 exit ;;
379 atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
380 echo m68k-atari-mint${UNAME_RELEASE}
381 exit ;;
382 *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
383 echo m68k-atari-mint${UNAME_RELEASE}
384 exit ;;
385 milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
386 echo m68k-milan-mint${UNAME_RELEASE}
387 exit ;;
388 hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
389 echo m68k-hades-mint${UNAME_RELEASE}
390 exit ;;
391 *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
392 echo m68k-unknown-mint${UNAME_RELEASE}
393 exit ;;
394 m68k:machten:*:*)
395 echo m68k-apple-machten${UNAME_RELEASE}
396 exit ;;
397 powerpc:machten:*:*)
398 echo powerpc-apple-machten${UNAME_RELEASE}
399 exit ;;
400 RISC*:Mach:*:*)
401 echo mips-dec-mach_bsd4.3
402 exit ;;
403 RISC*:ULTRIX:*:*)
404 echo mips-dec-ultrix${UNAME_RELEASE}
405 exit ;;
406 VAX*:ULTRIX*:*:*)
407 echo vax-dec-ultrix${UNAME_RELEASE}
408 exit ;;
409 2020:CLIX:*:* | 2430:CLIX:*:*)
410 echo clipper-intergraph-clix${UNAME_RELEASE}
411 exit ;;
412 mips:*:*:UMIPS | mips:*:*:RISCos)
413 eval $set_cc_for_build
414 sed 's/^ //' << EOF >$dummy.c
415 #ifdef __cplusplus
416 #include <stdio.h> /* for printf() prototype */
417 int main (int argc, char *argv[]) {
418 #else
419 int main (argc, argv) int argc; char *argv[]; {
420 #endif
421 #if defined (host_mips) && defined (MIPSEB)
422 #if defined (SYSTYPE_SYSV)
423 printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
424 #endif
425 #if defined (SYSTYPE_SVR4)
426 printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
427 #endif
428 #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
429 printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
430 #endif
431 #endif
432 exit (-1);
433 }
434 EOF
435 $CC_FOR_BUILD -o $dummy $dummy.c &&
436 dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
437 SYSTEM_NAME=`$dummy $dummyarg` &&
438 { echo "$SYSTEM_NAME"; exit; }
439 echo mips-mips-riscos${UNAME_RELEASE}
440 exit ;;
441 Motorola:PowerMAX_OS:*:*)
442 echo powerpc-motorola-powermax
443 exit ;;
444 Motorola:*:4.3:PL8-*)
445 echo powerpc-harris-powermax
446 exit ;;
447 Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
448 echo powerpc-harris-powermax
449 exit ;;
450 Night_Hawk:Power_UNIX:*:*)
451 echo powerpc-harris-powerunix
452 exit ;;
453 m88k:CX/UX:7*:*)
454 echo m88k-harris-cxux7
455 exit ;;
456 m88k:*:4*:R4*)
457 echo m88k-motorola-sysv4
458 exit ;;
459 m88k:*:3*:R3*)
460 echo m88k-motorola-sysv3
461 exit ;;
462 AViiON:dgux:*:*)
463 # DG/UX returns AViiON for all architectures
464 UNAME_PROCESSOR=`/usr/bin/uname -p`
465 if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
466 then
467 if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
468 [ ${TARGET_BINARY_INTERFACE}x = x ]
469 then
470 echo m88k-dg-dgux${UNAME_RELEASE}
471 else
472 echo m88k-dg-dguxbcs${UNAME_RELEASE}
473 fi
474 else
475 echo i586-dg-dgux${UNAME_RELEASE}
476 fi
477 exit ;;
478 M88*:DolphinOS:*:*) # DolphinOS (SVR3)
479 echo m88k-dolphin-sysv3
480 exit ;;
481 M88*:*:R3*:*)
482 # Delta 88k system running SVR3
483 echo m88k-motorola-sysv3
484 exit ;;
485 XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
486 echo m88k-tektronix-sysv3
487 exit ;;
488 Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
489 echo m68k-tektronix-bsd
490 exit ;;
491 *:IRIX*:*:*)
492 echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
493 exit ;;
494 ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
495 echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
496 exit ;; # Note that: echo "'`uname -s`'" gives 'AIX '
497 i*86:AIX:*:*)
498 echo i386-ibm-aix
499 exit ;;
500 ia64:AIX:*:*)
501 if [ -x /usr/bin/oslevel ] ; then
502 IBM_REV=`/usr/bin/oslevel`
503 else
504 IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
505 fi
506 echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
507 exit ;;
508 *:AIX:2:3)
509 if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
510 eval $set_cc_for_build
511 sed 's/^ //' << EOF >$dummy.c
512 #include <sys/systemcfg.h>
513
514 main()
515 {
516 if (!__power_pc())
517 exit(1);
518 puts("powerpc-ibm-aix3.2.5");
519 exit(0);
520 }
521 EOF
522 if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
523 then
524 echo "$SYSTEM_NAME"
525 else
526 echo rs6000-ibm-aix3.2.5
527 fi
528 elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
529 echo rs6000-ibm-aix3.2.4
530 else
531 echo rs6000-ibm-aix3.2
532 fi
533 exit ;;
534 *:AIX:*:[45])
535 IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
536 if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
537 IBM_ARCH=rs6000
538 else
539 IBM_ARCH=powerpc
540 fi
541 if [ -x /usr/bin/oslevel ] ; then
542 IBM_REV=`/usr/bin/oslevel`
543 else
544 IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
545 fi
546 echo ${IBM_ARCH}-ibm-aix${IBM_REV}
547 exit ;;
548 *:AIX:*:*)
549 echo rs6000-ibm-aix
550 exit ;;
551 ibmrt:4.4BSD:*|romp-ibm:BSD:*)
552 echo romp-ibm-bsd4.4
553 exit ;;
554 ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
555 echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
556 exit ;; # report: romp-ibm BSD 4.3
557 *:BOSX:*:*)
558 echo rs6000-bull-bosx
559 exit ;;
560 DPX/2?00:B.O.S.:*:*)
561 echo m68k-bull-sysv3
562 exit ;;
563 9000/[34]??:4.3bsd:1.*:*)
564 echo m68k-hp-bsd
565 exit ;;
566 hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
567 echo m68k-hp-bsd4.4
568 exit ;;
569 9000/[34678]??:HP-UX:*:*)
570 HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
571 case "${UNAME_MACHINE}" in
572 9000/31? ) HP_ARCH=m68000 ;;
573 9000/[34]?? ) HP_ARCH=m68k ;;
574 9000/[678][0-9][0-9])
575 if [ -x /usr/bin/getconf ]; then
576 sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
577 sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
578 case "${sc_cpu_version}" in
579 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
580 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
581 532) # CPU_PA_RISC2_0
582 case "${sc_kernel_bits}" in
583 32) HP_ARCH="hppa2.0n" ;;
584 64) HP_ARCH="hppa2.0w" ;;
585 '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
586 esac ;;
587 esac
588 fi
589 if [ "${HP_ARCH}" = "" ]; then
590 eval $set_cc_for_build
591 sed 's/^ //' << EOF >$dummy.c
592
593 #define _HPUX_SOURCE
594 #include <stdlib.h>
595 #include <unistd.h>
596
597 int main ()
598 {
599 #if defined(_SC_KERNEL_BITS)
600 long bits = sysconf(_SC_KERNEL_BITS);
601 #endif
602 long cpu = sysconf (_SC_CPU_VERSION);
603
604 switch (cpu)
605 {
606 case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
607 case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
608 case CPU_PA_RISC2_0:
609 #if defined(_SC_KERNEL_BITS)
610 switch (bits)
611 {
612 case 64: puts ("hppa2.0w"); break;
613 case 32: puts ("hppa2.0n"); break;
614 default: puts ("hppa2.0"); break;
615 } break;
616 #else /* !defined(_SC_KERNEL_BITS) */
617 puts ("hppa2.0"); break;
618 #endif
619 default: puts ("hppa1.0"); break;
620 }
621 exit (0);
622 }
623 EOF
624 (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
625 test -z "$HP_ARCH" && HP_ARCH=hppa
626 fi ;;
627 esac
628 if [ ${HP_ARCH} = "hppa2.0w" ]
629 then
630 eval $set_cc_for_build
631
632 # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
633 # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
634 # generating 64-bit code. GNU and HP use different nomenclature:
635 #
636 # $ CC_FOR_BUILD=cc ./config.guess
637 # => hppa2.0w-hp-hpux11.23
638 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
639 # => hppa64-hp-hpux11.23
640
641 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
642 grep __LP64__ >/dev/null
643 then
644 HP_ARCH="hppa2.0w"
645 else
646 HP_ARCH="hppa64"
647 fi
648 fi
649 echo ${HP_ARCH}-hp-hpux${HPUX_REV}
650 exit ;;
651 ia64:HP-UX:*:*)
652 HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
653 echo ia64-hp-hpux${HPUX_REV}
654 exit ;;
655 3050*:HI-UX:*:*)
656 eval $set_cc_for_build
657 sed 's/^ //' << EOF >$dummy.c
658 #include <unistd.h>
659 int
660 main ()
661 {
662 long cpu = sysconf (_SC_CPU_VERSION);
663 /* The order matters, because CPU_IS_HP_MC68K erroneously returns
664 true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
665 results, however. */
666 if (CPU_IS_PA_RISC (cpu))
667 {
668 switch (cpu)
669 {
670 case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
671 case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
672 case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
673 default: puts ("hppa-hitachi-hiuxwe2"); break;
674 }
675 }
676 else if (CPU_IS_HP_MC68K (cpu))
677 puts ("m68k-hitachi-hiuxwe2");
678 else puts ("unknown-hitachi-hiuxwe2");
679 exit (0);
680 }
681 EOF
682 $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
683 { echo "$SYSTEM_NAME"; exit; }
684 echo unknown-hitachi-hiuxwe2
685 exit ;;
686 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
687 echo hppa1.1-hp-bsd
688 exit ;;
689 9000/8??:4.3bsd:*:*)
690 echo hppa1.0-hp-bsd
691 exit ;;
692 *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
693 echo hppa1.0-hp-mpeix
694 exit ;;
695 hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
696 echo hppa1.1-hp-osf
697 exit ;;
698 hp8??:OSF1:*:*)
699 echo hppa1.0-hp-osf
700 exit ;;
701 i*86:OSF1:*:*)
702 if [ -x /usr/sbin/sysversion ] ; then
703 echo ${UNAME_MACHINE}-unknown-osf1mk
704 else
705 echo ${UNAME_MACHINE}-unknown-osf1
706 fi
707 exit ;;
708 parisc*:Lites*:*:*)
709 echo hppa1.1-hp-lites
710 exit ;;
711 C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
712 echo c1-convex-bsd
713 exit ;;
714 C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
715 if getsysinfo -f scalar_acc
716 then echo c32-convex-bsd
717 else echo c2-convex-bsd
718 fi
719 exit ;;
720 C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
721 echo c34-convex-bsd
722 exit ;;
723 C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
724 echo c38-convex-bsd
725 exit ;;
726 C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
727 echo c4-convex-bsd
728 exit ;;
729 CRAY*Y-MP:*:*:*)
730 echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
731 exit ;;
732 CRAY*[A-Z]90:*:*:*)
733 echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
734 | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
735 -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
736 -e 's/\.[^.]*$/.X/'
737 exit ;;
738 CRAY*TS:*:*:*)
739 echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
740 exit ;;
741 CRAY*T3E:*:*:*)
742 echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
743 exit ;;
744 CRAY*SV1:*:*:*)
745 echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
746 exit ;;
747 *:UNICOS/mp:*:*)
748 echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
749 exit ;;
750 F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
751 FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
752 FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
753 FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
754 echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
755 exit ;;
756 5000:UNIX_System_V:4.*:*)
757 FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
758 FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
759 echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
760 exit ;;
761 i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
762 echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
763 exit ;;
764 sparc*:BSD/OS:*:*)
765 echo sparc-unknown-bsdi${UNAME_RELEASE}
766 exit ;;
767 *:BSD/OS:*:*)
768 echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
769 exit ;;
770 *:FreeBSD:*:*)
771 case ${UNAME_MACHINE} in
772 pc98)
773 echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
774 amd64)
775 echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
776 *)
777 echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
778 esac
779 exit ;;
780 i*:CYGWIN*:*)
781 echo ${UNAME_MACHINE}-pc-cygwin
782 exit ;;
783 *:MINGW*:*)
784 echo ${UNAME_MACHINE}-pc-mingw32
785 exit ;;
786 i*:windows32*:*)
787 # uname -m includes "-pc" on this system.
788 echo ${UNAME_MACHINE}-mingw32
789 exit ;;
790 i*:PW*:*)
791 echo ${UNAME_MACHINE}-pc-pw32
792 exit ;;
793 *:Interix*:[3456]*)
794 case ${UNAME_MACHINE} in
795 x86)
796 echo i586-pc-interix${UNAME_RELEASE}
797 exit ;;
798 EM64T | authenticamd)
799 echo x86_64-unknown-interix${UNAME_RELEASE}
800 exit ;;
801 esac ;;
802 [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
803 echo i${UNAME_MACHINE}-pc-mks
804 exit ;;
805 i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
806 # How do we know it's Interix rather than the generic POSIX subsystem?
807 # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
808 # UNAME_MACHINE based on the output of uname instead of i386?
809 echo i586-pc-interix
810 exit ;;
811 i*:UWIN*:*)
812 echo ${UNAME_MACHINE}-pc-uwin
813 exit ;;
814 amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
815 echo x86_64-unknown-cygwin
816 exit ;;
817 p*:CYGWIN*:*)
818 echo powerpcle-unknown-cygwin
819 exit ;;
820 prep*:SunOS:5.*:*)
821 echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
822 exit ;;
823 *:GNU:*:*)
824 # the GNU system
825 echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
826 exit ;;
827 *:GNU/*:*:*)
828 # other systems with GNU libc and userland
829 echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
830 exit ;;
831 i*86:Minix:*:*)
832 echo ${UNAME_MACHINE}-pc-minix
833 exit ;;
834 arm*:Linux:*:*)
835 echo ${UNAME_MACHINE}-unknown-linux-gnu
836 exit ;;
837 avr32*:Linux:*:*)
838 echo ${UNAME_MACHINE}-unknown-linux-gnu
839 exit ;;
840 cris:Linux:*:*)
841 echo cris-axis-linux-gnu
842 exit ;;
843 crisv32:Linux:*:*)
844 echo crisv32-axis-linux-gnu
845 exit ;;
846 frv:Linux:*:*)
847 echo frv-unknown-linux-gnu
848 exit ;;
849 ia64:Linux:*:*)
850 echo ${UNAME_MACHINE}-unknown-linux-gnu
851 exit ;;
852 m32r*:Linux:*:*)
853 echo ${UNAME_MACHINE}-unknown-linux-gnu
854 exit ;;
855 m68*:Linux:*:*)
856 echo ${UNAME_MACHINE}-unknown-linux-gnu
857 exit ;;
858 mips:Linux:*:*)
859 eval $set_cc_for_build
860 sed 's/^ //' << EOF >$dummy.c
861 #undef CPU
862 #undef mips
863 #undef mipsel
864 #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
865 CPU=mipsel
866 #else
867 #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
868 CPU=mips
869 #else
870 CPU=
871 #endif
872 #endif
873 EOF
874 eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
875 /^CPU/{
876 s: ::g
877 p
878 }'`"
879 test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
880 ;;
881 mips64:Linux:*:*)
882 eval $set_cc_for_build
883 sed 's/^ //' << EOF >$dummy.c
884 #undef CPU
885 #undef mips64
886 #undef mips64el
887 #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
888 CPU=mips64el
889 #else
890 #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
891 CPU=mips64
892 #else
893 CPU=
894 #endif
895 #endif
896 EOF
897 eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
898 /^CPU/{
899 s: ::g
900 p
901 }'`"
902 test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
903 ;;
904 or32:Linux:*:*)
905 echo or32-unknown-linux-gnu
906 exit ;;
907 ppc:Linux:*:*)
908 echo powerpc-unknown-linux-gnu
909 exit ;;
910 ppc64:Linux:*:*)
911 echo powerpc64-unknown-linux-gnu
912 exit ;;
913 alpha:Linux:*:*)
914 case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
915 EV5) UNAME_MACHINE=alphaev5 ;;
916 EV56) UNAME_MACHINE=alphaev56 ;;
917 PCA56) UNAME_MACHINE=alphapca56 ;;
918 PCA57) UNAME_MACHINE=alphapca56 ;;
919 EV6) UNAME_MACHINE=alphaev6 ;;
920 EV67) UNAME_MACHINE=alphaev67 ;;
921 EV68*) UNAME_MACHINE=alphaev68 ;;
922 esac
923 objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
924 if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
925 echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
926 exit ;;
927 parisc:Linux:*:* | hppa:Linux:*:*)
928 # Look for CPU level
929 case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
930 PA7*) echo hppa1.1-unknown-linux-gnu ;;
931 PA8*) echo hppa2.0-unknown-linux-gnu ;;
932 *) echo hppa-unknown-linux-gnu ;;
933 esac
934 exit ;;
935 parisc64:Linux:*:* | hppa64:Linux:*:*)
936 echo hppa64-unknown-linux-gnu
937 exit ;;
938 s390:Linux:*:* | s390x:Linux:*:*)
939 echo ${UNAME_MACHINE}-ibm-linux
940 exit ;;
941 sh64*:Linux:*:*)
942 echo ${UNAME_MACHINE}-unknown-linux-gnu
943 exit ;;
944 sh*:Linux:*:*)
945 echo ${UNAME_MACHINE}-unknown-linux-gnu
946 exit ;;
947 sparc:Linux:*:* | sparc64:Linux:*:*)
948 echo ${UNAME_MACHINE}-unknown-linux-gnu
949 exit ;;
950 vax:Linux:*:*)
951 echo ${UNAME_MACHINE}-dec-linux-gnu
952 exit ;;
953 x86_64:Linux:*:*)
954 echo x86_64-unknown-linux-gnu
955 exit ;;
956 xtensa:Linux:*:*)
957 echo xtensa-unknown-linux-gnu
958 exit ;;
959 i*86:Linux:*:*)
960 # The BFD linker knows what the default object file format is, so
961 # first see if it will tell us. cd to the root directory to prevent
962 # problems with other programs or directories called `ld' in the path.
963 # Set LC_ALL=C to ensure ld outputs messages in English.
964 ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
965 | sed -ne '/supported targets:/!d
966 s/[ ][ ]*/ /g
967 s/.*supported targets: *//
968 s/ .*//
969 p'`
970 case "$ld_supported_targets" in
971 elf32-i386)
972 TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
973 ;;
974 a.out-i386-linux)
975 echo "${UNAME_MACHINE}-pc-linux-gnuaout"
976 exit ;;
977 coff-i386)
978 echo "${UNAME_MACHINE}-pc-linux-gnucoff"
979 exit ;;
980 "")
981 # Either a pre-BFD a.out linker (linux-gnuoldld) or
982 # one that does not give us useful --help.
983 echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
984 exit ;;
985 esac
986 # Determine whether the default compiler is a.out or elf
987 eval $set_cc_for_build
988 sed 's/^ //' << EOF >$dummy.c
989 #include <features.h>
990 #ifdef __ELF__
991 # ifdef __GLIBC__
992 # if __GLIBC__ >= 2
993 LIBC=gnu
994 # else
995 LIBC=gnulibc1
996 # endif
997 # else
998 LIBC=gnulibc1
999 # endif
1000 #else
1001 #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
1002 LIBC=gnu
1003 #else
1004 LIBC=gnuaout
1005 #endif
1006 #endif
1007 #ifdef __dietlibc__
1008 LIBC=dietlibc
1009 #endif
1010 EOF
1011 eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
1012 /^LIBC/{
1013 s: ::g
1014 p
1015 }'`"
1016 test x"${LIBC}" != x && {
1017 echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
1018 exit
1019 }
1020 test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
1021 ;;
1022 i*86:DYNIX/ptx:4*:*)
1023 # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
1024 # earlier versions are messed up and put the nodename in both
1025 # sysname and nodename.
1026 echo i386-sequent-sysv4
1027 exit ;;
1028 i*86:UNIX_SV:4.2MP:2.*)
1029 # Unixware is an offshoot of SVR4, but it has its own version
1030 # number series starting with 2...
1031 # I am not positive that other SVR4 systems won't match this,
1032 # I just have to hope. -- rms.
1033 # Use sysv4.2uw... so that sysv4* matches it.
1034 echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
1035 exit ;;
1036 i*86:OS/2:*:*)
1037 # If we were able to find `uname', then EMX Unix compatibility
1038 # is probably installed.
1039 echo ${UNAME_MACHINE}-pc-os2-emx
1040 exit ;;
1041 i*86:XTS-300:*:STOP)
1042 echo ${UNAME_MACHINE}-unknown-stop
1043 exit ;;
1044 i*86:atheos:*:*)
1045 echo ${UNAME_MACHINE}-unknown-atheos
1046 exit ;;
1047 i*86:syllable:*:*)
1048 echo ${UNAME_MACHINE}-pc-syllable
1049 exit ;;
1050 i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
1051 echo i386-unknown-lynxos${UNAME_RELEASE}
1052 exit ;;
1053 i*86:*DOS:*:*)
1054 echo ${UNAME_MACHINE}-pc-msdosdjgpp
1055 exit ;;
1056 i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
1057 UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
1058 if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
1059 echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
1060 else
1061 echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
1062 fi
1063 exit ;;
1064 i*86:*:5:[678]*)
1065 # UnixWare 7.x, OpenUNIX and OpenServer 6.
1066 case `/bin/uname -X | grep "^Machine"` in
1067 *486*) UNAME_MACHINE=i486 ;;
1068 *Pentium) UNAME_MACHINE=i586 ;;
1069 *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
1070 esac
1071 echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
1072 exit ;;
1073 i*86:*:3.2:*)
1074 if test -f /usr/options/cb.name; then
1075 UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
1076 echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
1077 elif /bin/uname -X 2>/dev/null >/dev/null ; then
1078 UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
1079 (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
1080 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
1081 && UNAME_MACHINE=i586
1082 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
1083 && UNAME_MACHINE=i686
1084 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
1085 && UNAME_MACHINE=i686
1086 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
1087 else
1088 echo ${UNAME_MACHINE}-pc-sysv32
1089 fi
1090 exit ;;
1091 pc:*:*:*)
1092 # Left here for compatibility:
1093 # uname -m prints for DJGPP always 'pc', but it prints nothing about
1094 # the processor, so we play safe by assuming i386.
1095 echo i386-pc-msdosdjgpp
1096 exit ;;
1097 Intel:Mach:3*:*)
1098 echo i386-pc-mach3
1099 exit ;;
1100 paragon:*:*:*)
1101 echo i860-intel-osf1
1102 exit ;;
1103 i860:*:4.*:*) # i860-SVR4
1104 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
1105 echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
1106 else # Add other i860-SVR4 vendors below as they are discovered.
1107 echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
1108 fi
1109 exit ;;
1110 mini*:CTIX:SYS*5:*)
1111 # "miniframe"
1112 echo m68010-convergent-sysv
1113 exit ;;
1114 mc68k:UNIX:SYSTEM5:3.51m)
1115 echo m68k-convergent-sysv
1116 exit ;;
1117 M680?0:D-NIX:5.3:*)
1118 echo m68k-diab-dnix
1119 exit ;;
1120 M68*:*:R3V[5678]*:*)
1121 test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
1122 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
1123 OS_REL=''
1124 test -r /etc/.relid \
1125 && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1126 /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1127 && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
1128 /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1129 && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
1130 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
1131 /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1132 && { echo i486-ncr-sysv4; exit; } ;;
1133 m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
1134 echo m68k-unknown-lynxos${UNAME_RELEASE}
1135 exit ;;
1136 mc68030:UNIX_System_V:4.*:*)
1137 echo m68k-atari-sysv4
1138 exit ;;
1139 TSUNAMI:LynxOS:2.*:*)
1140 echo sparc-unknown-lynxos${UNAME_RELEASE}
1141 exit ;;
1142 rs6000:LynxOS:2.*:*)
1143 echo rs6000-unknown-lynxos${UNAME_RELEASE}
1144 exit ;;
1145 PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
1146 echo powerpc-unknown-lynxos${UNAME_RELEASE}
1147 exit ;;
1148 SM[BE]S:UNIX_SV:*:*)
1149 echo mips-dde-sysv${UNAME_RELEASE}
1150 exit ;;
1151 RM*:ReliantUNIX-*:*:*)
1152 echo mips-sni-sysv4
1153 exit ;;
1154 RM*:SINIX-*:*:*)
1155 echo mips-sni-sysv4
1156 exit ;;
1157 *:SINIX-*:*:*)
1158 if uname -p 2>/dev/null >/dev/null ; then
1159 UNAME_MACHINE=`(uname -p) 2>/dev/null`
1160 echo ${UNAME_MACHINE}-sni-sysv4
1161 else
1162 echo ns32k-sni-sysv
1163 fi
1164 exit ;;
1165 PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
1166 # says <Richard.M.Bartel@ccMail.Census.GOV>
1167 echo i586-unisys-sysv4
1168 exit ;;
1169 *:UNIX_System_V:4*:FTX*)
1170 # From Gerald Hewes <hewes@openmarket.com>.
1171 # How about differentiating between stratus architectures? -djm
1172 echo hppa1.1-stratus-sysv4
1173 exit ;;
1174 *:*:*:FTX*)
1175 # From seanf@swdc.stratus.com.
1176 echo i860-stratus-sysv4
1177 exit ;;
1178 i*86:VOS:*:*)
1179 # From Paul.Green@stratus.com.
1180 echo ${UNAME_MACHINE}-stratus-vos
1181 exit ;;
1182 *:VOS:*:*)
1183 # From Paul.Green@stratus.com.
1184 echo hppa1.1-stratus-vos
1185 exit ;;
1186 mc68*:A/UX:*:*)
1187 echo m68k-apple-aux${UNAME_RELEASE}
1188 exit ;;
1189 news*:NEWS-OS:6*:*)
1190 echo mips-sony-newsos6
1191 exit ;;
1192 R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
1193 if [ -d /usr/nec ]; then
1194 echo mips-nec-sysv${UNAME_RELEASE}
1195 else
1196 echo mips-unknown-sysv${UNAME_RELEASE}
1197 fi
1198 exit ;;
1199 BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
1200 echo powerpc-be-beos
1201 exit ;;
1202 BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
1203 echo powerpc-apple-beos
1204 exit ;;
1205 BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
1206 echo i586-pc-beos
1207 exit ;;
1208 SX-4:SUPER-UX:*:*)
1209 echo sx4-nec-superux${UNAME_RELEASE}
1210 exit ;;
1211 SX-5:SUPER-UX:*:*)
1212 echo sx5-nec-superux${UNAME_RELEASE}
1213 exit ;;
1214 SX-6:SUPER-UX:*:*)
1215 echo sx6-nec-superux${UNAME_RELEASE}
1216 exit ;;
1217 SX-7:SUPER-UX:*:*)
1218 echo sx7-nec-superux${UNAME_RELEASE}
1219 exit ;;
1220 SX-8:SUPER-UX:*:*)
1221 echo sx8-nec-superux${UNAME_RELEASE}
1222 exit ;;
1223 SX-8R:SUPER-UX:*:*)
1224 echo sx8r-nec-superux${UNAME_RELEASE}
1225 exit ;;
1226 Power*:Rhapsody:*:*)
1227 echo powerpc-apple-rhapsody${UNAME_RELEASE}
1228 exit ;;
1229 *:Rhapsody:*:*)
1230 echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
1231 exit ;;
1232 *:Darwin:*:*)
1233 UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
1234 case $UNAME_PROCESSOR in
1235 unknown) UNAME_PROCESSOR=powerpc ;;
1236 esac
1237 echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
1238 exit ;;
1239 *:procnto*:*:* | *:QNX:[0123456789]*:*)
1240 UNAME_PROCESSOR=`uname -p`
1241 if test "$UNAME_PROCESSOR" = "x86"; then
1242 UNAME_PROCESSOR=i386
1243 UNAME_MACHINE=pc
1244 fi
1245 echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
1246 exit ;;
1247 *:QNX:*:4*)
1248 echo i386-pc-qnx
1249 exit ;;
1250 NSE-?:NONSTOP_KERNEL:*:*)
1251 echo nse-tandem-nsk${UNAME_RELEASE}
1252 exit ;;
1253 NSR-?:NONSTOP_KERNEL:*:*)
1254 echo nsr-tandem-nsk${UNAME_RELEASE}
1255 exit ;;
1256 *:NonStop-UX:*:*)
1257 echo mips-compaq-nonstopux
1258 exit ;;
1259 BS2000:POSIX*:*:*)
1260 echo bs2000-siemens-sysv
1261 exit ;;
1262 DS/*:UNIX_System_V:*:*)
1263 echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
1264 exit ;;
1265 *:Plan9:*:*)
1266 # "uname -m" is not consistent, so use $cputype instead. 386
1267 # is converted to i386 for consistency with other x86
1268 # operating systems.
1269 if test "$cputype" = "386"; then
1270 UNAME_MACHINE=i386
1271 else
1272 UNAME_MACHINE="$cputype"
1273 fi
1274 echo ${UNAME_MACHINE}-unknown-plan9
1275 exit ;;
1276 *:TOPS-10:*:*)
1277 echo pdp10-unknown-tops10
1278 exit ;;
1279 *:TENEX:*:*)
1280 echo pdp10-unknown-tenex
1281 exit ;;
1282 KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
1283 echo pdp10-dec-tops20
1284 exit ;;
1285 XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
1286 echo pdp10-xkl-tops20
1287 exit ;;
1288 *:TOPS-20:*:*)
1289 echo pdp10-unknown-tops20
1290 exit ;;
1291 *:ITS:*:*)
1292 echo pdp10-unknown-its
1293 exit ;;
1294 SEI:*:*:SEIUX)
1295 echo mips-sei-seiux${UNAME_RELEASE}
1296 exit ;;
1297 *:DragonFly:*:*)
1298 echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
1299 exit ;;
1300 *:*VMS:*:*)
1301 UNAME_MACHINE=`(uname -p) 2>/dev/null`
1302 case "${UNAME_MACHINE}" in
1303 A*) echo alpha-dec-vms ; exit ;;
1304 I*) echo ia64-dec-vms ; exit ;;
1305 V*) echo vax-dec-vms ; exit ;;
1306 esac ;;
1307 *:XENIX:*:SysV)
1308 echo i386-pc-xenix
1309 exit ;;
1310 i*86:skyos:*:*)
1311 echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
1312 exit ;;
1313 i*86:rdos:*:*)
1314 echo ${UNAME_MACHINE}-pc-rdos
1315 exit ;;
1316 esac
1317
1318 #echo '(No uname command or uname output not recognized.)' 1>&2
1319 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
1320
1321 eval $set_cc_for_build
1322 cat >$dummy.c <<EOF
1323 #ifdef _SEQUENT_
1324 # include <sys/types.h>
1325 # include <sys/utsname.h>
1326 #endif
1327 main ()
1328 {
1329 #if defined (sony)
1330 #if defined (MIPSEB)
1331 /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
1332 I don't know.... */
1333 printf ("mips-sony-bsd\n"); exit (0);
1334 #else
1335 #include <sys/param.h>
1336 printf ("m68k-sony-newsos%s\n",
1337 #ifdef NEWSOS4
1338 "4"
1339 #else
1340 ""
1341 #endif
1342 ); exit (0);
1343 #endif
1344 #endif
1345
1346 #if defined (__arm) && defined (__acorn) && defined (__unix)
1347 printf ("arm-acorn-riscix\n"); exit (0);
1348 #endif
1349
1350 #if defined (hp300) && !defined (hpux)
1351 printf ("m68k-hp-bsd\n"); exit (0);
1352 #endif
1353
1354 #if defined (NeXT)
1355 #if !defined (__ARCHITECTURE__)
1356 #define __ARCHITECTURE__ "m68k"
1357 #endif
1358 int version;
1359 version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
1360 if (version < 4)
1361 printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
1362 else
1363 printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
1364 exit (0);
1365 #endif
1366
1367 #if defined (MULTIMAX) || defined (n16)
1368 #if defined (UMAXV)
1369 printf ("ns32k-encore-sysv\n"); exit (0);
1370 #else
1371 #if defined (CMU)
1372 printf ("ns32k-encore-mach\n"); exit (0);
1373 #else
1374 printf ("ns32k-encore-bsd\n"); exit (0);
1375 #endif
1376 #endif
1377 #endif
1378
1379 #if defined (__386BSD__)
1380 printf ("i386-pc-bsd\n"); exit (0);
1381 #endif
1382
1383 #if defined (sequent)
1384 #if defined (i386)
1385 printf ("i386-sequent-dynix\n"); exit (0);
1386 #endif
1387 #if defined (ns32000)
1388 printf ("ns32k-sequent-dynix\n"); exit (0);
1389 #endif
1390 #endif
1391
1392 #if defined (_SEQUENT_)
1393 struct utsname un;
1394
1395 uname(&un);
1396
1397 if (strncmp(un.version, "V2", 2) == 0) {
1398 printf ("i386-sequent-ptx2\n"); exit (0);
1399 }
1400 if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
1401 printf ("i386-sequent-ptx1\n"); exit (0);
1402 }
1403 printf ("i386-sequent-ptx\n"); exit (0);
1404
1405 #endif
1406
1407 #if defined (vax)
1408 # if !defined (ultrix)
1409 # include <sys/param.h>
1410 # if defined (BSD)
1411 # if BSD == 43
1412 printf ("vax-dec-bsd4.3\n"); exit (0);
1413 # else
1414 # if BSD == 199006
1415 printf ("vax-dec-bsd4.3reno\n"); exit (0);
1416 # else
1417 printf ("vax-dec-bsd\n"); exit (0);
1418 # endif
1419 # endif
1420 # else
1421 printf ("vax-dec-bsd\n"); exit (0);
1422 # endif
1423 # else
1424 printf ("vax-dec-ultrix\n"); exit (0);
1425 # endif
1426 #endif
1427
1428 #if defined (alliant) && defined (i860)
1429 printf ("i860-alliant-bsd\n"); exit (0);
1430 #endif
1431
1432 exit (1);
1433 }
1434 EOF
1435
1436 $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
1437 { echo "$SYSTEM_NAME"; exit; }
1438
1439 # Apollos put the system type in the environment.
1440
1441 test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
1442
1443 # Convex versions that predate uname can use getsysinfo(1)
1444
1445 if [ -x /usr/convex/getsysinfo ]
1446 then
1447 case `getsysinfo -f cpu_type` in
1448 c1*)
1449 echo c1-convex-bsd
1450 exit ;;
1451 c2*)
1452 if getsysinfo -f scalar_acc
1453 then echo c32-convex-bsd
1454 else echo c2-convex-bsd
1455 fi
1456 exit ;;
1457 c34*)
1458 echo c34-convex-bsd
1459 exit ;;
1460 c38*)
1461 echo c38-convex-bsd
1462 exit ;;
1463 c4*)
1464 echo c4-convex-bsd
1465 exit ;;
1466 esac
1467 fi
1468
1469 cat >&2 <<EOF
1470 $0: unable to guess system type
1471
1472 This script, last modified $timestamp, has failed to recognize
1473 the operating system you are using. It is advised that you
1474 download the most up to date version of the config scripts from
1475
1476 http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
1477 and
1478 http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
1479
1480 If the version you run ($0) is already up to date, please
1481 send the following data and any information you think might be
1482 pertinent to <config-patches@gnu.org> in order to provide the needed
1483 information to handle your system.
1484
1485 config.guess timestamp = $timestamp
1486
1487 uname -m = `(uname -m) 2>/dev/null || echo unknown`
1488 uname -r = `(uname -r) 2>/dev/null || echo unknown`
1489 uname -s = `(uname -s) 2>/dev/null || echo unknown`
1490 uname -v = `(uname -v) 2>/dev/null || echo unknown`
1491
1492 /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
1493 /bin/uname -X = `(/bin/uname -X) 2>/dev/null`
1494
1495 hostinfo = `(hostinfo) 2>/dev/null`
1496 /bin/universe = `(/bin/universe) 2>/dev/null`
1497 /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
1498 /bin/arch = `(/bin/arch) 2>/dev/null`
1499 /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
1500 /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
1501
1502 UNAME_MACHINE = ${UNAME_MACHINE}
1503 UNAME_RELEASE = ${UNAME_RELEASE}
1504 UNAME_SYSTEM = ${UNAME_SYSTEM}
1505 UNAME_VERSION = ${UNAME_VERSION}
1506 EOF
1507
1508 exit 1
1509
1510 # Local variables:
1511 # eval: (add-hook 'write-file-hooks 'time-stamp)
1512 # time-stamp-start: "timestamp='"
1513 # time-stamp-format: "%:y-%02m-%02d"
1514 # time-stamp-end: "'"
1515 # End:
0 #! /bin/sh
1 # Configuration validation subroutine script.
2 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
3 # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
4 # Inc.
5
6 timestamp='2007-04-29'
7
8 # This file is (in principle) common to ALL GNU software.
9 # The presence of a machine in this file suggests that SOME GNU software
10 # can handle that machine. It does not imply ALL GNU software can.
11 #
12 # This file is free software; you can redistribute it and/or modify
13 # it under the terms of the GNU General Public License as published by
14 # the Free Software Foundation; either version 2 of the License, or
15 # (at your option) any later version.
16 #
17 # This program is distributed in the hope that it will be useful,
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 # GNU General Public License for more details.
21 #
22 # You should have received a copy of the GNU General Public License
23 # along with this program; if not, write to the Free Software
24 # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
25 # 02110-1301, USA.
26 #
27 # As a special exception to the GNU General Public License, if you
28 # distribute this file as part of a program that contains a
29 # configuration script generated by Autoconf, you may include it under
30 # the same distribution terms that you use for the rest of that program.
31
32
33 # Please send patches to <config-patches@gnu.org>. Submit a context
34 # diff and a properly formatted ChangeLog entry.
35 #
36 # Configuration subroutine to validate and canonicalize a configuration type.
37 # Supply the specified configuration type as an argument.
38 # If it is invalid, we print an error message on stderr and exit with code 1.
39 # Otherwise, we print the canonical config type on stdout and succeed.
40
41 # This file is supposed to be the same for all GNU packages
42 # and recognize all the CPU types, system types and aliases
43 # that are meaningful with *any* GNU software.
44 # Each package is responsible for reporting which valid configurations
45 # it does not support. The user should be able to distinguish
46 # a failure to support a valid configuration from a meaningless
47 # configuration.
48
49 # The goal of this file is to map all the various variations of a given
50 # machine specification into a single specification in the form:
51 # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
52 # or in some cases, the newer four-part form:
53 # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
54 # It is wrong to echo any other type of specification.
55
56 me=`echo "$0" | sed -e 's,.*/,,'`
57
58 usage="\
59 Usage: $0 [OPTION] CPU-MFR-OPSYS
60 $0 [OPTION] ALIAS
61
62 Canonicalize a configuration name.
63
64 Operation modes:
65 -h, --help print this help, then exit
66 -t, --time-stamp print date of last modification, then exit
67 -v, --version print version number, then exit
68
69 Report bugs and patches to <config-patches@gnu.org>."
70
71 version="\
72 GNU config.sub ($timestamp)
73
74 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
75 Free Software Foundation, Inc.
76
77 This is free software; see the source for copying conditions. There is NO
78 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
79
80 help="
81 Try \`$me --help' for more information."
82
83 # Parse command line
84 while test $# -gt 0 ; do
85 case $1 in
86 --time-stamp | --time* | -t )
87 echo "$timestamp" ; exit ;;
88 --version | -v )
89 echo "$version" ; exit ;;
90 --help | --h* | -h )
91 echo "$usage"; exit ;;
92 -- ) # Stop option processing
93 shift; break ;;
94 - ) # Use stdin as input.
95 break ;;
96 -* )
97 echo "$me: invalid option $1$help"
98 exit 1 ;;
99
100 *local*)
101 # First pass through any local machine types.
102 echo $1
103 exit ;;
104
105 * )
106 break ;;
107 esac
108 done
109
110 case $# in
111 0) echo "$me: missing argument$help" >&2
112 exit 1;;
113 1) ;;
114 *) echo "$me: too many arguments$help" >&2
115 exit 1;;
116 esac
117
118 # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
119 # Here we must recognize all the valid KERNEL-OS combinations.
120 maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
121 case $maybe_os in
122 nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
123 uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
124 storm-chaos* | os2-emx* | rtmk-nova*)
125 os=-$maybe_os
126 basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
127 ;;
128 *)
129 basic_machine=`echo $1 | sed 's/-[^-]*$//'`
130 if [ $basic_machine != $1 ]
131 then os=`echo $1 | sed 's/.*-/-/'`
132 else os=; fi
133 ;;
134 esac
135
136 ### Let's recognize common machines as not being operating systems so
137 ### that things like config.sub decstation-3100 work. We also
138 ### recognize some manufacturers as not being operating systems, so we
139 ### can provide default operating systems below.
140 case $os in
141 -sun*os*)
142 # Prevent following clause from handling this invalid input.
143 ;;
144 -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
145 -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
146 -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
147 -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
148 -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
149 -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
150 -apple | -axis | -knuth | -cray)
151 os=
152 basic_machine=$1
153 ;;
154 -sim | -cisco | -oki | -wec | -winbond)
155 os=
156 basic_machine=$1
157 ;;
158 -scout)
159 ;;
160 -wrs)
161 os=-vxworks
162 basic_machine=$1
163 ;;
164 -chorusos*)
165 os=-chorusos
166 basic_machine=$1
167 ;;
168 -chorusrdb)
169 os=-chorusrdb
170 basic_machine=$1
171 ;;
172 -hiux*)
173 os=-hiuxwe2
174 ;;
175 -sco6)
176 os=-sco5v6
177 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
178 ;;
179 -sco5)
180 os=-sco3.2v5
181 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
182 ;;
183 -sco4)
184 os=-sco3.2v4
185 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
186 ;;
187 -sco3.2.[4-9]*)
188 os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
189 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
190 ;;
191 -sco3.2v[4-9]*)
192 # Don't forget version if it is 3.2v4 or newer.
193 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
194 ;;
195 -sco5v6*)
196 # Don't forget version if it is 3.2v4 or newer.
197 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
198 ;;
199 -sco*)
200 os=-sco3.2v2
201 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
202 ;;
203 -udk*)
204 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
205 ;;
206 -isc)
207 os=-isc2.2
208 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
209 ;;
210 -clix*)
211 basic_machine=clipper-intergraph
212 ;;
213 -isc*)
214 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
215 ;;
216 -lynx*)
217 os=-lynxos
218 ;;
219 -ptx*)
220 basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
221 ;;
222 -windowsnt*)
223 os=`echo $os | sed -e 's/windowsnt/winnt/'`
224 ;;
225 -psos*)
226 os=-psos
227 ;;
228 -mint | -mint[0-9]*)
229 basic_machine=m68k-atari
230 os=-mint
231 ;;
232 esac
233
234 # Decode aliases for certain CPU-COMPANY combinations.
235 case $basic_machine in
236 # Recognize the basic CPU types without company name.
237 # Some are omitted here because they have special meanings below.
238 1750a | 580 \
239 | a29k \
240 | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
241 | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
242 | am33_2.0 \
243 | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
244 | bfin \
245 | c4x | clipper \
246 | d10v | d30v | dlx | dsp16xx \
247 | fido | fr30 | frv \
248 | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
249 | i370 | i860 | i960 | ia64 \
250 | ip2k | iq2000 \
251 | m32c | m32r | m32rle | m68000 | m68k | m88k \
252 | maxq | mb | microblaze | mcore | mep \
253 | mips | mipsbe | mipseb | mipsel | mipsle \
254 | mips16 \
255 | mips64 | mips64el \
256 | mips64vr | mips64vrel \
257 | mips64orion | mips64orionel \
258 | mips64vr4100 | mips64vr4100el \
259 | mips64vr4300 | mips64vr4300el \
260 | mips64vr5000 | mips64vr5000el \
261 | mips64vr5900 | mips64vr5900el \
262 | mipsisa32 | mipsisa32el \
263 | mipsisa32r2 | mipsisa32r2el \
264 | mipsisa64 | mipsisa64el \
265 | mipsisa64r2 | mipsisa64r2el \
266 | mipsisa64sb1 | mipsisa64sb1el \
267 | mipsisa64sr71k | mipsisa64sr71kel \
268 | mipstx39 | mipstx39el \
269 | mn10200 | mn10300 \
270 | mt \
271 | msp430 \
272 | nios | nios2 \
273 | ns16k | ns32k \
274 | or32 \
275 | pdp10 | pdp11 | pj | pjl \
276 | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
277 | pyramid \
278 | score \
279 | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
280 | sh64 | sh64le \
281 | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
282 | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
283 | spu | strongarm \
284 | tahoe | thumb | tic4x | tic80 | tron \
285 | v850 | v850e \
286 | we32k \
287 | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
288 | z8k)
289 basic_machine=$basic_machine-unknown
290 ;;
291 m6811 | m68hc11 | m6812 | m68hc12)
292 # Motorola 68HC11/12.
293 basic_machine=$basic_machine-unknown
294 os=-none
295 ;;
296 m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
297 ;;
298 ms1)
299 basic_machine=mt-unknown
300 ;;
301
302 # We use `pc' rather than `unknown'
303 # because (1) that's what they normally are, and
304 # (2) the word "unknown" tends to confuse beginning users.
305 i*86 | x86_64)
306 basic_machine=$basic_machine-pc
307 ;;
308 # Object if more than one company name word.
309 *-*-*)
310 echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
311 exit 1
312 ;;
313 # Recognize the basic CPU types with company name.
314 580-* \
315 | a29k-* \
316 | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
317 | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
318 | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
319 | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
320 | avr-* | avr32-* \
321 | bfin-* | bs2000-* \
322 | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
323 | clipper-* | craynv-* | cydra-* \
324 | d10v-* | d30v-* | dlx-* \
325 | elxsi-* \
326 | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
327 | h8300-* | h8500-* \
328 | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
329 | i*86-* | i860-* | i960-* | ia64-* \
330 | ip2k-* | iq2000-* \
331 | m32c-* | m32r-* | m32rle-* \
332 | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
333 | m88110-* | m88k-* | maxq-* | mcore-* \
334 | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
335 | mips16-* \
336 | mips64-* | mips64el-* \
337 | mips64vr-* | mips64vrel-* \
338 | mips64orion-* | mips64orionel-* \
339 | mips64vr4100-* | mips64vr4100el-* \
340 | mips64vr4300-* | mips64vr4300el-* \
341 | mips64vr5000-* | mips64vr5000el-* \
342 | mips64vr5900-* | mips64vr5900el-* \
343 | mipsisa32-* | mipsisa32el-* \
344 | mipsisa32r2-* | mipsisa32r2el-* \
345 | mipsisa64-* | mipsisa64el-* \
346 | mipsisa64r2-* | mipsisa64r2el-* \
347 | mipsisa64sb1-* | mipsisa64sb1el-* \
348 | mipsisa64sr71k-* | mipsisa64sr71kel-* \
349 | mipstx39-* | mipstx39el-* \
350 | mmix-* \
351 | mt-* \
352 | msp430-* \
353 | nios-* | nios2-* \
354 | none-* | np1-* | ns16k-* | ns32k-* \
355 | orion-* \
356 | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
357 | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
358 | pyramid-* \
359 | romp-* | rs6000-* \
360 | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
361 | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
362 | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
363 | sparclite-* \
364 | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
365 | tahoe-* | thumb-* \
366 | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
367 | tron-* \
368 | v850-* | v850e-* | vax-* \
369 | we32k-* \
370 | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
371 | xstormy16-* | xtensa-* \
372 | ymp-* \
373 | z8k-*)
374 ;;
375 # Recognize the various machine names and aliases which stand
376 # for a CPU type and a company and sometimes even an OS.
377 386bsd)
378 basic_machine=i386-unknown
379 os=-bsd
380 ;;
381 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
382 basic_machine=m68000-att
383 ;;
384 3b*)
385 basic_machine=we32k-att
386 ;;
387 a29khif)
388 basic_machine=a29k-amd
389 os=-udi
390 ;;
391 abacus)
392 basic_machine=abacus-unknown
393 ;;
394 adobe68k)
395 basic_machine=m68010-adobe
396 os=-scout
397 ;;
398 alliant | fx80)
399 basic_machine=fx80-alliant
400 ;;
401 altos | altos3068)
402 basic_machine=m68k-altos
403 ;;
404 am29k)
405 basic_machine=a29k-none
406 os=-bsd
407 ;;
408 amd64)
409 basic_machine=x86_64-pc
410 ;;
411 amd64-*)
412 basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
413 ;;
414 amdahl)
415 basic_machine=580-amdahl
416 os=-sysv
417 ;;
418 amiga | amiga-*)
419 basic_machine=m68k-unknown
420 ;;
421 amigaos | amigados)
422 basic_machine=m68k-unknown
423 os=-amigaos
424 ;;
425 amigaunix | amix)
426 basic_machine=m68k-unknown
427 os=-sysv4
428 ;;
429 apollo68)
430 basic_machine=m68k-apollo
431 os=-sysv
432 ;;
433 apollo68bsd)
434 basic_machine=m68k-apollo
435 os=-bsd
436 ;;
437 aux)
438 basic_machine=m68k-apple
439 os=-aux
440 ;;
441 balance)
442 basic_machine=ns32k-sequent
443 os=-dynix
444 ;;
445 c90)
446 basic_machine=c90-cray
447 os=-unicos
448 ;;
449 convex-c1)
450 basic_machine=c1-convex
451 os=-bsd
452 ;;
453 convex-c2)
454 basic_machine=c2-convex
455 os=-bsd
456 ;;
457 convex-c32)
458 basic_machine=c32-convex
459 os=-bsd
460 ;;
461 convex-c34)
462 basic_machine=c34-convex
463 os=-bsd
464 ;;
465 convex-c38)
466 basic_machine=c38-convex
467 os=-bsd
468 ;;
469 cray | j90)
470 basic_machine=j90-cray
471 os=-unicos
472 ;;
473 craynv)
474 basic_machine=craynv-cray
475 os=-unicosmp
476 ;;
477 cr16c)
478 basic_machine=cr16c-unknown
479 os=-elf
480 ;;
481 crds | unos)
482 basic_machine=m68k-crds
483 ;;
484 crisv32 | crisv32-* | etraxfs*)
485 basic_machine=crisv32-axis
486 ;;
487 cris | cris-* | etrax*)
488 basic_machine=cris-axis
489 ;;
490 crx)
491 basic_machine=crx-unknown
492 os=-elf
493 ;;
494 da30 | da30-*)
495 basic_machine=m68k-da30
496 ;;
497 decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
498 basic_machine=mips-dec
499 ;;
500 decsystem10* | dec10*)
501 basic_machine=pdp10-dec
502 os=-tops10
503 ;;
504 decsystem20* | dec20*)
505 basic_machine=pdp10-dec
506 os=-tops20
507 ;;
508 delta | 3300 | motorola-3300 | motorola-delta \
509 | 3300-motorola | delta-motorola)
510 basic_machine=m68k-motorola
511 ;;
512 delta88)
513 basic_machine=m88k-motorola
514 os=-sysv3
515 ;;
516 djgpp)
517 basic_machine=i586-pc
518 os=-msdosdjgpp
519 ;;
520 dpx20 | dpx20-*)
521 basic_machine=rs6000-bull
522 os=-bosx
523 ;;
524 dpx2* | dpx2*-bull)
525 basic_machine=m68k-bull
526 os=-sysv3
527 ;;
528 ebmon29k)
529 basic_machine=a29k-amd
530 os=-ebmon
531 ;;
532 elxsi)
533 basic_machine=elxsi-elxsi
534 os=-bsd
535 ;;
536 encore | umax | mmax)
537 basic_machine=ns32k-encore
538 ;;
539 es1800 | OSE68k | ose68k | ose | OSE)
540 basic_machine=m68k-ericsson
541 os=-ose
542 ;;
543 fx2800)
544 basic_machine=i860-alliant
545 ;;
546 genix)
547 basic_machine=ns32k-ns
548 ;;
549 gmicro)
550 basic_machine=tron-gmicro
551 os=-sysv
552 ;;
553 go32)
554 basic_machine=i386-pc
555 os=-go32
556 ;;
557 h3050r* | hiux*)
558 basic_machine=hppa1.1-hitachi
559 os=-hiuxwe2
560 ;;
561 h8300hms)
562 basic_machine=h8300-hitachi
563 os=-hms
564 ;;
565 h8300xray)
566 basic_machine=h8300-hitachi
567 os=-xray
568 ;;
569 h8500hms)
570 basic_machine=h8500-hitachi
571 os=-hms
572 ;;
573 harris)
574 basic_machine=m88k-harris
575 os=-sysv3
576 ;;
577 hp300-*)
578 basic_machine=m68k-hp
579 ;;
580 hp300bsd)
581 basic_machine=m68k-hp
582 os=-bsd
583 ;;
584 hp300hpux)
585 basic_machine=m68k-hp
586 os=-hpux
587 ;;
588 hp3k9[0-9][0-9] | hp9[0-9][0-9])
589 basic_machine=hppa1.0-hp
590 ;;
591 hp9k2[0-9][0-9] | hp9k31[0-9])
592 basic_machine=m68000-hp
593 ;;
594 hp9k3[2-9][0-9])
595 basic_machine=m68k-hp
596 ;;
597 hp9k6[0-9][0-9] | hp6[0-9][0-9])
598 basic_machine=hppa1.0-hp
599 ;;
600 hp9k7[0-79][0-9] | hp7[0-79][0-9])
601 basic_machine=hppa1.1-hp
602 ;;
603 hp9k78[0-9] | hp78[0-9])
604 # FIXME: really hppa2.0-hp
605 basic_machine=hppa1.1-hp
606 ;;
607 hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
608 # FIXME: really hppa2.0-hp
609 basic_machine=hppa1.1-hp
610 ;;
611 hp9k8[0-9][13679] | hp8[0-9][13679])
612 basic_machine=hppa1.1-hp
613 ;;
614 hp9k8[0-9][0-9] | hp8[0-9][0-9])
615 basic_machine=hppa1.0-hp
616 ;;
617 hppa-next)
618 os=-nextstep3
619 ;;
620 hppaosf)
621 basic_machine=hppa1.1-hp
622 os=-osf
623 ;;
624 hppro)
625 basic_machine=hppa1.1-hp
626 os=-proelf
627 ;;
628 i370-ibm* | ibm*)
629 basic_machine=i370-ibm
630 ;;
631 # I'm not sure what "Sysv32" means. Should this be sysv3.2?
632 i*86v32)
633 basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
634 os=-sysv32
635 ;;
636 i*86v4*)
637 basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
638 os=-sysv4
639 ;;
640 i*86v)
641 basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
642 os=-sysv
643 ;;
644 i*86sol2)
645 basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
646 os=-solaris2
647 ;;
648 i386mach)
649 basic_machine=i386-mach
650 os=-mach
651 ;;
652 i386-vsta | vsta)
653 basic_machine=i386-unknown
654 os=-vsta
655 ;;
656 iris | iris4d)
657 basic_machine=mips-sgi
658 case $os in
659 -irix*)
660 ;;
661 *)
662 os=-irix4
663 ;;
664 esac
665 ;;
666 isi68 | isi)
667 basic_machine=m68k-isi
668 os=-sysv
669 ;;
670 m88k-omron*)
671 basic_machine=m88k-omron
672 ;;
673 magnum | m3230)
674 basic_machine=mips-mips
675 os=-sysv
676 ;;
677 merlin)
678 basic_machine=ns32k-utek
679 os=-sysv
680 ;;
681 mingw32)
682 basic_machine=i386-pc
683 os=-mingw32
684 ;;
685 mingw32ce)
686 basic_machine=arm-unknown
687 os=-mingw32ce
688 ;;
689 miniframe)
690 basic_machine=m68000-convergent
691 ;;
692 *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
693 basic_machine=m68k-atari
694 os=-mint
695 ;;
696 mips3*-*)
697 basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
698 ;;
699 mips3*)
700 basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
701 ;;
702 monitor)
703 basic_machine=m68k-rom68k
704 os=-coff
705 ;;
706 morphos)
707 basic_machine=powerpc-unknown
708 os=-morphos
709 ;;
710 msdos)
711 basic_machine=i386-pc
712 os=-msdos
713 ;;
714 ms1-*)
715 basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
716 ;;
717 mvs)
718 basic_machine=i370-ibm
719 os=-mvs
720 ;;
721 ncr3000)
722 basic_machine=i486-ncr
723 os=-sysv4
724 ;;
725 netbsd386)
726 basic_machine=i386-unknown
727 os=-netbsd
728 ;;
729 netwinder)
730 basic_machine=armv4l-rebel
731 os=-linux
732 ;;
733 news | news700 | news800 | news900)
734 basic_machine=m68k-sony
735 os=-newsos
736 ;;
737 news1000)
738 basic_machine=m68030-sony
739 os=-newsos
740 ;;
741 news-3600 | risc-news)
742 basic_machine=mips-sony
743 os=-newsos
744 ;;
745 necv70)
746 basic_machine=v70-nec
747 os=-sysv
748 ;;
749 next | m*-next )
750 basic_machine=m68k-next
751 case $os in
752 -nextstep* )
753 ;;
754 -ns2*)
755 os=-nextstep2
756 ;;
757 *)
758 os=-nextstep3
759 ;;
760 esac
761 ;;
762 nh3000)
763 basic_machine=m68k-harris
764 os=-cxux
765 ;;
766 nh[45]000)
767 basic_machine=m88k-harris
768 os=-cxux
769 ;;
770 nindy960)
771 basic_machine=i960-intel
772 os=-nindy
773 ;;
774 mon960)
775 basic_machine=i960-intel
776 os=-mon960
777 ;;
778 nonstopux)
779 basic_machine=mips-compaq
780 os=-nonstopux
781 ;;
782 np1)
783 basic_machine=np1-gould
784 ;;
785 nsr-tandem)
786 basic_machine=nsr-tandem
787 ;;
788 op50n-* | op60c-*)
789 basic_machine=hppa1.1-oki
790 os=-proelf
791 ;;
792 openrisc | openrisc-*)
793 basic_machine=or32-unknown
794 ;;
795 os400)
796 basic_machine=powerpc-ibm
797 os=-os400
798 ;;
799 OSE68000 | ose68000)
800 basic_machine=m68000-ericsson
801 os=-ose
802 ;;
803 os68k)
804 basic_machine=m68k-none
805 os=-os68k
806 ;;
807 pa-hitachi)
808 basic_machine=hppa1.1-hitachi
809 os=-hiuxwe2
810 ;;
811 paragon)
812 basic_machine=i860-intel
813 os=-osf
814 ;;
815 pbd)
816 basic_machine=sparc-tti
817 ;;
818 pbb)
819 basic_machine=m68k-tti
820 ;;
821 pc532 | pc532-*)
822 basic_machine=ns32k-pc532
823 ;;
824 pc98)
825 basic_machine=i386-pc
826 ;;
827 pc98-*)
828 basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
829 ;;
830 pentium | p5 | k5 | k6 | nexgen | viac3)
831 basic_machine=i586-pc
832 ;;
833 pentiumpro | p6 | 6x86 | athlon | athlon_*)
834 basic_machine=i686-pc
835 ;;
836 pentiumii | pentium2 | pentiumiii | pentium3)
837 basic_machine=i686-pc
838 ;;
839 pentium4)
840 basic_machine=i786-pc
841 ;;
842 pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
843 basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
844 ;;
845 pentiumpro-* | p6-* | 6x86-* | athlon-*)
846 basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
847 ;;
848 pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
849 basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
850 ;;
851 pentium4-*)
852 basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
853 ;;
854 pn)
855 basic_machine=pn-gould
856 ;;
857 power) basic_machine=power-ibm
858 ;;
859 ppc) basic_machine=powerpc-unknown
860 ;;
861 ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
862 ;;
863 ppcle | powerpclittle | ppc-le | powerpc-little)
864 basic_machine=powerpcle-unknown
865 ;;
866 ppcle-* | powerpclittle-*)
867 basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
868 ;;
869 ppc64) basic_machine=powerpc64-unknown
870 ;;
871 ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
872 ;;
873 ppc64le | powerpc64little | ppc64-le | powerpc64-little)
874 basic_machine=powerpc64le-unknown
875 ;;
876 ppc64le-* | powerpc64little-*)
877 basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
878 ;;
879 ps2)
880 basic_machine=i386-ibm
881 ;;
882 pw32)
883 basic_machine=i586-unknown
884 os=-pw32
885 ;;
886 rdos)
887 basic_machine=i386-pc
888 os=-rdos
889 ;;
890 rom68k)
891 basic_machine=m68k-rom68k
892 os=-coff
893 ;;
894 rm[46]00)
895 basic_machine=mips-siemens
896 ;;
897 rtpc | rtpc-*)
898 basic_machine=romp-ibm
899 ;;
900 s390 | s390-*)
901 basic_machine=s390-ibm
902 ;;
903 s390x | s390x-*)
904 basic_machine=s390x-ibm
905 ;;
906 sa29200)
907 basic_machine=a29k-amd
908 os=-udi
909 ;;
910 sb1)
911 basic_machine=mipsisa64sb1-unknown
912 ;;
913 sb1el)
914 basic_machine=mipsisa64sb1el-unknown
915 ;;
916 sde)
917 basic_machine=mipsisa32-sde
918 os=-elf
919 ;;
920 sei)
921 basic_machine=mips-sei
922 os=-seiux
923 ;;
924 sequent)
925 basic_machine=i386-sequent
926 ;;
927 sh)
928 basic_machine=sh-hitachi
929 os=-hms
930 ;;
931 sh5el)
932 basic_machine=sh5le-unknown
933 ;;
934 sh64)
935 basic_machine=sh64-unknown
936 ;;
937 sparclite-wrs | simso-wrs)
938 basic_machine=sparclite-wrs
939 os=-vxworks
940 ;;
941 sps7)
942 basic_machine=m68k-bull
943 os=-sysv2
944 ;;
945 spur)
946 basic_machine=spur-unknown
947 ;;
948 st2000)
949 basic_machine=m68k-tandem
950 ;;
951 stratus)
952 basic_machine=i860-stratus
953 os=-sysv4
954 ;;
955 sun2)
956 basic_machine=m68000-sun
957 ;;
958 sun2os3)
959 basic_machine=m68000-sun
960 os=-sunos3
961 ;;
962 sun2os4)
963 basic_machine=m68000-sun
964 os=-sunos4
965 ;;
966 sun3os3)
967 basic_machine=m68k-sun
968 os=-sunos3
969 ;;
970 sun3os4)
971 basic_machine=m68k-sun
972 os=-sunos4
973 ;;
974 sun4os3)
975 basic_machine=sparc-sun
976 os=-sunos3
977 ;;
978 sun4os4)
979 basic_machine=sparc-sun
980 os=-sunos4
981 ;;
982 sun4sol2)
983 basic_machine=sparc-sun
984 os=-solaris2
985 ;;
986 sun3 | sun3-*)
987 basic_machine=m68k-sun
988 ;;
989 sun4)
990 basic_machine=sparc-sun
991 ;;
992 sun386 | sun386i | roadrunner)
993 basic_machine=i386-sun
994 ;;
995 sv1)
996 basic_machine=sv1-cray
997 os=-unicos
998 ;;
999 symmetry)
1000 basic_machine=i386-sequent
1001 os=-dynix
1002 ;;
1003 t3e)
1004 basic_machine=alphaev5-cray
1005 os=-unicos
1006 ;;
1007 t90)
1008 basic_machine=t90-cray
1009 os=-unicos
1010 ;;
1011 tic54x | c54x*)
1012 basic_machine=tic54x-unknown
1013 os=-coff
1014 ;;
1015 tic55x | c55x*)
1016 basic_machine=tic55x-unknown
1017 os=-coff
1018 ;;
1019 tic6x | c6x*)
1020 basic_machine=tic6x-unknown
1021 os=-coff
1022 ;;
1023 tx39)
1024 basic_machine=mipstx39-unknown
1025 ;;
1026 tx39el)
1027 basic_machine=mipstx39el-unknown
1028 ;;
1029 toad1)
1030 basic_machine=pdp10-xkl
1031 os=-tops20
1032 ;;
1033 tower | tower-32)
1034 basic_machine=m68k-ncr
1035 ;;
1036 tpf)
1037 basic_machine=s390x-ibm
1038 os=-tpf
1039 ;;
1040 udi29k)
1041 basic_machine=a29k-amd
1042 os=-udi
1043 ;;
1044 ultra3)
1045 basic_machine=a29k-nyu
1046 os=-sym1
1047 ;;
1048 v810 | necv810)
1049 basic_machine=v810-nec
1050 os=-none
1051 ;;
1052 vaxv)
1053 basic_machine=vax-dec
1054 os=-sysv
1055 ;;
1056 vms)
1057 basic_machine=vax-dec
1058 os=-vms
1059 ;;
1060 vpp*|vx|vx-*)
1061 basic_machine=f301-fujitsu
1062 ;;
1063 vxworks960)
1064 basic_machine=i960-wrs
1065 os=-vxworks
1066 ;;
1067 vxworks68)
1068 basic_machine=m68k-wrs
1069 os=-vxworks
1070 ;;
1071 vxworks29k)
1072 basic_machine=a29k-wrs
1073 os=-vxworks
1074 ;;
1075 w65*)
1076 basic_machine=w65-wdc
1077 os=-none
1078 ;;
1079 w89k-*)
1080 basic_machine=hppa1.1-winbond
1081 os=-proelf
1082 ;;
1083 xbox)
1084 basic_machine=i686-pc
1085 os=-mingw32
1086 ;;
1087 xps | xps100)
1088 basic_machine=xps100-honeywell
1089 ;;
1090 ymp)
1091 basic_machine=ymp-cray
1092 os=-unicos
1093 ;;
1094 z8k-*-coff)
1095 basic_machine=z8k-unknown
1096 os=-sim
1097 ;;
1098 none)
1099 basic_machine=none-none
1100 os=-none
1101 ;;
1102
1103 # Here we handle the default manufacturer of certain CPU types. It is in
1104 # some cases the only manufacturer, in others, it is the most popular.
1105 w89k)
1106 basic_machine=hppa1.1-winbond
1107 ;;
1108 op50n)
1109 basic_machine=hppa1.1-oki
1110 ;;
1111 op60c)
1112 basic_machine=hppa1.1-oki
1113 ;;
1114 romp)
1115 basic_machine=romp-ibm
1116 ;;
1117 mmix)
1118 basic_machine=mmix-knuth
1119 ;;
1120 rs6000)
1121 basic_machine=rs6000-ibm
1122 ;;
1123 vax)
1124 basic_machine=vax-dec
1125 ;;
1126 pdp10)
1127 # there are many clones, so DEC is not a safe bet
1128 basic_machine=pdp10-unknown
1129 ;;
1130 pdp11)
1131 basic_machine=pdp11-dec
1132 ;;
1133 we32k)
1134 basic_machine=we32k-att
1135 ;;
1136 sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
1137 basic_machine=sh-unknown
1138 ;;
1139 sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
1140 basic_machine=sparc-sun
1141 ;;
1142 cydra)
1143 basic_machine=cydra-cydrome
1144 ;;
1145 orion)
1146 basic_machine=orion-highlevel
1147 ;;
1148 orion105)
1149 basic_machine=clipper-highlevel
1150 ;;
1151 mac | mpw | mac-mpw)
1152 basic_machine=m68k-apple
1153 ;;
1154 pmac | pmac-mpw)
1155 basic_machine=powerpc-apple
1156 ;;
1157 *-unknown)
1158 # Make sure to match an already-canonicalized machine name.
1159 ;;
1160 *)
1161 echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
1162 exit 1
1163 ;;
1164 esac
1165
1166 # Here we canonicalize certain aliases for manufacturers.
1167 case $basic_machine in
1168 *-digital*)
1169 basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
1170 ;;
1171 *-commodore*)
1172 basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
1173 ;;
1174 *)
1175 ;;
1176 esac
1177
1178 # Decode manufacturer-specific aliases for certain operating systems.
1179
1180 if [ x"$os" != x"" ]
1181 then
1182 case $os in
1183 # First match some system type aliases
1184 # that might get confused with valid system types.
1185 # -solaris* is a basic system type, with this one exception.
1186 -solaris1 | -solaris1.*)
1187 os=`echo $os | sed -e 's|solaris1|sunos4|'`
1188 ;;
1189 -solaris)
1190 os=-solaris2
1191 ;;
1192 -svr4*)
1193 os=-sysv4
1194 ;;
1195 -unixware*)
1196 os=-sysv4.2uw
1197 ;;
1198 -gnu/linux*)
1199 os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
1200 ;;
1201 # First accept the basic system types.
1202 # The portable systems comes first.
1203 # Each alternative MUST END IN A *, to match a version number.
1204 # -sysv* is not here because it comes later, after sysvr4.
1205 -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
1206 | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
1207 | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
1208 | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
1209 | -aos* \
1210 | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
1211 | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
1212 | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
1213 | -openbsd* | -solidbsd* \
1214 | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
1215 | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
1216 | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
1217 | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
1218 | -chorusos* | -chorusrdb* \
1219 | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
1220 | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
1221 | -uxpv* | -beos* | -mpeix* | -udk* \
1222 | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
1223 | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
1224 | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
1225 | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
1226 | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
1227 | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
1228 | -skyos* | -haiku* | -rdos* | -toppers* | -drops*)
1229 # Remember, each alternative MUST END IN *, to match a version number.
1230 ;;
1231 -qnx*)
1232 case $basic_machine in
1233 x86-* | i*86-*)
1234 ;;
1235 *)
1236 os=-nto$os
1237 ;;
1238 esac
1239 ;;
1240 -nto-qnx*)
1241 ;;
1242 -nto*)
1243 os=`echo $os | sed -e 's|nto|nto-qnx|'`
1244 ;;
1245 -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
1246 | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
1247 | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
1248 ;;
1249 -mac*)
1250 os=`echo $os | sed -e 's|mac|macos|'`
1251 ;;
1252 -linux-dietlibc)
1253 os=-linux-dietlibc
1254 ;;
1255 -linux*)
1256 os=`echo $os | sed -e 's|linux|linux-gnu|'`
1257 ;;
1258 -sunos5*)
1259 os=`echo $os | sed -e 's|sunos5|solaris2|'`
1260 ;;
1261 -sunos6*)
1262 os=`echo $os | sed -e 's|sunos6|solaris3|'`
1263 ;;
1264 -opened*)
1265 os=-openedition
1266 ;;
1267 -os400*)
1268 os=-os400
1269 ;;
1270 -wince*)
1271 os=-wince
1272 ;;
1273 -osfrose*)
1274 os=-osfrose
1275 ;;
1276 -osf*)
1277 os=-osf
1278 ;;
1279 -utek*)
1280 os=-bsd
1281 ;;
1282 -dynix*)
1283 os=-bsd
1284 ;;
1285 -acis*)
1286 os=-aos
1287 ;;
1288 -atheos*)
1289 os=-atheos
1290 ;;
1291 -syllable*)
1292 os=-syllable
1293 ;;
1294 -386bsd)
1295 os=-bsd
1296 ;;
1297 -ctix* | -uts*)
1298 os=-sysv
1299 ;;
1300 -nova*)
1301 os=-rtmk-nova
1302 ;;
1303 -ns2 )
1304 os=-nextstep2
1305 ;;
1306 -nsk*)
1307 os=-nsk
1308 ;;
1309 # Preserve the version number of sinix5.
1310 -sinix5.*)
1311 os=`echo $os | sed -e 's|sinix|sysv|'`
1312 ;;
1313 -sinix*)
1314 os=-sysv4
1315 ;;
1316 -tpf*)
1317 os=-tpf
1318 ;;
1319 -triton*)
1320 os=-sysv3
1321 ;;
1322 -oss*)
1323 os=-sysv3
1324 ;;
1325 -svr4)
1326 os=-sysv4
1327 ;;
1328 -svr3)
1329 os=-sysv3
1330 ;;
1331 -sysvr4)
1332 os=-sysv4
1333 ;;
1334 # This must come after -sysvr4.
1335 -sysv*)
1336 ;;
1337 -ose*)
1338 os=-ose
1339 ;;
1340 -es1800*)
1341 os=-ose
1342 ;;
1343 -xenix)
1344 os=-xenix
1345 ;;
1346 -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
1347 os=-mint
1348 ;;
1349 -aros*)
1350 os=-aros
1351 ;;
1352 -kaos*)
1353 os=-kaos
1354 ;;
1355 -zvmoe)
1356 os=-zvmoe
1357 ;;
1358 -none)
1359 ;;
1360 *)
1361 # Get rid of the `-' at the beginning of $os.
1362 os=`echo $os | sed 's/[^-]*-//'`
1363 echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
1364 exit 1
1365 ;;
1366 esac
1367 else
1368
1369 # Here we handle the default operating systems that come with various machines.
1370 # The value should be what the vendor currently ships out the door with their
1371 # machine or put another way, the most popular os provided with the machine.
1372
1373 # Note that if you're going to try to match "-MANUFACTURER" here (say,
1374 # "-sun"), then you have to tell the case statement up towards the top
1375 # that MANUFACTURER isn't an operating system. Otherwise, code above
1376 # will signal an error saying that MANUFACTURER isn't an operating
1377 # system, and we'll never get to this point.
1378
1379 case $basic_machine in
1380 score-*)
1381 os=-elf
1382 ;;
1383 spu-*)
1384 os=-elf
1385 ;;
1386 *-acorn)
1387 os=-riscix1.2
1388 ;;
1389 arm*-rebel)
1390 os=-linux
1391 ;;
1392 arm*-semi)
1393 os=-aout
1394 ;;
1395 c4x-* | tic4x-*)
1396 os=-coff
1397 ;;
1398 # This must come before the *-dec entry.
1399 pdp10-*)
1400 os=-tops20
1401 ;;
1402 pdp11-*)
1403 os=-none
1404 ;;
1405 *-dec | vax-*)
1406 os=-ultrix4.2
1407 ;;
1408 m68*-apollo)
1409 os=-domain
1410 ;;
1411 i386-sun)
1412 os=-sunos4.0.2
1413 ;;
1414 m68000-sun)
1415 os=-sunos3
1416 # This also exists in the configure program, but was not the
1417 # default.
1418 # os=-sunos4
1419 ;;
1420 m68*-cisco)
1421 os=-aout
1422 ;;
1423 mep-*)
1424 os=-elf
1425 ;;
1426 mips*-cisco)
1427 os=-elf
1428 ;;
1429 mips*-*)
1430 os=-elf
1431 ;;
1432 or32-*)
1433 os=-coff
1434 ;;
1435 *-tti) # must be before sparc entry or we get the wrong os.
1436 os=-sysv3
1437 ;;
1438 sparc-* | *-sun)
1439 os=-sunos4.1.1
1440 ;;
1441 *-be)
1442 os=-beos
1443 ;;
1444 *-haiku)
1445 os=-haiku
1446 ;;
1447 *-ibm)
1448 os=-aix
1449 ;;
1450 *-knuth)
1451 os=-mmixware
1452 ;;
1453 *-wec)
1454 os=-proelf
1455 ;;
1456 *-winbond)
1457 os=-proelf
1458 ;;
1459 *-oki)
1460 os=-proelf
1461 ;;
1462 *-hp)
1463 os=-hpux
1464 ;;
1465 *-hitachi)
1466 os=-hiux
1467 ;;
1468 i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
1469 os=-sysv
1470 ;;
1471 *-cbm)
1472 os=-amigaos
1473 ;;
1474 *-dg)
1475 os=-dgux
1476 ;;
1477 *-dolphin)
1478 os=-sysv3
1479 ;;
1480 m68k-ccur)
1481 os=-rtu
1482 ;;
1483 m88k-omron*)
1484 os=-luna
1485 ;;
1486 *-next )
1487 os=-nextstep
1488 ;;
1489 *-sequent)
1490 os=-ptx
1491 ;;
1492 *-crds)
1493 os=-unos
1494 ;;
1495 *-ns)
1496 os=-genix
1497 ;;
1498 i370-*)
1499 os=-mvs
1500 ;;
1501 *-next)
1502 os=-nextstep3
1503 ;;
1504 *-gould)
1505 os=-sysv
1506 ;;
1507 *-highlevel)
1508 os=-bsd
1509 ;;
1510 *-encore)
1511 os=-bsd
1512 ;;
1513 *-sgi)
1514 os=-irix
1515 ;;
1516 *-siemens)
1517 os=-sysv4
1518 ;;
1519 *-masscomp)
1520 os=-rtu
1521 ;;
1522 f30[01]-fujitsu | f700-fujitsu)
1523 os=-uxpv
1524 ;;
1525 *-rom68k)
1526 os=-coff
1527 ;;
1528 *-*bug)
1529 os=-coff
1530 ;;
1531 *-apple)
1532 os=-macos
1533 ;;
1534 *-atari*)
1535 os=-mint
1536 ;;
1537 *)
1538 os=-none
1539 ;;
1540 esac
1541 fi
1542
1543 # Here we handle the case where we know the os, and the CPU type, but not the
1544 # manufacturer. We pick the logical manufacturer.
1545 vendor=unknown
1546 case $basic_machine in
1547 *-unknown)
1548 case $os in
1549 -riscix*)
1550 vendor=acorn
1551 ;;
1552 -sunos*)
1553 vendor=sun
1554 ;;
1555 -aix*)
1556 vendor=ibm
1557 ;;
1558 -beos*)
1559 vendor=be
1560 ;;
1561 -hpux*)
1562 vendor=hp
1563 ;;
1564 -mpeix*)
1565 vendor=hp
1566 ;;
1567 -hiux*)
1568 vendor=hitachi
1569 ;;
1570 -unos*)
1571 vendor=crds
1572 ;;
1573 -dgux*)
1574 vendor=dg
1575 ;;
1576 -luna*)
1577 vendor=omron
1578 ;;
1579 -genix*)
1580 vendor=ns
1581 ;;
1582 -mvs* | -opened*)
1583 vendor=ibm
1584 ;;
1585 -os400*)
1586 vendor=ibm
1587 ;;
1588 -ptx*)
1589 vendor=sequent
1590 ;;
1591 -tpf*)
1592 vendor=ibm
1593 ;;
1594 -vxsim* | -vxworks* | -windiss*)
1595 vendor=wrs
1596 ;;
1597 -aux*)
1598 vendor=apple
1599 ;;
1600 -hms*)
1601 vendor=hitachi
1602 ;;
1603 -mpw* | -macos*)
1604 vendor=apple
1605 ;;
1606 -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
1607 vendor=atari
1608 ;;
1609 -vos*)
1610 vendor=stratus
1611 ;;
1612 esac
1613 basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
1614 ;;
1615 esac
1616
1617 echo $basic_machine$os
1618 exit
1619
1620 # Local variables:
1621 # eval: (add-hook 'write-file-hooks 'time-stamp)
1622 # time-stamp-start: "timestamp='"
1623 # time-stamp-format: "%:y-%02m-%02d"
1624 # time-stamp-end: "'"
1625 # End:
00 #! /bin/sh
11 # Guess values for system-dependent variables and create Makefiles.
2 # Generated by GNU Autoconf 2.61 for gsl 1.11.
2 # Generated by GNU Autoconf 2.61 for gsl 1.12.
33 #
44 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
55 # 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
720720 # Identity of this package.
721721 PACKAGE_NAME='gsl'
722722 PACKAGE_TARNAME='gsl'
723 PACKAGE_VERSION='1.11'
724 PACKAGE_STRING='gsl 1.11'
723 PACKAGE_VERSION='1.12'
724 PACKAGE_STRING='gsl 1.12'
725725 PACKAGE_BUGREPORT=''
726726
727727 ac_unique_file="gsl_math.h"
851851 DUMPBIN
852852 ac_ct_DUMPBIN
853853 NM
854 OBJDUMP
854855 AR
855856 RANLIB
856857 lt_ECHO
857858 DSYMUTIL
858859 NMEDIT
860 LIPO
861 OTOOL
862 OTOOL64
859863 GSL_CFLAGS
860864 GSL_LIBS
861865 MINGW32_HOST_TRUE
13911395 # Omit some internal or obsolete options to make the list less imposing.
13921396 # This message is too long to be a string in the A/UX 3.1 sh.
13931397 cat <<_ACEOF
1394 \`configure' configures gsl 1.11 to adapt to many kinds of systems.
1398 \`configure' configures gsl 1.12 to adapt to many kinds of systems.
13951399
13961400 Usage: $0 [OPTION]... [VAR=VALUE]...
13971401
14611465
14621466 if test -n "$ac_init_help"; then
14631467 case $ac_init_help in
1464 short | recursive ) echo "Configuration of gsl 1.11:";;
1468 short | recursive ) echo "Configuration of gsl 1.12:";;
14651469 esac
14661470 cat <<\_ACEOF
14671471
15561560 test -n "$ac_init_help" && exit $ac_status
15571561 if $ac_init_version; then
15581562 cat <<\_ACEOF
1559 gsl configure 1.11
1563 gsl configure 1.12
15601564 generated by GNU Autoconf 2.61
15611565
15621566 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
15701574 This file contains any messages produced by compilers while
15711575 running configure, to aid debugging if configure makes a mistake.
15721576
1573 It was created by gsl $as_me 1.11, which was
1577 It was created by gsl $as_me 1.12, which was
15741578 generated by GNU Autoconf 2.61. Invocation command line was
15751579
15761580 $ $0 $@
22622266
22632267 # Define the identity of the package.
22642268 PACKAGE='gsl'
2265 VERSION='1.11'
2269 VERSION='1.12'
22662270
22672271
22682272 cat >>confdefs.h <<_ACEOF
24342438
24352439
24362440
2437 GSL_CURRENT=12
2441 GSL_CURRENT=13
24382442 GSL_REVISION=0
2439 GSL_AGE=12
2443 GSL_AGE=13
24402444 CBLAS_CURRENT=0
24412445 CBLAS_REVISION=0
24422446 CBLAS_AGE=0
38283832
38293833
38303834
3831 macro_version='2.2'
3832 macro_revision='1.2599'
3835 macro_version='2.2.6'
3836 macro_revision='1.3012'
38333837
38343838
38353839
43204324
43214325
43224326
4323
43244327 { echo "$as_me:$LINENO: checking for BSD- or MS-compatible name lister (nm)" >&5
43254328 echo $ECHO_N "checking for BSD- or MS-compatible name lister (nm)... $ECHO_C" >&6; }
43264329 if test "${lt_cv_path_NM+set}" = set; then
44994502 else
45004503 lt_cv_nm_interface="BSD nm"
45014504 echo "int some_variable = 0;" > conftest.$ac_ext
4502 (eval echo "\"\$as_me:4503: $ac_compile\"" >&5)
4505 (eval echo "\"\$as_me:4506: $ac_compile\"" >&5)
45034506 (eval "$ac_compile" 2>conftest.err)
45044507 cat conftest.err >&5
4505 (eval echo "\"\$as_me:4506: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
4508 (eval echo "\"\$as_me:4509: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
45064509 (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
45074510 cat conftest.err >&5
4508 (eval echo "\"\$as_me:4509: output\"" >&5)
4511 (eval echo "\"\$as_me:4512: output\"" >&5)
45094512 cat conftest.out >&5
45104513 if $GREP 'External.*some_variable' conftest.out > /dev/null; then
45114514 lt_cv_nm_interface="MS dumpbin"
45404543 lt_cv_sys_max_cmd_len=-1;
45414544 ;;
45424545
4543 cygwin* | mingw*)
4546 cygwin* | mingw* | cegcc*)
45444547 # On Win9x/ME, this test blows up -- it succeeds, but takes
45454548 # about 5 minutes as the teststring grows exponentially.
45464549 # Worse, since 9x/ME are not pre-emptively multitasking,
46494652
46504653
46514654
4652
46534655 : ${CP="cp -f"}
46544656 : ${MV="mv -f"}
46554657 : ${RM="rm -f"}
46604662 xsi_shell=no
46614663 ( _lt_dummy="a/b/c"
46624664 test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \
4663 = c,a/b,, ) >/dev/null 2>&1 \
4665 = c,a/b,, \
4666 && eval 'test $(( 1 + 1 )) -eq 2 \
4667 && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
46644668 && xsi_shell=yes
46654669 { echo "$as_me:$LINENO: result: $xsi_shell" >&5
46664670 echo "${ECHO_T}$xsi_shell" >&6; }
47404744
47414745
47424746
4747 if test -n "$ac_tool_prefix"; then
4748 # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args.
4749 set dummy ${ac_tool_prefix}objdump; ac_word=$2
4750 { echo "$as_me:$LINENO: checking for $ac_word" >&5
4751 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
4752 if test "${ac_cv_prog_OBJDUMP+set}" = set; then
4753 echo $ECHO_N "(cached) $ECHO_C" >&6
4754 else
4755 if test -n "$OBJDUMP"; then
4756 ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test.
4757 else
4758 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
4759 for as_dir in $PATH
4760 do
4761 IFS=$as_save_IFS
4762 test -z "$as_dir" && as_dir=.
4763 for ac_exec_ext in '' $ac_executable_extensions; do
4764 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
4765 ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
4766 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
4767 break 2
4768 fi
4769 done
4770 done
4771 IFS=$as_save_IFS
4772
4773 fi
4774 fi
4775 OBJDUMP=$ac_cv_prog_OBJDUMP
4776 if test -n "$OBJDUMP"; then
4777 { echo "$as_me:$LINENO: result: $OBJDUMP" >&5
4778 echo "${ECHO_T}$OBJDUMP" >&6; }
4779 else
4780 { echo "$as_me:$LINENO: result: no" >&5
4781 echo "${ECHO_T}no" >&6; }
4782 fi
4783
4784
4785 fi
4786 if test -z "$ac_cv_prog_OBJDUMP"; then
4787 ac_ct_OBJDUMP=$OBJDUMP
4788 # Extract the first word of "objdump", so it can be a program name with args.
4789 set dummy objdump; ac_word=$2
4790 { echo "$as_me:$LINENO: checking for $ac_word" >&5
4791 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
4792 if test "${ac_cv_prog_ac_ct_OBJDUMP+set}" = set; then
4793 echo $ECHO_N "(cached) $ECHO_C" >&6
4794 else
4795 if test -n "$ac_ct_OBJDUMP"; then
4796 ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test.
4797 else
4798 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
4799 for as_dir in $PATH
4800 do
4801 IFS=$as_save_IFS
4802 test -z "$as_dir" && as_dir=.
4803 for ac_exec_ext in '' $ac_executable_extensions; do
4804 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
4805 ac_cv_prog_ac_ct_OBJDUMP="objdump"
4806 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
4807 break 2
4808 fi
4809 done
4810 done
4811 IFS=$as_save_IFS
4812
4813 fi
4814 fi
4815 ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP
4816 if test -n "$ac_ct_OBJDUMP"; then
4817 { echo "$as_me:$LINENO: result: $ac_ct_OBJDUMP" >&5
4818 echo "${ECHO_T}$ac_ct_OBJDUMP" >&6; }
4819 else
4820 { echo "$as_me:$LINENO: result: no" >&5
4821 echo "${ECHO_T}no" >&6; }
4822 fi
4823
4824 if test "x$ac_ct_OBJDUMP" = x; then
4825 OBJDUMP="false"
4826 else
4827 case $cross_compiling:$ac_tool_warned in
4828 yes:)
4829 { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
4830 whose name does not start with the host triplet. If you think this
4831 configuration is useful to you, please write to autoconf@gnu.org." >&5
4832 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
4833 whose name does not start with the host triplet. If you think this
4834 configuration is useful to you, please write to autoconf@gnu.org." >&2;}
4835 ac_tool_warned=yes ;;
4836 esac
4837 OBJDUMP=$ac_ct_OBJDUMP
4838 fi
4839 else
4840 OBJDUMP="$ac_cv_prog_OBJDUMP"
4841 fi
4842
4843 test -z "$OBJDUMP" && OBJDUMP=objdump
4844
4845
4846
4847
4848
4849
4850
4851
47434852
47444853 { echo "$as_me:$LINENO: checking how to recognize dependent libraries" >&5
47454854 echo $ECHO_N "checking how to recognize dependent libraries... $ECHO_C" >&6; }
47924901 lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
47934902 lt_cv_file_magic_cmd='$OBJDUMP -f'
47944903 fi
4904 ;;
4905
4906 cegcc)
4907 # use the weaker test based on 'objdump'. See mingw*.
4908 lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
4909 lt_cv_file_magic_cmd='$OBJDUMP -f'
47954910 ;;
47964911
47974912 darwin* | rhapsody*)
53445459 aix*)
53455460 symcode='[BCDT]'
53465461 ;;
5347 cygwin* | mingw* | pw32*)
5462 cygwin* | mingw* | pw32* | cegcc*)
53485463 symcode='[ABCDGISTW]'
53495464 ;;
53505465 hpux*)
56045719 ;;
56055720 *-*-irix6*)
56065721 # Find out which ABI we are using.
5607 echo '#line 5608 "configure"' > conftest.$ac_ext
5722 echo '#line 5723 "configure"' > conftest.$ac_ext
56085723 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
56095724 (eval $ac_compile) 2>&5
56105725 ac_status=$?
59866101 NMEDIT="$ac_cv_prog_NMEDIT"
59876102 fi
59886103
6104 if test -n "$ac_tool_prefix"; then
6105 # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args.
6106 set dummy ${ac_tool_prefix}lipo; ac_word=$2
6107 { echo "$as_me:$LINENO: checking for $ac_word" >&5
6108 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
6109 if test "${ac_cv_prog_LIPO+set}" = set; then
6110 echo $ECHO_N "(cached) $ECHO_C" >&6
6111 else
6112 if test -n "$LIPO"; then
6113 ac_cv_prog_LIPO="$LIPO" # Let the user override the test.
6114 else
6115 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
6116 for as_dir in $PATH
6117 do
6118 IFS=$as_save_IFS
6119 test -z "$as_dir" && as_dir=.
6120 for ac_exec_ext in '' $ac_executable_extensions; do
6121 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
6122 ac_cv_prog_LIPO="${ac_tool_prefix}lipo"
6123 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
6124 break 2
6125 fi
6126 done
6127 done
6128 IFS=$as_save_IFS
6129
6130 fi
6131 fi
6132 LIPO=$ac_cv_prog_LIPO
6133 if test -n "$LIPO"; then
6134 { echo "$as_me:$LINENO: result: $LIPO" >&5
6135 echo "${ECHO_T}$LIPO" >&6; }
6136 else
6137 { echo "$as_me:$LINENO: result: no" >&5
6138 echo "${ECHO_T}no" >&6; }
6139 fi
6140
6141
6142 fi
6143 if test -z "$ac_cv_prog_LIPO"; then
6144 ac_ct_LIPO=$LIPO
6145 # Extract the first word of "lipo", so it can be a program name with args.
6146 set dummy lipo; ac_word=$2
6147 { echo "$as_me:$LINENO: checking for $ac_word" >&5
6148 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
6149 if test "${ac_cv_prog_ac_ct_LIPO+set}" = set; then
6150 echo $ECHO_N "(cached) $ECHO_C" >&6
6151 else
6152 if test -n "$ac_ct_LIPO"; then
6153 ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test.
6154 else
6155 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
6156 for as_dir in $PATH
6157 do
6158 IFS=$as_save_IFS
6159 test -z "$as_dir" && as_dir=.
6160 for ac_exec_ext in '' $ac_executable_extensions; do
6161 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
6162 ac_cv_prog_ac_ct_LIPO="lipo"
6163 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
6164 break 2
6165 fi
6166 done
6167 done
6168 IFS=$as_save_IFS
6169
6170 fi
6171 fi
6172 ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO
6173 if test -n "$ac_ct_LIPO"; then
6174 { echo "$as_me:$LINENO: result: $ac_ct_LIPO" >&5
6175 echo "${ECHO_T}$ac_ct_LIPO" >&6; }
6176 else
6177 { echo "$as_me:$LINENO: result: no" >&5
6178 echo "${ECHO_T}no" >&6; }
6179 fi
6180
6181 if test "x$ac_ct_LIPO" = x; then
6182 LIPO=":"
6183 else
6184 case $cross_compiling:$ac_tool_warned in
6185 yes:)
6186 { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
6187 whose name does not start with the host triplet. If you think this
6188 configuration is useful to you, please write to autoconf@gnu.org." >&5
6189 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
6190 whose name does not start with the host triplet. If you think this
6191 configuration is useful to you, please write to autoconf@gnu.org." >&2;}
6192 ac_tool_warned=yes ;;
6193 esac
6194 LIPO=$ac_ct_LIPO
6195 fi
6196 else
6197 LIPO="$ac_cv_prog_LIPO"
6198 fi
6199
6200 if test -n "$ac_tool_prefix"; then
6201 # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args.
6202 set dummy ${ac_tool_prefix}otool; ac_word=$2
6203 { echo "$as_me:$LINENO: checking for $ac_word" >&5
6204 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
6205 if test "${ac_cv_prog_OTOOL+set}" = set; then
6206 echo $ECHO_N "(cached) $ECHO_C" >&6
6207 else
6208 if test -n "$OTOOL"; then
6209 ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test.
6210 else
6211 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
6212 for as_dir in $PATH
6213 do
6214 IFS=$as_save_IFS
6215 test -z "$as_dir" && as_dir=.
6216 for ac_exec_ext in '' $ac_executable_extensions; do
6217 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
6218 ac_cv_prog_OTOOL="${ac_tool_prefix}otool"
6219 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
6220 break 2
6221 fi
6222 done
6223 done
6224 IFS=$as_save_IFS
6225
6226 fi
6227 fi
6228 OTOOL=$ac_cv_prog_OTOOL
6229 if test -n "$OTOOL"; then
6230 { echo "$as_me:$LINENO: result: $OTOOL" >&5
6231 echo "${ECHO_T}$OTOOL" >&6; }
6232 else
6233 { echo "$as_me:$LINENO: result: no" >&5
6234 echo "${ECHO_T}no" >&6; }
6235 fi
6236
6237
6238 fi
6239 if test -z "$ac_cv_prog_OTOOL"; then
6240 ac_ct_OTOOL=$OTOOL
6241 # Extract the first word of "otool", so it can be a program name with args.
6242 set dummy otool; ac_word=$2
6243 { echo "$as_me:$LINENO: checking for $ac_word" >&5
6244 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
6245 if test "${ac_cv_prog_ac_ct_OTOOL+set}" = set; then
6246 echo $ECHO_N "(cached) $ECHO_C" >&6
6247 else
6248 if test -n "$ac_ct_OTOOL"; then
6249 ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test.
6250 else
6251 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
6252 for as_dir in $PATH
6253 do
6254 IFS=$as_save_IFS
6255 test -z "$as_dir" && as_dir=.
6256 for ac_exec_ext in '' $ac_executable_extensions; do
6257 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
6258 ac_cv_prog_ac_ct_OTOOL="otool"
6259 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
6260 break 2
6261 fi
6262 done
6263 done
6264 IFS=$as_save_IFS
6265
6266 fi
6267 fi
6268 ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL
6269 if test -n "$ac_ct_OTOOL"; then
6270 { echo "$as_me:$LINENO: result: $ac_ct_OTOOL" >&5
6271 echo "${ECHO_T}$ac_ct_OTOOL" >&6; }
6272 else
6273 { echo "$as_me:$LINENO: result: no" >&5
6274 echo "${ECHO_T}no" >&6; }
6275 fi
6276
6277 if test "x$ac_ct_OTOOL" = x; then
6278 OTOOL=":"
6279 else
6280 case $cross_compiling:$ac_tool_warned in
6281 yes:)
6282 { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
6283 whose name does not start with the host triplet. If you think this
6284 configuration is useful to you, please write to autoconf@gnu.org." >&5
6285 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
6286 whose name does not start with the host triplet. If you think this
6287 configuration is useful to you, please write to autoconf@gnu.org." >&2;}
6288 ac_tool_warned=yes ;;
6289 esac
6290 OTOOL=$ac_ct_OTOOL
6291 fi
6292 else
6293 OTOOL="$ac_cv_prog_OTOOL"
6294 fi
6295
6296 if test -n "$ac_tool_prefix"; then
6297 # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args.
6298 set dummy ${ac_tool_prefix}otool64; ac_word=$2
6299 { echo "$as_me:$LINENO: checking for $ac_word" >&5
6300 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
6301 if test "${ac_cv_prog_OTOOL64+set}" = set; then
6302 echo $ECHO_N "(cached) $ECHO_C" >&6
6303 else
6304 if test -n "$OTOOL64"; then
6305 ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test.
6306 else
6307 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
6308 for as_dir in $PATH
6309 do
6310 IFS=$as_save_IFS
6311 test -z "$as_dir" && as_dir=.
6312 for ac_exec_ext in '' $ac_executable_extensions; do
6313 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
6314 ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64"
6315 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
6316 break 2
6317 fi
6318 done
6319 done
6320 IFS=$as_save_IFS
6321
6322 fi
6323 fi
6324 OTOOL64=$ac_cv_prog_OTOOL64
6325 if test -n "$OTOOL64"; then
6326 { echo "$as_me:$LINENO: result: $OTOOL64" >&5
6327 echo "${ECHO_T}$OTOOL64" >&6; }
6328 else
6329 { echo "$as_me:$LINENO: result: no" >&5
6330 echo "${ECHO_T}no" >&6; }
6331 fi
6332
6333
6334 fi
6335 if test -z "$ac_cv_prog_OTOOL64"; then
6336 ac_ct_OTOOL64=$OTOOL64
6337 # Extract the first word of "otool64", so it can be a program name with args.
6338 set dummy otool64; ac_word=$2
6339 { echo "$as_me:$LINENO: checking for $ac_word" >&5
6340 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
6341 if test "${ac_cv_prog_ac_ct_OTOOL64+set}" = set; then
6342 echo $ECHO_N "(cached) $ECHO_C" >&6
6343 else
6344 if test -n "$ac_ct_OTOOL64"; then
6345 ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test.
6346 else
6347 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
6348 for as_dir in $PATH
6349 do
6350 IFS=$as_save_IFS
6351 test -z "$as_dir" && as_dir=.
6352 for ac_exec_ext in '' $ac_executable_extensions; do
6353 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
6354 ac_cv_prog_ac_ct_OTOOL64="otool64"
6355 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
6356 break 2
6357 fi
6358 done
6359 done
6360 IFS=$as_save_IFS
6361
6362 fi
6363 fi
6364 ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64
6365 if test -n "$ac_ct_OTOOL64"; then
6366 { echo "$as_me:$LINENO: result: $ac_ct_OTOOL64" >&5
6367 echo "${ECHO_T}$ac_ct_OTOOL64" >&6; }
6368 else
6369 { echo "$as_me:$LINENO: result: no" >&5
6370 echo "${ECHO_T}no" >&6; }
6371 fi
6372
6373 if test "x$ac_ct_OTOOL64" = x; then
6374 OTOOL64=":"
6375 else
6376 case $cross_compiling:$ac_tool_warned in
6377 yes:)
6378 { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
6379 whose name does not start with the host triplet. If you think this
6380 configuration is useful to you, please write to autoconf@gnu.org." >&5
6381 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
6382 whose name does not start with the host triplet. If you think this
6383 configuration is useful to you, please write to autoconf@gnu.org." >&2;}
6384 ac_tool_warned=yes ;;
6385 esac
6386 OTOOL64=$ac_ct_OTOOL64
6387 fi
6388 else
6389 OTOOL64="$ac_cv_prog_OTOOL64"
6390 fi
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
59896407
59906408
59916409
60086426 # by either setting the environment variable LT_MULTI_MODULE
60096427 # non-empty at configure time, or by adding -multi_module to the
60106428 # link flags.
6429 rm -rf libconftest.dylib*
60116430 echo "int foo(void){return 1;}" > conftest.c
6431 echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
6432 -dynamiclib -Wl,-single_module conftest.c" >&5
60126433 $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
6013 -dynamiclib ${wl}-single_module conftest.c
6014 if test -f libconftest.dylib; then
6434 -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
6435 _lt_result=$?
6436 if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then
60156437 lt_cv_apple_cc_single_mod=yes
6016 rm -rf libconftest.dylib*
6438 else
6439 cat conftest.err >&5
60176440 fi
6018 rm conftest.c
6441 rm -rf libconftest.dylib*
6442 rm -f conftest.*
60196443 fi
60206444 fi
60216445 { echo "$as_me:$LINENO: result: $lt_cv_apple_cc_single_mod" >&5
69127336 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
69137337 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
69147338 -e 's:$: $lt_compiler_flag:'`
6915 (eval echo "\"\$as_me:6916: $lt_compile\"" >&5)
7339 (eval echo "\"\$as_me:7340: $lt_compile\"" >&5)
69167340 (eval "$lt_compile" 2>conftest.err)
69177341 ac_status=$?
69187342 cat conftest.err >&5
6919 echo "$as_me:6920: \$? = $ac_status" >&5
7343 echo "$as_me:7344: \$? = $ac_status" >&5
69207344 if (exit $ac_status) && test -s "$ac_outfile"; then
69217345 # The compiler can only warn and ignore the option if not recognized
69227346 # So say no if there are warnings other than the usual output.
69667390 ;;
69677391
69687392 amigaos*)
6969 if test "$host_cpu" = m68k; then
6970 # FIXME: we need at least 68020 code to build shared libraries, but
6971 # adding the `-m68020' flag to GCC prevents building anything better,
6972 # like `-m68040'.
6973 lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4'
6974 fi
7393 case $host_cpu in
7394 powerpc)
7395 # see comment about AmigaOS4 .so support
7396 lt_prog_compiler_pic='-fPIC'
7397 ;;
7398 m68k)
7399 # FIXME: we need at least 68020 code to build shared libraries, but
7400 # adding the `-m68020' flag to GCC prevents building anything better,
7401 # like `-m68040'.
7402 lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4'
7403 ;;
7404 esac
69757405 ;;
69767406
69777407 beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
69787408 # PIC is the default for these OSes.
69797409 ;;
69807410
6981 mingw* | cygwin* | pw32* | os2*)
7411 mingw* | cygwin* | pw32* | os2* | cegcc*)
69827412 # This hack is so that the source file can tell whether it is being
69837413 # built for inclusion in a dll (and should export symbols for example).
69847414 # Although the cygwin gcc ignores -fPIC, still need this for old-style
69937423 ;;
69947424
69957425 hpux*)
6996 # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
6997 # not for PA HP-UX.
7426 # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
7427 # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag
7428 # sets the default TLS model and affects inlining.
69987429 case $host_cpu in
6999 hppa*64*|ia64*)
7430 hppa*64*)
70007431 # +Z the default
70017432 ;;
70027433 *)
70467477 fi
70477478 ;;
70487479
7049 mingw* | cygwin* | pw32* | os2*)
7480 mingw* | cygwin* | pw32* | os2* | cegcc*)
70507481 # This hack is so that the source file can tell whether it is being
70517482 # built for inclusion in a dll (and should export symbols for example).
70527483 lt_prog_compiler_pic='-DDLL_EXPORT'
70767507
70777508 linux* | k*bsd*-gnu)
70787509 case $cc_basename in
7079 icc* | ecc* | ifort*)
7510 # old Intel for x86_64 which still supported -KPIC.
7511 ecc*)
70807512 lt_prog_compiler_wl='-Wl,'
70817513 lt_prog_compiler_pic='-KPIC'
70827514 lt_prog_compiler_static='-static'
70837515 ;;
7516 # icc used to be incompatible with GCC.
7517 # ICC 10 doesn't accept -KPIC any more.
7518 icc* | ifort*)
7519 lt_prog_compiler_wl='-Wl,'
7520 lt_prog_compiler_pic='-fPIC'
7521 lt_prog_compiler_static='-static'
7522 ;;
7523 # Lahey Fortran 8.1.
7524 lf95*)
7525 lt_prog_compiler_wl='-Wl,'
7526 lt_prog_compiler_pic='--shared'
7527 lt_prog_compiler_static='--static'
7528 ;;
70847529 pgcc* | pgf77* | pgf90* | pgf95*)
70857530 # Portland Group compilers (*not* the Pentium gcc compiler,
70867531 # which looks to be a dead project)
72307675 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
72317676 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
72327677 -e 's:$: $lt_compiler_flag:'`
7233 (eval echo "\"\$as_me:7234: $lt_compile\"" >&5)
7678 (eval echo "\"\$as_me:7679: $lt_compile\"" >&5)
72347679 (eval "$lt_compile" 2>conftest.err)
72357680 ac_status=$?
72367681 cat conftest.err >&5
7237 echo "$as_me:7238: \$? = $ac_status" >&5
7682 echo "$as_me:7683: \$? = $ac_status" >&5
72387683 if (exit $ac_status) && test -s "$ac_outfile"; then
72397684 # The compiler can only warn and ignore the option if not recognized
72407685 # So say no if there are warnings other than the usual output.
73357780 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
73367781 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
73377782 -e 's:$: $lt_compiler_flag:'`
7338 (eval echo "\"\$as_me:7339: $lt_compile\"" >&5)
7783 (eval echo "\"\$as_me:7784: $lt_compile\"" >&5)
73397784 (eval "$lt_compile" 2>out/conftest.err)
73407785 ac_status=$?
73417786 cat out/conftest.err >&5
7342 echo "$as_me:7343: \$? = $ac_status" >&5
7787 echo "$as_me:7788: \$? = $ac_status" >&5
73437788 if (exit $ac_status) && test -s out/conftest2.$ac_objext
73447789 then
73457790 # The compiler can only warn and ignore the option if not recognized
73907835 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
73917836 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
73927837 -e 's:$: $lt_compiler_flag:'`
7393 (eval echo "\"\$as_me:7394: $lt_compile\"" >&5)
7838 (eval echo "\"\$as_me:7839: $lt_compile\"" >&5)
73947839 (eval "$lt_compile" 2>out/conftest.err)
73957840 ac_status=$?
73967841 cat out/conftest.err >&5
7397 echo "$as_me:7398: \$? = $ac_status" >&5
7842 echo "$as_me:7843: \$? = $ac_status" >&5
73987843 if (exit $ac_status) && test -s out/conftest2.$ac_objext
73997844 then
74007845 # The compiler can only warn and ignore the option if not recognized
74947939 extract_expsyms_cmds=
74957940
74967941 case $host_os in
7497 cygwin* | mingw* | pw32*)
7942 cygwin* | mingw* | pw32* | cegcc*)
74987943 # FIXME: the MSVC++ port hasn't been tested in a loooong time
74997944 # When not using gcc, we currently assume that we are using
75007945 # Microsoft Visual C++.
75568001 ;;
75578002
75588003 amigaos*)
7559 if test "$host_cpu" = m68k; then
7560 archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
7561 hardcode_libdir_flag_spec='-L$libdir'
7562 hardcode_minus_L=yes
7563 fi
7564
7565 # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
7566 # that the semantics of dynamic libraries on AmigaOS, at least up
7567 # to version 4, is to share data among multiple programs linked
7568 # with the same dynamic library. Since this doesn't match the
7569 # behavior of shared libraries on other platforms, we can't use
7570 # them.
7571 ld_shlibs=no
8004 case $host_cpu in
8005 powerpc)
8006 # see comment about AmigaOS4 .so support
8007 archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
8008 archive_expsym_cmds=''
8009 ;;
8010 m68k)
8011 archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
8012 hardcode_libdir_flag_spec='-L$libdir'
8013 hardcode_minus_L=yes
8014 ;;
8015 esac
75728016 ;;
75738017
75748018 beos*)
75828026 fi
75838027 ;;
75848028
7585 cygwin* | mingw* | pw32*)
8029 cygwin* | mingw* | pw32* | cegcc*)
75868030 # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless,
75878031 # as there is no search path for DLLs.
75888032 hardcode_libdir_flag_spec='-L$libdir'
76488092 tmp_addflag=' -i_dynamic -nofor_main' ;;
76498093 ifc* | ifort*) # Intel Fortran compiler
76508094 tmp_addflag=' -nofor_main' ;;
8095 lf95*) # Lahey Fortran 8.1
8096 whole_archive_flag_spec=
8097 tmp_sharedflag='--shared' ;;
76518098 xl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below)
76528099 tmp_sharedflag='-qmkshrobj'
76538100 tmp_addflag= ;;
78798326 fi
78808327 fi
78818328
8329 export_dynamic_flag_spec='${wl}-bexpall'
78828330 # It seems that -bexpall does not export symbols beginning with
78838331 # underscore (_), so it is better to generate a list of symbols to export.
78848332 always_export_symbols=yes
80278475 ;;
80288476
80298477 amigaos*)
8030 if test "$host_cpu" = m68k; then
8031 archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
8032 hardcode_libdir_flag_spec='-L$libdir'
8033 hardcode_minus_L=yes
8034 fi
8035 # see comment about different semantics on the GNU ld section
8036 ld_shlibs=no
8478 case $host_cpu in
8479 powerpc)
8480 # see comment about AmigaOS4 .so support
8481 archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
8482 archive_expsym_cmds=''
8483 ;;
8484 m68k)
8485 archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
8486 hardcode_libdir_flag_spec='-L$libdir'
8487 hardcode_minus_L=yes
8488 ;;
8489 esac
80378490 ;;
80388491
80398492 bsdi[45]*)
80408493 export_dynamic_flag_spec=-rdynamic
80418494 ;;
80428495
8043 cygwin* | mingw* | pw32*)
8496 cygwin* | mingw* | pw32* | cegcc*)
80448497 # When not using gcc, we currently assume that we are using
80458498 # Microsoft Visual C++.
80468499 # hardcode_libdir_flag_spec is actually meaningless, as there is
80718524 whole_archive_flag_spec=''
80728525 link_all_deplibs=yes
80738526 allow_undefined_flag="$_lt_dar_allow_undefined"
8074 if test "$GCC" = "yes"; then
8527 case $cc_basename in
8528 ifort*) _lt_dar_can_shared=yes ;;
8529 *) _lt_dar_can_shared=$GCC ;;
8530 esac
8531 if test "$_lt_dar_can_shared" = "yes"; then
80758532 output_verbose_link_cmd=echo
80768533 archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
80778534 module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
81638620 archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
81648621 ;;
81658622 ia64*)
8166 archive_cmds='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
8623 archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
81678624 ;;
81688625 *)
81698626 archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
88679324 ;;
88689325
88699326 amigaos*)
8870 if test "$host_cpu" = m68k; then
9327 case $host_cpu in
9328 powerpc)
9329 # Since July 2007 AmigaOS4 officially supports .so libraries.
9330 # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
9331 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
9332 ;;
9333 m68k)
88719334 library_names_spec='$libname.ixlibrary $libname.a'
88729335 # Create ${libname}_ixlibrary.a entries in /sys/libs.
88739336 finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
8874 else
8875 dynamic_linker=no
8876 fi
9337 ;;
9338 esac
88779339 ;;
88789340
88799341 beos*)
88969358 # libtool to hard-code these into programs
88979359 ;;
88989360
8899 cygwin* | mingw* | pw32*)
9361 cygwin* | mingw* | pw32* | cegcc*)
89009362 version_type=windows
89019363 shrext_cmds=".dll"
89029364 need_version=no
89039365 need_lib_prefix=no
89049366
89059367 case $GCC,$host_os in
8906 yes,cygwin* | yes,mingw* | yes,pw32*)
9368 yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
89079369 library_names_spec='$libname.dll.a'
89089370 # DLL is installed to $(libdir)/../bin by postinstall_cmds
89099371 postinstall_cmds='base_file=`basename \${file}`~
89269388 soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
89279389 sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
89289390 ;;
8929 mingw*)
9391 mingw* | cegcc*)
89309392 # MinGW DLLs use traditional 'lib' prefix
89319393 soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
89329394 sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
93959857 version_type=linux
93969858 need_lib_prefix=no
93979859 need_version=no
9398 library_name_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
9860 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
93999861 shlibpath_var=LD_LIBRARY_PATH
94009862 shlibpath_overrides_runpath=no
94019863 hardcode_into_libs=yes
957210034 lt_cv_dlopen_self=yes
957310035 ;;
957410036
9575 mingw* | pw32*)
10037 mingw* | pw32* | cegcc*)
957610038 lt_cv_dlopen="LoadLibrary"
957710039 lt_cv_dlopen_libs=
957810040 ;;
1012910591 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
1013010592 lt_status=$lt_dlunknown
1013110593 cat > conftest.$ac_ext <<_LT_EOF
10132 #line 10133 "configure"
10594 #line 10595 "configure"
1013310595 #include "confdefs.h"
1013410596
1013510597 #if HAVE_DLFCN_H
1017010632 # endif
1017110633 #endif
1017210634
10173 #ifdef __cplusplus
10174 extern "C" void exit (int);
10175 #endif
10176
1017710635 void fnord() { int i=42;}
1017810636 int main ()
1017910637 {
1018910647 else
1019010648 puts (dlerror ());
1019110649
10192 exit (status);
10650 return status;
1019310651 }
1019410652 _LT_EOF
1019510653 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
1022910687 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
1023010688 lt_status=$lt_dlunknown
1023110689 cat > conftest.$ac_ext <<_LT_EOF
10232 #line 10233 "configure"
10690 #line 10691 "configure"
1023310691 #include "confdefs.h"
1023410692
1023510693 #if HAVE_DLFCN_H
1027010728 # endif
1027110729 #endif
1027210730
10273 #ifdef __cplusplus
10274 extern "C" void exit (int);
10275 #endif
10276
1027710731 void fnord() { int i=42;}
1027810732 int main ()
1027910733 {
1028910743 else
1029010744 puts (dlerror ());
1029110745
10292 exit (status);
10746 return status;
1029310747 }
1029410748 _LT_EOF
1029510749 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
1071911173
1072011174
1072111175
10722 { echo "$as_me:$LINENO: checking for extern inline" >&5
10723 echo $ECHO_N "checking for extern inline... $ECHO_C" >&6; }
11176 { echo "$as_me:$LINENO: checking for GNU-style extern inline" >&5
11177 echo $ECHO_N "checking for GNU-style extern inline... $ECHO_C" >&6; }
1072411178 if test "${ac_cv_c_extern_inline+set}" = set; then
1072511179 echo $ECHO_N "(cached) $ECHO_C" >&6
1072611180 else
1077911233 #define HAVE_INLINE
1078011234 _ACEOF
1078111235
11236 else
11237 { echo "$as_me:$LINENO: checking for C99-style inline" >&5
11238 echo $ECHO_N "checking for C99-style inline... $ECHO_C" >&6; }
11239 if test "${ac_cv_c_c99inline+set}" = set; then
11240 echo $ECHO_N "(cached) $ECHO_C" >&6
11241 else
11242 ac_cv_c_c99inline=no
11243 cat >conftest.$ac_ext <<_ACEOF
11244 /* confdefs.h. */
11245 _ACEOF
11246 cat confdefs.h >>conftest.$ac_ext
11247 cat >>conftest.$ac_ext <<_ACEOF
11248 /* end confdefs.h. */
11249 #ifdef __GNUC_STDC_INLINE__
11250 inline double foo(double x);
11251 inline double foo(double x) { return x + 1.0 ; };
11252 #endif
11253 int
11254 main ()
11255 {
11256 foo(1.0)
11257 ;
11258 return 0;
11259 }
11260 _ACEOF
11261 rm -f conftest.$ac_objext
11262 if { (ac_try="$ac_compile"
11263 case "(($ac_try" in
11264 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
11265 *) ac_try_echo=$ac_try;;
11266 esac
11267 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
11268 (eval "$ac_compile") 2>conftest.er1
11269 ac_status=$?
11270 grep -v '^ *+' conftest.er1 >conftest.err
11271 rm -f conftest.er1
11272 cat conftest.err >&5
11273 echo "$as_me:$LINENO: \$? = $ac_status" >&5
11274 (exit $ac_status); } && {
11275 test -z "$ac_c_werror_flag" ||
11276 test ! -s conftest.err
11277 } && test -s conftest.$ac_objext; then
11278 ac_cv_c_c99inline="yes"
11279 else
11280 echo "$as_me: failed program was:" >&5
11281 sed 's/^/| /' conftest.$ac_ext >&5
11282
11283
11284 fi
11285
11286 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
11287
11288 fi
11289 { echo "$as_me:$LINENO: result: $ac_cv_c_c99inline" >&5
11290 echo "${ECHO_T}$ac_cv_c_c99inline" >&6; }
11291
11292 if test "$ac_cv_c_c99inline" != no ; then
11293
11294 cat >>confdefs.h <<\_ACEOF
11295 #define HAVE_INLINE
11296 _ACEOF
11297
11298 fi
1078211299 fi
1078311300
1078411301
1257313090 else
1257413091 ac_cv_c_fpu_sse=no
1257513092 if test "$cross_compiling" = yes; then
12576 { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
12577 See \`config.log' for more details." >&5
12578 echo "$as_me: error: cannot run test program while cross compiling
12579 See \`config.log' for more details." >&2;}
12580 { (exit 1); exit 1; }; }
13093
13094 cat >conftest.$ac_ext <<_ACEOF
13095 /* confdefs.h. */
13096 _ACEOF
13097 cat confdefs.h >>conftest.$ac_ext
13098 cat >>conftest.$ac_ext <<_ACEOF
13099 /* end confdefs.h. */
13100
13101 #include <stdlib.h>
13102 #define _FPU_SETMXCSR(cw_sse) asm volatile ("ldmxcsr %0" : : "m" (*&cw_sse))
13103
13104 int
13105 main ()
13106 {
13107 unsigned int mode = 0x1f80 ; _FPU_SETMXCSR(mode); exit(0);
13108 ;
13109 return 0;
13110 }
13111 _ACEOF
13112 rm -f conftest.$ac_objext
13113 if { (ac_try="$ac_compile"
13114 case "(($ac_try" in
13115 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
13116 *) ac_try_echo=$ac_try;;
13117 esac
13118 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
13119 (eval "$ac_compile") 2>conftest.er1
13120 ac_status=$?
13121 grep -v '^ *+' conftest.er1 >conftest.err
13122 rm -f conftest.er1
13123 cat conftest.err >&5
13124 echo "$as_me:$LINENO: \$? = $ac_status" >&5
13125 (exit $ac_status); } && {
13126 test -z "$ac_c_werror_flag" ||
13127 test ! -s conftest.err
13128 } && test -s conftest.$ac_objext; then
13129 ac_cv_c_fpu_sse="yes"
13130 else
13131 echo "$as_me: failed program was:" >&5
13132 sed 's/^/| /' conftest.$ac_ext >&5
13133
13134 ac_cv_c_fpu_sse="no"
13135 fi
13136
13137 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
13138
1258113139 else
1258213140 cat >conftest.$ac_ext <<_ACEOF
1258313141 /* confdefs.h. */
1262313181 echo "$as_me: failed program was:" >&5
1262413182 sed 's/^/| /' conftest.$ac_ext >&5
1262513183
13184 ( exit $ac_status )
13185 ac_cv_c_fpu_sse="no"
1262613186 fi
1262713187 rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
1262813188 fi
12629
1263013189
1263113190
1263213191 fi
1263313192 { echo "$as_me:$LINENO: result: $ac_cv_c_fpu_sse" >&5
1263413193 echo "${ECHO_T}$ac_cv_c_fpu_sse" >&6; }
13194
1263513195 if test $ac_cv_c_fpu_sse = yes; then
1263613196
1263713197 cat >>confdefs.h <<\_ACEOF
1331913879 # report actual input values of CONFIG_FILES etc. instead of their
1332013880 # values after options handling.
1332113881 ac_log="
13322 This file was extended by gsl $as_me 1.11, which was
13882 This file was extended by gsl $as_me 1.12, which was
1332313883 generated by GNU Autoconf 2.61. Invocation command line was
1332413884
1332513885 CONFIG_FILES = $CONFIG_FILES
1337213932 _ACEOF
1337313933 cat >>$CONFIG_STATUS <<_ACEOF
1337413934 ac_cs_version="\\
13375 gsl config.status 1.11
13935 gsl config.status 1.12
1337613936 configured by $0, generated by GNU Autoconf 2.61,
1337713937 with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
1337813938
1351314073 lt_NL2SP='`$ECHO "X$lt_NL2SP" | $Xsed -e "$delay_single_quote_subst"`'
1351414074 reload_flag='`$ECHO "X$reload_flag" | $Xsed -e "$delay_single_quote_subst"`'
1351514075 reload_cmds='`$ECHO "X$reload_cmds" | $Xsed -e "$delay_single_quote_subst"`'
14076 OBJDUMP='`$ECHO "X$OBJDUMP" | $Xsed -e "$delay_single_quote_subst"`'
1351614077 deplibs_check_method='`$ECHO "X$deplibs_check_method" | $Xsed -e "$delay_single_quote_subst"`'
1351714078 file_magic_cmd='`$ECHO "X$file_magic_cmd" | $Xsed -e "$delay_single_quote_subst"`'
1351814079 AR='`$ECHO "X$AR" | $Xsed -e "$delay_single_quote_subst"`'
1354214103 need_locks='`$ECHO "X$need_locks" | $Xsed -e "$delay_single_quote_subst"`'
1354314104 DSYMUTIL='`$ECHO "X$DSYMUTIL" | $Xsed -e "$delay_single_quote_subst"`'
1354414105 NMEDIT='`$ECHO "X$NMEDIT" | $Xsed -e "$delay_single_quote_subst"`'
14106 LIPO='`$ECHO "X$LIPO" | $Xsed -e "$delay_single_quote_subst"`'
14107 OTOOL='`$ECHO "X$OTOOL" | $Xsed -e "$delay_single_quote_subst"`'
14108 OTOOL64='`$ECHO "X$OTOOL64" | $Xsed -e "$delay_single_quote_subst"`'
1354514109 libext='`$ECHO "X$libext" | $Xsed -e "$delay_single_quote_subst"`'
1354614110 shrext_cmds='`$ECHO "X$shrext_cmds" | $Xsed -e "$delay_single_quote_subst"`'
1354714111 extract_expsyms_cmds='`$ECHO "X$extract_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`'
1361514179 lt_SP2NL \
1361614180 lt_NL2SP \
1361714181 reload_flag \
14182 OBJDUMP \
1361814183 deplibs_check_method \
1361914184 file_magic_cmd \
1362014185 AR \
1363814203 need_locks \
1363914204 DSYMUTIL \
1364014205 NMEDIT \
14206 LIPO \
14207 OTOOL \
14208 OTOOL64 \
1364114209 shrext_cmds \
1364214210 export_dynamic_flag_spec \
1364314211 whole_archive_flag_spec \
1393814506 DUMPBIN!$DUMPBIN$ac_delim
1393914507 ac_ct_DUMPBIN!$ac_ct_DUMPBIN$ac_delim
1394014508 NM!$NM$ac_delim
14509 OBJDUMP!$OBJDUMP$ac_delim
1394114510 AR!$AR$ac_delim
1394214511 RANLIB!$RANLIB$ac_delim
1394314512 lt_ECHO!$lt_ECHO$ac_delim
1394414513 DSYMUTIL!$DSYMUTIL$ac_delim
1394514514 NMEDIT!$NMEDIT$ac_delim
13946 GSL_CFLAGS!$GSL_CFLAGS$ac_delim
13947 GSL_LIBS!$GSL_LIBS$ac_delim
14515 LIPO!$LIPO$ac_delim
1394814516 _ACEOF
1394914517
1395014518 if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
1398614554 ac_delim='%!_!# '
1398714555 for ac_last_try in false false false false false :; do
1398814556 cat >conf$$subs.sed <<_ACEOF
14557 OTOOL!$OTOOL$ac_delim
14558 OTOOL64!$OTOOL64$ac_delim
14559 GSL_CFLAGS!$GSL_CFLAGS$ac_delim
14560 GSL_LIBS!$GSL_LIBS$ac_delim
1398914561 MINGW32_HOST_TRUE!$MINGW32_HOST_TRUE$ac_delim
1399014562 MINGW32_HOST_FALSE!$MINGW32_HOST_FALSE$ac_delim
1399114563 LIBOBJS!$LIBOBJS$ac_delim
1400914581 LTLIBOBJS!$LTLIBOBJS$ac_delim
1401014582 _ACEOF
1401114583
14012 if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 21; then
14584 if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 25; then
1401314585 break
1401414586 elif $ac_last_try; then
1401514587 { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
1446815040 #! $SHELL
1446915041
1447015042 # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
14471 # Generated automatically by $as_me (GNU $PACKAGE$TIMESTAMP) $VERSION
15043 # Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION
1447215044 # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
1447315045 # NOTE: Changes made to this file will be lost: look at ltmain.sh.
1447415046 #
1457415146 reload_flag=$lt_reload_flag
1457515147 reload_cmds=$lt_reload_cmds
1457615148
15149 # An object symbol dumper.
15150 OBJDUMP=$lt_OBJDUMP
15151
1457715152 # Method to check whether dependent libraries are shared objects.
1457815153 deplibs_check_method=$lt_deplibs_check_method
1457915154
1463015205
1463115206 # Tool to change global to local symbols on Mac OS X.
1463215207 NMEDIT=$lt_NMEDIT
15208
15209 # Tool to manipulate fat objects and archives on Mac OS X.
15210 LIPO=$lt_LIPO
15211
15212 # ldd/readelf like tool for Mach-O binaries on Mac OS X.
15213 OTOOL=$lt_OTOOL
15214
15215 # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
15216 OTOOL64=$lt_OTOOL64
1463315217
1463415218 # Old archive suffix (normally "a").
1463515219 libext=$libext
1487115455 case $xsi_shell in
1487215456 yes)
1487315457 cat << \_LT_EOF >> "$cfgfile"
15458
1487415459 # func_dirname file append nondir_replacement
1487515460 # Compute the dirname of FILE. If nonempty, add APPEND to the result,
1487615461 # otherwise set result to NONDIR_REPLACEMENT.
1493815523 *) func_lo2o_result=${1} ;;
1493915524 esac
1494015525 }
15526
15527 # func_xform libobj-or-source
15528 func_xform ()
15529 {
15530 func_xform_result=${1%.*}.lo
15531 }
15532
15533 # func_arith arithmetic-term...
15534 func_arith ()
15535 {
15536 func_arith_result=$(( $* ))
15537 }
15538
15539 # func_len string
15540 # STRING may not start with a hyphen.
15541 func_len ()
15542 {
15543 func_len_result=${#1}
15544 }
15545
1494115546 _LT_EOF
1494215547 ;;
1494315548 *) # Bourne compatible functions.
1494415549 cat << \_LT_EOF >> "$cfgfile"
15550
1494515551 # func_dirname file append nondir_replacement
1494615552 # Compute the dirname of FILE. If nonempty, add APPEND to the result,
1494715553 # otherwise set result to NONDIR_REPLACEMENT.
1496215568 func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
1496315569 }
1496415570
14965 # func_dirname_and_basename file append nondir_replacement
14966 # perform func_basename and func_dirname in a single function
14967 # call:
14968 # dirname: Compute the dirname of FILE. If nonempty,
14969 # add APPEND to the result, otherwise set result
14970 # to NONDIR_REPLACEMENT.
14971 # value returned in "$func_dirname_result"
14972 # basename: Compute filename of FILE.
14973 # value retuned in "$func_basename_result"
14974 # Implementation must be kept synchronized with func_dirname
14975 # and func_basename. For efficiency, we do not delegate to
14976 # those functions but instead duplicate the functionality here.
14977 func_dirname_and_basename ()
14978 {
14979 # Extract subdirectory from the argument.
14980 func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
14981 if test "X$func_dirname_result" = "X${1}"; then
14982 func_dirname_result="${3}"
14983 else
14984 func_dirname_result="$func_dirname_result${2}"
14985 fi
14986 func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
14987 }
1498815571
1498915572 # func_stripname prefix suffix name
1499015573 # strip PREFIX and SUFFIX off of NAME.
1501815601 {
1501915602 func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"`
1502015603 }
15604
15605 # func_xform libobj-or-source
15606 func_xform ()
15607 {
15608 func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[^.]*$/.lo/'`
15609 }
15610
15611 # func_arith arithmetic-term...
15612 func_arith ()
15613 {
15614 func_arith_result=`expr "$@"`
15615 }
15616
15617 # func_len string
15618 # STRING may not start with a hyphen.
15619 func_len ()
15620 {
15621 func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
15622 }
15623
1502115624 _LT_EOF
1502215625 esac
1502315626
1504215645 {
1504315646 eval "$1=\$$1\$2"
1504415647 }
15648
1504515649 _LT_EOF
1504615650 ;;
1504715651 esac
00 dnl Process this file with autoconf to produce a configure script.
11
2 AC_INIT([gsl],[1.11])
2 AC_INIT([gsl],[1.12])
33 AC_CONFIG_SRCDIR(gsl_math.h)
44
55 AM_INIT_AUTOMAKE([gnu no-dependencies])
2222 dnl gsl-1.9 libgsl 10:0:10 libgslcblas 0:0:0
2323 dnl gsl-1.10 libgsl 10:0:10 (*) libgslcblas 0:0:0
2424 dnl gsl-1.11 libgsl 12:0:12 libgslcblas 0:0:0
25 dnl gsl-1.12 libgsl 13:0:13 libgslcblas 0:0:0
2526 dnl
2627 dnl (*) There was an error on this release. Firstly, the versioning
2728 dnl numbers were not updated. Secondly, 2 functions were removed, but
4243 dnl so set to 0 if both happened.
4344
4445 dnl
45 GSL_CURRENT=12
46 GSL_CURRENT=13
4647 GSL_REVISION=0
47 GSL_AGE=12
48 GSL_AGE=13
4849 dnl
4950 CBLAS_CURRENT=0
5051 CBLAS_REVISION=0
9596 dnl Check for "extern inline", using a modified version of the test
9697 dnl for AC_C_INLINE from acspecific.mt
9798 dnl
98 AC_CACHE_CHECK([for extern inline], ac_cv_c_extern_inline,
99 AC_CACHE_CHECK([for GNU-style extern inline], ac_cv_c_extern_inline,
99100 [ac_cv_c_extern_inline=no
100101 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[extern $ac_cv_c_inline double foo(double x);
101102 extern $ac_cv_c_inline double foo(double x) { return x + 1.0 ; } ;
104105
105106 if test "$ac_cv_c_extern_inline" != no ; then
106107 AC_DEFINE(HAVE_INLINE,[],[Define if you have inline])
108 else
109 AC_CACHE_CHECK([for C99-style inline], ac_cv_c_c99inline,
110 [ac_cv_c_c99inline=no
111 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#ifdef __GNUC_STDC_INLINE__
112 inline double foo(double x);
113 inline double foo(double x) { return x + 1.0 ; };
114 #endif]],
115 [[ foo(1.0) ]])],[ac_cv_c_c99inline="yes"],[])
116 ])
117
118 if test "$ac_cv_c_c99inline" != no ; then
119 AC_DEFINE(HAVE_INLINE,[],[Define if you have inline])
120 fi
107121 fi
108122
109123 dnl Checks for header files.
310324 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
311325 #include <stdlib.h>
312326 #define _FPU_SETMXCSR(cw_sse) asm volatile ("ldmxcsr %0" : : "m" (*&cw_sse))
313 ]], [[ unsigned int mode = 0x1f80 ; _FPU_SETMXCSR(mode); exit(0); ]])],[ac_cv_c_fpu_sse="yes"])
314 ])
327 ]], [[ unsigned int mode = 0x1f80 ; _FPU_SETMXCSR(mode); exit(0); ]])],[ac_cv_c_fpu_sse="yes"],[ac_cv_c_fpu_sse="no"],[
328 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
329 #include <stdlib.h>
330 #define _FPU_SETMXCSR(cw_sse) asm volatile ("ldmxcsr %0" : : "m" (*&cw_sse))
331 ]], [[ unsigned int mode = 0x1f80 ; _FPU_SETMXCSR(mode); exit(0); ]])],[ac_cv_c_fpu_sse="yes"],[ac_cv_c_fpu_sse="no"])
332 ])])
333
315334 if test $ac_cv_c_fpu_sse = yes; then
316335 AC_DEFINE([HAVE_FPU_X86_SSE], 1,
317336 [Define if x86 processor has sse extensions.])
0 2008-07-03 Brian Gough <bjg@hp2.network-theory.co.uk>
1
2 * Makefile.am (INCLUDES): use top_srcdir instead of top_builddir
3
04 2006-03-21 Brian Gough <bjg@network-theory.co.uk>
15
26 * test.c (main): added some extra tests
00 pkginclude_HEADERS = gsl_const.h gsl_const_cgs.h gsl_const_mks.h gsl_const_cgsm.h gsl_const_mksa.h gsl_const_num.h
11
2 INCLUDES= -I$(top_builddir)
2 INCLUDES = -I$(top_srcdir)
33
44 TESTS = $(check_PROGRAMS)
55
126126 LIBOBJS = @LIBOBJS@
127127 LIBS = @LIBS@
128128 LIBTOOL = @LIBTOOL@
129 LIPO = @LIPO@
129130 LN_S = @LN_S@
130131 LTLIBOBJS = @LTLIBOBJS@
131132 MAINT = @MAINT@
133134 MKDIR_P = @MKDIR_P@
134135 NM = @NM@
135136 NMEDIT = @NMEDIT@
137 OBJDUMP = @OBJDUMP@
136138 OBJEXT = @OBJEXT@
139 OTOOL = @OTOOL@
140 OTOOL64 = @OTOOL64@
137141 PACKAGE = @PACKAGE@
138142 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
139143 PACKAGE_NAME = @PACKAGE_NAME@
197201 top_builddir = @top_builddir@
198202 top_srcdir = @top_srcdir@
199203 pkginclude_HEADERS = gsl_const.h gsl_const_cgs.h gsl_const_mks.h gsl_const_cgsm.h gsl_const_mksa.h gsl_const_num.h
200 INCLUDES = -I$(top_builddir)
204 INCLUDES = -I$(top_srcdir)
201205 TESTS = $(check_PROGRAMS)
202206 test_SOURCES = test.c
203207 test_LDADD = ../ieee-utils/libgslieeeutils.la ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la ../utils/libutils.la
0 gsl (1.12+dfsg-1) unstable; urgency=low
1
2 * New upstream version released today
3
4 * doc/*: As before, removed the 'non-free' documentation to create a
5 source package that complies with Debian's interpretation of what is free.
6
7 -- Dirk Eddelbuettel <edd@debian.org> Tue, 16 Dec 2008 06:17:55 -0600
8
09 gsl (1.11+dfsg-2) unstable; urgency=low
110
211 * debian/*: Applied patch by Matthew Vernon for building an optional package
0 #! /bin/sh
1 # depcomp - compile a program generating dependencies as side-effects
2
3 scriptversion=2007-03-29.01
4
5 # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007 Free Software
6 # Foundation, Inc.
7
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2, or (at your option)
11 # any later version.
12
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
17
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 # 02110-1301, USA.
22
23 # As a special exception to the GNU General Public License, if you
24 # distribute this file as part of a program that contains a
25 # configuration script generated by Autoconf, you may include it under
26 # the same distribution terms that you use for the rest of that program.
27
28 # Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
29
30 case $1 in
31 '')
32 echo "$0: No command. Try \`$0 --help' for more information." 1>&2
33 exit 1;
34 ;;
35 -h | --h*)
36 cat <<\EOF
37 Usage: depcomp [--help] [--version] PROGRAM [ARGS]
38
39 Run PROGRAMS ARGS to compile a file, generating dependencies
40 as side-effects.
41
42 Environment variables:
43 depmode Dependency tracking mode.
44 source Source file read by `PROGRAMS ARGS'.
45 object Object file output by `PROGRAMS ARGS'.
46 DEPDIR directory where to store dependencies.
47 depfile Dependency file to output.
48 tmpdepfile Temporary file to use when outputing dependencies.
49 libtool Whether libtool is used (yes/no).
50
51 Report bugs to <bug-automake@gnu.org>.
52 EOF
53 exit $?
54 ;;
55 -v | --v*)
56 echo "depcomp $scriptversion"
57 exit $?
58 ;;
59 esac
60
61 if test -z "$depmode" || test -z "$source" || test -z "$object"; then
62 echo "depcomp: Variables source, object and depmode must be set" 1>&2
63 exit 1
64 fi
65
66 # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
67 depfile=${depfile-`echo "$object" |
68 sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
69 tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
70
71 rm -f "$tmpdepfile"
72
73 # Some modes work just like other modes, but use different flags. We
74 # parameterize here, but still list the modes in the big case below,
75 # to make depend.m4 easier to write. Note that we *cannot* use a case
76 # here, because this file can only contain one case statement.
77 if test "$depmode" = hp; then
78 # HP compiler uses -M and no extra arg.
79 gccflag=-M
80 depmode=gcc
81 fi
82
83 if test "$depmode" = dashXmstdout; then
84 # This is just like dashmstdout with a different argument.
85 dashmflag=-xM
86 depmode=dashmstdout
87 fi
88
89 case "$depmode" in
90 gcc3)
91 ## gcc 3 implements dependency tracking that does exactly what
92 ## we want. Yay! Note: for some reason libtool 1.4 doesn't like
93 ## it if -MD -MP comes after the -MF stuff. Hmm.
94 ## Unfortunately, FreeBSD c89 acceptance of flags depends upon
95 ## the command line argument order; so add the flags where they
96 ## appear in depend2.am. Note that the slowdown incurred here
97 ## affects only configure: in makefiles, %FASTDEP% shortcuts this.
98 for arg
99 do
100 case $arg in
101 -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
102 *) set fnord "$@" "$arg" ;;
103 esac
104 shift # fnord
105 shift # $arg
106 done
107 "$@"
108 stat=$?
109 if test $stat -eq 0; then :
110 else
111 rm -f "$tmpdepfile"
112 exit $stat
113 fi
114 mv "$tmpdepfile" "$depfile"
115 ;;
116
117 gcc)
118 ## There are various ways to get dependency output from gcc. Here's
119 ## why we pick this rather obscure method:
120 ## - Don't want to use -MD because we'd like the dependencies to end
121 ## up in a subdir. Having to rename by hand is ugly.
122 ## (We might end up doing this anyway to support other compilers.)
123 ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
124 ## -MM, not -M (despite what the docs say).
125 ## - Using -M directly means running the compiler twice (even worse
126 ## than renaming).
127 if test -z "$gccflag"; then
128 gccflag=-MD,
129 fi
130 "$@" -Wp,"$gccflag$tmpdepfile"
131 stat=$?
132 if test $stat -eq 0; then :
133 else
134 rm -f "$tmpdepfile"
135 exit $stat
136 fi
137 rm -f "$depfile"
138 echo "$object : \\" > "$depfile"
139 alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
140 ## The second -e expression handles DOS-style file names with drive letters.
141 sed -e 's/^[^:]*: / /' \
142 -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
143 ## This next piece of magic avoids the `deleted header file' problem.
144 ## The problem is that when a header file which appears in a .P file
145 ## is deleted, the dependency causes make to die (because there is
146 ## typically no way to rebuild the header). We avoid this by adding
147 ## dummy dependencies for each header file. Too bad gcc doesn't do
148 ## this for us directly.
149 tr ' ' '
150 ' < "$tmpdepfile" |
151 ## Some versions of gcc put a space before the `:'. On the theory
152 ## that the space means something, we add a space to the output as
153 ## well.
154 ## Some versions of the HPUX 10.20 sed can't process this invocation
155 ## correctly. Breaking it into two sed invocations is a workaround.
156 sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
157 rm -f "$tmpdepfile"
158 ;;
159
160 hp)
161 # This case exists only to let depend.m4 do its work. It works by
162 # looking at the text of this script. This case will never be run,
163 # since it is checked for above.
164 exit 1
165 ;;
166
167 sgi)
168 if test "$libtool" = yes; then
169 "$@" "-Wp,-MDupdate,$tmpdepfile"
170 else
171 "$@" -MDupdate "$tmpdepfile"
172 fi
173 stat=$?
174 if test $stat -eq 0; then :
175 else
176 rm -f "$tmpdepfile"
177 exit $stat
178 fi
179 rm -f "$depfile"
180
181 if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
182 echo "$object : \\" > "$depfile"
183
184 # Clip off the initial element (the dependent). Don't try to be
185 # clever and replace this with sed code, as IRIX sed won't handle
186 # lines with more than a fixed number of characters (4096 in
187 # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
188 # the IRIX cc adds comments like `#:fec' to the end of the
189 # dependency line.
190 tr ' ' '
191 ' < "$tmpdepfile" \
192 | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
193 tr '
194 ' ' ' >> $depfile
195 echo >> $depfile
196
197 # The second pass generates a dummy entry for each header file.
198 tr ' ' '
199 ' < "$tmpdepfile" \
200 | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
201 >> $depfile
202 else
203 # The sourcefile does not contain any dependencies, so just
204 # store a dummy comment line, to avoid errors with the Makefile
205 # "include basename.Plo" scheme.
206 echo "#dummy" > "$depfile"
207 fi
208 rm -f "$tmpdepfile"
209 ;;
210
211 aix)
212 # The C for AIX Compiler uses -M and outputs the dependencies
213 # in a .u file. In older versions, this file always lives in the
214 # current directory. Also, the AIX compiler puts `$object:' at the
215 # start of each line; $object doesn't have directory information.
216 # Version 6 uses the directory in both cases.
217 dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
218 test "x$dir" = "x$object" && dir=
219 base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
220 if test "$libtool" = yes; then
221 tmpdepfile1=$dir$base.u
222 tmpdepfile2=$base.u
223 tmpdepfile3=$dir.libs/$base.u
224 "$@" -Wc,-M
225 else
226 tmpdepfile1=$dir$base.u
227 tmpdepfile2=$dir$base.u
228 tmpdepfile3=$dir$base.u
229 "$@" -M
230 fi
231 stat=$?
232
233 if test $stat -eq 0; then :
234 else
235 rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
236 exit $stat
237 fi
238
239 for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
240 do
241 test -f "$tmpdepfile" && break
242 done
243 if test -f "$tmpdepfile"; then
244 # Each line is of the form `foo.o: dependent.h'.
245 # Do two passes, one to just change these to
246 # `$object: dependent.h' and one to simply `dependent.h:'.
247 sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
248 # That's a tab and a space in the [].
249 sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
250 else
251 # The sourcefile does not contain any dependencies, so just
252 # store a dummy comment line, to avoid errors with the Makefile
253 # "include basename.Plo" scheme.
254 echo "#dummy" > "$depfile"
255 fi
256 rm -f "$tmpdepfile"
257 ;;
258
259 icc)
260 # Intel's C compiler understands `-MD -MF file'. However on
261 # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
262 # ICC 7.0 will fill foo.d with something like
263 # foo.o: sub/foo.c
264 # foo.o: sub/foo.h
265 # which is wrong. We want:
266 # sub/foo.o: sub/foo.c
267 # sub/foo.o: sub/foo.h
268 # sub/foo.c:
269 # sub/foo.h:
270 # ICC 7.1 will output
271 # foo.o: sub/foo.c sub/foo.h
272 # and will wrap long lines using \ :
273 # foo.o: sub/foo.c ... \
274 # sub/foo.h ... \
275 # ...
276
277 "$@" -MD -MF "$tmpdepfile"
278 stat=$?
279 if test $stat -eq 0; then :
280 else
281 rm -f "$tmpdepfile"
282 exit $stat
283 fi
284 rm -f "$depfile"
285 # Each line is of the form `foo.o: dependent.h',
286 # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
287 # Do two passes, one to just change these to
288 # `$object: dependent.h' and one to simply `dependent.h:'.
289 sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
290 # Some versions of the HPUX 10.20 sed can't process this invocation
291 # correctly. Breaking it into two sed invocations is a workaround.
292 sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
293 sed -e 's/$/ :/' >> "$depfile"
294 rm -f "$tmpdepfile"
295 ;;
296
297 hp2)
298 # The "hp" stanza above does not work with aCC (C++) and HP's ia64
299 # compilers, which have integrated preprocessors. The correct option
300 # to use with these is +Maked; it writes dependencies to a file named
301 # 'foo.d', which lands next to the object file, wherever that
302 # happens to be.
303 # Much of this is similar to the tru64 case; see comments there.
304 dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
305 test "x$dir" = "x$object" && dir=
306 base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
307 if test "$libtool" = yes; then
308 tmpdepfile1=$dir$base.d
309 tmpdepfile2=$dir.libs/$base.d
310 "$@" -Wc,+Maked
311 else
312 tmpdepfile1=$dir$base.d
313 tmpdepfile2=$dir$base.d
314 "$@" +Maked
315 fi
316 stat=$?
317 if test $stat -eq 0; then :
318 else
319 rm -f "$tmpdepfile1" "$tmpdepfile2"
320 exit $stat
321 fi
322
323 for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
324 do
325 test -f "$tmpdepfile" && break
326 done
327 if test -f "$tmpdepfile"; then
328 sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
329 # Add `dependent.h:' lines.
330 sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile"
331 else
332 echo "#dummy" > "$depfile"
333 fi
334 rm -f "$tmpdepfile" "$tmpdepfile2"
335 ;;
336
337 tru64)
338 # The Tru64 compiler uses -MD to generate dependencies as a side
339 # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
340 # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
341 # dependencies in `foo.d' instead, so we check for that too.
342 # Subdirectories are respected.
343 dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
344 test "x$dir" = "x$object" && dir=
345 base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
346
347 if test "$libtool" = yes; then
348 # With Tru64 cc, shared objects can also be used to make a
349 # static library. This mechanism is used in libtool 1.4 series to
350 # handle both shared and static libraries in a single compilation.
351 # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
352 #
353 # With libtool 1.5 this exception was removed, and libtool now
354 # generates 2 separate objects for the 2 libraries. These two
355 # compilations output dependencies in $dir.libs/$base.o.d and
356 # in $dir$base.o.d. We have to check for both files, because
357 # one of the two compilations can be disabled. We should prefer
358 # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
359 # automatically cleaned when .libs/ is deleted, while ignoring
360 # the former would cause a distcleancheck panic.
361 tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
362 tmpdepfile2=$dir$base.o.d # libtool 1.5
363 tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
364 tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
365 "$@" -Wc,-MD
366 else
367 tmpdepfile1=$dir$base.o.d
368 tmpdepfile2=$dir$base.d
369 tmpdepfile3=$dir$base.d
370 tmpdepfile4=$dir$base.d
371 "$@" -MD
372 fi
373
374 stat=$?
375 if test $stat -eq 0; then :
376 else
377 rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
378 exit $stat
379 fi
380
381 for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
382 do
383 test -f "$tmpdepfile" && break
384 done
385 if test -f "$tmpdepfile"; then
386 sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
387 # That's a tab and a space in the [].
388 sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
389 else
390 echo "#dummy" > "$depfile"
391 fi
392 rm -f "$tmpdepfile"
393 ;;
394
395 #nosideeffect)
396 # This comment above is used by automake to tell side-effect
397 # dependency tracking mechanisms from slower ones.
398
399 dashmstdout)
400 # Important note: in order to support this mode, a compiler *must*
401 # always write the preprocessed file to stdout, regardless of -o.
402 "$@" || exit $?
403
404 # Remove the call to Libtool.
405 if test "$libtool" = yes; then
406 while test $1 != '--mode=compile'; do
407 shift
408 done
409 shift
410 fi
411
412 # Remove `-o $object'.
413 IFS=" "
414 for arg
415 do
416 case $arg in
417 -o)
418 shift
419 ;;
420 $object)
421 shift
422 ;;
423 *)
424 set fnord "$@" "$arg"
425 shift # fnord
426 shift # $arg
427 ;;
428 esac
429 done
430
431 test -z "$dashmflag" && dashmflag=-M
432 # Require at least two characters before searching for `:'
433 # in the target name. This is to cope with DOS-style filenames:
434 # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
435 "$@" $dashmflag |
436 sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
437 rm -f "$depfile"
438 cat < "$tmpdepfile" > "$depfile"
439 tr ' ' '
440 ' < "$tmpdepfile" | \
441 ## Some versions of the HPUX 10.20 sed can't process this invocation
442 ## correctly. Breaking it into two sed invocations is a workaround.
443 sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
444 rm -f "$tmpdepfile"
445 ;;
446
447 dashXmstdout)
448 # This case only exists to satisfy depend.m4. It is never actually
449 # run, as this mode is specially recognized in the preamble.
450 exit 1
451 ;;
452
453 makedepend)
454 "$@" || exit $?
455 # Remove any Libtool call
456 if test "$libtool" = yes; then
457 while test $1 != '--mode=compile'; do
458 shift
459 done
460 shift
461 fi
462 # X makedepend
463 shift
464 cleared=no
465 for arg in "$@"; do
466 case $cleared in
467 no)
468 set ""; shift
469 cleared=yes ;;
470 esac
471 case "$arg" in
472 -D*|-I*)
473 set fnord "$@" "$arg"; shift ;;
474 # Strip any option that makedepend may not understand. Remove
475 # the object too, otherwise makedepend will parse it as a source file.
476 -*|$object)
477 ;;
478 *)
479 set fnord "$@" "$arg"; shift ;;
480 esac
481 done
482 obj_suffix="`echo $object | sed 's/^.*\././'`"
483 touch "$tmpdepfile"
484 ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
485 rm -f "$depfile"
486 cat < "$tmpdepfile" > "$depfile"
487 sed '1,2d' "$tmpdepfile" | tr ' ' '
488 ' | \
489 ## Some versions of the HPUX 10.20 sed can't process this invocation
490 ## correctly. Breaking it into two sed invocations is a workaround.
491 sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
492 rm -f "$tmpdepfile" "$tmpdepfile".bak
493 ;;
494
495 cpp)
496 # Important note: in order to support this mode, a compiler *must*
497 # always write the preprocessed file to stdout.
498 "$@" || exit $?
499
500 # Remove the call to Libtool.
501 if test "$libtool" = yes; then
502 while test $1 != '--mode=compile'; do
503 shift
504 done
505 shift
506 fi
507
508 # Remove `-o $object'.
509 IFS=" "
510 for arg
511 do
512 case $arg in
513 -o)
514 shift
515 ;;
516 $object)
517 shift
518 ;;
519 *)
520 set fnord "$@" "$arg"
521 shift # fnord
522 shift # $arg
523 ;;
524 esac
525 done
526
527 "$@" -E |
528 sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
529 -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
530 sed '$ s: \\$::' > "$tmpdepfile"
531 rm -f "$depfile"
532 echo "$object : \\" > "$depfile"
533 cat < "$tmpdepfile" >> "$depfile"
534 sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
535 rm -f "$tmpdepfile"
536 ;;
537
538 msvisualcpp)
539 # Important note: in order to support this mode, a compiler *must*
540 # always write the preprocessed file to stdout, regardless of -o,
541 # because we must use -o when running libtool.
542 "$@" || exit $?
543 IFS=" "
544 for arg
545 do
546 case "$arg" in
547 "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
548 set fnord "$@"
549 shift
550 shift
551 ;;
552 *)
553 set fnord "$@" "$arg"
554 shift
555 shift
556 ;;
557 esac
558 done
559 "$@" -E |
560 sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
561 rm -f "$depfile"
562 echo "$object : \\" > "$depfile"
563 . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
564 echo " " >> "$depfile"
565 . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
566 rm -f "$tmpdepfile"
567 ;;
568
569 none)
570 exec "$@"
571 ;;
572
573 *)
574 echo "Unknown depmode $depmode" 1>&2
575 exit 1
576 ;;
577 esac
578
579 exit 0
580
581 # Local Variables:
582 # mode: shell-script
583 # sh-indentation: 2
584 # eval: (add-hook 'write-file-hooks 'time-stamp)
585 # time-stamp-start: "scriptversion="
586 # time-stamp-format: "%:y-%02m-%02d.%02H"
587 # time-stamp-end: "$"
588 # End:
0 2008-07-03 Brian Gough <bjg@hp2.network-theory.co.uk>
1
2 * Makefile.am (INCLUDES): use top_srcdir instead of top_builddir
3
04 2007-08-22 Brian Gough <bjg@network-theory.co.uk>
15
26 * deriv.c (central_deriv): corrected dy term for error in h
00 noinst_LTLIBRARIES = libgslderiv.la
11
2 INCLUDES= -I$(top_builddir)
2 INCLUDES = -I$(top_srcdir)
33
44 libgslderiv_la_SOURCES = deriv.c
55
131131 LIBOBJS = @LIBOBJS@
132132 LIBS = @LIBS@
133133 LIBTOOL = @LIBTOOL@
134 LIPO = @LIPO@
134135 LN_S = @LN_S@
135136 LTLIBOBJS = @LTLIBOBJS@
136137 MAINT = @MAINT@
138139 MKDIR_P = @MKDIR_P@
139140 NM = @NM@
140141 NMEDIT = @NMEDIT@
142 OBJDUMP = @OBJDUMP@
141143 OBJEXT = @OBJEXT@
144 OTOOL = @OTOOL@
145 OTOOL64 = @OTOOL64@
142146 PACKAGE = @PACKAGE@
143147 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
144148 PACKAGE_NAME = @PACKAGE_NAME@
202206 top_builddir = @top_builddir@
203207 top_srcdir = @top_srcdir@
204208 noinst_LTLIBRARIES = libgslderiv.la
205 INCLUDES = -I$(top_builddir)
209 INCLUDES = -I$(top_srcdir)
206210 libgslderiv_la_SOURCES = deriv.c
207211 pkginclude_HEADERS = gsl_deriv.h
208212 TESTS = $(check_PROGRAMS)
0 2008-07-03 Brian Gough <bjg@hp2.network-theory.co.uk>
1
2 * Makefile.am (INCLUDES): use top_srcdir instead of top_builddir
3
04 Mon Apr 23 10:31:58 2001 Brian Gough <bjg@network-theory.co.uk>
15
26 * unified error handling conventions to _e for error handling
11
22 pkginclude_HEADERS = gsl_dht.h
33
4 INCLUDES= -I$(top_builddir)
4 INCLUDES = -I$(top_srcdir)
55
66 TESTS = $(check_PROGRAMS)
77
132132 LIBOBJS = @LIBOBJS@
133133 LIBS = @LIBS@
134134 LIBTOOL = @LIBTOOL@
135 LIPO = @LIPO@
135136 LN_S = @LN_S@
136137 LTLIBOBJS = @LTLIBOBJS@
137138 MAINT = @MAINT@
139140 MKDIR_P = @MKDIR_P@
140141 NM = @NM@
141142 NMEDIT = @NMEDIT@
143 OBJDUMP = @OBJDUMP@
142144 OBJEXT = @OBJEXT@
145 OTOOL = @OTOOL@
146 OTOOL64 = @OTOOL64@
143147 PACKAGE = @PACKAGE@
144148 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
145149 PACKAGE_NAME = @PACKAGE_NAME@
204208 top_srcdir = @top_srcdir@
205209 noinst_LTLIBRARIES = libgsldht.la
206210 pkginclude_HEADERS = gsl_dht.h
207 INCLUDES = -I$(top_builddir)
211 INCLUDES = -I$(top_srcdir)
208212 TESTS = $(check_PROGRAMS)
209213 test_LDADD = libgsldht.la ../specfunc/libgslspecfunc.la ../complex/libgslcomplex.la ../ieee-utils/libgslieeeutils.la ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la ../utils/libutils.la
210214 test_SOURCES = test.c
0 2008-09-18 Brian Gough <bjg@network-theory.co.uk>
1
2 * diff.c test.c: temporarily enable deprecated functions for
3 testing
4
5 * gsl_diff.h: marked these functions deprecated, use gsl_deriv
6 instead.
7
8 2008-07-03 Brian Gough <bjg@hp2.network-theory.co.uk>
9
10 * Makefile.am (INCLUDES): use top_srcdir instead of top_builddir
11
012 Mon Apr 23 13:26:21 2001 Brian Gough <bjg@network-theory.co.uk>
113
214 * Makefile.am: removed demo from Makefile
00 noinst_LTLIBRARIES = libgsldiff.la
11
2 INCLUDES= -I$(top_builddir)
2 INCLUDES = -I$(top_srcdir)
33
44 libgsldiff_la_SOURCES = diff.c
55
131131 LIBOBJS = @LIBOBJS@
132132 LIBS = @LIBS@
133133 LIBTOOL = @LIBTOOL@
134 LIPO = @LIPO@
134135 LN_S = @LN_S@
135136 LTLIBOBJS = @LTLIBOBJS@
136137 MAINT = @MAINT@
138139 MKDIR_P = @MKDIR_P@
139140 NM = @NM@
140141 NMEDIT = @NMEDIT@
142 OBJDUMP = @OBJDUMP@
141143 OBJEXT = @OBJEXT@
144 OTOOL = @OTOOL@
145 OTOOL64 = @OTOOL64@
142146 PACKAGE = @PACKAGE@
143147 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
144148 PACKAGE_NAME = @PACKAGE_NAME@
202206 top_builddir = @top_builddir@
203207 top_srcdir = @top_srcdir@
204208 noinst_LTLIBRARIES = libgsldiff.la
205 INCLUDES = -I$(top_builddir)
209 INCLUDES = -I$(top_srcdir)
206210 libgsldiff_la_SOURCES = diff.c
207211 pkginclude_HEADERS = gsl_diff.h
208212 TESTS = $(check_PROGRAMS)
2020 #include <stdlib.h>
2121 #include <gsl/gsl_math.h>
2222 #include <gsl/gsl_errno.h>
23
24 #undef GSL_DISABLE_DEPRECATED
2325 #include <gsl/gsl_diff.h>
2426
2527 int
3232
3333 __BEGIN_DECLS
3434
35 #ifndef GSL_DISABLE_DEPRECATED
3536 int gsl_diff_central (const gsl_function *f,
3637 double x,
3738 double *result, double *abserr);
4344 int gsl_diff_forward (const gsl_function *f,
4445 double x,
4546 double *result, double *abserr);
47 #endif
4648
4749 __END_DECLS
4850
2121 #include <stdio.h>
2222 #include <math.h>
2323 #include <gsl/gsl_math.h>
24 #include <gsl/gsl_diff.h>
2524 #include <gsl/gsl_errno.h>
2625 #include <gsl/gsl_test.h>
2726 #include <gsl/gsl_ieee_utils.h>
27
28 #undef GSL_DISABLE_DEPRECATED
29 #include <gsl/gsl_diff.h>
2830
2931 double
3032 f1 (double x, void *params)
0 2008-07-03 Brian Gough <bjg@hp2.network-theory.co.uk>
1
2 * Makefile.am (INCLUDES): use top_srcdir instead of top_builddir
3
04 2007-08-30 Brian Gough <bjg@network-theory.co.uk>
15
26 * test.c (test_eigen_symm): added new test case for underflow
33
44 pkginclude_HEADERS = gsl_eigen.h
55 libgsleigen_la_SOURCES = jacobi.c symm.c symmv.c nonsymm.c nonsymmv.c herm.c hermv.c gensymm.c gensymmv.c genherm.c genhermv.c gen.c genv.c sort.c francis.c schur.c
6 INCLUDES= -I$(top_builddir)
6
7 INCLUDES = -I$(top_srcdir)
78
89 noinst_HEADERS = qrstep.c
910
138138 LIBOBJS = @LIBOBJS@
139139 LIBS = @LIBS@
140140 LIBTOOL = @LIBTOOL@
141 LIPO = @LIPO@
141142 LN_S = @LN_S@
142143 LTLIBOBJS = @LTLIBOBJS@
143144 MAINT = @MAINT@
145146 MKDIR_P = @MKDIR_P@
146147 NM = @NM@
147148 NMEDIT = @NMEDIT@
149 OBJDUMP = @OBJDUMP@
148150 OBJEXT = @OBJEXT@
151 OTOOL = @OTOOL@
152 OTOOL64 = @OTOOL64@
149153 PACKAGE = @PACKAGE@
150154 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
151155 PACKAGE_NAME = @PACKAGE_NAME@
211215 noinst_LTLIBRARIES = libgsleigen.la
212216 pkginclude_HEADERS = gsl_eigen.h
213217 libgsleigen_la_SOURCES = jacobi.c symm.c symmv.c nonsymm.c nonsymmv.c herm.c hermv.c gensymm.c gensymmv.c genherm.c genhermv.c gen.c genv.c sort.c francis.c schur.c
214 INCLUDES = -I$(top_builddir)
218 INCLUDES = -I$(top_srcdir)
215219 noinst_HEADERS = qrstep.c
216220 TESTS = $(check_PROGRAMS)
217221 test_LDADD = libgsleigen.la ../test/libgsltest.la ../linalg/libgsllinalg.la ../permutation/libgslpermutation.la ../blas/libgslblas.la ../cblas/libgslcblas.la ../matrix/libgslmatrix.la ../vector/libgslvector.la ../block/libgslblock.la ../complex/libgslcomplex.la ../ieee-utils/libgslieeeutils.la ../sys/libgslsys.la ../err/libgslerr.la ../utils/libutils.la ../rng/libgslrng.la ../sort/libgslsort.la
117117 GSL_EINVAL);
118118 }
119119
120 w = calloc (1, sizeof (gsl_eigen_gen_workspace));
120 w = (gsl_eigen_gen_workspace *) calloc (1, sizeof (gsl_eigen_gen_workspace));
121121
122122 if (w == 0)
123123 {
5656 GSL_EINVAL);
5757 }
5858
59 w = calloc (1, sizeof (gsl_eigen_genherm_workspace));
59 w = (gsl_eigen_genherm_workspace *) calloc (1, sizeof (gsl_eigen_genherm_workspace));
6060
6161 if (w == 0)
6262 {
5858 GSL_EINVAL);
5959 }
6060
61 w = calloc (1, sizeof (gsl_eigen_genhermv_workspace));
61 w = (gsl_eigen_genhermv_workspace *) calloc (1, sizeof (gsl_eigen_genhermv_workspace));
6262
6363 if (w == 0)
6464 {
5454 GSL_EINVAL);
5555 }
5656
57 w = calloc (1, sizeof (gsl_eigen_gensymm_workspace));
57 w = (gsl_eigen_gensymm_workspace *) calloc (1, sizeof (gsl_eigen_gensymm_workspace));
5858
5959 if (w == 0)
6060 {
5656 GSL_EINVAL);
5757 }
5858
59 w = calloc (1, sizeof (gsl_eigen_gensymmv_workspace));
59 w = (gsl_eigen_gensymmv_workspace *) calloc (1, sizeof (gsl_eigen_gensymmv_workspace));
6060
6161 if (w == 0)
6262 {
6767 GSL_EINVAL);
6868 }
6969
70 w = calloc (1, sizeof (gsl_eigen_genv_workspace));
70 w = (gsl_eigen_genv_workspace *) calloc (1, sizeof (gsl_eigen_genv_workspace));
7171
7272 if (w == 0)
7373 {
506506 = gsl_matrix_complex_const_column(evec, j);
507507 gsl_complex vivj;
508508 gsl_blas_zdotc (&vi.vector, &vj.vector, &vivj);
509 gsl_test_abs (gsl_complex_abs(vivj), 0.0, N * GSL_DBL_EPSILON,
509 gsl_test_abs (gsl_complex_abs(vivj), 0.0, 10.0 * N * GSL_DBL_EPSILON,
510510 "%s, orthogonal(%d,%d), %s", desc, i, j, desc2);
511511 }
512512 }
10571057 {
10581058 test_eigen_gen_workspace *w;
10591059
1060 w = calloc(1, sizeof(test_eigen_gen_workspace));
1060 w = (test_eigen_gen_workspace *) calloc(1, sizeof(test_eigen_gen_workspace));
10611061
10621062 w->A = gsl_matrix_alloc(n, n);
10631063 w->B = gsl_matrix_alloc(n, n);
130130 LIBOBJS = @LIBOBJS@
131131 LIBS = @LIBS@
132132 LIBTOOL = @LIBTOOL@
133 LIPO = @LIPO@
133134 LN_S = @LN_S@
134135 LTLIBOBJS = @LTLIBOBJS@
135136 MAINT = @MAINT@
137138 MKDIR_P = @MKDIR_P@
138139 NM = @NM@
139140 NMEDIT = @NMEDIT@
141 OBJDUMP = @OBJDUMP@
140142 OBJEXT = @OBJEXT@
143 OTOOL = @OTOOL@
144 OTOOL64 = @OTOOL64@
141145 PACKAGE = @PACKAGE@
142146 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
143147 PACKAGE_NAME = @PACKAGE_NAME@
0 2008-07-03 Brian Gough <bjg@hp2.network-theory.co.uk>
1
2 * Makefile.am (INCLUDES): use top_srcdir instead of top_builddir
3
04 2006-03-16 Brian Gough <bjg@network-theory.co.uk>
15
26 * changed to gsl_fft_forward and gsl_fft_backward enums throughout
11
22 pkginclude_HEADERS = gsl_fft.h gsl_fft_complex.h gsl_fft_halfcomplex.h gsl_fft_real.h gsl_dft_complex.h gsl_dft_complex_float.h gsl_fft_complex_float.h gsl_fft_halfcomplex_float.h gsl_fft_real_float.h
33
4 INCLUDES= -I$(top_builddir) -I$(top_srcdir)
4 INCLUDES = -I$(top_srcdir)
55
66 libgslfft_la_SOURCES = dft.c fft.c
77
131131 LIBOBJS = @LIBOBJS@
132132 LIBS = @LIBS@
133133 LIBTOOL = @LIBTOOL@
134 LIPO = @LIPO@
134135 LN_S = @LN_S@
135136 LTLIBOBJS = @LTLIBOBJS@
136137 MAINT = @MAINT@
138139 MKDIR_P = @MKDIR_P@
139140 NM = @NM@
140141 NMEDIT = @NMEDIT@
142 OBJDUMP = @OBJDUMP@
141143 OBJEXT = @OBJEXT@
144 OTOOL = @OTOOL@
145 OTOOL64 = @OTOOL64@
142146 PACKAGE = @PACKAGE@
143147 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
144148 PACKAGE_NAME = @PACKAGE_NAME@
203207 top_srcdir = @top_srcdir@
204208 noinst_LTLIBRARIES = libgslfft.la
205209 pkginclude_HEADERS = gsl_fft.h gsl_fft_complex.h gsl_fft_halfcomplex.h gsl_fft_real.h gsl_dft_complex.h gsl_dft_complex_float.h gsl_fft_complex_float.h gsl_fft_halfcomplex_float.h gsl_fft_real_float.h
206 INCLUDES = -I$(top_builddir) -I$(top_srcdir)
210 INCLUDES = -I$(top_srcdir)
207211 libgslfft_la_SOURCES = dft.c fft.c
208212 noinst_HEADERS = c_pass.h hc_pass.h real_pass.h signals.h signals_source.c c_main.c c_init.c c_pass_2.c c_pass_3.c c_pass_4.c c_pass_5.c c_pass_6.c c_pass_7.c c_pass_n.c c_radix2.c bitreverse.c bitreverse.h factorize.c factorize.h hc_init.c hc_pass_2.c hc_pass_3.c hc_pass_4.c hc_pass_5.c hc_pass_n.c hc_radix2.c hc_unpack.c real_init.c real_pass_2.c real_pass_3.c real_pass_4.c real_pass_5.c real_pass_n.c real_radix2.c real_unpack.c compare.h compare_source.c dft_source.c hc_main.c real_main.c test_complex_source.c test_real_source.c test_trap_source.c urand.c complex_internal.h
209213 TESTS = $(check_PROGRAMS)
0 2008-07-03 Brian Gough <bjg@hp2.network-theory.co.uk>
1
2 * Makefile.am (INCLUDES): use top_srcdir instead of top_builddir
3
04 2007-05-23 Brian Gough <bjg@network-theory.co.uk>
15
26 * gsl_fit.h linear.c (gsl_fit_mul_est, gsl_fit_linear_est): made
11
22 pkginclude_HEADERS = gsl_fit.h
33
4 INCLUDES= -I$(top_builddir)
4 INCLUDES = -I$(top_srcdir)
55
66 libgslfit_la_SOURCES = linear.c
77
131131 LIBOBJS = @LIBOBJS@
132132 LIBS = @LIBS@
133133 LIBTOOL = @LIBTOOL@
134 LIPO = @LIPO@
134135 LN_S = @LN_S@
135136 LTLIBOBJS = @LTLIBOBJS@
136137 MAINT = @MAINT@
138139 MKDIR_P = @MKDIR_P@
139140 NM = @NM@
140141 NMEDIT = @NMEDIT@
142 OBJDUMP = @OBJDUMP@
141143 OBJEXT = @OBJEXT@
144 OTOOL = @OTOOL@
145 OTOOL64 = @OTOOL64@
142146 PACKAGE = @PACKAGE@
143147 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
144148 PACKAGE_NAME = @PACKAGE_NAME@
203207 top_srcdir = @top_srcdir@
204208 noinst_LTLIBRARIES = libgslfit.la
205209 pkginclude_HEADERS = gsl_fit.h
206 INCLUDES = -I$(top_builddir)
210 INCLUDES = -I$(top_srcdir)
207211 libgslfit_la_SOURCES = linear.c
208212 TESTS = $(check_PROGRAMS)
209213 test_SOURCES = test.c
9797 LIBOBJS = @LIBOBJS@
9898 LIBS = @LIBS@
9999 LIBTOOL = @LIBTOOL@
100 LIPO = @LIPO@
100101 LN_S = @LN_S@
101102 LTLIBOBJS = @LTLIBOBJS@
102103 MAINT = @MAINT@
104105 MKDIR_P = @MKDIR_P@
105106 NM = @NM@
106107 NMEDIT = @NMEDIT@
108 OBJDUMP = @OBJDUMP@
107109 OBJEXT = @OBJEXT@
110 OTOOL = @OTOOL@
111 OTOOL64 = @OTOOL64@
108112 PACKAGE = @PACKAGE@
109113 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
110114 PACKAGE_NAME = @PACKAGE_NAME@
0 /* gsl_inline.h
1 *
2 * Copyright (C) 2008 Brian Gough
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 3 of the License, or (at
7 * your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18
19 #ifndef __GSL_INLINE_H__
20 #define __GSL_INLINE_H__
21
22 /* In recent versiions of GCC, the inline keyword has two different
23 forms: GNU and C99.
24
25 In GNU mode we can use 'extern inline' to make inline functions
26 work like macros. The function is only inlined--it is never output
27 as a definition in an object file.
28
29 In the new C99 mode 'extern inline' has a different meaning--it
30 causes the definition of the function to be output in each object
31 file where it is used. This will result in multiple-definition
32 errors on linking. The 'inline' keyword on its own (without
33 extern) has the same behavior as the original GNU 'extern inline'.
34
35 The C99 style is the default with -std=c99 in GCC 4.3.
36
37 This header file allows either form of inline to be used by
38 redefining the macros INLINE_DECL and INLINE_FUN. These are used
39 in the public header files as
40
41 INLINE_DECL double gsl_foo (double x);
42 #ifdef HAVE_INLINE
43 INLINE_FUN double gsl_foo (double x) { return x+1.0; } ;
44 #endif
45
46 */
47
48 #ifdef HAVE_INLINE
49 # if defined(__GNUC_STDC_INLINE__) || defined(GSL_C99_INLINE)
50 # define INLINE_DECL inline /* use C99 inline */
51 # define INLINE_FUN inline
52 # else
53 # define INLINE_DECL /* use GNU extern inline */
54 # define INLINE_FUN extern inline
55 # endif
56 #else
57 # define INLINE_DECL /* */
58 #endif
59
60 /* Range checking conditions in headers do not require any run-time
61 tests of the global variable gsl_check_range. They are enabled or
62 disabled in user code at compile time with GSL_RANGE_CHECK macro.
63 See also build.h. */
64 #define GSL_RANGE_COND(x) (x)
65
66 #endif /* __GSL_INLINE_H__ */
2020 #define __GSL_MATH_H__
2121 #include <math.h>
2222 #include <gsl/gsl_sys.h>
23 #include <gsl/gsl_inline.h>
2324 #include <gsl/gsl_machine.h>
2425 #include <gsl/gsl_precision.h>
2526 #include <gsl/gsl_nan.h>
2627 #include <gsl/gsl_pow_int.h>
28 #include <gsl/gsl_minmax.h>
2729
2830 #ifndef M_E
2931 #define M_E 2.71828182845904523536028747135 /* e */
115117 /* Return nonzero if x is a real number, i.e. non NaN or infinite. */
116118 #define GSL_IS_REAL(x) (gsl_finite(x))
117119
118 /* Define MAX and MIN macros/functions if they don't exist. */
119
120 /* plain old macros for general use */
121 #define GSL_MAX(a,b) ((a) > (b) ? (a) : (b))
122 #define GSL_MIN(a,b) ((a) < (b) ? (a) : (b))
123
124 /* function versions of the above, in case they are needed */
125 double gsl_max (double a, double b);
126 double gsl_min (double a, double b);
127
128 /* inline-friendly strongly typed versions */
129 #ifdef HAVE_INLINE
130
131 extern inline int GSL_MAX_INT (int a, int b);
132 extern inline int GSL_MIN_INT (int a, int b);
133 extern inline double GSL_MAX_DBL (double a, double b);
134 extern inline double GSL_MIN_DBL (double a, double b);
135 extern inline long double GSL_MAX_LDBL (long double a, long double b);
136 extern inline long double GSL_MIN_LDBL (long double a, long double b);
137
138 extern inline int
139 GSL_MAX_INT (int a, int b)
140 {
141 return GSL_MAX (a, b);
142 }
143
144 extern inline int
145 GSL_MIN_INT (int a, int b)
146 {
147 return GSL_MIN (a, b);
148 }
149
150 extern inline double
151 GSL_MAX_DBL (double a, double b)
152 {
153 return GSL_MAX (a, b);
154 }
155
156 extern inline double
157 GSL_MIN_DBL (double a, double b)
158 {
159 return GSL_MIN (a, b);
160 }
161
162 extern inline long double
163 GSL_MAX_LDBL (long double a, long double b)
164 {
165 return GSL_MAX (a, b);
166 }
167
168 extern inline long double
169 GSL_MIN_LDBL (long double a, long double b)
170 {
171 return GSL_MIN (a, b);
172 }
173 #else
174 #define GSL_MAX_INT(a,b) GSL_MAX(a,b)
175 #define GSL_MIN_INT(a,b) GSL_MIN(a,b)
176 #define GSL_MAX_DBL(a,b) GSL_MAX(a,b)
177 #define GSL_MIN_DBL(a,b) GSL_MIN(a,b)
178 #define GSL_MAX_LDBL(a,b) GSL_MAX(a,b)
179 #define GSL_MIN_LDBL(a,b) GSL_MIN(a,b)
180 #endif /* HAVE_INLINE */
181
182120 /* Definition of an arbitrary function with parameters */
183121
184122 struct gsl_function_struct
0 /* gsl_minmax.h
1 *
2 * Copyright (C) 2008 Gerard Jungman, Brian Gough
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 3 of the License, or (at
7 * your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18
19 #ifndef __GSL_MINMAX_H__
20 #define __GSL_MINMAX_H__
21 #include <gsl/gsl_inline.h>
22
23 #undef __BEGIN_DECLS
24 #undef __END_DECLS
25 #ifdef __cplusplus
26 # define __BEGIN_DECLS extern "C" {
27 # define __END_DECLS }
28 #else
29 # define __BEGIN_DECLS /* empty */
30 # define __END_DECLS /* empty */
31 #endif
32
33 __BEGIN_DECLS
34
35 /* Define MAX and MIN macros/functions if they don't exist. */
36
37 /* plain old macros for general use */
38 #define GSL_MAX(a,b) ((a) > (b) ? (a) : (b))
39 #define GSL_MIN(a,b) ((a) < (b) ? (a) : (b))
40
41 /* function versions of the above, in case they are needed */
42 double gsl_max (double a, double b);
43 double gsl_min (double a, double b);
44
45 /* inline-friendly strongly typed versions */
46 #ifdef HAVE_INLINE
47
48 INLINE_FUN int GSL_MAX_INT (int a, int b);
49 INLINE_FUN int GSL_MIN_INT (int a, int b);
50 INLINE_FUN double GSL_MAX_DBL (double a, double b);
51 INLINE_FUN double GSL_MIN_DBL (double a, double b);
52 INLINE_FUN long double GSL_MAX_LDBL (long double a, long double b);
53 INLINE_FUN long double GSL_MIN_LDBL (long double a, long double b);
54
55 INLINE_FUN int
56 GSL_MAX_INT (int a, int b)
57 {
58 return GSL_MAX (a, b);
59 }
60
61 INLINE_FUN int
62 GSL_MIN_INT (int a, int b)
63 {
64 return GSL_MIN (a, b);
65 }
66
67 INLINE_FUN double
68 GSL_MAX_DBL (double a, double b)
69 {
70 return GSL_MAX (a, b);
71 }
72
73 INLINE_FUN double
74 GSL_MIN_DBL (double a, double b)
75 {
76 return GSL_MIN (a, b);
77 }
78
79 INLINE_FUN long double
80 GSL_MAX_LDBL (long double a, long double b)
81 {
82 return GSL_MAX (a, b);
83 }
84
85 INLINE_FUN long double
86 GSL_MIN_LDBL (long double a, long double b)
87 {
88 return GSL_MIN (a, b);
89 }
90 #else
91 #define GSL_MAX_INT(a,b) GSL_MAX(a,b)
92 #define GSL_MIN_INT(a,b) GSL_MIN(a,b)
93 #define GSL_MAX_DBL(a,b) GSL_MAX(a,b)
94 #define GSL_MIN_DBL(a,b) GSL_MIN(a,b)
95 #define GSL_MAX_LDBL(a,b) GSL_MAX(a,b)
96 #define GSL_MIN_LDBL(a,b) GSL_MIN(a,b)
97 #endif /* HAVE_INLINE */
98
99 __END_DECLS
100
101 #endif /* __GSL_POW_INT_H__ */
2020
2121 #ifndef __GSL_MODE_H__
2222 #define __GSL_MODE_H__
23 #include <gsl/gsl_inline.h>
2324
2425 #undef __BEGIN_DECLS
2526 #undef __END_DECLS
6667 #define GSL_PREC_APPROX 2
6768
6869 #ifdef HAVE_INLINE
69 extern inline unsigned int GSL_MODE_PREC(gsl_mode_t mt);
70 INLINE_FUN unsigned int GSL_MODE_PREC(gsl_mode_t mt);
7071
71 extern inline unsigned int
72 INLINE_FUN unsigned int
7273 GSL_MODE_PREC(gsl_mode_t mt)
7374 { return (mt & (unsigned int)7); }
7475 #else /* HAVE_INLINE */
1818
1919 #ifndef __GSL_POW_INT_H__
2020 #define __GSL_POW_INT_H__
21 #include <gsl/gsl_inline.h>
2122
2223 #undef __BEGIN_DECLS
2324 #undef __END_DECLS
3132
3233 __BEGIN_DECLS
3334
35 INLINE_DECL double gsl_pow_2(const double x);
36 INLINE_DECL double gsl_pow_3(const double x);
37 INLINE_DECL double gsl_pow_4(const double x);
38 INLINE_DECL double gsl_pow_5(const double x);
39 INLINE_DECL double gsl_pow_6(const double x);
40 INLINE_DECL double gsl_pow_7(const double x);
41 INLINE_DECL double gsl_pow_8(const double x);
42 INLINE_DECL double gsl_pow_9(const double x);
43
3444 #ifdef HAVE_INLINE
35 extern inline double gsl_pow_2(const double x);
36 extern inline double gsl_pow_3(const double x);
37 extern inline double gsl_pow_4(const double x);
38 extern inline double gsl_pow_5(const double x);
39 extern inline double gsl_pow_6(const double x);
40 extern inline double gsl_pow_7(const double x);
41 extern inline double gsl_pow_8(const double x);
42 extern inline double gsl_pow_9(const double x);
43
44 extern inline double gsl_pow_2(const double x) { return x*x; }
45 extern inline double gsl_pow_3(const double x) { return x*x*x; }
46 extern inline double gsl_pow_4(const double x) { double x2 = x*x; return x2*x2; }
47 extern inline double gsl_pow_5(const double x) { double x2 = x*x; return x2*x2*x; }
48 extern inline double gsl_pow_6(const double x) { double x2 = x*x; return x2*x2*x2; }
49 extern inline double gsl_pow_7(const double x) { double x3 = x*x*x; return x3*x3*x; }
50 extern inline double gsl_pow_8(const double x) { double x2 = x*x; double x4 = x2*x2; return x4*x4; }
51 extern inline double gsl_pow_9(const double x) { double x3 = x*x*x; return x3*x3*x3; }
52 #else
53 double gsl_pow_2(const double x);
54 double gsl_pow_3(const double x);
55 double gsl_pow_4(const double x);
56 double gsl_pow_5(const double x);
57 double gsl_pow_6(const double x);
58 double gsl_pow_7(const double x);
59 double gsl_pow_8(const double x);
60 double gsl_pow_9(const double x);
45 INLINE_FUN double gsl_pow_2(const double x) { return x*x; }
46 INLINE_FUN double gsl_pow_3(const double x) { return x*x*x; }
47 INLINE_FUN double gsl_pow_4(const double x) { double x2 = x*x; return x2*x2; }
48 INLINE_FUN double gsl_pow_5(const double x) { double x2 = x*x; return x2*x2*x; }
49 INLINE_FUN double gsl_pow_6(const double x) { double x2 = x*x; return x2*x2*x2; }
50 INLINE_FUN double gsl_pow_7(const double x) { double x3 = x*x*x; return x3*x3*x; }
51 INLINE_FUN double gsl_pow_8(const double x) { double x2 = x*x; double x4 = x2*x2; return x4*x4; }
52 INLINE_FUN double gsl_pow_9(const double x) { double x3 = x*x*x; return x3*x3*x3; }
6153 #endif
6254
6355 double gsl_pow_int(double x, int n);
1414 __BEGIN_DECLS
1515
1616
17 #define GSL_VERSION "1.11"
17 #define GSL_VERSION "1.12"
1818
1919 GSL_VAR const char * gsl_version;
2020
0 2008-07-03 Brian Gough <bjg@hp2.network-theory.co.uk>
1
2 * Makefile.am (INCLUDES): use top_srcdir instead of top_builddir
3
04 2004-11-28 Brian Gough <bjg@network-theory.co.uk>
15
26 * init2d.c (make_uniform): compute uniform range without
11
22 pkginclude_HEADERS = gsl_histogram.h gsl_histogram2d.h
33
4 INCLUDES= -I$(top_builddir)
4 INCLUDES = -I$(top_srcdir)
55
66 libgslhistogram_la_SOURCES = add.c get.c init.c params.c reset.c file.c pdf.c gsl_histogram.h add2d.c get2d.c init2d.c params2d.c reset2d.c file2d.c pdf2d.c gsl_histogram2d.h calloc_range.c calloc_range2d.c copy.c copy2d.c maxval.c maxval2d.c oper.c oper2d.c stat.c stat2d.c
77
137137 LIBOBJS = @LIBOBJS@
138138 LIBS = @LIBS@
139139 LIBTOOL = @LIBTOOL@
140 LIPO = @LIPO@
140141 LN_S = @LN_S@
141142 LTLIBOBJS = @LTLIBOBJS@
142143 MAINT = @MAINT@
144145 MKDIR_P = @MKDIR_P@
145146 NM = @NM@
146147 NMEDIT = @NMEDIT@
148 OBJDUMP = @OBJDUMP@
147149 OBJEXT = @OBJEXT@
150 OTOOL = @OTOOL@
151 OTOOL64 = @OTOOL64@
148152 PACKAGE = @PACKAGE@
149153 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
150154 PACKAGE_NAME = @PACKAGE_NAME@
209213 top_srcdir = @top_srcdir@
210214 noinst_LTLIBRARIES = libgslhistogram.la
211215 pkginclude_HEADERS = gsl_histogram.h gsl_histogram2d.h
212 INCLUDES = -I$(top_builddir)
216 INCLUDES = -I$(top_srcdir)
213217 libgslhistogram_la_SOURCES = add.c get.c init.c params.c reset.c file.c pdf.c gsl_histogram.h add2d.c get2d.c init2d.c params2d.c reset2d.c file2d.c pdf2d.c gsl_histogram2d.h calloc_range.c calloc_range2d.c copy.c copy2d.c maxval.c maxval2d.c oper.c oper2d.c stat.c stat2d.c
214218 noinst_HEADERS = urand.c find.c find2d.c
215219 TESTS = $(check_PROGRAMS)
0 2008-07-03 Brian Gough <bjg@hp2.network-theory.co.uk>
1
2 * Makefile.am (INCLUDES): use top_srcdir instead of top_builddir
3
04 2007-06-21 Brian Gough <bjg@network-theory.co.uk>
15
26 * fp.c: allow universal binaries by checking __ppc__ and __i386__
55
66 noinst_HEADERS = fp-aix.c fp-darwin.c fp-darwin86.c fp-hpux.c fp-hpux11.c fp-irix.c fp-gnum68k.c fp-gnuppc.c fp-solaris.c fp-gnusparc.c fp-sunos4.c fp-tru64.c fp-unknown.c fp-gnux86.c fp-freebsd.c fp-os2emx.c fp-netbsd.c fp-openbsd.c fp-gnuc99.c endian.c standardize.c
77
8 INCLUDES= -I$(top_builddir)
8 INCLUDES = -I$(top_srcdir)
99
1010 TESTS = $(check_PROGRAMS)
1111 check_PROGRAMS = test
131131 LIBOBJS = @LIBOBJS@
132132 LIBS = @LIBS@
133133 LIBTOOL = @LIBTOOL@
134 LIPO = @LIPO@
134135 LN_S = @LN_S@
135136 LTLIBOBJS = @LTLIBOBJS@
136137 MAINT = @MAINT@
138139 MKDIR_P = @MKDIR_P@
139140 NM = @NM@
140141 NMEDIT = @NMEDIT@
142 OBJDUMP = @OBJDUMP@
141143 OBJEXT = @OBJEXT@
144 OTOOL = @OTOOL@
145 OTOOL64 = @OTOOL64@
142146 PACKAGE = @PACKAGE@
143147 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
144148 PACKAGE_NAME = @PACKAGE_NAME@
205209 pkginclude_HEADERS = gsl_ieee_utils.h
206210 libgslieeeutils_la_SOURCES = print.c make_rep.c gsl_ieee_utils.h env.c fp.c read.c
207211 noinst_HEADERS = fp-aix.c fp-darwin.c fp-darwin86.c fp-hpux.c fp-hpux11.c fp-irix.c fp-gnum68k.c fp-gnuppc.c fp-solaris.c fp-gnusparc.c fp-sunos4.c fp-tru64.c fp-unknown.c fp-gnux86.c fp-freebsd.c fp-os2emx.c fp-netbsd.c fp-openbsd.c fp-gnuc99.c endian.c standardize.c
208 INCLUDES = -I$(top_builddir)
212 INCLUDES = -I$(top_srcdir)
209213 TESTS = $(check_PROGRAMS)
210214 test_LDADD = libgslieeeutils.la ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la ../utils/libutils.la
211215 test_SOURCES = test.c
0 2008-07-03 Brian Gough <bjg@hp2.network-theory.co.uk>
1
2 * Makefile.am (INCLUDES): use top_srcdir instead of top_builddir
3
04 2003-01-12 Brian Gough <brian.gough@network-theory.co.uk>
15
26 * qawc.c (gsl_integration_qawc): fixed bisection condition to
00 noinst_LTLIBRARIES = libgslintegration.la
11
2 INCLUDES= -I$(top_builddir)
2 INCLUDES = -I$(top_srcdir)
33
44 libgslintegration_la_SOURCES = qk15.c qk21.c qk31.c qk41.c qk51.c qk61.c qk.c qng.c qng.h qag.c qags.c qagp.c workspace.c qcheb.c qawc.c qmomo.c qaws.c qmomof.c qawo.c qawf.c
55
134134 LIBOBJS = @LIBOBJS@
135135 LIBS = @LIBS@
136136 LIBTOOL = @LIBTOOL@
137 LIPO = @LIPO@
137138 LN_S = @LN_S@
138139 LTLIBOBJS = @LTLIBOBJS@
139140 MAINT = @MAINT@
141142 MKDIR_P = @MKDIR_P@
142143 NM = @NM@
143144 NMEDIT = @NMEDIT@
145 OBJDUMP = @OBJDUMP@
144146 OBJEXT = @OBJEXT@
147 OTOOL = @OTOOL@
148 OTOOL64 = @OTOOL64@
145149 PACKAGE = @PACKAGE@
146150 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
147151 PACKAGE_NAME = @PACKAGE_NAME@
205209 top_builddir = @top_builddir@
206210 top_srcdir = @top_srcdir@
207211 noinst_LTLIBRARIES = libgslintegration.la
208 INCLUDES = -I$(top_builddir)
212 INCLUDES = -I$(top_srcdir)
209213 libgslintegration_la_SOURCES = qk15.c qk21.c qk31.c qk41.c qk51.c qk61.c qk.c qng.c qng.h qag.c qags.c qagp.c workspace.c qcheb.c qawc.c qmomo.c qaws.c qmomof.c qawo.c qawf.c
210214 pkginclude_HEADERS = gsl_integration.h
211215 noinst_HEADERS = qpsrt.c qpsrt2.c qelg.c qc25c.c qc25s.c qc25f.c ptsort.c util.c err.c positivity.c append.c initialise.c set_initial.c reset.c
0 2008-09-05 Brian Gough <bjg@network-theory.co.uk>
1
2 * gsl_interp.h (gsl_interp_accel_find): corrected condition for
3 x>=xa.
4
5 2008-07-03 Brian Gough <bjg@hp2.network-theory.co.uk>
6
7 * gsl_interp.h: added inline declarations
8
9 * accel.c: moved gsl_interp_accel_find to inline.c
10
11 * bsearch.h bsearch.c: removed, moved to inline.c
12
13 * Makefile.am (INCLUDES): use top_srcdir instead of top_builddir
14
015 2007-03-14 Brian Gough <bjg@network-theory.co.uk>
116
217 * interp.c (gsl_interp_init): added check for monotonically
33
44 pkginclude_HEADERS = gsl_interp.h gsl_spline.h
55
6 libgslinterpolation_la_SOURCES = accel.c akima.c bsearch.c cspline.c interp.c linear.c integ_eval.h spline.c poly.c
6 libgslinterpolation_la_SOURCES = accel.c akima.c cspline.c interp.c linear.c integ_eval.h spline.c poly.c inline.c
77
8 noinst_HEADERS = bsearch.h
9
10 INCLUDES= -I$(top_builddir)
8 INCLUDES = -I$(top_srcdir)
119
1210 TESTS = $(check_PROGRAMS)
1311
3434 host_triplet = @host@
3535 check_PROGRAMS = test$(EXEEXT)
3636 subdir = interpolation
37 DIST_COMMON = $(noinst_HEADERS) $(pkginclude_HEADERS) \
38 $(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog TODO
37 DIST_COMMON = $(pkginclude_HEADERS) $(srcdir)/Makefile.am \
38 $(srcdir)/Makefile.in ChangeLog TODO
3939 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
4040 am__aclocal_m4_deps = $(top_srcdir)/configure.ac
4141 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
4545 CONFIG_CLEAN_FILES =
4646 LTLIBRARIES = $(noinst_LTLIBRARIES)
4747 libgslinterpolation_la_LIBADD =
48 am_libgslinterpolation_la_OBJECTS = accel.lo akima.lo bsearch.lo \
49 cspline.lo interp.lo linear.lo spline.lo poly.lo
48 am_libgslinterpolation_la_OBJECTS = accel.lo akima.lo cspline.lo \
49 interp.lo linear.lo spline.lo poly.lo inline.lo
5050 libgslinterpolation_la_OBJECTS = $(am_libgslinterpolation_la_OBJECTS)
5151 am_test_OBJECTS = test.$(OBJEXT)
5252 test_OBJECTS = $(am_test_OBJECTS)
7979 am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
8080 am__installdirs = "$(DESTDIR)$(pkgincludedir)"
8181 pkgincludeHEADERS_INSTALL = $(INSTALL_HEADER)
82 HEADERS = $(noinst_HEADERS) $(pkginclude_HEADERS)
82 HEADERS = $(pkginclude_HEADERS)
8383 ETAGS = etags
8484 CTAGS = ctags
8585 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
136136 LIBOBJS = @LIBOBJS@
137137 LIBS = @LIBS@
138138 LIBTOOL = @LIBTOOL@
139 LIPO = @LIPO@
139140 LN_S = @LN_S@
140141 LTLIBOBJS = @LTLIBOBJS@
141142 MAINT = @MAINT@
143144 MKDIR_P = @MKDIR_P@
144145 NM = @NM@
145146 NMEDIT = @NMEDIT@
147 OBJDUMP = @OBJDUMP@
146148 OBJEXT = @OBJEXT@
149 OTOOL = @OTOOL@
150 OTOOL64 = @OTOOL64@
147151 PACKAGE = @PACKAGE@
148152 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
149153 PACKAGE_NAME = @PACKAGE_NAME@
208212 top_srcdir = @top_srcdir@
209213 noinst_LTLIBRARIES = libgslinterpolation.la
210214 pkginclude_HEADERS = gsl_interp.h gsl_spline.h
211 libgslinterpolation_la_SOURCES = accel.c akima.c bsearch.c cspline.c interp.c linear.c integ_eval.h spline.c poly.c
212 noinst_HEADERS = bsearch.h
213 INCLUDES = -I$(top_builddir)
215 libgslinterpolation_la_SOURCES = accel.c akima.c cspline.c interp.c linear.c integ_eval.h spline.c poly.c inline.c
216 INCLUDES = -I$(top_srcdir)
214217 TESTS = $(check_PROGRAMS)
215218 test_LDADD = libgslinterpolation.la ../poly/libgslpoly.la ../linalg/libgsllinalg.la ../permutation/libgslpermutation.la ../blas/libgslblas.la ../matrix/libgslmatrix.la ../vector/libgslvector.la ../block/libgslblock.la ../complex/libgslcomplex.la ../cblas/libgslcblas.la ../ieee-utils/libgslieeeutils.la ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la ../utils/libutils.la
216219 test_SOURCES = test.c
4949 return GSL_SUCCESS;
5050 }
5151
52 #ifndef HIDE_INLINE_STATIC
53 size_t
54 gsl_interp_accel_find (gsl_interp_accel * a, const double xa[], size_t len, double x)
55 {
56 size_t x_index = a->cache;
57
58 if (x < xa[x_index])
59 {
60 a->miss_count++;
61 a->cache = gsl_interp_bsearch (xa, x, 0, x_index);
62 }
63 else if (x > xa[x_index + 1])
64 {
65 a->miss_count++;
66 a->cache = gsl_interp_bsearch (xa, x, x_index, len - 1);
67 }
68 else
69 {
70 a->hit_count++;
71 }
72
73 return a->cache;
74 }
75 #endif
76
7752 void
7853 gsl_interp_accel_free (gsl_interp_accel * a)
7954 {
+0
-47
interpolation/bsearch.c less more
0 /* interpolation/bsearch.c
1 *
2 * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 3 of the License, or (at
7 * your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18
19 /* Author: G. Jungman
20 */
21 #include <config.h>
22 #include <stdlib.h>
23 #include <gsl/gsl_interp.h>
24
25 #ifndef HIDE_INLINE_STATIC
26 size_t
27 gsl_interp_bsearch (
28 const double x_array[], double x,
29 size_t index_lo,
30 size_t index_hi
31 )
32 {
33 size_t ilo = index_lo;
34 size_t ihi = index_hi;
35 while (ihi > ilo + 1)
36 {
37 size_t i = (ihi + ilo) / 2;
38 if (x_array[i] > x)
39 ihi = i;
40 else
41 ilo = i;
42 }
43
44 return ilo;
45 }
46 #endif
+0
-80
interpolation/bsearch.h less more
0 /* interpolation/bsearch.h
1 *
2 * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2004 Gerard Jungman
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 3 of the License, or (at
7 * your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18
19 /* Author: G. Jungman
20 */
21 #ifndef __GSL_INTERP_BSEARCH_H__
22 #define __GSL_INTERP_BSEARCH_H__
23
24
25 /* Perform a binary search of an array of values.
26 *
27 * The parameters index_lo and index_hi provide an initial bracket,
28 * and it is assumed that index_lo < index_hi. The resulting index
29 * is guaranteed to be strictly less than index_hi and greater than
30 * or equal to index_lo, so that the implicit bracket [index, index+1]
31 * always corresponds to a region within the implicit value range of
32 * the value array.
33 *
34 * Note that this means the relationship of 'x' to x_array[index]
35 * and x_array[index+1] depends on the result region, i.e. the
36 * behaviour at the boundaries may not correspond to what you
37 * expect. We have the following complete specification of the
38 * behaviour.
39 * Suppose the input is x_array[] = { x0, x1, ..., xN }
40 * if ( x == x0 ) then index == 0
41 * if ( x > x0 && x <= x1 ) then index == 0, and sim. for other interior pts
42 * if ( x == xN ) then index == N-1
43 * if ( x > xN ) then index == N-1
44 * if ( x < x0 ) then index == 0
45 */
46 size_t
47 gsl_interp_bsearch(
48 const double x_array[], double x,
49 size_t index_lo,
50 size_t index_hi
51 );
52
53
54 #ifdef HAVE_INLINE
55 extern
56 inline
57 size_t
58 gsl_interp_bsearch(
59 const double x_array[], double x,
60 size_t index_lo,
61 size_t index_hi
62 )
63 {
64 size_t ilo = index_lo;
65 size_t ihi = index_hi;
66 while(ihi > ilo + 1) {
67 size_t i = (ihi + ilo)/2;
68 if(x_array[i] > x)
69 ihi = i;
70 else
71 ilo = i;
72 }
73
74 return ilo;
75 }
76 #endif /* HAVE_INLINE */
77
78
79 #endif /* __GSL_INTERP_BSEARCH_H__ */
2121 #ifndef __GSL_INTERP_H__
2222 #define __GSL_INTERP_H__
2323 #include <stdlib.h>
24 #include <gsl/gsl_inline.h>
2425 #include <gsl/gsl_types.h>
2526
2627 #undef __BEGIN_DECLS
8081 gsl_interp_accel *
8182 gsl_interp_accel_alloc(void);
8283
83 size_t
84 gsl_interp_accel_find(gsl_interp_accel * a, const double x_array[], size_t size, double x);
85
8684 int
8785 gsl_interp_accel_reset (gsl_interp_accel * a);
8886
147145 void
148146 gsl_interp_free(gsl_interp * interp);
149147
150 size_t gsl_interp_bsearch(const double x_array[], double x,
151 size_t index_lo, size_t index_hi);
152
153 #ifdef HAVE_INLINE
154 extern inline size_t
148 INLINE_DECL size_t
155149 gsl_interp_bsearch(const double x_array[], double x,
156150 size_t index_lo, size_t index_hi);
157151
158 extern inline size_t
152 #ifdef HAVE_INLINE
153
154 /* Perform a binary search of an array of values.
155 *
156 * The parameters index_lo and index_hi provide an initial bracket,
157 * and it is assumed that index_lo < index_hi. The resulting index
158 * is guaranteed to be strictly less than index_hi and greater than
159 * or equal to index_lo, so that the implicit bracket [index, index+1]
160 * always corresponds to a region within the implicit value range of
161 * the value array.
162 *
163 * Note that this means the relationship of 'x' to x_array[index]
164 * and x_array[index+1] depends on the result region, i.e. the
165 * behaviour at the boundaries may not correspond to what you
166 * expect. We have the following complete specification of the
167 * behaviour.
168 * Suppose the input is x_array[] = { x0, x1, ..., xN }
169 * if ( x == x0 ) then index == 0
170 * if ( x > x0 && x <= x1 ) then index == 0, and sim. for other interior pts
171 * if ( x == xN ) then index == N-1
172 * if ( x > xN ) then index == N-1
173 * if ( x < x0 ) then index == 0
174 */
175
176 INLINE_FUN size_t
159177 gsl_interp_bsearch(const double x_array[], double x,
160178 size_t index_lo, size_t index_hi)
161179 {
173191 }
174192 #endif
175193
194 INLINE_DECL size_t
195 gsl_interp_accel_find(gsl_interp_accel * a, const double x_array[], size_t size, double x);
196
176197 #ifdef HAVE_INLINE
177 extern inline size_t
198 INLINE_FUN size_t
178199 gsl_interp_accel_find(gsl_interp_accel * a, const double xa[], size_t len, double x)
179200 {
180201 size_t x_index = a->cache;
183204 a->miss_count++;
184205 a->cache = gsl_interp_bsearch(xa, x, 0, x_index);
185206 }
186 else if(x > xa[x_index + 1]) {
207 else if(x >= xa[x_index + 1]) {
187208 a->miss_count++;
188209 a->cache = gsl_interp_bsearch(xa, x, x_index, len-1);
189210 }
0 /* interpolation/bsearch.c
1 *
2 * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 3 of the License, or (at
7 * your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18
19 /* Author: G. Jungman
20 */
21 #include <config.h>
22 #include <stdlib.h>
23
24 /* Compile all the inline functions */
25
26 #define COMPILE_INLINE_STATIC
27 #include "build.h"
28 #include <gsl/gsl_interp.h>
29
7272 s = (index_result != 0);
7373 status += s;
7474 gsl_test (s, "out of bounds bsearch -");
75
76 /* Test the accelerator */
77
78 {
79 size_t i, j, k1 = 0, k2 = 0;
80 int t = 0;
81 double x = 0;
82 double r[16] = { -0.2, 0.0, 0.1, 0.7,
83 1.0, 1.3, 1.9,
84 2.0, 2.2, 2.7,
85 3.0, 3.1, 3.6,
86 4.0, 4.1, 4.9 };
87
88 gsl_interp_accel *a = gsl_interp_accel_alloc ();
89
90 /* Run through all the pairs of points */
91
92 while (k1 < 16 && k2 < 16) {
93
94 x = r[t ? k1 : k2];
95 t = !t;
96
97 if (t == 0) {
98 k1 = (k1 + 1) % 16;
99 if (k1 == 0) k2++;
100 };
101
102 i = gsl_interp_accel_find(a, x_array, 5, x);
103 j = gsl_interp_bsearch(x_array, x, 0, 4);
104 gsl_test(i != j, "(%u,%u) accelerated lookup vs bsearch (x = %g)", i, j, x);
105 }
106
107 gsl_interp_accel_free(a);
108 }
75109
76110 return status;
77111 }
0 2008-10-20 Brian Gough <bjg@network-theory.co.uk>
1
2 * svd.c (gsl_linalg_SV_decomp_jacobi): change use of
3 gsl_coerce_double to macro so it is not called unnecessarily
4
5 2008-08-30 Brian Gough <bjg@network-theory.co.uk>
6
7 * tridiag.c (solve_cyc_tridiag_nonsym): use x_stride when storing
8 in x[] (fixes bug #24162)
9
10 2008-08-26 Brian Gough <bjg@network-theory.co.uk>
11
12 * test.c (test_QRPT_update_dim): added tests for
13 gsl_linalg_QRPT_update
14
15 * qrpt.c (gsl_linalg_QRPT_update): handle rectangular matrices
16
17 2008-07-03 Brian Gough <bjg@hp2.network-theory.co.uk>
18
19 * Makefile.am (INCLUDES): use top_srcdir instead of top_builddir
20
21 2008-04-28 Brian Gough <bjg@network-theory.co.uk>
22
23 * bidiag.c (gsl_linalg_bidiag_unpack, gsl_linalg_bidiag_unpack2):
24 use new descending loop convention
25
26 * hermtd.c (gsl_linalg_hermtd_unpack): use new descending loop
27 convention
28
29 * hh.c (gsl_linalg_HH_svx): use new descending loop convention
30
31 * lq.c (gsl_linalg_LQ_vecQ, gsl_linalg_LQ_unpack): use new
32 descending loop convention
33
34 * qr.c (gsl_linalg_QR_Qvec, gsl_linalg_QR_unpack): use new
35 descending loop convention
36
37 * svd.c (gsl_linalg_SV_decomp_mod): use new descending loop
38 convention
39
40 * svdstep.c (chase_out_trailing_zero): use new descending loop
41 convention
42
43 * symmtd.c (gsl_linalg_symmtd_unpack): use new descending loop
44 convention
45
46 2008-04-03 Brian Gough <bjg@network-theory.co.uk>
47
48 * qr.c lq.c: removed unused definition of REAL
49
050 2007-08-27 Brian Gough <bjg@network-theory.co.uk>
151
252 * tridiag.c: use GSL_ERROR for failed allocation, signal
11
22 pkginclude_HEADERS = gsl_linalg.h
33
4 INCLUDES= -I$(top_builddir)
4 INCLUDES = -I$(top_srcdir)
55
66 libgsllinalg_la_SOURCES = multiply.c exponential.c tridiag.c tridiag.h lu.c luc.c hh.c qr.c qrpt.c lq.c ptlq.c svd.c householder.c householdercomplex.c hessenberg.c hesstri.c cholesky.c choleskyc.c symmtd.c hermtd.c bidiag.c balance.c balancemat.c
77
138138 LIBOBJS = @LIBOBJS@
139139 LIBS = @LIBS@
140140 LIBTOOL = @LIBTOOL@
141 LIPO = @LIPO@
141142 LN_S = @LN_S@
142143 LTLIBOBJS = @LTLIBOBJS@
143144 MAINT = @MAINT@
145146 MKDIR_P = @MKDIR_P@
146147 NM = @NM@
147148 NMEDIT = @NMEDIT@
149 OBJDUMP = @OBJDUMP@
148150 OBJEXT = @OBJEXT@
151 OTOOL = @OTOOL@
152 OTOOL64 = @OTOOL64@
149153 PACKAGE = @PACKAGE@
150154 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
151155 PACKAGE_NAME = @PACKAGE_NAME@
210214 top_srcdir = @top_srcdir@
211215 noinst_LTLIBRARIES = libgsllinalg.la
212216 pkginclude_HEADERS = gsl_linalg.h
213 INCLUDES = -I$(top_builddir)
217 INCLUDES = -I$(top_srcdir)
214218 libgsllinalg_la_SOURCES = multiply.c exponential.c tridiag.c tridiag.h lu.c luc.c hh.c qr.c qrpt.c lq.c ptlq.c svd.c householder.c householdercomplex.c hessenberg.c hesstri.c cholesky.c choleskyc.c symmtd.c hermtd.c bidiag.c balance.c balancemat.c
215219 noinst_HEADERS = givens.c apply_givens.c svdstep.c tridiag.h
216220 TESTS = $(check_PROGRAMS)
207207
208208 gsl_matrix_set_identity (V);
209209
210 for (i = N - 1; i > 0 && i--;)
210 for (i = N - 1; i-- > 0;)
211211 {
212212 /* Householder row transformation to accumulate V */
213213 gsl_vector_const_view r = gsl_matrix_const_row (A, i);
226226
227227 gsl_matrix_set_identity (U);
228228
229 for (j = N; j > 0 && j--;)
229 for (j = N; j-- > 0;)
230230 {
231231 /* Householder column transformation to accumulate U */
232232 gsl_vector_const_view c = gsl_matrix_const_column (A, j);
278278
279279 gsl_matrix_set_identity (V);
280280
281 for (i = N - 1; i > 0 && i--;)
281 for (i = N - 1; i-- > 0;)
282282 {
283283 /* Householder row transformation to accumulate V */
284284 gsl_vector_const_view r = gsl_matrix_const_row (A, i);
304304 /* Allow U to be unpacked into the same memory as A, copy
305305 diagonal into tau_U */
306306
307 for (j = N; j > 0 && j--;)
307 for (j = N; j-- > 0;)
308308 {
309309 /* Householder column transformation to accumulate U */
310310 double tj = gsl_vector_get (tau_U, j);
223223 }
224224 }
225225
226 /*
227 gsl_linalg_cholesky_invert()
228 Compute the inverse of a symmetric positive definite matrix in
229 Cholesky form.
230
231 Inputs: LLT - matrix in cholesky form on input
232 A^{-1} = L^{-t} L^{-1} on output
233
234 Return: success or error
235 */
236
237 int
238 gsl_linalg_cholesky_invert(gsl_matrix * LLT)
239 {
240 if (LLT->size1 != LLT->size2)
241 {
242 GSL_ERROR ("cholesky matrix must be square", GSL_ENOTSQR);
243 }
244 else
245 {
246 size_t N = LLT->size1;
247 size_t i, j;
248 double sum;
249 gsl_vector_view v1, v2;
250
251 /* invert the lower triangle of LLT */
252 for (i = 0; i < N; ++i)
253 {
254 double ajj;
255
256 j = N - i - 1;
257
258 gsl_matrix_set(LLT, j, j, 1.0 / gsl_matrix_get(LLT, j, j));
259 ajj = -gsl_matrix_get(LLT, j, j);
260
261 if (j < N - 1)
262 {
263 gsl_matrix_view m;
264
265 m = gsl_matrix_submatrix(LLT, j + 1, j + 1,
266 N - j - 1, N - j - 1);
267 v1 = gsl_matrix_subcolumn(LLT, j, j + 1, N - j - 1);
268
269 gsl_blas_dtrmv(CblasLower, CblasNoTrans, CblasNonUnit,
270 &m.matrix, &v1.vector);
271
272 gsl_blas_dscal(ajj, &v1.vector);
273 }
274 } /* for (i = 0; i < N; ++i) */
275
276 /*
277 * The lower triangle of LLT now contains L^{-1}. Now compute
278 * A^{-1} = L^{-t} L^{-1}
279 *
280 * The (ij) element of A^{-1} is column i of L^{-1} dotted into
281 * column j of L^{-1}
282 */
283
284 for (i = 0; i < N; ++i)
285 {
286 for (j = i + 1; j < N; ++j)
287 {
288 v1 = gsl_matrix_subcolumn(LLT, i, j, N - j);
289 v2 = gsl_matrix_subcolumn(LLT, j, j, N - j);
290
291 /* compute Ainv_{ij} = sum_k Linv_{ki} Linv_{kj} */
292 gsl_blas_ddot(&v1.vector, &v2.vector, &sum);
293
294 /* store in upper triangle */
295 gsl_matrix_set(LLT, i, j, sum);
296 }
297
298 /* now compute the diagonal element */
299 v1 = gsl_matrix_subcolumn(LLT, i, i, N - i);
300 gsl_blas_ddot(&v1.vector, &v1.vector, &sum);
301 gsl_matrix_set(LLT, i, i, sum);
302 }
303
304 /* copy the transposed upper triangle to the lower triangle */
305
306 for (j = 1; j < N; j++)
307 {
308 for (i = 0; i < j; i++)
309 {
310 double A_ij = gsl_matrix_get (LLT, i, j);
311 gsl_matrix_set (LLT, j, i, A_ij);
312 }
313 }
314
315 return GSL_SUCCESS;
316 }
317 } /* gsl_linalg_cholesky_invert() */
226318
227319 int
228320 gsl_linalg_cholesky_decomp_unit(gsl_matrix * A, gsl_vector * D)
428428 int gsl_linalg_cholesky_svx (const gsl_matrix * cholesky,
429429 gsl_vector * x);
430430
431 int gsl_linalg_cholesky_invert(gsl_matrix * cholesky);
431432
432433 /* Cholesky decomposition with unit-diagonal triangular parts.
433434 * A = L D L^T, where diag(L) = (1,1,...,1).
160160
161161 gsl_matrix_complex_set_identity (Q);
162162
163 for (i = N - 1; i > 0 && i--;)
163 for (i = N - 1; i-- > 0;)
164164 {
165165 gsl_complex ti = gsl_vector_complex_get (tau, i);
166166
159159
160160 /* Perform back-substitution. */
161161
162 for (i = N; i > 0 && i--;)
162 for (i = N; i-- > 0;)
163163 {
164164 REAL xi = gsl_vector_get (x, i);
165165 REAL sum = 0.0;
2727
2828 #include <gsl/gsl_linalg.h>
2929
30 #define REAL double
31
3230 #include "givens.c"
3331 #include "apply_givens.c"
3432
384382
385383 /* compute v Q^T */
386384
387 for (i = GSL_MIN (M, N); i > 0 && i--;)
385 for (i = GSL_MIN (M, N); i-- > 0;)
388386 {
389387 gsl_vector_const_view c = gsl_matrix_const_row (LQ, i);
390388 gsl_vector_const_view h = gsl_vector_const_subvector (&(c.vector),
426424
427425 gsl_matrix_set_identity (Q);
428426
429 for (i = GSL_MIN (M, N); i > 0 && i--;)
427 for (i = GSL_MIN (M, N); i-- > 0;)
430428 {
431429 gsl_vector_const_view c = gsl_matrix_const_row (LQ, i);
432430 gsl_vector_const_view h = gsl_vector_const_subvector (&c.vector,
496494 simultaneously applied to L, H = J_1^T ... J^T_(n-1) L
497495 so that H is upper Hessenberg. (12.5.2) */
498496
499 for (k = M - 1; k > 0; k--)
497 for (k = M - 1; k > 0; k--) /* loop from k = M-1 to 1 */
500498 {
501499 double c, s;
502500 double wk = gsl_vector_get (w, k);
2828
2929 #include <gsl/gsl_linalg.h>
3030
31 #define REAL double
32
3331 #include "givens.c"
3432 #include "apply_givens.c"
3533
384382
385383 /* compute Q^T v */
386384
387 for (i = GSL_MIN (M, N); i > 0 && i--;)
385 for (i = GSL_MIN (M, N); i-- > 0;)
388386 {
389387 gsl_vector_const_view c = gsl_matrix_const_column (QR, i);
390388 gsl_vector_const_view h = gsl_vector_const_subvector (&(c.vector),
460458
461459 gsl_matrix_set_identity (Q);
462460
463 for (i = GSL_MIN (M, N); i > 0 && i--;)
461 for (i = GSL_MIN (M, N); i-- > 0;)
464462 {
465463 gsl_vector_const_view c = gsl_matrix_const_column (QR, i);
466464 gsl_vector_const_view h = gsl_vector_const_subvector (&c.vector,
529527 simultaneously applied to R, H = J_1^T ... J^T_(n-1) R
530528 so that H is upper Hessenberg. (12.5.2) */
531529
532 for (k = M - 1; k > 0; k--)
530 for (k = M - 1; k > 0; k--) /* loop from k = M-1 to 1 */
533531 {
534532 double c, s;
535533 double wk = gsl_vector_get (w, k);
422422 const gsl_permutation * p,
423423 gsl_vector * w, const gsl_vector * v)
424424 {
425 if (Q->size1 != Q->size2 || R->size1 != R->size2)
426 {
427 return GSL_ENOTSQR;
428 }
429 else if (R->size1 != Q->size2 || v->size != Q->size2 || w->size != Q->size2)
430 {
431 return GSL_EBADLEN;
425 const size_t M = R->size1;
426 const size_t N = R->size2;
427
428 if (Q->size1 != M || Q->size2 != M)
429 {
430 GSL_ERROR ("Q matrix must be M x M if R is M x N", GSL_ENOTSQR);
431 }
432 else if (w->size != M)
433 {
434 GSL_ERROR ("w must be length M if R is M x N", GSL_EBADLEN);
435 }
436 else if (v->size != N)
437 {
438 GSL_ERROR ("v must be length N if R is M x N", GSL_EBADLEN);
432439 }
433440 else
434441 {
435442 size_t j, k;
436 const size_t M = Q->size1;
437 const size_t N = Q->size2;
438443 double w0;
439444
440445 /* Apply Given's rotations to reduce w to (|w|, 0, 0, ... , 0)
444449 simultaneously applied to R, H = J_1^T ... J^T_(n-1) R
445450 so that H is upper Hessenberg. (12.5.2) */
446451
447 for (k = N - 1; k > 0; k--)
452 for (k = M - 1; k > 0; k--)
448453 {
449454 double c, s;
450455 double wk = gsl_vector_get (w, k);
470475 /* Apply Givens transformations R' = G_(n-1)^T ... G_1^T H
471476 Equation 12.5.4 */
472477
473 for (k = 1; k < N; k++)
478 for (k = 1; k < GSL_MIN(M,N+1); k++)
474479 {
475480 double c, s;
476481 double diag = gsl_matrix_get (R, k - 1, k - 1);
478483
479484 create_givens (diag, offdiag, &c, &s);
480485 apply_givens_qr (M, N, Q, R, k - 1, k, c, s);
486
487 gsl_matrix_set (R, k, k - 1, 0.0); /* exact zero of G^T */
481488 }
482489
483490 return GSL_SUCCESS;
322322
323323 /* Convert A into an orthogonal matrix L */
324324
325 for (j = N; j > 0 && j--;)
325 for (j = N; j-- > 0;)
326326 {
327327 /* Householder column transformation to accumulate L */
328328 double tj = gsl_vector_get (S, j);
532532 abserr_a = gsl_vector_get(S,j);
533533 abserr_b = gsl_vector_get(S,k);
534534
535 sorted = (gsl_coerce_double(a) >= gsl_coerce_double(b));
536 orthog = (fabs (p) <= tolerance * gsl_coerce_double(a * b));
535 sorted = (GSL_COERCE_DBL(a) >= GSL_COERCE_DBL(b));
536 orthog = (fabs (p) <= tolerance * GSL_COERCE_DBL(a * b));
537537 noisya = (a < abserr_a);
538538 noisyb = (b < abserr_b);
539539
322322 x = gsl_vector_get (d, n - 2);
323323 y = gsl_vector_get (f, n - 2);
324324
325 for (k = n - 1; k > 0 && k--;)
325 for (k = n - 1; k-- > 0;)
326326 {
327327 create_givens (x, y, &c, &s);
328328
156156
157157 gsl_matrix_set_identity (Q);
158158
159 for (i = N - 2; i > 0 && i--;)
159 for (i = N - 2; i-- > 0;)
160160 {
161161 gsl_vector_const_view c = gsl_matrix_const_column (A, i);
162162 gsl_vector_const_view h = gsl_vector_const_subvector (&c.vector, i + 1, N - (i+1));
6161 int test_QRPT_decomp(void);
6262 int test_QR_update_dim(const gsl_matrix * m, double eps);
6363 int test_QR_update(void);
64 int test_QRPT_update_dim(const gsl_matrix * m, double eps);
65 int test_QRPT_update(void);
6466
6567 int test_LQ_solve_dim(const gsl_matrix * m, const double * actual, double eps);
6668 int test_LQ_solve(void);
9193 int test_cholesky_solve(void);
9294 int test_cholesky_decomp_dim(const gsl_matrix * m, double eps);
9395 int test_cholesky_decomp(void);
96 int test_cholesky_invert_dim(const gsl_matrix * m, double eps);
97 int test_cholesky_invert(void);
9498 int test_HH_solve_dim(const gsl_matrix * m, const double * actual, double eps);
9599 int test_HH_solve(void);
96100 int test_TDS_solve_dim(unsigned long dim, double d, double od, const double * actual, double eps);
122126 }
123127 }
124128
129
130 gsl_vector *
131 vector_alloc (size_t n)
132 {
133 size_t p[5] = {3, 5, 7, 11, 13};
134 static size_t k = 0;
135
136 size_t stride = p[k];
137 k = (k + 1) % 5;
138
139 {
140 gsl_block * b = gsl_block_alloc (n * stride);
141 gsl_vector * v = gsl_vector_alloc_from_block (b, 0, n, stride);
142 v->owner = 1;
143 return v;
144 }
145 }
146
147 void
148 vector_free (gsl_vector * v)
149 {
150 gsl_vector_free (v);
151 }
152
125153 gsl_matrix *
126154 create_hilbert_matrix(unsigned long size)
127155 {
12261254 int s = 0;
12271255 unsigned long i,j,k, M = m->size1, N = m->size2;
12281256
1229 gsl_vector * rhs = gsl_vector_alloc(N);
12301257 gsl_matrix * qr1 = gsl_matrix_alloc(M,N);
12311258 gsl_matrix * qr2 = gsl_matrix_alloc(M,N);
12321259 gsl_matrix * q1 = gsl_matrix_alloc(M,M);
12421269
12431270 gsl_matrix_memcpy(qr1,m);
12441271 gsl_matrix_memcpy(qr2,m);
1245 for(i=0; i<N; i++) gsl_vector_set(rhs, i, i+1.0);
1272
12461273 for(i=0; i<M; i++) gsl_vector_set(u, i, sin(i+1.0));
12471274 for(i=0; i<N; i++) gsl_vector_set(v, i, cos(i+2.0) + sin(i*i+3.0));
12481275
13141341 gsl_matrix_free(r1);
13151342 gsl_matrix_free(q2);
13161343 gsl_matrix_free(r2);
1317 gsl_vector_free(rhs);
13181344
13191345 return s;
13201346 }
13621388
13631389 f = test_QR_update_dim(vander12, 0.0005); /* FIXME: bad accuracy */
13641390 gsl_test(f, " QR_update vander(12)");
1391 s += f;
1392
1393 return s;
1394 }
1395
1396
1397 int
1398 test_QRPT_update_dim(const gsl_matrix * m, double eps)
1399 {
1400 int s = 0, signum;
1401 unsigned long i,j,k, M = m->size1, N = m->size2;
1402
1403 gsl_matrix * qr1 = gsl_matrix_alloc(M,N);
1404 gsl_matrix * qr2 = gsl_matrix_alloc(M,N);
1405 gsl_matrix * q1 = gsl_matrix_alloc(M,M);
1406 gsl_matrix * r1 = gsl_matrix_alloc(M,N);
1407 gsl_matrix * q2 = gsl_matrix_alloc(M,M);
1408 gsl_matrix * r2 = gsl_matrix_alloc(M,N);
1409 gsl_vector * d = gsl_vector_alloc(GSL_MIN(M,N));
1410 gsl_vector * u = gsl_vector_alloc(M);
1411 gsl_vector * v = gsl_vector_alloc(N);
1412 gsl_vector * w = gsl_vector_alloc(M);
1413
1414 gsl_vector * norm = gsl_vector_alloc(N);
1415 gsl_permutation * perm = gsl_permutation_alloc(N);
1416
1417 gsl_matrix_memcpy(qr1,m);
1418 gsl_matrix_memcpy(qr2,m);
1419 for(i=0; i<M; i++) gsl_vector_set(u, i, sin(i+1.0));
1420 for(i=0; i<N; i++) gsl_vector_set(v, i, cos(i+2.0) + sin(i*i+3.0));
1421
1422 for(i=0; i<M; i++)
1423 {
1424 double ui = gsl_vector_get(u, i);
1425 for(j=0; j<N; j++)
1426 {
1427 double vj = gsl_vector_get(v, j);
1428 double qij = gsl_matrix_get(qr1, i, j);
1429 gsl_matrix_set(qr1, i, j, qij + ui * vj);
1430 }
1431 }
1432
1433 s += gsl_linalg_QRPT_decomp(qr2, d, perm, &signum, norm);
1434 s += gsl_linalg_QR_unpack(qr2, d, q2, r2);
1435
1436 /* compute w = Q^T u */
1437
1438 for (j = 0; j < M; j++)
1439 {
1440 double sum = 0;
1441 for (i = 0; i < M; i++)
1442 sum += gsl_matrix_get (q2, i, j) * gsl_vector_get (u, i);
1443 gsl_vector_set (w, j, sum);
1444 }
1445
1446 s += gsl_linalg_QRPT_update(q2, r2, perm, w, v);
1447
1448 /* Now compute qr2 = q2 * r2 * p^T */
1449
1450 /* first multiply q2 * r2 */
1451
1452 for (i = 0; i < M; i++)
1453 {
1454 for (j = 0; j< N; j++)
1455 {
1456 double sum = 0;
1457 for (k = 0; k <= GSL_MIN(j,M-1); k++)
1458 {
1459 double qik = gsl_matrix_get(q2, i, k);
1460 double rkj = gsl_matrix_get(r2, k, j);
1461 sum += qik * rkj ;
1462 }
1463 gsl_matrix_set (qr2, i, j, sum);
1464 }
1465 }
1466
1467 /* now apply permutation to get qr2 = q2 * r2 * p^T */
1468
1469 for (i = 0; i < M ; i++)
1470 {
1471 gsl_vector_view r_i = gsl_matrix_row(qr2, i);
1472 gsl_permute_vector_inverse(perm, &r_i.vector);
1473 }
1474
1475
1476 for(i=0; i<M; i++) {
1477 for(j=0; j<N; j++) {
1478 double s1 = gsl_matrix_get(qr1, i, j);
1479 double s2 = gsl_matrix_get(qr2, i, j);
1480
1481 int foo = check(s1, s2, eps);
1482 if(foo) {
1483 printf("(%3lu,%3lu)[%lu,%lu]: %22.18g %22.18g\n", M, N, i,j, s1, s2);
1484 }
1485 s += foo;
1486 }
1487 }
1488
1489 gsl_permutation_free (perm);
1490 gsl_vector_free(norm);
1491 gsl_vector_free(d);
1492 gsl_vector_free(u);
1493 gsl_vector_free(v);
1494 gsl_vector_free(w);
1495 gsl_matrix_free(qr1);
1496 gsl_matrix_free(qr2);
1497 gsl_matrix_free(q1);
1498 gsl_matrix_free(r1);
1499 gsl_matrix_free(q2);
1500 gsl_matrix_free(r2);
1501
1502 return s;
1503 }
1504
1505 int test_QRPT_update(void)
1506 {
1507 int f;
1508 int s = 0;
1509
1510 f = test_QRPT_update_dim(m35, 2 * 512.0 * GSL_DBL_EPSILON);
1511 gsl_test(f, " QRPT_update m(3,5)");
1512 s += f;
1513
1514 f = test_QRPT_update_dim(m53, 2 * 512.0 * GSL_DBL_EPSILON);
1515 gsl_test(f, " QRPT_update m(5,3)");
1516 s += f;
1517
1518 f = test_QRPT_update_dim(hilb2, 2 * 512.0 * GSL_DBL_EPSILON);
1519 gsl_test(f, " QRPT_update hilbert(2)");
1520 s += f;
1521
1522 f = test_QRPT_update_dim(hilb3, 2 * 512.0 * GSL_DBL_EPSILON);
1523 gsl_test(f, " QRPT_update hilbert(3)");
1524 s += f;
1525
1526 f = test_QRPT_update_dim(hilb4, 2 * 1024.0 * GSL_DBL_EPSILON);
1527 gsl_test(f, " QRPT_update hilbert(4)");
1528 s += f;
1529
1530 f = test_QRPT_update_dim(hilb12, 2 * 1024.0 * GSL_DBL_EPSILON);
1531 gsl_test(f, " QRPT_update hilbert(12)");
1532 s += f;
1533
1534 f = test_QRPT_update_dim(vander2, 8.0 * GSL_DBL_EPSILON);
1535 gsl_test(f, " QRPT_update vander(2)");
1536 s += f;
1537
1538 f = test_QRPT_update_dim(vander3, 64.0 * GSL_DBL_EPSILON);
1539 gsl_test(f, " QRPT_update vander(3)");
1540 s += f;
1541
1542 f = test_QRPT_update_dim(vander4, 1024.0 * GSL_DBL_EPSILON);
1543 gsl_test(f, " QRPT_update vander(4)");
1544 s += f;
1545
1546 f = test_QRPT_update_dim(vander12, 0.0005); /* FIXME: bad accuracy */
1547 gsl_test(f, " QRPT_update vander(12)");
13651548 s += f;
13661549
13671550 return s;
30793262 return s;
30803263 }
30813264
3265 int
3266 test_cholesky_invert_dim(const gsl_matrix * m, double eps)
3267 {
3268 int s = 0;
3269 unsigned long i, j, N = m->size1;
3270
3271 gsl_matrix * v = gsl_matrix_alloc(N, N);
3272 gsl_matrix * c = gsl_matrix_alloc(N, N);
3273
3274 gsl_matrix_memcpy(v,m);
3275
3276 s += gsl_linalg_cholesky_decomp(v);
3277 s += gsl_linalg_cholesky_invert(v);
3278
3279 gsl_blas_dsymm(CblasLeft, CblasUpper, 1.0, m, v, 0.0, c);
3280
3281 /* c should be the identity matrix */
3282
3283 for (i = 0; i < N; ++i)
3284 {
3285 for (j = 0; j < N; ++j)
3286 {
3287 int foo;
3288 double cij = gsl_matrix_get(c, i, j);
3289 double expected;
3290
3291 if (i == j)
3292 expected = 1.0;
3293 else
3294 expected = 0.0;
3295
3296 foo = check(cij, expected, eps);
3297
3298 if (foo)
3299 printf("(%3lu,%3lu)[%lu,%lu]: %22.18g %22.18g\n", N, N, i,j, cij, expected);
3300
3301 s += foo;
3302 }
3303 }
3304
3305 gsl_matrix_free(v);
3306 gsl_matrix_free(c);
3307
3308 return s;
3309 }
3310
3311 int
3312 test_cholesky_invert(void)
3313 {
3314 int f;
3315 int s = 0;
3316
3317 f = test_cholesky_invert_dim(hilb2, 2 * 8.0 * GSL_DBL_EPSILON);
3318 gsl_test(f, " cholesky_invert hilbert(2)");
3319 s += f;
3320
3321 f = test_cholesky_invert_dim(hilb3, 2 * 64.0 * GSL_DBL_EPSILON);
3322 gsl_test(f, " cholesky_invert hilbert(3)");
3323 s += f;
3324
3325 f = test_cholesky_invert_dim(hilb4, 2 * 1024.0 * GSL_DBL_EPSILON);
3326 gsl_test(f, " cholesky_invert hilbert(4)");
3327 s += f;
3328
3329 return s;
3330 }
3331
30823332
30833333 int
30843334 test_cholesky_decomp_unit_dim(const gsl_matrix * m, double eps)
34033653 int s = 0;
34043654 unsigned long i;
34053655
3406 gsl_vector * offdiag = gsl_vector_alloc(dim-1);
3407 gsl_vector * diag = gsl_vector_alloc(dim);
3408 gsl_vector * rhs = gsl_vector_alloc(dim);
3409 gsl_vector * x = gsl_vector_alloc(dim);
3656 gsl_vector * offdiag = vector_alloc(dim-1);
3657 gsl_vector * diag = vector_alloc(dim);
3658 gsl_vector * rhs = vector_alloc(dim);
3659 gsl_vector * x = vector_alloc(dim);
34103660
34113661 for(i=0; i<dim; i++) {
34123662 gsl_vector_set(diag, i, d);
34283678 s += foo;
34293679 }
34303680
3431 gsl_vector_free(x);
3432 gsl_vector_free(rhs);
3433 gsl_vector_free(diag);
3434 gsl_vector_free(offdiag);
3681 vector_free(x);
3682 vector_free(rhs);
3683 vector_free(diag);
3684 vector_free(offdiag);
34353685
34363686 return s;
34373687 }
34413691 {
34423692 int f;
34433693 int s = 0;
3444
3694
34453695 {
34463696 double actual[] = {0.0, 2.0};
34473697 f = test_TDS_solve_dim(2, 1.0, 0.5, actual, 8.0 * GSL_DBL_EPSILON);
34673717 }
34683718
34693719 int
3470 test_TDS_cyc_solve_one(const unsigned long dim, const double * d, const double * od,
3471 const double * r, const double * actual, double eps)
3720 test_TDS_cyc_solve_one(const unsigned long dim,
3721 const double * d, const double * od,
3722 const double * r, const double * actual, double eps)
34723723 {
34733724 int s = 0;
34743725 unsigned long i;
34753726
3476 gsl_vector * offdiag = gsl_vector_alloc(dim);
3477 gsl_vector * diag = gsl_vector_alloc(dim);
3478 gsl_vector * rhs = gsl_vector_alloc(dim);
3479 gsl_vector * x = gsl_vector_alloc(dim);
3727 gsl_vector * offdiag = vector_alloc(dim);
3728 gsl_vector * diag = vector_alloc(dim);
3729 gsl_vector * rhs = vector_alloc(dim);
3730 gsl_vector * x = vector_alloc(dim);
34803731
34813732 for(i=0; i<dim; i++) {
34823733 gsl_vector_set(diag, i, d[i]);
34963747 s += foo;
34973748 }
34983749
3499 gsl_vector_free(x);
3500 gsl_vector_free(rhs);
3501 gsl_vector_free(diag);
3502 gsl_vector_free(offdiag);
3750 vector_free(x);
3751 vector_free(rhs);
3752 vector_free(diag);
3753 vector_free(offdiag);
35033754
35043755 return s;
35053756 }
35703821 int s = 0;
35713822 unsigned long i;
35723823
3573 gsl_vector * abovediag = gsl_vector_alloc(dim-1);
3574 gsl_vector * belowdiag = gsl_vector_alloc(dim-1);
3575 gsl_vector * diag = gsl_vector_alloc(dim);
3576 gsl_vector * rhs = gsl_vector_alloc(dim);
3577 gsl_vector * x = gsl_vector_alloc(dim);
3824 gsl_vector * abovediag = vector_alloc(dim-1);
3825 gsl_vector * belowdiag = vector_alloc(dim-1);
3826 gsl_vector * diag = vector_alloc(dim);
3827 gsl_vector * rhs = vector_alloc(dim);
3828 gsl_vector * x = vector_alloc(dim);
35783829
35793830 for(i=0; i<dim; i++) {
35803831 gsl_vector_set(diag, i, d);
35973848 s += foo;
35983849 }
35993850
3600 gsl_vector_free(x);
3601 gsl_vector_free(rhs);
3602 gsl_vector_free(diag);
3603 gsl_vector_free(abovediag);
3604 gsl_vector_free(belowdiag);
3851 vector_free(x);
3852 vector_free(rhs);
3853 vector_free(diag);
3854 vector_free(abovediag);
3855 vector_free(belowdiag);
36053856
36063857 return s;
36073858 }
36233874 actual[0] = 0.75;
36243875 actual[1] = 0.75;
36253876 actual[2] = 2.625;
3877
36263878 f = test_TDN_solve_dim(3, 1.0, 1.0/3.0, 1.0/2.0, actual, 2.0 * GSL_DBL_EPSILON);
36273879 gsl_test(f, " solve_TDN dim=2 B");
36283880 s += f;
36453897 int s = 0;
36463898 unsigned long i;
36473899
3648 gsl_vector * abovediag = gsl_vector_alloc(dim);
3649 gsl_vector * belowdiag = gsl_vector_alloc(dim);
3650 gsl_vector * diag = gsl_vector_alloc(dim);
3651 gsl_vector * rhs = gsl_vector_alloc(dim);
3652 gsl_vector * x = gsl_vector_alloc(dim);
3900 gsl_vector * abovediag = vector_alloc(dim);
3901 gsl_vector * belowdiag = vector_alloc(dim);
3902 gsl_vector * diag = vector_alloc(dim);
3903 gsl_vector * rhs = vector_alloc(dim);
3904 gsl_vector * x = vector_alloc(dim);
36533905
36543906 for(i=0; i<dim; i++) {
36553907 gsl_vector_set(diag, i, d);
36723924 s += foo;
36733925 }
36743926
3675 gsl_vector_free(x);
3676 gsl_vector_free(rhs);
3677 gsl_vector_free(diag);
3678 gsl_vector_free(abovediag);
3679 gsl_vector_free(belowdiag);
3927 vector_free(x);
3928 vector_free(rhs);
3929 vector_free(diag);
3930 vector_free(abovediag);
3931 vector_free(belowdiag);
36803932
36813933 return s;
36823934 }
37003952 actual[2] = 29.0/22.0;
37013953 actual[3] = -9.0/22.0;
37023954 actual[4] = 43.0/22.0;
3955
37033956 f = test_TDN_cyc_solve_dim(5, 3.0, 2.0, 1.0, actual, 66.0 * GSL_DBL_EPSILON);
37043957 gsl_test(f, " solve_TDN_cyc dim=5");
37053958 s += f;
38934146 gsl_test(test_QRPT_decomp(), "QRPT Decomposition");
38944147 gsl_test(test_QRPT_solve(), "QRPT Solve");
38954148 gsl_test(test_QRPT_QRsolve(), "QRPT QR Solve");
4149 gsl_test(test_QRPT_update(), "QRPT Rank-1 Update");
38964150 gsl_test(test_SV_decomp(), "Singular Value Decomposition");
38974151 gsl_test(test_SV_decomp_jacobi(), "Singular Value Decomposition (Jacobi)");
38984152 gsl_test(test_SV_decomp_mod(), "Singular Value Decomposition (Mod)");
39004154 gsl_test(test_cholesky_decomp(), "Cholesky Decomposition");
39014155 gsl_test(test_cholesky_decomp_unit(), "Cholesky Decomposition [unit triangular]");
39024156 gsl_test(test_cholesky_solve(), "Cholesky Solve");
4157 gsl_test(test_cholesky_invert(), "Cholesky Inverse");
39034158 gsl_test(test_choleskyc_decomp(), "Complex Cholesky Decomposition");
39044159 gsl_test(test_choleskyc_solve(), "Complex Cholesky Solve");
39054160 gsl_test(test_HH_solve(), "Householder solve");
39414196 gsl_matrix_free (inf5);
39424197 gsl_matrix_free (nan5);
39434198
4199 gsl_matrix_free (dblmin3);
4200 gsl_matrix_free (dblmin5);
4201
39444202 exit (gsl_test_summary());
39454203 }
399399 {
400400 size_t i, j;
401401 w[N-1] = zu[N-1]/alpha[N-1];
402 x[N-1] = zb[N-1]/alpha[N-1];
402 x[x_stride*(N-1)] = zb[N-1]/alpha[N-1];
403403 for (i = N - 2, j = 0; j <= N - 2; j++, i--)
404404 {
405405 w[i] = (zu[i] - abovediag[a_stride*i] * w[i+1])/alpha[i];
419419 {
420420 size_t i;
421421 for (i = 0; i < N; i++)
422 x[i] -= vx/(1 + vw)*w[i];
422 x[i*x_stride] -= vx/(1 + vw)*w[i];
423423 }
424424 }
425425 }
+2142
-1486
ltmain.sh less more
00 # Generated from ltmain.m4sh.
11
2 # ltmain.sh (GNU libtool) 2.2
2 # ltmain.sh (GNU libtool) 2.2.6
33 # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
44
55 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc.
6464 # compiler: $LTCC
6565 # compiler flags: $LTCFLAGS
6666 # linker: $LD (gnu? $with_gnu_ld)
67 # $progname: (GNU libtool) 2.2
67 # $progname: (GNU libtool) 2.2.6
6868 # automake: $automake_version
6969 # autoconf: $autoconf_version
7070 #
7272
7373 PROGRAM=ltmain.sh
7474 PACKAGE=libtool
75 VERSION=2.2
75 VERSION=2.2.6
7676 TIMESTAMP=""
77 package_revision=1.2599
77 package_revision=1.3012
7878
7979 # Be Bourne compatible
8080 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
9494 # Only set LANG and LC_ALL to C if already set.
9595 # These must not be set unconditionally because not all systems understand
9696 # e.g. LANG=C (notably SCO).
97 lt_user_locale=
98 lt_safe_locale=
9799 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
98100 do
99101 eval "if test \"\${$lt_var+set}\" = set; then
100102 save_$lt_var=\$$lt_var
101103 $lt_var=C
102104 export $lt_var
105 lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
106 lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
103107 fi"
104108 done
105109
119123 : ${MKDIR="mkdir"}
120124 : ${MV="mv -f"}
121125 : ${RM="rm -f"}
122 : ${SED="/usr/bin/sed"}
126 : ${SED="/opt/local/bin/gsed"}
123127 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
124128 : ${Xsed="$SED -e 1s/^X//"}
125129
138142
139143 dirname="s,/[^/]*$,,"
140144 basename="s,^.*/,,"
145
146 # func_dirname_and_basename file append nondir_replacement
147 # perform func_basename and func_dirname in a single function
148 # call:
149 # dirname: Compute the dirname of FILE. If nonempty,
150 # add APPEND to the result, otherwise set result
151 # to NONDIR_REPLACEMENT.
152 # value returned in "$func_dirname_result"
153 # basename: Compute filename of FILE.
154 # value retuned in "$func_basename_result"
155 # Implementation must be kept synchronized with func_dirname
156 # and func_basename. For efficiency, we do not delegate to
157 # those functions but instead duplicate the functionality here.
158 func_dirname_and_basename ()
159 {
160 # Extract subdirectory from the argument.
161 func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
162 if test "X$func_dirname_result" = "X${1}"; then
163 func_dirname_result="${3}"
164 else
165 func_dirname_result="$func_dirname_result${2}"
166 fi
167 func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
168 }
169
170 # Generated shell functions inserted here.
141171
142172 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
143173 # is ksh but when the shell is invoked as "sh" and the current value of
149179 # The name of this program:
150180 # In the unlikely event $progname began with a '-', it would play havoc with
151181 # func_echo (imagine progname=-n), so we prepend ./ in that case:
152 progname=`$ECHO "X$progpath" | $Xsed -e "$basename" -e 's,^-,./-,'`
182 func_dirname_and_basename "$progpath"
183 progname=$func_basename_result
184 case $progname in
185 -*) progname=./$progname ;;
186 esac
153187
154188 # Make sure we have an absolute path for reexecution:
155189 case $progpath in
156190 [\\/]*|[A-Za-z]:\\*) ;;
157191 *[\\/]*)
158 progdir=`$ECHO "X$progpath" | $Xsed -e "$dirname"`
192 progdir=$func_dirname_result
159193 progdir=`cd "$progdir" && pwd`
160194 progpath="$progdir/$progname"
161195 ;;
201235 opt_help=false
202236 opt_quiet=false
203237 opt_verbose=false
238 opt_warning=:
204239
205240 # func_echo arg...
206241 # Echo program name prefixed message, along with the current mode
233268 # Echo program name prefixed warning message to standard error.
234269 func_warning ()
235270 {
236 $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
271 $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
272
273 # bash bug again:
274 :
237275 }
238276
239277 # func_fatal_error arg...
417455 if ${opt_dry_run-false}; then :; else
418456 eval "$my_cmd"
419457 my_status=$?
458 if test "$my_status" -eq 0; then :; else
459 eval "(exit $my_status); $my_fail_exp"
460 fi
461 fi
462 }
463
464
465 # func_show_eval_locale cmd [fail_exp]
466 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
467 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
468 # is given, then evaluate it. Use the saved locale for evaluation.
469 func_show_eval_locale ()
470 {
471 my_cmd="$1"
472 my_fail_exp="${2-:}"
473
474 ${opt_silent-false} || {
475 func_quote_for_expand "$my_cmd"
476 eval "func_echo $func_quote_for_expand_result"
477 }
478
479 if ${opt_dry_run-false}; then :; else
480 eval "$lt_user_locale
481 $my_cmd"
482 my_status=$?
483 eval "$lt_safe_locale"
420484 if test "$my_status" -eq 0; then :; else
421485 eval "(exit $my_status); $my_fail_exp"
422486 fi
626690 ;;
627691 esac
628692 }
629
630
631 func_mode_help ()
632 {
633 # We need to display help for each of the modes.
634 case $mode in
635 "")
636 # Generic help is extracted from the usage comments
637 # at the start of this file.
638 func_help
639 ;;
640
641 clean)
642 $ECHO \
643 "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
644
645 Remove files from the build directory.
646
647 RM is the name of the program to use to delete files associated with each FILE
648 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
649 to RM.
650
651 If FILE is a libtool library, object or program, all the files associated
652 with it are deleted. Otherwise, only FILE itself is deleted using RM."
653 ;;
654
655 compile)
656 $ECHO \
657 "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
658
659 Compile a source file into a libtool library object.
660
661 This mode accepts the following additional options:
662
663 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
664 -no-suppress do not suppress compiler output for multiple passes
665 -prefer-pic try to building PIC objects only
666 -prefer-non-pic try to building non-PIC objects only
667 -shared do not build a \`.o' file suitable for static linking
668 -static only build a \`.o' file suitable for static linking
669
670 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
671 from the given SOURCEFILE.
672
673 The output file name is determined by removing the directory component from
674 SOURCEFILE, then substituting the C source code suffix \`.c' with the
675 library object suffix, \`.lo'."
676 ;;
677
678 execute)
679 $ECHO \
680 "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
681
682 Automatically set library path, then run a program.
683
684 This mode accepts the following additional options:
685
686 -dlopen FILE add the directory containing FILE to the library path
687
688 This mode sets the library path environment variable according to \`-dlopen'
689 flags.
690
691 If any of the ARGS are libtool executable wrappers, then they are translated
692 into their corresponding uninstalled binary, and any of their required library
693 directories are added to the library path.
694
695 Then, COMMAND is executed, with ARGS as arguments."
696 ;;
697
698 finish)
699 $ECHO \
700 "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
701
702 Complete the installation of libtool libraries.
703
704 Each LIBDIR is a directory that contains libtool libraries.
705
706 The commands that this mode executes may require superuser privileges. Use
707 the \`--dry-run' option if you just want to see what would be executed."
708 ;;
709
710 install)
711 $ECHO \
712 "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
713
714 Install executables or libraries.
715
716 INSTALL-COMMAND is the installation command. The first component should be
717 either the \`install' or \`cp' program.
718
719 The following components of INSTALL-COMMAND are treated specially:
720
721 -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation
722
723 The rest of the components are interpreted as arguments to that command (only
724 BSD-compatible install options are recognized)."
725 ;;
726
727 link)
728 $ECHO \
729 "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
730
731 Link object files or libraries together to form another library, or to
732 create an executable program.
733
734 LINK-COMMAND is a command using the C compiler that you would use to create
735 a program from several object files.
736
737 The following components of LINK-COMMAND are treated specially:
738
739 -all-static do not do any dynamic linking at all
740 -avoid-version do not add a version suffix if possible
741 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
742 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
743 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
744 -export-symbols SYMFILE
745 try to export only the symbols listed in SYMFILE
746 -export-symbols-regex REGEX
747 try to export only the symbols matching REGEX
748 -LLIBDIR search LIBDIR for required installed libraries
749 -lNAME OUTPUT-FILE requires the installed library libNAME
750 -module build a library that can dlopened
751 -no-fast-install disable the fast-install mode
752 -no-install link a not-installable executable
753 -no-undefined declare that a library does not refer to external symbols
754 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
755 -objectlist FILE Use a list of object files found in FILE to specify objects
756 -precious-files-regex REGEX
757 don't remove output files matching REGEX
758 -release RELEASE specify package release information
759 -rpath LIBDIR the created library will eventually be installed in LIBDIR
760 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
761 -shared only do dynamic linking of libtool libraries
762 -shrext SUFFIX override the standard shared library file extension
763 -static do not do any dynamic linking of uninstalled libtool libraries
764 -static-libtool-libs
765 do not do any dynamic linking of libtool libraries
766 -version-info CURRENT[:REVISION[:AGE]]
767 specify library version info [each variable defaults to 0]
768 -weak LIBNAME declare that the target provides the LIBNAME interface
769
770 All other options (arguments beginning with \`-') are ignored.
771
772 Every other argument is treated as a filename. Files ending in \`.la' are
773 treated as uninstalled libtool libraries, other files are standard or library
774 object files.
775
776 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
777 only library objects (\`.lo' files) may be specified, and \`-rpath' is
778 required, except when creating a convenience library.
779
780 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
781 using \`ar' and \`ranlib', or on Windows using \`lib'.
782
783 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
784 is created, otherwise an executable program is created."
785 ;;
786
787 uninstall)
788 $ECHO \
789 "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
790
791 Remove libraries from an installation directory.
792
793 RM is the name of the program to use to delete files associated with each FILE
794 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
795 to RM.
796
797 If FILE is a libtool library, all the files associated with it are deleted.
798 Otherwise, only FILE itself is deleted using RM."
799 ;;
800
801 *)
802 func_fatal_help "invalid operation mode \`$mode'"
803 ;;
804 esac
805
806 $ECHO
807 $ECHO "Try \`$progname --help' for more information about other modes."
808
809 exit $?
810 }
811
812 # Generated shell functions inserted here.
813
814693
815694 # Parse options once, thoroughly. This comes as soon as possible in
816695 # the script to make things like `libtool --version' happen quickly.
923802 esac
924803 done
925804
926 # Now that we've collected a possible --mode arg, show help if necessary
927 $opt_help && func_mode_help
928805
929806 case $host in
930 *cygwin* | *mingw* | *pw32*)
807 *cygwin* | *mingw* | *pw32* | *cegcc*)
931808 # don't eliminate duplications in $postdeps and $predeps
932809 opt_duplicate_compiler_generated_deps=:
933810 ;;
981858 ## Main. ##
982859 ## ----------- ##
983860
984 {
861 $opt_help || {
985862 # Sanity checks first:
986863 func_check_version_match
987864
1015892 # determined imposters.
1016893 func_lalib_p ()
1017894 {
1018 $SED -e 4q "$1" 2>/dev/null \
1019 | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
895 test -f "$1" &&
896 $SED -e 4q "$1" 2>/dev/null \
897 | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
1020898 }
1021899
1022900 # func_lalib_unsafe_p file
1029907 func_lalib_unsafe_p ()
1030908 {
1031909 lalib_p=no
1032 if test -r "$1" && exec 5<&1 <"$1"; then
910 if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
1033911 for lalib_p_l in 1 2 3 4
1034912 do
1035913 read lalib_p_line
1037915 \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
1038916 esac
1039917 done
1040 exec 1<&5 5<&-
918 exec 0<&5 5<&-
1041919 fi
1042920 test "$lalib_p" = yes
1043921 }
1120998 *) . "./$1" ;;
1121999 esac
11221000 }
1123
1124
1125 # func_win32_libid arg
1126 # return the library type of file 'arg'
1127 #
1128 # Need a lot of goo to handle *both* DLLs and import libs
1129 # Has to be a shell function in order to 'eat' the argument
1130 # that is supplied when $file_magic_command is called.
1131 func_win32_libid ()
1132 {
1133 $opt_debug
1134 win32_libid_type="unknown"
1135 win32_fileres=`file -L $1 2>/dev/null`
1136 case $win32_fileres in
1137 *ar\ archive\ import\ library*) # definitely import
1138 win32_libid_type="x86 archive import"
1139 ;;
1140 *ar\ archive*) # could be an import, or static
1141 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
1142 $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
1143 win32_nmres=`eval $NM -f posix -A $1 |
1144 $SED -n -e '
1145 1,100{
1146 / I /{
1147 s,.*,import,
1148 p
1149 q
1150 }
1151 }'`
1152 case $win32_nmres in
1153 import*) win32_libid_type="x86 archive import";;
1154 *) win32_libid_type="x86 archive static";;
1155 esac
1156 fi
1157 ;;
1158 *DLL*)
1159 win32_libid_type="x86 DLL"
1160 ;;
1161 *executable*) # but shell scripts are "executable" too...
1162 case $win32_fileres in
1163 *MS\ Windows\ PE\ Intel*)
1164 win32_libid_type="x86 DLL"
1165 ;;
1166 esac
1167 ;;
1168 esac
1169 $ECHO "$win32_libid_type"
1170 }
1171
11721001
11731002
11741003 # func_infer_tag arg
12301059
12311060
12321061
1062 # func_write_libtool_object output_name pic_name nonpic_name
1063 # Create a libtool object file (analogous to a ".la" file),
1064 # but don't create it if we're doing a dry run.
1065 func_write_libtool_object ()
1066 {
1067 write_libobj=${1}
1068 if test "$build_libtool_libs" = yes; then
1069 write_lobj=\'${2}\'
1070 else
1071 write_lobj=none
1072 fi
1073
1074 if test "$build_old_libs" = yes; then
1075 write_oldobj=\'${3}\'
1076 else
1077 write_oldobj=none
1078 fi
1079
1080 $opt_dry_run || {
1081 cat >${write_libobj}T <<EOF
1082 # $write_libobj - a libtool object file
1083 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
1084 #
1085 # Please DO NOT delete this file!
1086 # It is necessary for linking the library.
1087
1088 # Name of the PIC object.
1089 pic_object=$write_lobj
1090
1091 # Name of the non-PIC object
1092 non_pic_object=$write_oldobj
1093
1094 EOF
1095 $MV "${write_libobj}T" "${write_libobj}"
1096 }
1097 }
1098
1099 # func_mode_compile arg...
1100 func_mode_compile ()
1101 {
1102 $opt_debug
1103 # Get the compilation command and the source file.
1104 base_compile=
1105 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
1106 suppress_opt=yes
1107 suppress_output=
1108 arg_mode=normal
1109 libobj=
1110 later=
1111 pie_flag=
1112
1113 for arg
1114 do
1115 case $arg_mode in
1116 arg )
1117 # do not "continue". Instead, add this to base_compile
1118 lastarg="$arg"
1119 arg_mode=normal
1120 ;;
1121
1122 target )
1123 libobj="$arg"
1124 arg_mode=normal
1125 continue
1126 ;;
1127
1128 normal )
1129 # Accept any command-line options.
1130 case $arg in
1131 -o)
1132 test -n "$libobj" && \
1133 func_fatal_error "you cannot specify \`-o' more than once"
1134 arg_mode=target
1135 continue
1136 ;;
1137
1138 -pie | -fpie | -fPIE)
1139 pie_flag="$pie_flag $arg"
1140 continue
1141 ;;
1142
1143 -shared | -static | -prefer-pic | -prefer-non-pic)
1144 later="$later $arg"
1145 continue
1146 ;;
1147
1148 -no-suppress)
1149 suppress_opt=no
1150 continue
1151 ;;
1152
1153 -Xcompiler)
1154 arg_mode=arg # the next one goes into the "base_compile" arg list
1155 continue # The current "srcfile" will either be retained or
1156 ;; # replaced later. I would guess that would be a bug.
1157
1158 -Wc,*)
1159 func_stripname '-Wc,' '' "$arg"
1160 args=$func_stripname_result
1161 lastarg=
1162 save_ifs="$IFS"; IFS=','
1163 for arg in $args; do
1164 IFS="$save_ifs"
1165 func_quote_for_eval "$arg"
1166 lastarg="$lastarg $func_quote_for_eval_result"
1167 done
1168 IFS="$save_ifs"
1169 func_stripname ' ' '' "$lastarg"
1170 lastarg=$func_stripname_result
1171
1172 # Add the arguments to base_compile.
1173 base_compile="$base_compile $lastarg"
1174 continue
1175 ;;
1176
1177 *)
1178 # Accept the current argument as the source file.
1179 # The previous "srcfile" becomes the current argument.
1180 #
1181 lastarg="$srcfile"
1182 srcfile="$arg"
1183 ;;
1184 esac # case $arg
1185 ;;
1186 esac # case $arg_mode
1187
1188 # Aesthetically quote the previous argument.
1189 func_quote_for_eval "$lastarg"
1190 base_compile="$base_compile $func_quote_for_eval_result"
1191 done # for arg
1192
1193 case $arg_mode in
1194 arg)
1195 func_fatal_error "you must specify an argument for -Xcompile"
1196 ;;
1197 target)
1198 func_fatal_error "you must specify a target with \`-o'"
1199 ;;
1200 *)
1201 # Get the name of the library object.
1202 test -z "$libobj" && {
1203 func_basename "$srcfile"
1204 libobj="$func_basename_result"
1205 }
1206 ;;
1207 esac
1208
1209 # Recognize several different file suffixes.
1210 # If the user specifies -o file.o, it is replaced with file.lo
1211 case $libobj in
1212 *.[cCFSifmso] | \
1213 *.ada | *.adb | *.ads | *.asm | \
1214 *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
1215 *.[fF][09]? | *.for | *.java | *.obj | *.sx)
1216 func_xform "$libobj"
1217 libobj=$func_xform_result
1218 ;;
1219 esac
1220
1221 case $libobj in
1222 *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
1223 *)
1224 func_fatal_error "cannot determine name of library object from \`$libobj'"
1225 ;;
1226 esac
1227
1228 func_infer_tag $base_compile
1229
1230 for arg in $later; do
1231 case $arg in
1232 -shared)
1233 test "$build_libtool_libs" != yes && \
1234 func_fatal_configuration "can not build a shared library"
1235 build_old_libs=no
1236 continue
1237 ;;
1238
1239 -static)
1240 build_libtool_libs=no
1241 build_old_libs=yes
1242 continue
1243 ;;
1244
1245 -prefer-pic)
1246 pic_mode=yes
1247 continue
1248 ;;
1249
1250 -prefer-non-pic)
1251 pic_mode=no
1252 continue
1253 ;;
1254 esac
1255 done
1256
1257 func_quote_for_eval "$libobj"
1258 test "X$libobj" != "X$func_quote_for_eval_result" \
1259 && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
1260 && func_warning "libobj name \`$libobj' may not contain shell special characters."
1261 func_dirname_and_basename "$obj" "/" ""
1262 objname="$func_basename_result"
1263 xdir="$func_dirname_result"
1264 lobj=${xdir}$objdir/$objname
1265
1266 test -z "$base_compile" && \
1267 func_fatal_help "you must specify a compilation command"
1268
1269 # Delete any leftover library objects.
1270 if test "$build_old_libs" = yes; then
1271 removelist="$obj $lobj $libobj ${libobj}T"
1272 else
1273 removelist="$lobj $libobj ${libobj}T"
1274 fi
1275
1276 # On Cygwin there's no "real" PIC flag so we must build both object types
1277 case $host_os in
1278 cygwin* | mingw* | pw32* | os2* | cegcc*)
1279 pic_mode=default
1280 ;;
1281 esac
1282 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
1283 # non-PIC code in shared libraries is not supported
1284 pic_mode=default
1285 fi
1286
1287 # Calculate the filename of the output object if compiler does
1288 # not support -o with -c
1289 if test "$compiler_c_o" = no; then
1290 output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
1291 lockfile="$output_obj.lock"
1292 else
1293 output_obj=
1294 need_locks=no
1295 lockfile=
1296 fi
1297
1298 # Lock this critical section if it is needed
1299 # We use this script file to make the link, it avoids creating a new file
1300 if test "$need_locks" = yes; then
1301 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
1302 func_echo "Waiting for $lockfile to be removed"
1303 sleep 2
1304 done
1305 elif test "$need_locks" = warn; then
1306 if test -f "$lockfile"; then
1307 $ECHO "\
1308 *** ERROR, $lockfile exists and contains:
1309 `cat $lockfile 2>/dev/null`
1310
1311 This indicates that another process is trying to use the same
1312 temporary object file, and libtool could not work around it because
1313 your compiler does not support \`-c' and \`-o' together. If you
1314 repeat this compilation, it may succeed, by chance, but you had better
1315 avoid parallel builds (make -j) in this platform, or get a better
1316 compiler."
1317
1318 $opt_dry_run || $RM $removelist
1319 exit $EXIT_FAILURE
1320 fi
1321 removelist="$removelist $output_obj"
1322 $ECHO "$srcfile" > "$lockfile"
1323 fi
1324
1325 $opt_dry_run || $RM $removelist
1326 removelist="$removelist $lockfile"
1327 trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
1328
1329 if test -n "$fix_srcfile_path"; then
1330 eval srcfile=\"$fix_srcfile_path\"
1331 fi
1332 func_quote_for_eval "$srcfile"
1333 qsrcfile=$func_quote_for_eval_result
1334
1335 # Only build a PIC object if we are building libtool libraries.
1336 if test "$build_libtool_libs" = yes; then
1337 # Without this assignment, base_compile gets emptied.
1338 fbsd_hideous_sh_bug=$base_compile
1339
1340 if test "$pic_mode" != no; then
1341 command="$base_compile $qsrcfile $pic_flag"
1342 else
1343 # Don't build PIC code
1344 command="$base_compile $qsrcfile"
1345 fi
1346
1347 func_mkdir_p "$xdir$objdir"
1348
1349 if test -z "$output_obj"; then
1350 # Place PIC objects in $objdir
1351 command="$command -o $lobj"
1352 fi
1353
1354 func_show_eval_locale "$command" \
1355 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
1356
1357 if test "$need_locks" = warn &&
1358 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1359 $ECHO "\
1360 *** ERROR, $lockfile contains:
1361 `cat $lockfile 2>/dev/null`
1362
1363 but it should contain:
1364 $srcfile
1365
1366 This indicates that another process is trying to use the same
1367 temporary object file, and libtool could not work around it because
1368 your compiler does not support \`-c' and \`-o' together. If you
1369 repeat this compilation, it may succeed, by chance, but you had better
1370 avoid parallel builds (make -j) in this platform, or get a better
1371 compiler."
1372
1373 $opt_dry_run || $RM $removelist
1374 exit $EXIT_FAILURE
1375 fi
1376
1377 # Just move the object if needed, then go on to compile the next one
1378 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
1379 func_show_eval '$MV "$output_obj" "$lobj"' \
1380 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
1381 fi
1382
1383 # Allow error messages only from the first compilation.
1384 if test "$suppress_opt" = yes; then
1385 suppress_output=' >/dev/null 2>&1'
1386 fi
1387 fi
1388
1389 # Only build a position-dependent object if we build old libraries.
1390 if test "$build_old_libs" = yes; then
1391 if test "$pic_mode" != yes; then
1392 # Don't build PIC code
1393 command="$base_compile $qsrcfile$pie_flag"
1394 else
1395 command="$base_compile $qsrcfile $pic_flag"
1396 fi
1397 if test "$compiler_c_o" = yes; then
1398 command="$command -o $obj"
1399 fi
1400
1401 # Suppress compiler output if we already did a PIC compilation.
1402 command="$command$suppress_output"
1403 func_show_eval_locale "$command" \
1404 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
1405
1406 if test "$need_locks" = warn &&
1407 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1408 $ECHO "\
1409 *** ERROR, $lockfile contains:
1410 `cat $lockfile 2>/dev/null`
1411
1412 but it should contain:
1413 $srcfile
1414
1415 This indicates that another process is trying to use the same
1416 temporary object file, and libtool could not work around it because
1417 your compiler does not support \`-c' and \`-o' together. If you
1418 repeat this compilation, it may succeed, by chance, but you had better
1419 avoid parallel builds (make -j) in this platform, or get a better
1420 compiler."
1421
1422 $opt_dry_run || $RM $removelist
1423 exit $EXIT_FAILURE
1424 fi
1425
1426 # Just move the object if needed
1427 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1428 func_show_eval '$MV "$output_obj" "$obj"' \
1429 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
1430 fi
1431 fi
1432
1433 $opt_dry_run || {
1434 func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
1435
1436 # Unlock the critical section if it was locked
1437 if test "$need_locks" != no; then
1438 removelist=$lockfile
1439 $RM "$lockfile"
1440 fi
1441 }
1442
1443 exit $EXIT_SUCCESS
1444 }
1445
1446 $opt_help || {
1447 test "$mode" = compile && func_mode_compile ${1+"$@"}
1448 }
1449
1450 func_mode_help ()
1451 {
1452 # We need to display help for each of the modes.
1453 case $mode in
1454 "")
1455 # Generic help is extracted from the usage comments
1456 # at the start of this file.
1457 func_help
1458 ;;
1459
1460 clean)
1461 $ECHO \
1462 "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
1463
1464 Remove files from the build directory.
1465
1466 RM is the name of the program to use to delete files associated with each FILE
1467 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
1468 to RM.
1469
1470 If FILE is a libtool library, object or program, all the files associated
1471 with it are deleted. Otherwise, only FILE itself is deleted using RM."
1472 ;;
1473
1474 compile)
1475 $ECHO \
1476 "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
1477
1478 Compile a source file into a libtool library object.
1479
1480 This mode accepts the following additional options:
1481
1482 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
1483 -no-suppress do not suppress compiler output for multiple passes
1484 -prefer-pic try to building PIC objects only
1485 -prefer-non-pic try to building non-PIC objects only
1486 -shared do not build a \`.o' file suitable for static linking
1487 -static only build a \`.o' file suitable for static linking
1488
1489 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
1490 from the given SOURCEFILE.
1491
1492 The output file name is determined by removing the directory component from
1493 SOURCEFILE, then substituting the C source code suffix \`.c' with the
1494 library object suffix, \`.lo'."
1495 ;;
1496
1497 execute)
1498 $ECHO \
1499 "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
1500
1501 Automatically set library path, then run a program.
1502
1503 This mode accepts the following additional options:
1504
1505 -dlopen FILE add the directory containing FILE to the library path
1506
1507 This mode sets the library path environment variable according to \`-dlopen'
1508 flags.
1509
1510 If any of the ARGS are libtool executable wrappers, then they are translated
1511 into their corresponding uninstalled binary, and any of their required library
1512 directories are added to the library path.
1513
1514 Then, COMMAND is executed, with ARGS as arguments."
1515 ;;
1516
1517 finish)
1518 $ECHO \
1519 "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
1520
1521 Complete the installation of libtool libraries.
1522
1523 Each LIBDIR is a directory that contains libtool libraries.
1524
1525 The commands that this mode executes may require superuser privileges. Use
1526 the \`--dry-run' option if you just want to see what would be executed."
1527 ;;
1528
1529 install)
1530 $ECHO \
1531 "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
1532
1533 Install executables or libraries.
1534
1535 INSTALL-COMMAND is the installation command. The first component should be
1536 either the \`install' or \`cp' program.
1537
1538 The following components of INSTALL-COMMAND are treated specially:
1539
1540 -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation
1541
1542 The rest of the components are interpreted as arguments to that command (only
1543 BSD-compatible install options are recognized)."
1544 ;;
1545
1546 link)
1547 $ECHO \
1548 "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
1549
1550 Link object files or libraries together to form another library, or to
1551 create an executable program.
1552
1553 LINK-COMMAND is a command using the C compiler that you would use to create
1554 a program from several object files.
1555
1556 The following components of LINK-COMMAND are treated specially:
1557
1558 -all-static do not do any dynamic linking at all
1559 -avoid-version do not add a version suffix if possible
1560 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
1561 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
1562 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
1563 -export-symbols SYMFILE
1564 try to export only the symbols listed in SYMFILE
1565 -export-symbols-regex REGEX
1566 try to export only the symbols matching REGEX
1567 -LLIBDIR search LIBDIR for required installed libraries
1568 -lNAME OUTPUT-FILE requires the installed library libNAME
1569 -module build a library that can dlopened
1570 -no-fast-install disable the fast-install mode
1571 -no-install link a not-installable executable
1572 -no-undefined declare that a library does not refer to external symbols
1573 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
1574 -objectlist FILE Use a list of object files found in FILE to specify objects
1575 -precious-files-regex REGEX
1576 don't remove output files matching REGEX
1577 -release RELEASE specify package release information
1578 -rpath LIBDIR the created library will eventually be installed in LIBDIR
1579 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
1580 -shared only do dynamic linking of libtool libraries
1581 -shrext SUFFIX override the standard shared library file extension
1582 -static do not do any dynamic linking of uninstalled libtool libraries
1583 -static-libtool-libs
1584 do not do any dynamic linking of libtool libraries
1585 -version-info CURRENT[:REVISION[:AGE]]
1586 specify library version info [each variable defaults to 0]
1587 -weak LIBNAME declare that the target provides the LIBNAME interface
1588
1589 All other options (arguments beginning with \`-') are ignored.
1590
1591 Every other argument is treated as a filename. Files ending in \`.la' are
1592 treated as uninstalled libtool libraries, other files are standard or library
1593 object files.
1594
1595 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
1596 only library objects (\`.lo' files) may be specified, and \`-rpath' is
1597 required, except when creating a convenience library.
1598
1599 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
1600 using \`ar' and \`ranlib', or on Windows using \`lib'.
1601
1602 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
1603 is created, otherwise an executable program is created."
1604 ;;
1605
1606 uninstall)
1607 $ECHO \
1608 "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
1609
1610 Remove libraries from an installation directory.
1611
1612 RM is the name of the program to use to delete files associated with each FILE
1613 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
1614 to RM.
1615
1616 If FILE is a libtool library, all the files associated with it are deleted.
1617 Otherwise, only FILE itself is deleted using RM."
1618 ;;
1619
1620 *)
1621 func_fatal_help "invalid operation mode \`$mode'"
1622 ;;
1623 esac
1624
1625 $ECHO
1626 $ECHO "Try \`$progname --help' for more information about other modes."
1627
1628 exit $?
1629 }
1630
1631 # Now that we've collected a possible --mode arg, show help if necessary
1632 $opt_help && func_mode_help
1633
1634
1635 # func_mode_execute arg...
1636 func_mode_execute ()
1637 {
1638 $opt_debug
1639 # The first argument is the command name.
1640 cmd="$nonopt"
1641 test -z "$cmd" && \
1642 func_fatal_help "you must specify a COMMAND"
1643
1644 # Handle -dlopen flags immediately.
1645 for file in $execute_dlfiles; do
1646 test -f "$file" \
1647 || func_fatal_help "\`$file' is not a file"
1648
1649 dir=
1650 case $file in
1651 *.la)
1652 # Check to see that this really is a libtool archive.
1653 func_lalib_unsafe_p "$file" \
1654 || func_fatal_help "\`$lib' is not a valid libtool archive"
1655
1656 # Read the libtool library.
1657 dlname=
1658 library_names=
1659 func_source "$file"
1660
1661 # Skip this library if it cannot be dlopened.
1662 if test -z "$dlname"; then
1663 # Warn if it was a shared library.
1664 test -n "$library_names" && \
1665 func_warning "\`$file' was not linked with \`-export-dynamic'"
1666 continue
1667 fi
1668
1669 func_dirname "$file" "" "."
1670 dir="$func_dirname_result"
1671
1672 if test -f "$dir/$objdir/$dlname"; then
1673 dir="$dir/$objdir"
1674 else
1675 if test ! -f "$dir/$dlname"; then
1676 func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
1677 fi
1678 fi
1679 ;;
1680
1681 *.lo)
1682 # Just add the directory containing the .lo file.
1683 func_dirname "$file" "" "."
1684 dir="$func_dirname_result"
1685 ;;
1686
1687 *)
1688 func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
1689 continue
1690 ;;
1691 esac
1692
1693 # Get the absolute pathname.
1694 absdir=`cd "$dir" && pwd`
1695 test -n "$absdir" && dir="$absdir"
1696
1697 # Now add the directory to shlibpath_var.
1698 if eval "test -z \"\$$shlibpath_var\""; then
1699 eval "$shlibpath_var=\"\$dir\""
1700 else
1701 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
1702 fi
1703 done
1704
1705 # This variable tells wrapper scripts just to set shlibpath_var
1706 # rather than running their programs.
1707 libtool_execute_magic="$magic"
1708
1709 # Check if any of the arguments is a wrapper script.
1710 args=
1711 for file
1712 do
1713 case $file in
1714 -*) ;;
1715 *)
1716 # Do a test to see if this is really a libtool program.
1717 if func_ltwrapper_script_p "$file"; then
1718 func_source "$file"
1719 # Transform arg to wrapped name.
1720 file="$progdir/$program"
1721 elif func_ltwrapper_executable_p "$file"; then
1722 func_ltwrapper_scriptname "$file"
1723 func_source "$func_ltwrapper_scriptname_result"
1724 # Transform arg to wrapped name.
1725 file="$progdir/$program"
1726 fi
1727 ;;
1728 esac
1729 # Quote arguments (to preserve shell metacharacters).
1730 func_quote_for_eval "$file"
1731 args="$args $func_quote_for_eval_result"
1732 done
1733
1734 if test "X$opt_dry_run" = Xfalse; then
1735 if test -n "$shlibpath_var"; then
1736 # Export the shlibpath_var.
1737 eval "export $shlibpath_var"
1738 fi
1739
1740 # Restore saved environment variables
1741 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
1742 do
1743 eval "if test \"\${save_$lt_var+set}\" = set; then
1744 $lt_var=\$save_$lt_var; export $lt_var
1745 else
1746 $lt_unset $lt_var
1747 fi"
1748 done
1749
1750 # Now prepare to actually exec the command.
1751 exec_cmd="\$cmd$args"
1752 else
1753 # Display what would be done.
1754 if test -n "$shlibpath_var"; then
1755 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
1756 $ECHO "export $shlibpath_var"
1757 fi
1758 $ECHO "$cmd$args"
1759 exit $EXIT_SUCCESS
1760 fi
1761 }
1762
1763 test "$mode" = execute && func_mode_execute ${1+"$@"}
1764
1765
1766 # func_mode_finish arg...
1767 func_mode_finish ()
1768 {
1769 $opt_debug
1770 libdirs="$nonopt"
1771 admincmds=
1772
1773 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
1774 for dir
1775 do
1776 libdirs="$libdirs $dir"
1777 done
1778
1779 for libdir in $libdirs; do
1780 if test -n "$finish_cmds"; then
1781 # Do each command in the finish commands.
1782 func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
1783 '"$cmd"'"'
1784 fi
1785 if test -n "$finish_eval"; then
1786 # Do the single finish_eval.
1787 eval cmds=\"$finish_eval\"
1788 $opt_dry_run || eval "$cmds" || admincmds="$admincmds
1789 $cmds"
1790 fi
1791 done
1792 fi
1793
1794 # Exit here if they wanted silent mode.
1795 $opt_silent && exit $EXIT_SUCCESS
1796
1797 $ECHO "X----------------------------------------------------------------------" | $Xsed
1798 $ECHO "Libraries have been installed in:"
1799 for libdir in $libdirs; do
1800 $ECHO " $libdir"
1801 done
1802 $ECHO
1803 $ECHO "If you ever happen to want to link against installed libraries"
1804 $ECHO "in a given directory, LIBDIR, you must either use libtool, and"
1805 $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'"
1806 $ECHO "flag during linking and do at least one of the following:"
1807 if test -n "$shlibpath_var"; then
1808 $ECHO " - add LIBDIR to the \`$shlibpath_var' environment variable"
1809 $ECHO " during execution"
1810 fi
1811 if test -n "$runpath_var"; then
1812 $ECHO " - add LIBDIR to the \`$runpath_var' environment variable"
1813 $ECHO " during linking"
1814 fi
1815 if test -n "$hardcode_libdir_flag_spec"; then
1816 libdir=LIBDIR
1817 eval flag=\"$hardcode_libdir_flag_spec\"
1818
1819 $ECHO " - use the \`$flag' linker flag"
1820 fi
1821 if test -n "$admincmds"; then
1822 $ECHO " - have your system administrator run these commands:$admincmds"
1823 fi
1824 if test -f /etc/ld.so.conf; then
1825 $ECHO " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
1826 fi
1827 $ECHO
1828
1829 $ECHO "See any operating system documentation about shared libraries for"
1830 case $host in
1831 solaris2.[6789]|solaris2.1[0-9])
1832 $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual"
1833 $ECHO "pages."
1834 ;;
1835 *)
1836 $ECHO "more information, such as the ld(1) and ld.so(8) manual pages."
1837 ;;
1838 esac
1839 $ECHO "X----------------------------------------------------------------------" | $Xsed
1840 exit $EXIT_SUCCESS
1841 }
1842
1843 test "$mode" = finish && func_mode_finish ${1+"$@"}
1844
1845
1846 # func_mode_install arg...
1847 func_mode_install ()
1848 {
1849 $opt_debug
1850 # There may be an optional sh(1) argument at the beginning of
1851 # install_prog (especially on Windows NT).
1852 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
1853 # Allow the use of GNU shtool's install command.
1854 $ECHO "X$nonopt" | $GREP shtool >/dev/null; then
1855 # Aesthetically quote it.
1856 func_quote_for_eval "$nonopt"
1857 install_prog="$func_quote_for_eval_result "
1858 arg=$1
1859 shift
1860 else
1861 install_prog=
1862 arg=$nonopt
1863 fi
1864
1865 # The real first argument should be the name of the installation program.
1866 # Aesthetically quote it.
1867 func_quote_for_eval "$arg"
1868 install_prog="$install_prog$func_quote_for_eval_result"
1869
1870 # We need to accept at least all the BSD install flags.
1871 dest=
1872 files=
1873 opts=
1874 prev=
1875 install_type=
1876 isdir=no
1877 stripme=
1878 for arg
1879 do
1880 if test -n "$dest"; then
1881 files="$files $dest"
1882 dest=$arg
1883 continue
1884 fi
1885
1886 case $arg in
1887 -d) isdir=yes ;;
1888 -f)
1889 case " $install_prog " in
1890 *[\\\ /]cp\ *) ;;
1891 *) prev=$arg ;;
1892 esac
1893 ;;
1894 -g | -m | -o)
1895 prev=$arg
1896 ;;
1897 -s)
1898 stripme=" -s"
1899 continue
1900 ;;
1901 -*)
1902 ;;
1903 *)
1904 # If the previous option needed an argument, then skip it.
1905 if test -n "$prev"; then
1906 prev=
1907 else
1908 dest=$arg
1909 continue
1910 fi
1911 ;;
1912 esac
1913
1914 # Aesthetically quote the argument.
1915 func_quote_for_eval "$arg"
1916 install_prog="$install_prog $func_quote_for_eval_result"
1917 done
1918
1919 test -z "$install_prog" && \
1920 func_fatal_help "you must specify an install program"
1921
1922 test -n "$prev" && \
1923 func_fatal_help "the \`$prev' option requires an argument"
1924
1925 if test -z "$files"; then
1926 if test -z "$dest"; then
1927 func_fatal_help "no file or destination specified"
1928 else
1929 func_fatal_help "you must specify a destination"
1930 fi
1931 fi
1932
1933 # Strip any trailing slash from the destination.
1934 func_stripname '' '/' "$dest"
1935 dest=$func_stripname_result
1936
1937 # Check to see that the destination is a directory.
1938 test -d "$dest" && isdir=yes
1939 if test "$isdir" = yes; then
1940 destdir="$dest"
1941 destname=
1942 else
1943 func_dirname_and_basename "$dest" "" "."
1944 destdir="$func_dirname_result"
1945 destname="$func_basename_result"
1946
1947 # Not a directory, so check to see that there is only one file specified.
1948 set dummy $files; shift
1949 test "$#" -gt 1 && \
1950 func_fatal_help "\`$dest' is not a directory"
1951 fi
1952 case $destdir in
1953 [\\/]* | [A-Za-z]:[\\/]*) ;;
1954 *)
1955 for file in $files; do
1956 case $file in
1957 *.lo) ;;
1958 *)
1959 func_fatal_help "\`$destdir' must be an absolute directory name"
1960 ;;
1961 esac
1962 done
1963 ;;
1964 esac
1965
1966 # This variable tells wrapper scripts just to set variables rather
1967 # than running their programs.
1968 libtool_install_magic="$magic"
1969
1970 staticlibs=
1971 future_libdirs=
1972 current_libdirs=
1973 for file in $files; do
1974
1975 # Do each installation.
1976 case $file in
1977 *.$libext)
1978 # Do the static libraries later.
1979 staticlibs="$staticlibs $file"
1980 ;;
1981
1982 *.la)
1983 # Check to see that this really is a libtool archive.
1984 func_lalib_unsafe_p "$file" \
1985 || func_fatal_help "\`$file' is not a valid libtool archive"
1986
1987 library_names=
1988 old_library=
1989 relink_command=
1990 func_source "$file"
1991
1992 # Add the libdir to current_libdirs if it is the destination.
1993 if test "X$destdir" = "X$libdir"; then
1994 case "$current_libdirs " in
1995 *" $libdir "*) ;;
1996 *) current_libdirs="$current_libdirs $libdir" ;;
1997 esac
1998 else
1999 # Note the libdir as a future libdir.
2000 case "$future_libdirs " in
2001 *" $libdir "*) ;;
2002 *) future_libdirs="$future_libdirs $libdir" ;;
2003 esac
2004 fi
2005
2006 func_dirname "$file" "/" ""
2007 dir="$func_dirname_result"
2008 dir="$dir$objdir"
2009
2010 if test -n "$relink_command"; then
2011 # Determine the prefix the user has applied to our future dir.
2012 inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"`
2013
2014 # Don't allow the user to place us outside of our expected
2015 # location b/c this prevents finding dependent libraries that
2016 # are installed to the same prefix.
2017 # At present, this check doesn't affect windows .dll's that
2018 # are installed into $libdir/../bin (currently, that works fine)
2019 # but it's something to keep an eye on.
2020 test "$inst_prefix_dir" = "$destdir" && \
2021 func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
2022
2023 if test -n "$inst_prefix_dir"; then
2024 # Stick the inst_prefix_dir data into the link command.
2025 relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
2026 else
2027 relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"`
2028 fi
2029
2030 func_warning "relinking \`$file'"
2031 func_show_eval "$relink_command" \
2032 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
2033 fi
2034
2035 # See the names of the shared library.
2036 set dummy $library_names; shift
2037 if test -n "$1"; then
2038 realname="$1"
2039 shift
2040
2041 srcname="$realname"
2042 test -n "$relink_command" && srcname="$realname"T
2043
2044 # Install the shared library and build the symlinks.
2045 func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \
2046 'exit $?'
2047 tstripme="$stripme"
2048 case $host_os in
2049 cygwin* | mingw* | pw32* | cegcc*)
2050 case $realname in
2051 *.dll.a)
2052 tstripme=""
2053 ;;
2054 esac
2055 ;;
2056 esac
2057 if test -n "$tstripme" && test -n "$striplib"; then
2058 func_show_eval "$striplib $destdir/$realname" 'exit $?'
2059 fi
2060
2061 if test "$#" -gt 0; then
2062 # Delete the old symlinks, and create new ones.
2063 # Try `ln -sf' first, because the `ln' binary might depend on
2064 # the symlink we replace! Solaris /bin/ln does not understand -f,
2065 # so we also need to try rm && ln -s.
2066 for linkname
2067 do
2068 test "$linkname" != "$realname" \
2069 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
2070 done
2071 fi
2072
2073 # Do each command in the postinstall commands.
2074 lib="$destdir/$realname"
2075 func_execute_cmds "$postinstall_cmds" 'exit $?'
2076 fi
2077
2078 # Install the pseudo-library for information purposes.
2079 func_basename "$file"
2080 name="$func_basename_result"
2081 instname="$dir/$name"i
2082 func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
2083
2084 # Maybe install the static library, too.
2085 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
2086 ;;
2087
2088 *.lo)
2089 # Install (i.e. copy) a libtool object.
2090
2091 # Figure out destination file name, if it wasn't already specified.
2092 if test -n "$destname"; then
2093 destfile="$destdir/$destname"
2094 else
2095 func_basename "$file"
2096 destfile="$func_basename_result"
2097 destfile="$destdir/$destfile"
2098 fi
2099
2100 # Deduce the name of the destination old-style object file.
2101 case $destfile in
2102 *.lo)
2103 func_lo2o "$destfile"
2104 staticdest=$func_lo2o_result
2105 ;;
2106 *.$objext)
2107 staticdest="$destfile"
2108 destfile=
2109 ;;
2110 *)
2111 func_fatal_help "cannot copy a libtool object to \`$destfile'"
2112 ;;
2113 esac
2114
2115 # Install the libtool object if requested.
2116 test -n "$destfile" && \
2117 func_show_eval "$install_prog $file $destfile" 'exit $?'
2118
2119 # Install the old object if enabled.
2120 if test "$build_old_libs" = yes; then
2121 # Deduce the name of the old-style object file.
2122 func_lo2o "$file"
2123 staticobj=$func_lo2o_result
2124 func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
2125 fi
2126 exit $EXIT_SUCCESS
2127 ;;
2128
2129 *)
2130 # Figure out destination file name, if it wasn't already specified.
2131 if test -n "$destname"; then
2132 destfile="$destdir/$destname"
2133 else
2134 func_basename "$file"
2135 destfile="$func_basename_result"
2136 destfile="$destdir/$destfile"
2137 fi
2138
2139 # If the file is missing, and there is a .exe on the end, strip it
2140 # because it is most likely a libtool script we actually want to
2141 # install
2142 stripped_ext=""
2143 case $file in
2144 *.exe)
2145 if test ! -f "$file"; then
2146 func_stripname '' '.exe' "$file"
2147 file=$func_stripname_result
2148 stripped_ext=".exe"
2149 fi
2150 ;;
2151 esac
2152
2153 # Do a test to see if this is really a libtool program.
2154 case $host in
2155 *cygwin* | *mingw*)
2156 if func_ltwrapper_executable_p "$file"; then
2157 func_ltwrapper_scriptname "$file"
2158 wrapper=$func_ltwrapper_scriptname_result
2159 else
2160 func_stripname '' '.exe' "$file"
2161 wrapper=$func_stripname_result
2162 fi
2163 ;;
2164 *)
2165 wrapper=$file
2166 ;;
2167 esac
2168 if func_ltwrapper_script_p "$wrapper"; then
2169 notinst_deplibs=
2170 relink_command=
2171
2172 func_source "$wrapper"
2173
2174 # Check the variables that should have been set.
2175 test -z "$generated_by_libtool_version" && \
2176 func_fatal_error "invalid libtool wrapper script \`$wrapper'"
2177
2178 finalize=yes
2179 for lib in $notinst_deplibs; do
2180 # Check to see that each library is installed.
2181 libdir=
2182 if test -f "$lib"; then
2183 func_source "$lib"
2184 fi
2185 libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
2186 if test -n "$libdir" && test ! -f "$libfile"; then
2187 func_warning "\`$lib' has not been installed in \`$libdir'"
2188 finalize=no
2189 fi
2190 done
2191
2192 relink_command=
2193 func_source "$wrapper"
2194
2195 outputname=
2196 if test "$fast_install" = no && test -n "$relink_command"; then
2197 $opt_dry_run || {
2198 if test "$finalize" = yes; then
2199 tmpdir=`func_mktempdir`
2200 func_basename "$file$stripped_ext"
2201 file="$func_basename_result"
2202 outputname="$tmpdir/$file"
2203 # Replace the output file specification.
2204 relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
2205
2206 $opt_silent || {
2207 func_quote_for_expand "$relink_command"
2208 eval "func_echo $func_quote_for_expand_result"
2209 }
2210 if eval "$relink_command"; then :
2211 else
2212 func_error "error: relink \`$file' with the above command before installing it"
2213 $opt_dry_run || ${RM}r "$tmpdir"
2214 continue
2215 fi
2216 file="$outputname"
2217 else
2218 func_warning "cannot relink \`$file'"
2219 fi
2220 }
2221 else
2222 # Install the binary that we compiled earlier.
2223 file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
2224 fi
2225 fi
2226
2227 # remove .exe since cygwin /usr/bin/install will append another
2228 # one anyway
2229 case $install_prog,$host in
2230 */usr/bin/install*,*cygwin*)
2231 case $file:$destfile in
2232 *.exe:*.exe)
2233 # this is ok
2234 ;;
2235 *.exe:*)
2236 destfile=$destfile.exe
2237 ;;
2238 *:*.exe)
2239 func_stripname '' '.exe' "$destfile"
2240 destfile=$func_stripname_result
2241 ;;
2242 esac
2243 ;;
2244 esac
2245 func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
2246 $opt_dry_run || if test -n "$outputname"; then
2247 ${RM}r "$tmpdir"
2248 fi
2249 ;;
2250 esac
2251 done
2252
2253 for file in $staticlibs; do
2254 func_basename "$file"
2255 name="$func_basename_result"
2256
2257 # Set up the ranlib parameters.
2258 oldlib="$destdir/$name"
2259
2260 func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
2261
2262 if test -n "$stripme" && test -n "$old_striplib"; then
2263 func_show_eval "$old_striplib $oldlib" 'exit $?'
2264 fi
2265
2266 # Do each command in the postinstall commands.
2267 func_execute_cmds "$old_postinstall_cmds" 'exit $?'
2268 done
2269
2270 test -n "$future_libdirs" && \
2271 func_warning "remember to run \`$progname --finish$future_libdirs'"
2272
2273 if test -n "$current_libdirs"; then
2274 # Maybe just do a dry run.
2275 $opt_dry_run && current_libdirs=" -n$current_libdirs"
2276 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
2277 else
2278 exit $EXIT_SUCCESS
2279 fi
2280 }
2281
2282 test "$mode" = install && func_mode_install ${1+"$@"}
2283
2284
12332285 # func_generate_dlsyms outputname originator pic_p
12342286 # Extract symbols from dlprefiles and create ${outputname}S.o with
12352287 # a dlpreopen symbol table.
13062358 $RM $export_symbols
13072359 eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
13082360 case $host in
1309 *cygwin* | *mingw* )
2361 *cygwin* | *mingw* | *cegcc* )
13102362 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
13112363 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
13122364 ;;
13182370 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
13192371 eval '$MV "$nlist"T "$nlist"'
13202372 case $host in
1321 *cygwin | *mingw* )
2373 *cygwin | *mingw* | *cegcc* )
13222374 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
13232375 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
13242376 ;;
13742426 } lt_dlsymlist;
13752427 "
13762428 case $host in
1377 *cygwin* | *mingw* )
2429 *cygwin* | *mingw* | *cegcc* )
13782430 $ECHO >> "$output_objdir/$my_dlsyms" "\
13792431 /* DATA imports from DLLs on WIN32 con't be const, because
13802432 runtime relocations are performed -- see ld's documentation
14602512 # Transform the symbol file into the correct name.
14612513 symfileobj="$output_objdir/${my_outputname}S.$objext"
14622514 case $host in
1463 *cygwin* | *mingw* )
2515 *cygwin* | *mingw* | *cegcc* )
14642516 if test -f "$output_objdir/$my_outputname.def"; then
14652517 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
14662518 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
14902542 fi
14912543 }
14922544
2545 # func_win32_libid arg
2546 # return the library type of file 'arg'
2547 #
2548 # Need a lot of goo to handle *both* DLLs and import libs
2549 # Has to be a shell function in order to 'eat' the argument
2550 # that is supplied when $file_magic_command is called.
2551 func_win32_libid ()
2552 {
2553 $opt_debug
2554 win32_libid_type="unknown"
2555 win32_fileres=`file -L $1 2>/dev/null`
2556 case $win32_fileres in
2557 *ar\ archive\ import\ library*) # definitely import
2558 win32_libid_type="x86 archive import"
2559 ;;
2560 *ar\ archive*) # could be an import, or static
2561 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
2562 $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
2563 win32_nmres=`eval $NM -f posix -A $1 |
2564 $SED -n -e '
2565 1,100{
2566 / I /{
2567 s,.*,import,
2568 p
2569 q
2570 }
2571 }'`
2572 case $win32_nmres in
2573 import*) win32_libid_type="x86 archive import";;
2574 *) win32_libid_type="x86 archive static";;
2575 esac
2576 fi
2577 ;;
2578 *DLL*)
2579 win32_libid_type="x86 DLL"
2580 ;;
2581 *executable*) # but shell scripts are "executable" too...
2582 case $win32_fileres in
2583 *MS\ Windows\ PE\ Intel*)
2584 win32_libid_type="x86 DLL"
2585 ;;
2586 esac
2587 ;;
2588 esac
2589 $ECHO "$win32_libid_type"
2590 }
2591
2592
2593
14932594 # func_extract_an_archive dir oldlib
14942595 func_extract_an_archive ()
14952596 {
15282629 while :; do
15292630 case " $extracted_archives " in
15302631 *" $my_xlib_u "*)
1531 extracted_serial=`expr $extracted_serial + 1`
2632 func_arith $extracted_serial + 1
2633 extracted_serial=$func_arith_result
15322634 my_xlib_u=lt$extracted_serial-$my_xlib ;;
15332635 *) break ;;
15342636 esac
15482650 darwin_archive=$my_xabs
15492651 darwin_curdir=`pwd`
15502652 darwin_base_archive=`basename "$darwin_archive"`
1551 darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
2653 darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
15522654 if test -n "$darwin_arches"; then
15532655 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
15542656 darwin_arch=
15552657 func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
15562658 for darwin_arch in $darwin_arches ; do
15572659 func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
1558 lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
2660 $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
15592661 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
15602662 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
15612663 cd "$darwin_curdir"
15622664 $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
15632665 done # $darwin_arches
15642666 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
1565 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
2667 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
15662668 darwin_file=
15672669 darwin_files=
15682670 for darwin_file in $darwin_filelist; do
15692671 darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
1570 lipo -create -output "$darwin_file" $darwin_files
2672 $LIPO -create -output "$darwin_file" $darwin_files
15712673 done # $darwin_filelist
15722674 $RM -rf unfat-$$
15732675 cd "$darwin_orig_dir"
15892691
15902692
15912693
1592 # func_write_libtool_object output_name pic_name nonpic_name
1593 # Create a libtool object file (analogous to a ".la" file),
1594 # but don't create it if we're doing a dry run.
1595 func_write_libtool_object ()
2694 # func_emit_wrapper_part1 [arg=no]
2695 #
2696 # Emit the first part of a libtool wrapper script on stdout.
2697 # For more information, see the description associated with
2698 # func_emit_wrapper(), below.
2699 func_emit_wrapper_part1 ()
15962700 {
1597 write_libobj=${1}
1598 if test "$build_libtool_libs" = yes; then
1599 write_lobj=\'${2}\'
1600 else
1601 write_lobj=none
1602 fi
1603
1604 if test "$build_old_libs" = yes; then
1605 write_oldobj=\'${3}\'
1606 else
1607 write_oldobj=none
1608 fi
1609
1610 $opt_dry_run || {
1611 cat >${write_libobj}T <<EOF
1612 # $write_libobj - a libtool object file
1613 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
1614 #
1615 # Please DO NOT delete this file!
1616 # It is necessary for linking the library.
1617
1618 # Name of the PIC object.
1619 pic_object=$write_lobj
1620
1621 # Name of the non-PIC object
1622 non_pic_object=$write_oldobj
1623
1624 EOF
1625 mv -f "${write_libobj}T" "${write_libobj}"
1626 }
1627 }
1628
1629 # func_mode_compile arg...
1630 func_mode_compile ()
1631 {
1632 $opt_debug
1633 # Get the compilation command and the source file.
1634 base_compile=
1635 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
1636 suppress_opt=yes
1637 suppress_output=
1638 arg_mode=normal
1639 libobj=
1640 later=
1641 pie_flag=
1642
1643 for arg
1644 do
1645 case $arg_mode in
1646 arg )
1647 # do not "continue". Instead, add this to base_compile
1648 lastarg="$arg"
1649 arg_mode=normal
1650 ;;
1651
1652 target )
1653 libobj="$arg"
1654 arg_mode=normal
1655 continue
1656 ;;
1657
1658 normal )
1659 # Accept any command-line options.
1660 case $arg in
1661 -o)
1662 test -n "$libobj" && \
1663 func_fatal_error "you cannot specify \`-o' more than once"
1664 arg_mode=target
1665 continue
1666 ;;
1667
1668 -pie | -fpie | -fPIE)
1669 pie_flag="$pie_flag $arg"
1670 continue
1671 ;;
1672
1673 -shared | -static | -prefer-pic | -prefer-non-pic)
1674 later="$later $arg"
1675 continue
1676 ;;
1677
1678 -no-suppress)
1679 suppress_opt=no
1680 continue
1681 ;;
1682
1683 -Xcompiler)
1684 arg_mode=arg # the next one goes into the "base_compile" arg list
1685 continue # The current "srcfile" will either be retained or
1686 ;; # replaced later. I would guess that would be a bug.
1687
1688 -Wc,*)
1689 func_stripname '-Wc,' '' "$arg"
1690 args=$func_stripname_result
1691 lastarg=
1692 save_ifs="$IFS"; IFS=','
1693 for arg in $args; do
1694 IFS="$save_ifs"
1695 func_quote_for_eval "$arg"
1696 lastarg="$lastarg $func_quote_for_eval_result"
1697 done
1698 IFS="$save_ifs"
1699 func_stripname ' ' '' "$lastarg"
1700 lastarg=$func_stripname_result
1701
1702 # Add the arguments to base_compile.
1703 base_compile="$base_compile $lastarg"
1704 continue
1705 ;;
1706
1707 *)
1708 # Accept the current argument as the source file.
1709 # The previous "srcfile" becomes the current argument.
1710 #
1711 lastarg="$srcfile"
1712 srcfile="$arg"
1713 ;;
1714 esac # case $arg
1715 ;;
1716 esac # case $arg_mode
1717
1718 # Aesthetically quote the previous argument.
1719 func_quote_for_eval "$lastarg"
1720 base_compile="$base_compile $func_quote_for_eval_result"
1721 done # for arg
1722
1723 case $arg_mode in
1724 arg)
1725 func_fatal_error "you must specify an argument for -Xcompile"
1726 ;;
1727 target)
1728 func_fatal_error "you must specify a target with \`-o'"
1729 ;;
1730 *)
1731 # Get the name of the library object.
1732 test -z "$libobj" && {
1733 func_basename "$srcfile"
1734 libobj="$func_basename_result"
1735 }
1736 ;;
1737 esac
1738
1739 # Recognize several different file suffixes.
1740 # If the user specifies -o file.o, it is replaced with file.lo
1741 xform='[cCFSifmso]'
1742 case $libobj in
1743 *.ada) xform=ada ;;
1744 *.adb) xform=adb ;;
1745 *.ads) xform=ads ;;
1746 *.asm) xform=asm ;;
1747 *.c++) xform=c++ ;;
1748 *.cc) xform=cc ;;
1749 *.ii) xform=ii ;;
1750 *.class) xform=class ;;
1751 *.cpp) xform=cpp ;;
1752 *.cxx) xform=cxx ;;
1753 *.[fF][09]?) xform='[fF][09].' ;;
1754 *.for) xform=for ;;
1755 *.java) xform=java ;;
1756 *.obj) xform=obj ;;
1757 *.sx) xform=sx ;;
1758 esac
1759
1760 libobj=`$ECHO "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
1761
1762 case $libobj in
1763 *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
1764 *)
1765 func_fatal_error "cannot determine name of library object from \`$libobj'"
1766 ;;
1767 esac
1768
1769 func_infer_tag $base_compile
1770
1771 for arg in $later; do
1772 case $arg in
1773 -shared)
1774 test "$build_libtool_libs" != yes && \
1775 func_fatal_configuration "can not build a shared library"
1776 build_old_libs=no
1777 continue
1778 ;;
1779
1780 -static)
1781 build_libtool_libs=no
1782 build_old_libs=yes
1783 continue
1784 ;;
1785
1786 -prefer-pic)
1787 pic_mode=yes
1788 continue
1789 ;;
1790
1791 -prefer-non-pic)
1792 pic_mode=no
1793 continue
1794 ;;
1795 esac
1796 done
1797
1798 func_quote_for_eval "$libobj"
1799 test "X$libobj" != "X$func_quote_for_eval_result" \
1800 && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
1801 && func_warning "libobj name \`$libobj' may not contain shell special characters."
1802 func_dirname_and_basename "$obj" "/" ""
1803 objname="$func_basename_result"
1804 xdir="$func_dirname_result"
1805 lobj=${xdir}$objdir/$objname
1806
1807 test -z "$base_compile" && \
1808 func_fatal_help "you must specify a compilation command"
1809
1810 # Delete any leftover library objects.
1811 if test "$build_old_libs" = yes; then
1812 removelist="$obj $lobj $libobj ${libobj}T"
1813 else
1814 removelist="$lobj $libobj ${libobj}T"
1815 fi
1816
1817 $opt_dry_run || $RM $removelist
1818 trap "$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE" 1 2 15
1819
1820 # On Cygwin there's no "real" PIC flag so we must build both object types
1821 case $host_os in
1822 cygwin* | mingw* | pw32* | os2*)
1823 pic_mode=default
1824 ;;
1825 esac
1826 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
1827 # non-PIC code in shared libraries is not supported
1828 pic_mode=default
1829 fi
1830
1831 # Calculate the filename of the output object if compiler does
1832 # not support -o with -c
1833 if test "$compiler_c_o" = no; then
1834 output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
1835 lockfile="$output_obj.lock"
1836 removelist="$removelist $output_obj $lockfile"
1837 trap "$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE" 1 2 15
1838 else
1839 output_obj=
1840 need_locks=no
1841 lockfile=
1842 fi
1843
1844 # Lock this critical section if it is needed
1845 # We use this script file to make the link, it avoids creating a new file
1846 if test "$need_locks" = yes; then
1847 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
1848 func_echo "Waiting for $lockfile to be removed"
1849 sleep 2
1850 done
1851 elif test "$need_locks" = warn; then
1852 if test -f "$lockfile"; then
1853 $ECHO "\
1854 *** ERROR, $lockfile exists and contains:
1855 `cat $lockfile 2>/dev/null`
1856
1857 This indicates that another process is trying to use the same
1858 temporary object file, and libtool could not work around it because
1859 your compiler does not support \`-c' and \`-o' together. If you
1860 repeat this compilation, it may succeed, by chance, but you had better
1861 avoid parallel builds (make -j) in this platform, or get a better
1862 compiler."
1863
1864 $opt_dry_run || $RM $removelist
1865 exit $EXIT_FAILURE
1866 fi
1867 $ECHO "$srcfile" > "$lockfile"
1868 fi
1869
1870 if test -n "$fix_srcfile_path"; then
1871 eval srcfile=\"$fix_srcfile_path\"
1872 fi
1873 func_quote_for_eval "$srcfile"
1874 qsrcfile=$func_quote_for_eval_result
1875
1876 $opt_dry_run || $RM "$libobj" "${libobj}T"
1877
1878 # Only build a PIC object if we are building libtool libraries.
1879 if test "$build_libtool_libs" = yes; then
1880 # Without this assignment, base_compile gets emptied.
1881 fbsd_hideous_sh_bug=$base_compile
1882
1883 if test "$pic_mode" != no; then
1884 command="$base_compile $qsrcfile $pic_flag"
1885 else
1886 # Don't build PIC code
1887 command="$base_compile $qsrcfile"
1888 fi
1889
1890 func_mkdir_p "$xdir$objdir"
1891
1892 if test -z "$output_obj"; then
1893 # Place PIC objects in $objdir
1894 command="$command -o $lobj"
1895 fi
1896
1897 $opt_dry_run || $RM "$lobj" "$output_obj"
1898
1899 func_show_eval "$command" \
1900 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
1901
1902 if test "$need_locks" = warn &&
1903 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1904 $ECHO "\
1905 *** ERROR, $lockfile contains:
1906 `cat $lockfile 2>/dev/null`
1907
1908 but it should contain:
1909 $srcfile
1910
1911 This indicates that another process is trying to use the same
1912 temporary object file, and libtool could not work around it because
1913 your compiler does not support \`-c' and \`-o' together. If you
1914 repeat this compilation, it may succeed, by chance, but you had better
1915 avoid parallel builds (make -j) in this platform, or get a better
1916 compiler."
1917
1918 $opt_dry_run || $RM $removelist
1919 exit $EXIT_FAILURE
1920 fi
1921
1922 # Just move the object if needed, then go on to compile the next one
1923 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
1924 func_show_eval '$MV "$output_obj" "$lobj"' \
1925 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
1926 fi
1927
1928 # Allow error messages only from the first compilation.
1929 if test "$suppress_opt" = yes; then
1930 suppress_output=' >/dev/null 2>&1'
1931 fi
1932 fi
1933
1934 # Only build a position-dependent object if we build old libraries.
1935 if test "$build_old_libs" = yes; then
1936 if test "$pic_mode" != yes; then
1937 # Don't build PIC code
1938 command="$base_compile $qsrcfile$pie_flag"
1939 else
1940 command="$base_compile $qsrcfile $pic_flag"
1941 fi
1942 if test "$compiler_c_o" = yes; then
1943 command="$command -o $obj"
1944 fi
1945
1946 # Suppress compiler output if we already did a PIC compilation.
1947 command="$command$suppress_output"
1948 $opt_dry_run || $RM "$obj" "$output_obj"
1949 func_show_eval "$command" \
1950 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
1951
1952 if test "$need_locks" = warn &&
1953 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1954 $ECHO "\
1955 *** ERROR, $lockfile contains:
1956 `cat $lockfile 2>/dev/null`
1957
1958 but it should contain:
1959 $srcfile
1960
1961 This indicates that another process is trying to use the same
1962 temporary object file, and libtool could not work around it because
1963 your compiler does not support \`-c' and \`-o' together. If you
1964 repeat this compilation, it may succeed, by chance, but you had better
1965 avoid parallel builds (make -j) in this platform, or get a better
1966 compiler."
1967
1968 $opt_dry_run || $RM $removelist
1969 exit $EXIT_FAILURE
1970 fi
1971
1972 # Just move the object if needed
1973 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1974 func_show_eval '$MV "$output_obj" "$obj"' \
1975 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
1976 fi
1977 fi
1978
1979 $opt_dry_run || {
1980 func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
1981
1982 # Unlock the critical section if it was locked
1983 if test "$need_locks" != no; then
1984 $RM "$lockfile"
1985 fi
1986 }
1987
1988 exit $EXIT_SUCCESS
1989 }
1990
1991 test "$mode" = compile && func_mode_compile ${1+"$@"}
1992
1993
1994 # func_mode_execute arg...
1995 func_mode_execute ()
1996 {
1997 $opt_debug
1998 # The first argument is the command name.
1999 cmd="$nonopt"
2000 test -z "$cmd" && \
2001 func_fatal_help "you must specify a COMMAND"
2002
2003 # Handle -dlopen flags immediately.
2004 for file in $execute_dlfiles; do
2005 test -f "$file" \
2006 || func_fatal_help "\`$file' is not a file"
2007
2008 dir=
2009 case $file in
2010 *.la)
2011 # Check to see that this really is a libtool archive.
2012 func_lalib_unsafe_p "$file" \
2013 || func_fatal_help "\`$lib' is not a valid libtool archive"
2014
2015 # Read the libtool library.
2016 dlname=
2017 library_names=
2018 func_source "$file"
2019
2020 # Skip this library if it cannot be dlopened.
2021 if test -z "$dlname"; then
2022 # Warn if it was a shared library.
2023 test -n "$library_names" && \
2024 func_warning "\`$file' was not linked with \`-export-dynamic'"
2025 continue
2026 fi
2027
2028 func_dirname "$file" "" "."
2029 dir="$func_dirname_result"
2030
2031 if test -f "$dir/$objdir/$dlname"; then
2032 dir="$dir/$objdir"
2033 else
2034 if test ! -f "$dir/$dlname"; then
2035 func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
2036 fi
2037 fi
2038 ;;
2039
2040 *.lo)
2041 # Just add the directory containing the .lo file.
2042 func_dirname "$file" "" "."
2043 dir="$func_dirname_result"
2044 ;;
2045
2046 *)
2047 func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
2048 continue
2049 ;;
2050 esac
2051
2052 # Get the absolute pathname.
2053 absdir=`cd "$dir" && pwd`
2054 test -n "$absdir" && dir="$absdir"
2055
2056 # Now add the directory to shlibpath_var.
2057 if eval "test -z \"\$$shlibpath_var\""; then
2058 eval "$shlibpath_var=\"\$dir\""
2059 else
2060 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
2061 fi
2062 done
2063
2064 # This variable tells wrapper scripts just to set shlibpath_var
2065 # rather than running their programs.
2066 libtool_execute_magic="$magic"
2067
2068 # Check if any of the arguments is a wrapper script.
2069 args=
2070 for file
2071 do
2072 case $file in
2073 -*) ;;
2074 *)
2075 # Do a test to see if this is really a libtool program.
2076 if func_ltwrapper_script_p "$file"; then
2077 func_source "$file"
2078 elif func_ltwrapper_executable_p "$file"; then
2079 func_ltwrapper_scriptname "$file"
2080 func_source "$func_ltwrapper_scriptname_result"
2081 fi
2082 # Transform arg to wrapped name.
2083 file="$progdir/$program"
2084 ;;
2085 esac
2086 # Quote arguments (to preserve shell metacharacters).
2087 func_quote_for_eval "$file"
2088 args="$args $func_quote_for_eval_result"
2089 done
2090
2091 if test "X$opt_dry_run" = Xfalse; then
2092 if test -n "$shlibpath_var"; then
2093 # Export the shlibpath_var.
2094 eval "export $shlibpath_var"
2095 fi
2096
2097 # Restore saved environment variables
2098 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
2099 do
2100 eval "if test \"\${save_$lt_var+set}\" = set; then
2101 $lt_var=\$save_$lt_var; export $lt_var
2102 else
2103 $lt_unset $lt_var
2104 fi"
2105 done
2106
2107 # Now prepare to actually exec the command.
2108 exec_cmd="\$cmd$args"
2109 else
2110 # Display what would be done.
2111 if test -n "$shlibpath_var"; then
2112 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
2113 $ECHO "export $shlibpath_var"
2114 fi
2115 $ECHO "$cmd$args"
2116 exit $EXIT_SUCCESS
2117 fi
2118 }
2119
2120 test "$mode" = execute && func_mode_execute ${1+"$@"}
2121
2122
2123 # func_mode_finish arg...
2124 func_mode_finish ()
2125 {
2126 $opt_debug
2127 libdirs="$nonopt"
2128 admincmds=
2129
2130 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
2131 for dir
2132 do
2133 libdirs="$libdirs $dir"
2134 done
2135
2136 for libdir in $libdirs; do
2137 if test -n "$finish_cmds"; then
2138 # Do each command in the finish commands.
2139 func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
2140 '"$cmd"'"'
2141 fi
2142 if test -n "$finish_eval"; then
2143 # Do the single finish_eval.
2144 eval cmds=\"$finish_eval\"
2145 $opt_dry_run || eval "$cmds" || admincmds="$admincmds
2146 $cmds"
2147 fi
2148 done
2149 fi
2150
2151 # Exit here if they wanted silent mode.
2152 $opt_silent && exit $EXIT_SUCCESS
2153
2154 $ECHO "X----------------------------------------------------------------------" | $Xsed
2155 $ECHO "Libraries have been installed in:"
2156 for libdir in $libdirs; do
2157 $ECHO " $libdir"
2158 done
2159 $ECHO
2160 $ECHO "If you ever happen to want to link against installed libraries"
2161 $ECHO "in a given directory, LIBDIR, you must either use libtool, and"
2162 $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'"
2163 $ECHO "flag during linking and do at least one of the following:"
2164 if test -n "$shlibpath_var"; then
2165 $ECHO " - add LIBDIR to the \`$shlibpath_var' environment variable"
2166 $ECHO " during execution"
2167 fi
2168 if test -n "$runpath_var"; then
2169 $ECHO " - add LIBDIR to the \`$runpath_var' environment variable"
2170 $ECHO " during linking"
2171 fi
2172 if test -n "$hardcode_libdir_flag_spec"; then
2173 libdir=LIBDIR
2174 eval flag=\"$hardcode_libdir_flag_spec\"
2175
2176 $ECHO " - use the \`$flag' linker flag"
2177 fi
2178 if test -n "$admincmds"; then
2179 $ECHO " - have your system administrator run these commands:$admincmds"
2180 fi
2181 if test -f /etc/ld.so.conf; then
2182 $ECHO " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
2183 fi
2184 $ECHO
2185
2186 $ECHO "See any operating system documentation about shared libraries for"
2187 case $host in
2188 solaris2.[6789]|solaris2.1[0-9])
2189 $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual"
2190 $ECHO "pages."
2191 ;;
2192 *)
2193 $ECHO "more information, such as the ld(1) and ld.so(8) manual pages."
2194 ;;
2195 esac
2196 $ECHO "X----------------------------------------------------------------------" | $Xsed
2197 exit $EXIT_SUCCESS
2198 }
2199
2200 test "$mode" = finish && func_mode_finish ${1+"$@"}
2201
2202
2203 # func_mode_install arg...
2204 func_mode_install ()
2205 {
2206 $opt_debug
2207 # There may be an optional sh(1) argument at the beginning of
2208 # install_prog (especially on Windows NT).
2209 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
2210 # Allow the use of GNU shtool's install command.
2211 $ECHO "X$nonopt" | $GREP shtool >/dev/null; then
2212 # Aesthetically quote it.
2213 func_quote_for_eval "$nonopt"
2214 install_prog="$func_quote_for_eval_result "
2215 arg=$1
2216 shift
2217 else
2218 install_prog=
2219 arg=$nonopt
2220 fi
2221
2222 # The real first argument should be the name of the installation program.
2223 # Aesthetically quote it.
2224 func_quote_for_eval "$arg"
2225 install_prog="$install_prog$func_quote_for_eval_result"
2226
2227 # We need to accept at least all the BSD install flags.
2228 dest=
2229 files=
2230 opts=
2231 prev=
2232 install_type=
2233 isdir=no
2234 stripme=
2235 for arg
2236 do
2237 if test -n "$dest"; then
2238 files="$files $dest"
2239 dest=$arg
2240 continue
2241 fi
2242
2243 case $arg in
2244 -d) isdir=yes ;;
2245 -f)
2246 case " $install_prog " in
2247 *[\\\ /]cp\ *) ;;
2248 *) prev=$arg ;;
2249 esac
2250 ;;
2251 -g | -m | -o)
2252 prev=$arg
2253 ;;
2254 -s)
2255 stripme=" -s"
2256 continue
2257 ;;
2258 -*)
2259 ;;
2260 *)
2261 # If the previous option needed an argument, then skip it.
2262 if test -n "$prev"; then
2263 prev=
2264 else
2265 dest=$arg
2266 continue
2267 fi
2268 ;;
2269 esac
2270
2271 # Aesthetically quote the argument.
2272 func_quote_for_eval "$arg"
2273 install_prog="$install_prog $func_quote_for_eval_result"
2274 done
2275
2276 test -z "$install_prog" && \
2277 func_fatal_help "you must specify an install program"
2278
2279 test -n "$prev" && \
2280 func_fatal_help "the \`$prev' option requires an argument"
2281
2282 if test -z "$files"; then
2283 if test -z "$dest"; then
2284 func_fatal_help "no file or destination specified"
2285 else
2286 func_fatal_help "you must specify a destination"
2287 fi
2288 fi
2289
2290 # Strip any trailing slash from the destination.
2291 func_stripname '' '/' "$dest"
2292 dest=$func_stripname_result
2293
2294 # Check to see that the destination is a directory.
2295 test -d "$dest" && isdir=yes
2296 if test "$isdir" = yes; then
2297 destdir="$dest"
2298 destname=
2299 else
2300 func_dirname_and_basename "$dest" "" "."
2301 destdir="$func_dirname_result"
2302 destname="$func_basename_result"
2303
2304 # Not a directory, so check to see that there is only one file specified.
2305 set dummy $files; shift
2306 test "$#" -gt 1 && \
2307 func_fatal_help "\`$dest' is not a directory"
2308 fi
2309 case $destdir in
2310 [\\/]* | [A-Za-z]:[\\/]*) ;;
2311 *)
2312 for file in $files; do
2313 case $file in
2314 *.lo) ;;
2315 *)
2316 func_fatal_help "\`$destdir' must be an absolute directory name"
2317 ;;
2318 esac
2319 done
2320 ;;
2321 esac
2322
2323 # This variable tells wrapper scripts just to set variables rather
2324 # than running their programs.
2325 libtool_install_magic="$magic"
2326
2327 staticlibs=
2328 future_libdirs=
2329 current_libdirs=
2330 for file in $files; do
2331
2332 # Do each installation.
2333 case $file in
2334 *.$libext)
2335 # Do the static libraries later.
2336 staticlibs="$staticlibs $file"
2337 ;;
2338
2339 *.la)
2340 # Check to see that this really is a libtool archive.
2341 func_lalib_unsafe_p "$file" \
2342 || func_fatal_help "\`$file' is not a valid libtool archive"
2343
2344 library_names=
2345 old_library=
2346 relink_command=
2347 func_source "$file"
2348
2349 # Add the libdir to current_libdirs if it is the destination.
2350 if test "X$destdir" = "X$libdir"; then
2351 case "$current_libdirs " in
2352 *" $libdir "*) ;;
2353 *) current_libdirs="$current_libdirs $libdir" ;;
2354 esac
2355 else
2356 # Note the libdir as a future libdir.
2357 case "$future_libdirs " in
2358 *" $libdir "*) ;;
2359 *) future_libdirs="$future_libdirs $libdir" ;;
2360 esac
2361 fi
2362
2363 func_dirname "$file" "/" ""
2364 dir="$func_dirname_result"
2365 dir="$dir$objdir"
2366
2367 if test -n "$relink_command"; then
2368 # Determine the prefix the user has applied to our future dir.
2369 inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"`
2370
2371 # Don't allow the user to place us outside of our expected
2372 # location b/c this prevents finding dependent libraries that
2373 # are installed to the same prefix.
2374 # At present, this check doesn't affect windows .dll's that
2375 # are installed into $libdir/../bin (currently, that works fine)
2376 # but it's something to keep an eye on.
2377 test "$inst_prefix_dir" = "$destdir" && \
2378 func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
2379
2380 if test -n "$inst_prefix_dir"; then
2381 # Stick the inst_prefix_dir data into the link command.
2382 relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
2383 else
2384 relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"`
2385 fi
2386
2387 func_warning "relinking \`$file'"
2388 func_show_eval "$relink_command" \
2389 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
2390 fi
2391
2392 # See the names of the shared library.
2393 set dummy $library_names; shift
2394 if test -n "$1"; then
2395 realname="$1"
2396 shift
2397
2398 srcname="$realname"
2399 test -n "$relink_command" && srcname="$realname"T
2400
2401 # Install the shared library and build the symlinks.
2402 func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \
2403 'exit $?'
2404 tstripme="$stripme"
2405 case $host_os in
2406 cygwin* | mingw* | pw32*)
2407 case $realname in
2408 *.dll.a)
2409 tstripme=""
2410 ;;
2411 esac
2412 ;;
2413 esac
2414 if test -n "$tstripme" && test -n "$striplib"; then
2415 func_show_eval "$striplib $destdir/$realname" 'exit $?'
2416 fi
2417
2418 if test "$#" -gt 0; then
2419 # Delete the old symlinks, and create new ones.
2420 # Try `ln -sf' first, because the `ln' binary might depend on
2421 # the symlink we replace! Solaris /bin/ln does not understand -f,
2422 # so we also need to try rm && ln -s.
2423 for linkname
2424 do
2425 test "$linkname" != "$realname" \
2426 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
2427 done
2428 fi
2429
2430 # Do each command in the postinstall commands.
2431 lib="$destdir/$realname"
2432 func_execute_cmds "$postinstall_cmds" 'exit $?'
2433 fi
2434
2435 # Install the pseudo-library for information purposes.
2436 func_basename "$file"
2437 name="$func_basename_result"
2438 instname="$dir/$name"i
2439 func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
2440
2441 # Maybe install the static library, too.
2442 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
2443 ;;
2444
2445 *.lo)
2446 # Install (i.e. copy) a libtool object.
2447
2448 # Figure out destination file name, if it wasn't already specified.
2449 if test -n "$destname"; then
2450 destfile="$destdir/$destname"
2451 else
2452 func_basename "$file"
2453 destfile="$func_basename_result"
2454 destfile="$destdir/$destfile"
2455 fi
2456
2457 # Deduce the name of the destination old-style object file.
2458 case $destfile in
2459 *.lo)
2460 func_lo2o "$destfile"
2461 staticdest=$func_lo2o_result
2462 ;;
2463 *.$objext)
2464 staticdest="$destfile"
2465 destfile=
2466 ;;
2467 *)
2468 func_fatal_help "cannot copy a libtool object to \`$destfile'"
2469 ;;
2470 esac
2471
2472 # Install the libtool object if requested.
2473 test -n "$destfile" && \
2474 func_show_eval "$install_prog $file $destfile" 'exit $?'
2475
2476 # Install the old object if enabled.
2477 if test "$build_old_libs" = yes; then
2478 # Deduce the name of the old-style object file.
2479 func_lo2o "$file"
2480 staticobj=$func_lo2o_result
2481 func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
2482 fi
2483 exit $EXIT_SUCCESS
2484 ;;
2485
2486 *)
2487 # Figure out destination file name, if it wasn't already specified.
2488 if test -n "$destname"; then
2489 destfile="$destdir/$destname"
2490 else
2491 func_basename "$file"
2492 destfile="$func_basename_result"
2493 destfile="$destdir/$destfile"
2494 fi
2495
2496 # If the file is missing, and there is a .exe on the end, strip it
2497 # because it is most likely a libtool script we actually want to
2498 # install
2499 stripped_ext=""
2500 case $file in
2501 *.exe)
2502 if test ! -f "$file"; then
2503 func_stripname '' '.exe' "$file"
2504 file=$func_stripname_result
2505 stripped_ext=".exe"
2506 fi
2507 ;;
2508 esac
2509
2510 # Do a test to see if this is really a libtool program.
2511 case $host in
2512 *cygwin*|*mingw*)
2513 if func_ltwrapper_executable_p "$file"; then
2514 func_ltwrapper_scriptname "$file"
2515 wrapper=$func_ltwrapper_scriptname_result
2516 else
2517 func_stripname '' '.exe' "$file"
2518 wrapper=$func_stripname_result
2519 fi
2520 ;;
2521 *)
2522 wrapper=$file
2523 ;;
2524 esac
2525 if func_ltwrapper_script_p "$wrapper"; then
2526 notinst_deplibs=
2527 relink_command=
2528
2529 func_source "$wrapper"
2530
2531 # Check the variables that should have been set.
2532 test -z "$generated_by_libtool_version" && \
2533 func_fatal_error "invalid libtool wrapper script \`$wrapper'"
2534
2535 finalize=yes
2536 for lib in $notinst_deplibs; do
2537 # Check to see that each library is installed.
2538 libdir=
2539 if test -f "$lib"; then
2540 func_source "$lib"
2541 fi
2542 libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
2543 if test -n "$libdir" && test ! -f "$libfile"; then
2544 func_warning "\`$lib' has not been installed in \`$libdir'"
2545 finalize=no
2546 fi
2547 done
2548
2549 relink_command=
2550 func_source "$wrapper"
2551
2552 outputname=
2553 if test "$fast_install" = no && test -n "$relink_command"; then
2554 $opt_dry_run || {
2555 if test "$finalize" = yes; then
2556 tmpdir=`func_mktempdir`
2557 func_basename "$file$stripped_ext"
2558 file="$func_basename_result"
2559 outputname="$tmpdir/$file"
2560 # Replace the output file specification.
2561 relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
2562
2563 $opt_silent || {
2564 func_quote_for_expand "$relink_command"
2565 eval "func_echo $func_quote_for_expand_result"
2566 }
2567 if eval "$relink_command"; then :
2568 else
2569 func_error "error: relink \`$file' with the above command before installing it"
2570 $opt_dry_run || ${RM}r "$tmpdir"
2571 continue
2572 fi
2573 file="$outputname"
2574 else
2575 func_warning "cannot relink \`$file'"
2576 fi
2577 }
2578 else
2579 # Install the binary that we compiled earlier.
2580 file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
2581 fi
2582 fi
2583
2584 # remove .exe since cygwin /usr/bin/install will append another
2585 # one anyway
2586 case $install_prog,$host in
2587 */usr/bin/install*,*cygwin*)
2588 case $file:$destfile in
2589 *.exe:*.exe)
2590 # this is ok
2591 ;;
2592 *.exe:*)
2593 destfile=$destfile.exe
2594 ;;
2595 *:*.exe)
2596 func_stripname '' '.exe' "$destfile"
2597 destfile=$func_stripname_result
2598 ;;
2599 esac
2600 ;;
2601 esac
2602 func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
2603 $opt_dry_run || if test -n "$outputname"; then
2604 ${RM}r "$tmpdir"
2605 fi
2606 ;;
2607 esac
2608 done
2609
2610 for file in $staticlibs; do
2611 func_basename "$file"
2612 name="$func_basename_result"
2613
2614 # Set up the ranlib parameters.
2615 oldlib="$destdir/$name"
2616
2617 func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
2618
2619 if test -n "$stripme" && test -n "$old_striplib"; then
2620 func_show_eval "$old_striplib $oldlib" 'exit $?'
2621 fi
2622
2623 # Do each command in the postinstall commands.
2624 func_execute_cmds "$old_postinstall_cmds" 'exit $?'
2625 done
2626
2627 test -n "$future_libdirs" && \
2628 func_warning "remember to run \`$progname --finish$future_libdirs'"
2629
2630 if test -n "$current_libdirs"; then
2631 # Maybe just do a dry run.
2632 $opt_dry_run && current_libdirs=" -n$current_libdirs"
2633 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
2634 else
2635 exit $EXIT_SUCCESS
2636 fi
2637 }
2638
2639 test "$mode" = install && func_mode_install ${1+"$@"}
2640
2641
2642 # func_emit_wrapper arg
2643 #
2644 # emit a libtool wrapper script on stdout
2645 # don't directly open a file because we may want to
2646 # incorporate the script contents within a cygwin/mingw
2647 # wrapper executable. Must ONLY be called from within
2648 # func_mode_link because it depends on a number of variable
2649 # set therein.
2650 #
2651 # arg is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
2652 # variable will take. If 'yes', then the emitted script
2653 # will assume that the directory in which it is stored is
2654 # the '.lib' directory. This is a cygwin/mingw-specific
2655 # behavior.
2656 func_emit_wrapper ()
2657 {
2658 func_emit_wrapper_arg1=no
2701 func_emit_wrapper_part1_arg1=no
26592702 if test -n "$1" ; then
2660 func_emit_wrapper_arg1=$1
2703 func_emit_wrapper_part1_arg1=$1
26612704 fi
26622705
26632706 $ECHO "\
27422785 file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
27432786 file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
27442787 done
2788 "
2789 }
2790 # end: func_emit_wrapper_part1
2791
2792 # func_emit_wrapper_part2 [arg=no]
2793 #
2794 # Emit the second part of a libtool wrapper script on stdout.
2795 # For more information, see the description associated with
2796 # func_emit_wrapper(), below.
2797 func_emit_wrapper_part2 ()
2798 {
2799 func_emit_wrapper_part2_arg1=no
2800 if test -n "$1" ; then
2801 func_emit_wrapper_part2_arg1=$1
2802 fi
2803
2804 $ECHO "\
27452805
27462806 # Usually 'no', except on cygwin/mingw when embedded into
27472807 # the cwrapper.
2748 WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
2808 WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_part2_arg1
27492809 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
27502810 # special case for '.'
27512811 if test \"\$thisdir\" = \".\"; then
28362896 "
28372897 case $host in
28382898 # Backslashes separate directories on plain windows
2839 *-*-mingw | *-*-os2*)
2899 *-*-mingw | *-*-os2* | *-cegcc*)
28402900 $ECHO "\
28412901 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
28422902 "
28492909 ;;
28502910 esac
28512911 $ECHO "\
2852 \$ECHO \"\$0: cannot exec \$program \$*\"
2912 \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
28532913 exit 1
28542914 fi
28552915 else
28622922 fi\
28632923 "
28642924 }
2865 # end: func_emit_wrapper
2925 # end: func_emit_wrapper_part2
2926
2927
2928 # func_emit_wrapper [arg=no]
2929 #
2930 # Emit a libtool wrapper script on stdout.
2931 # Don't directly open a file because we may want to
2932 # incorporate the script contents within a cygwin/mingw
2933 # wrapper executable. Must ONLY be called from within
2934 # func_mode_link because it depends on a number of variables
2935 # set therein.
2936 #
2937 # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
2938 # variable will take. If 'yes', then the emitted script
2939 # will assume that the directory in which it is stored is
2940 # the $objdir directory. This is a cygwin/mingw-specific
2941 # behavior.
2942 func_emit_wrapper ()
2943 {
2944 func_emit_wrapper_arg1=no
2945 if test -n "$1" ; then
2946 func_emit_wrapper_arg1=$1
2947 fi
2948
2949 # split this up so that func_emit_cwrapperexe_src
2950 # can call each part independently.
2951 func_emit_wrapper_part1 "${func_emit_wrapper_arg1}"
2952 func_emit_wrapper_part2 "${func_emit_wrapper_arg1}"
2953 }
2954
2955
2956 # func_to_host_path arg
2957 #
2958 # Convert paths to host format when used with build tools.
2959 # Intended for use with "native" mingw (where libtool itself
2960 # is running under the msys shell), or in the following cross-
2961 # build environments:
2962 # $build $host
2963 # mingw (msys) mingw [e.g. native]
2964 # cygwin mingw
2965 # *nix + wine mingw
2966 # where wine is equipped with the `winepath' executable.
2967 # In the native mingw case, the (msys) shell automatically
2968 # converts paths for any non-msys applications it launches,
2969 # but that facility isn't available from inside the cwrapper.
2970 # Similar accommodations are necessary for $host mingw and
2971 # $build cygwin. Calling this function does no harm for other
2972 # $host/$build combinations not listed above.
2973 #
2974 # ARG is the path (on $build) that should be converted to
2975 # the proper representation for $host. The result is stored
2976 # in $func_to_host_path_result.
2977 func_to_host_path ()
2978 {
2979 func_to_host_path_result="$1"
2980 if test -n "$1" ; then
2981 case $host in
2982 *mingw* )
2983 lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
2984 case $build in
2985 *mingw* ) # actually, msys
2986 # awkward: cmd appends spaces to result
2987 lt_sed_strip_trailing_spaces="s/[ ]*\$//"
2988 func_to_host_path_tmp1=`( cmd //c echo "$1" |\
2989 $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
2990 func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
2991 $SED -e "$lt_sed_naive_backslashify"`
2992 ;;
2993 *cygwin* )
2994 func_to_host_path_tmp1=`cygpath -w "$1"`
2995 func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
2996 $SED -e "$lt_sed_naive_backslashify"`
2997 ;;
2998 * )
2999 # Unfortunately, winepath does not exit with a non-zero
3000 # error code, so we are forced to check the contents of
3001 # stdout. On the other hand, if the command is not
3002 # found, the shell will set an exit code of 127 and print
3003 # *an error message* to stdout. So we must check for both
3004 # error code of zero AND non-empty stdout, which explains
3005 # the odd construction:
3006 func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null`
3007 if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then
3008 func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
3009 $SED -e "$lt_sed_naive_backslashify"`
3010 else
3011 # Allow warning below.
3012 func_to_host_path_result=""
3013 fi
3014 ;;
3015 esac
3016 if test -z "$func_to_host_path_result" ; then
3017 func_error "Could not determine host path corresponding to"
3018 func_error " '$1'"
3019 func_error "Continuing, but uninstalled executables may not work."
3020 # Fallback:
3021 func_to_host_path_result="$1"
3022 fi
3023 ;;
3024 esac
3025 fi
3026 }
3027 # end: func_to_host_path
3028
3029 # func_to_host_pathlist arg
3030 #
3031 # Convert pathlists to host format when used with build tools.
3032 # See func_to_host_path(), above. This function supports the
3033 # following $build/$host combinations (but does no harm for
3034 # combinations not listed here):
3035 # $build $host
3036 # mingw (msys) mingw [e.g. native]
3037 # cygwin mingw
3038 # *nix + wine mingw
3039 #
3040 # Path separators are also converted from $build format to
3041 # $host format. If ARG begins or ends with a path separator
3042 # character, it is preserved (but converted to $host format)
3043 # on output.
3044 #
3045 # ARG is a pathlist (on $build) that should be converted to
3046 # the proper representation on $host. The result is stored
3047 # in $func_to_host_pathlist_result.
3048 func_to_host_pathlist ()
3049 {
3050 func_to_host_pathlist_result="$1"
3051 if test -n "$1" ; then
3052 case $host in
3053 *mingw* )
3054 lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
3055 # Remove leading and trailing path separator characters from
3056 # ARG. msys behavior is inconsistent here, cygpath turns them
3057 # into '.;' and ';.', and winepath ignores them completely.
3058 func_to_host_pathlist_tmp2="$1"
3059 # Once set for this call, this variable should not be
3060 # reassigned. It is used in tha fallback case.
3061 func_to_host_pathlist_tmp1=`echo "$func_to_host_pathlist_tmp2" |\
3062 $SED -e 's|^:*||' -e 's|:*$||'`
3063 case $build in
3064 *mingw* ) # Actually, msys.
3065 # Awkward: cmd appends spaces to result.
3066 lt_sed_strip_trailing_spaces="s/[ ]*\$//"
3067 func_to_host_pathlist_tmp2=`( cmd //c echo "$func_to_host_pathlist_tmp1" |\
3068 $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
3069 func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
3070 $SED -e "$lt_sed_naive_backslashify"`
3071 ;;
3072 *cygwin* )
3073 func_to_host_pathlist_tmp2=`cygpath -w -p "$func_to_host_pathlist_tmp1"`
3074 func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
3075 $SED -e "$lt_sed_naive_backslashify"`
3076 ;;
3077 * )
3078 # unfortunately, winepath doesn't convert pathlists
3079 func_to_host_pathlist_result=""
3080 func_to_host_pathlist_oldIFS=$IFS
3081 IFS=:
3082 for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do
3083 IFS=$func_to_host_pathlist_oldIFS
3084 if test -n "$func_to_host_pathlist_f" ; then
3085 func_to_host_path "$func_to_host_pathlist_f"
3086 if test -n "$func_to_host_path_result" ; then
3087 if test -z "$func_to_host_pathlist_result" ; then
3088 func_to_host_pathlist_result="$func_to_host_path_result"
3089 else
3090 func_to_host_pathlist_result="$func_to_host_pathlist_result;$func_to_host_path_result"
3091 fi
3092 fi
3093 fi
3094 IFS=:
3095 done
3096 IFS=$func_to_host_pathlist_oldIFS
3097 ;;
3098 esac
3099 if test -z "$func_to_host_pathlist_result" ; then
3100 func_error "Could not determine the host path(s) corresponding to"
3101 func_error " '$1'"
3102 func_error "Continuing, but uninstalled executables may not work."
3103 # Fallback. This may break if $1 contains DOS-style drive
3104 # specifications. The fix is not to complicate the expression
3105 # below, but for the user to provide a working wine installation
3106 # with winepath so that path translation in the cross-to-mingw
3107 # case works properly.
3108 lt_replace_pathsep_nix_to_dos="s|:|;|g"
3109 func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\
3110 $SED -e "$lt_replace_pathsep_nix_to_dos"`
3111 fi
3112 # Now, add the leading and trailing path separators back
3113 case "$1" in
3114 :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result"
3115 ;;
3116 esac
3117 case "$1" in
3118 *: ) func_to_host_pathlist_result="$func_to_host_pathlist_result;"
3119 ;;
3120 esac
3121 ;;
3122 esac
3123 fi
3124 }
3125 # end: func_to_host_pathlist
28663126
28673127 # func_emit_cwrapperexe_src
28683128 # emit the source code for a wrapper executable on stdout
28923152 #ifdef _MSC_VER
28933153 # include <direct.h>
28943154 # include <process.h>
3155 # include <io.h>
3156 # define setmode _setmode
28953157 #else
28963158 # include <unistd.h>
28973159 # include <stdint.h>
3160 # ifdef __CYGWIN__
3161 # include <io.h>
3162 # define HAVE_SETENV
3163 # ifdef __STRICT_ANSI__
3164 char *realpath (const char *, char *);
3165 int putenv (char *);
3166 int setenv (const char *, const char *, int);
3167 # endif
3168 # endif
28983169 #endif
28993170 #include <malloc.h>
29003171 #include <stdarg.h>
29023173 #include <string.h>
29033174 #include <ctype.h>
29043175 #include <errno.h>
3176 #include <fcntl.h>
29053177 #include <sys/stat.h>
29063178
29073179 #if defined(PATH_MAX)
29353207 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
29363208 defined (__OS2__)
29373209 # define HAVE_DOS_BASED_FILE_SYSTEM
3210 # define FOPEN_WB "wb"
29383211 # ifndef DIR_SEPARATOR_2
29393212 # define DIR_SEPARATOR_2 '\\'
29403213 # endif
29553228 #else /* PATH_SEPARATOR_2 */
29563229 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
29573230 #endif /* PATH_SEPARATOR_2 */
3231
3232 #ifdef __CYGWIN__
3233 # define FOPEN_WB "wb"
3234 #endif
3235
3236 #ifndef FOPEN_WB
3237 # define FOPEN_WB "w"
3238 #endif
3239 #ifndef _O_BINARY
3240 # define _O_BINARY 0
3241 #endif
29583242
29593243 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
29603244 #define XFREE(stale) do { \
29873271 int check_executable (const char *path);
29883272 char *strendzap (char *str, const char *pat);
29893273 void lt_fatal (const char *message, ...);
2990
2991 static const char *script_text =
3274 void lt_setenv (const char *name, const char *value);
3275 char *lt_extend_str (const char *orig_value, const char *add, int to_end);
3276 void lt_opt_process_env_set (const char *arg);
3277 void lt_opt_process_env_prepend (const char *arg);
3278 void lt_opt_process_env_append (const char *arg);
3279 int lt_split_name_value (const char *arg, char** name, char** value);
3280 void lt_update_exe_path (const char *name, const char *value);
3281 void lt_update_lib_path (const char *name, const char *value);
3282
3283 static const char *script_text_part1 =
29923284 EOF
29933285
2994 func_emit_wrapper yes |
3286 func_emit_wrapper_part1 yes |
29953287 $SED -e 's/\([\\"]\)/\\\1/g' \
29963288 -e 's/^/ "/' -e 's/$/\\n"/'
29973289 echo ";"
3290 cat <<EOF
3291
3292 static const char *script_text_part2 =
3293 EOF
3294 func_emit_wrapper_part2 yes |
3295 $SED -e 's/\([\\"]\)/\\\1/g' \
3296 -e 's/^/ "/' -e 's/$/\\n"/'
3297 echo ";"
29983298
29993299 cat <<EOF
30003300 const char * MAGIC_EXE = "$magic_exe";
3301 const char * LIB_PATH_VARNAME = "$shlibpath_var";
3302 EOF
3303
3304 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
3305 func_to_host_pathlist "$temp_rpath"
3306 cat <<EOF
3307 const char * LIB_PATH_VALUE = "$func_to_host_pathlist_result";
3308 EOF
3309 else
3310 cat <<"EOF"
3311 const char * LIB_PATH_VALUE = "";
3312 EOF
3313 fi
3314
3315 if test -n "$dllsearchpath"; then
3316 func_to_host_pathlist "$dllsearchpath:"
3317 cat <<EOF
3318 const char * EXE_PATH_VARNAME = "PATH";
3319 const char * EXE_PATH_VALUE = "$func_to_host_pathlist_result";
3320 EOF
3321 else
3322 cat <<"EOF"
3323 const char * EXE_PATH_VARNAME = "";
3324 const char * EXE_PATH_VALUE = "";
3325 EOF
3326 fi
3327
3328 if test "$fast_install" = yes; then
3329 cat <<EOF
3330 const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
3331 EOF
3332 else
3333 cat <<EOF
3334 const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
3335 EOF
3336 fi
3337
3338
3339 cat <<"EOF"
3340
3341 #define LTWRAPPER_OPTION_PREFIX "--lt-"
3342 #define LTWRAPPER_OPTION_PREFIX_LENGTH 5
3343
3344 static const size_t opt_prefix_len = LTWRAPPER_OPTION_PREFIX_LENGTH;
3345 static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
3346
3347 static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
3348
3349 static const size_t env_set_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 7;
3350 static const char *env_set_opt = LTWRAPPER_OPTION_PREFIX "env-set";
3351 /* argument is putenv-style "foo=bar", value of foo is set to bar */
3352
3353 static const size_t env_prepend_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 11;
3354 static const char *env_prepend_opt = LTWRAPPER_OPTION_PREFIX "env-prepend";
3355 /* argument is putenv-style "foo=bar", new value of foo is bar${foo} */
3356
3357 static const size_t env_append_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 10;
3358 static const char *env_append_opt = LTWRAPPER_OPTION_PREFIX "env-append";
3359 /* argument is putenv-style "foo=bar", new value of foo is ${foo}bar */
30013360
30023361 int
30033362 main (int argc, char *argv[])
30043363 {
30053364 char **newargz;
3365 int newargc;
30063366 char *tmp_pathspec;
30073367 char *actual_cwrapper_path;
3008 char *shwrapper_name;
3368 char *actual_cwrapper_name;
3369 char *target_name;
3370 char *lt_argv_zero;
30093371 intptr_t rval = 127;
3010 FILE *shwrapper;
3011
3012 const char *dumpscript_opt = "--lt-dump-script";
3372
30133373 int i;
30143374
30153375 program_name = (char *) xstrdup (base_name (argv[0]));
30213381 {
30223382 if (strcmp (argv[i], dumpscript_opt) == 0)
30233383 {
3024 printf ("%s", script_text);
3384 EOF
3385 case "$host" in
3386 *mingw* | *cygwin* )
3387 # make stdout use "unix" line endings
3388 echo " setmode(1,_O_BINARY);"
3389 ;;
3390 esac
3391
3392 cat <<"EOF"
3393 printf ("%s", script_text_part1);
3394 printf ("%s", script_text_part2);
30253395 return 0;
30263396 }
30273397 }
30283398
3029 newargz = XMALLOC (char *, argc + 2);
3030 EOF
3031
3032 if test -n "$TARGETSHELL" ; then
3033 # no path translation at all
3034 lt_newargv0=$TARGETSHELL
3035 else
3036 case "$host" in
3037 *mingw* )
3038 # awkward: cmd appends spaces to result
3039 lt_sed_strip_trailing_spaces="s/[ ]*\$//"
3040 lt_newargv0=`( cmd //c echo $SHELL | $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo $SHELL`
3041 case $lt_newargv0 in
3042 *.exe | *.EXE) ;;
3043 *) lt_newargv0=$lt_newargv0.exe ;;
3044 esac
3045 ;;
3046 * ) lt_newargv0=$SHELL ;;
3047 esac
3048 fi
3049
3050 cat <<EOF
3051 newargz[0] = (char *) xstrdup ("$lt_newargv0");
3052 EOF
3053
3054 cat <<"EOF"
3399 newargz = XMALLOC (char *, argc + 1);
30553400 tmp_pathspec = find_executable (argv[0]);
30563401 if (tmp_pathspec == NULL)
30573402 lt_fatal ("Couldn't find %s", argv[0]);
30633408 actual_cwrapper_path));
30643409 XFREE (tmp_pathspec);
30653410
3066 shwrapper_name = (char *) xstrdup (base_name (actual_cwrapper_path));
3067 strendzap (actual_cwrapper_path, shwrapper_name);
3068
3069 /* shwrapper_name transforms */
3070 strendzap (shwrapper_name, ".exe");
3071 tmp_pathspec = XMALLOC (char, (strlen (shwrapper_name) +
3072 strlen ("_ltshwrapperTMP") + 1));
3073 strcpy (tmp_pathspec, shwrapper_name);
3074 strcat (tmp_pathspec, "_ltshwrapperTMP");
3075 XFREE (shwrapper_name);
3076 shwrapper_name = tmp_pathspec;
3411 actual_cwrapper_name = xstrdup( base_name (actual_cwrapper_path));
3412 strendzap (actual_cwrapper_path, actual_cwrapper_name);
3413
3414 /* wrapper name transforms */
3415 strendzap (actual_cwrapper_name, ".exe");
3416 tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
3417 XFREE (actual_cwrapper_name);
3418 actual_cwrapper_name = tmp_pathspec;
30773419 tmp_pathspec = 0;
3078 LTWRAPPER_DEBUGPRINTF (("(main) libtool shell wrapper name: %s\n",
3079 shwrapper_name));
3420
3421 /* target_name transforms -- use actual target program name; might have lt- prefix */
3422 target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
3423 strendzap (target_name, ".exe");
3424 tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
3425 XFREE (target_name);
3426 target_name = tmp_pathspec;
3427 tmp_pathspec = 0;
3428
3429 LTWRAPPER_DEBUGPRINTF (("(main) libtool target name: %s\n",
3430 target_name));
30803431 EOF
30813432
30823433 cat <<EOF
3083 newargz[1] =
3434 newargz[0] =
30843435 XMALLOC (char, (strlen (actual_cwrapper_path) +
3085 strlen ("$objdir") + 1 + strlen (shwrapper_name) + 1));
3086 strcpy (newargz[1], actual_cwrapper_path);
3087 strcat (newargz[1], "$objdir");
3088 strcat (newargz[1], "/");
3089 strcat (newargz[1], shwrapper_name);
3436 strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
3437 strcpy (newargz[0], actual_cwrapper_path);
3438 strcat (newargz[0], "$objdir");
3439 strcat (newargz[0], "/");
30903440 EOF
30913441
3442 cat <<"EOF"
3443 /* stop here, and copy so we don't have to do this twice */
3444 tmp_pathspec = xstrdup (newargz[0]);
3445
3446 /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
3447 strcat (newargz[0], actual_cwrapper_name);
3448
3449 /* DO want the lt- prefix here if it exists, so use target_name */
3450 lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
3451 XFREE (tmp_pathspec);
3452 tmp_pathspec = NULL;
3453 EOF
30923454
30933455 case $host_os in
30943456 mingw*)
30953457 cat <<"EOF"
30963458 {
30973459 char* p;
3098 while ((p = strchr (newargz[1], '\\')) != NULL)
3460 while ((p = strchr (newargz[0], '\\')) != NULL)
3461 {
3462 *p = '/';
3463 }
3464 while ((p = strchr (lt_argv_zero, '\\')) != NULL)
30993465 {
31003466 *p = '/';
31013467 }
31053471 esac
31063472
31073473 cat <<"EOF"
3108 XFREE (shwrapper_name);
3474 XFREE (target_name);
31093475 XFREE (actual_cwrapper_path);
3110
3111 /* note: do NOT use "wt" here! -- defer to underlying
3112 * mount type on cygwin
3113 */
3114 if ((shwrapper = fopen (newargz[1], "w")) == 0)
3476 XFREE (actual_cwrapper_name);
3477
3478 lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
3479 lt_setenv ("DUALCASE", "1"); /* for MSK sh */
3480 lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
3481 lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
3482
3483 newargc=0;
3484 for (i = 1; i < argc; i++)
31153485 {
3116 lt_fatal ("Could not open %s for writing", newargz[1]);
3486 if (strncmp (argv[i], env_set_opt, env_set_opt_len) == 0)
3487 {
3488 if (argv[i][env_set_opt_len] == '=')
3489 {
3490 const char *p = argv[i] + env_set_opt_len + 1;
3491 lt_opt_process_env_set (p);
3492 }
3493 else if (argv[i][env_set_opt_len] == '\0' && i + 1 < argc)
3494 {
3495 lt_opt_process_env_set (argv[++i]); /* don't copy */
3496 }
3497 else
3498 lt_fatal ("%s missing required argument", env_set_opt);
3499 continue;
3500 }
3501 if (strncmp (argv[i], env_prepend_opt, env_prepend_opt_len) == 0)
3502 {
3503 if (argv[i][env_prepend_opt_len] == '=')
3504 {
3505 const char *p = argv[i] + env_prepend_opt_len + 1;
3506 lt_opt_process_env_prepend (p);
3507 }
3508 else if (argv[i][env_prepend_opt_len] == '\0' && i + 1 < argc)
3509 {
3510 lt_opt_process_env_prepend (argv[++i]); /* don't copy */
3511 }
3512 else
3513 lt_fatal ("%s missing required argument", env_prepend_opt);
3514 continue;
3515 }
3516 if (strncmp (argv[i], env_append_opt, env_append_opt_len) == 0)
3517 {
3518 if (argv[i][env_append_opt_len] == '=')
3519 {
3520 const char *p = argv[i] + env_append_opt_len + 1;
3521 lt_opt_process_env_append (p);
3522 }
3523 else if (argv[i][env_append_opt_len] == '\0' && i + 1 < argc)
3524 {
3525 lt_opt_process_env_append (argv[++i]); /* don't copy */
3526 }
3527 else
3528 lt_fatal ("%s missing required argument", env_append_opt);
3529 continue;
3530 }
3531 if (strncmp (argv[i], ltwrapper_option_prefix, opt_prefix_len) == 0)
3532 {
3533 /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
3534 namespace, but it is not one of the ones we know about and
3535 have already dealt with, above (inluding dump-script), then
3536 report an error. Otherwise, targets might begin to believe
3537 they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
3538 namespace. The first time any user complains about this, we'll
3539 need to make LTWRAPPER_OPTION_PREFIX a configure-time option
3540 or a configure.ac-settable value.
3541 */
3542 lt_fatal ("Unrecognized option in %s namespace: '%s'",
3543 ltwrapper_option_prefix, argv[i]);
3544 }
3545 /* otherwise ... */
3546 newargz[++newargc] = xstrdup (argv[i]);
31173547 }
3118 fprintf (shwrapper, "%s", script_text);
3119 fclose (shwrapper);
3120
3121 make_executable (newargz[1]);
3122
3123 for (i = 1; i < argc; i++)
3124 newargz[i + 1] = xstrdup (argv[i]);
3125 newargz[argc + 1] = NULL;
3126
3127 for (i = 0; i < argc + 1; i++)
3548 newargz[++newargc] = NULL;
3549
3550 LTWRAPPER_DEBUGPRINTF (("(main) lt_argv_zero : %s\n", (lt_argv_zero ? lt_argv_zero : "<NULL>")));
3551 for (i = 0; i < newargc; i++)
31283552 {
3129 LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d] : %s\n", i, newargz[i]));
3553 LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d] : %s\n", i, (newargz[i] ? newargz[i] : "<NULL>")));
31303554 }
31313555
31323556 EOF
31333557
31343558 case $host_os in
31353559 mingw*)
3136 cat <<EOF
3560 cat <<"EOF"
31373561 /* execv doesn't actually work on mingw as expected on unix */
3138 rval = _spawnv (_P_WAIT, "$lt_newargv0", (const char * const *) newargz);
3562 rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
31393563 if (rval == -1)
31403564 {
31413565 /* failed to start process */
3142 LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"$lt_newargv0\": errno = %d\n", errno));
3566 LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno));
31433567 return 127;
31443568 }
31453569 return rval;
3146 }
31473570 EOF
31483571 ;;
31493572 *)
3150 cat <<EOF
3151 execv ("$lt_newargv0", newargz);
3573 cat <<"EOF"
3574 execv (lt_argv_zero, newargz);
31523575 return rval; /* =127, but avoids unused variable warning */
3153 }
31543576 EOF
31553577 ;;
31563578 esac
31573579
31583580 cat <<"EOF"
3581 }
31593582
31603583 void *
31613584 xmalloc (size_t num)
34293852 lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
34303853 va_end (ap);
34313854 }
3855
3856 void
3857 lt_setenv (const char *name, const char *value)
3858 {
3859 LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n",
3860 (name ? name : "<NULL>"),
3861 (value ? value : "<NULL>")));
3862 {
3863 #ifdef HAVE_SETENV
3864 /* always make a copy, for consistency with !HAVE_SETENV */
3865 char *str = xstrdup (value);
3866 setenv (name, str, 1);
3867 #else
3868 int len = strlen (name) + 1 + strlen (value) + 1;
3869 char *str = XMALLOC (char, len);
3870 sprintf (str, "%s=%s", name, value);
3871 if (putenv (str) != EXIT_SUCCESS)
3872 {
3873 XFREE (str);
3874 }
3875 #endif
3876 }
3877 }
3878
3879 char *
3880 lt_extend_str (const char *orig_value, const char *add, int to_end)
3881 {
3882 char *new_value;
3883 if (orig_value && *orig_value)
3884 {
3885 int orig_value_len = strlen (orig_value);
3886 int add_len = strlen (add);
3887 new_value = XMALLOC (char, add_len + orig_value_len + 1);
3888 if (to_end)
3889 {
3890 strcpy (new_value, orig_value);
3891 strcpy (new_value + orig_value_len, add);
3892 }
3893 else
3894 {
3895 strcpy (new_value, add);
3896 strcpy (new_value + add_len, orig_value);
3897 }
3898 }
3899 else
3900 {
3901 new_value = xstrdup (add);
3902 }
3903 return new_value;
3904 }
3905
3906 int
3907 lt_split_name_value (const char *arg, char** name, char** value)
3908 {
3909 const char *p;
3910 int len;
3911 if (!arg || !*arg)
3912 return 1;
3913
3914 p = strchr (arg, (int)'=');
3915
3916 if (!p)
3917 return 1;
3918
3919 *value = xstrdup (++p);
3920
3921 len = strlen (arg) - strlen (*value);
3922 *name = XMALLOC (char, len);
3923 strncpy (*name, arg, len-1);
3924 (*name)[len - 1] = '\0';
3925
3926 return 0;
3927 }
3928
3929 void
3930 lt_opt_process_env_set (const char *arg)
3931 {
3932 char *name = NULL;
3933 char *value = NULL;
3934
3935 if (lt_split_name_value (arg, &name, &value) != 0)
3936 {
3937 XFREE (name);
3938 XFREE (value);
3939 lt_fatal ("bad argument for %s: '%s'", env_set_opt, arg);
3940 }
3941
3942 lt_setenv (name, value);
3943 XFREE (name);
3944 XFREE (value);
3945 }
3946
3947 void
3948 lt_opt_process_env_prepend (const char *arg)
3949 {
3950 char *name = NULL;
3951 char *value = NULL;
3952 char *new_value = NULL;
3953
3954 if (lt_split_name_value (arg, &name, &value) != 0)
3955 {
3956 XFREE (name);
3957 XFREE (value);
3958 lt_fatal ("bad argument for %s: '%s'", env_prepend_opt, arg);
3959 }
3960
3961 new_value = lt_extend_str (getenv (name), value, 0);
3962 lt_setenv (name, new_value);
3963 XFREE (new_value);
3964 XFREE (name);
3965 XFREE (value);
3966 }
3967
3968 void
3969 lt_opt_process_env_append (const char *arg)
3970 {
3971 char *name = NULL;
3972 char *value = NULL;
3973 char *new_value = NULL;
3974
3975 if (lt_split_name_value (arg, &name, &value) != 0)
3976 {
3977 XFREE (name);
3978 XFREE (value);
3979 lt_fatal ("bad argument for %s: '%s'", env_append_opt, arg);
3980 }
3981
3982 new_value = lt_extend_str (getenv (name), value, 1);
3983 lt_setenv (name, new_value);
3984 XFREE (new_value);
3985 XFREE (name);
3986 XFREE (value);
3987 }
3988
3989 void
3990 lt_update_exe_path (const char *name, const char *value)
3991 {
3992 LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
3993 (name ? name : "<NULL>"),
3994 (value ? value : "<NULL>")));
3995
3996 if (name && *name && value && *value)
3997 {
3998 char *new_value = lt_extend_str (getenv (name), value, 0);
3999 /* some systems can't cope with a ':'-terminated path #' */
4000 int len = strlen (new_value);
4001 while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
4002 {
4003 new_value[len-1] = '\0';
4004 }
4005 lt_setenv (name, new_value);
4006 XFREE (new_value);
4007 }
4008 }
4009
4010 void
4011 lt_update_lib_path (const char *name, const char *value)
4012 {
4013 LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
4014 (name ? name : "<NULL>"),
4015 (value ? value : "<NULL>")));
4016
4017 if (name && *name && value && *value)
4018 {
4019 char *new_value = lt_extend_str (getenv (name), value, 0);
4020 lt_setenv (name, new_value);
4021 XFREE (new_value);
4022 }
4023 }
4024
4025
34324026 EOF
34334027 }
34344028 # end: func_emit_cwrapperexe_src
34384032 {
34394033 $opt_debug
34404034 case $host in
3441 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
4035 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
34424036 # It is impossible to link a dll without this setting, and
34434037 # we shouldn't force the makefile maintainer to figure out
34444038 # which system we are compiling for in order to pass an extra
35254119 fi
35264120 if test -n "$link_static_flag"; then
35274121 dlopen_self=$dlopen_self_static
3528 # See comment for -static flag below, for more details.
3529 func_append compile_command " $link_static_flag"
3530 func_append finalize_command " $link_static_flag"
35314122 fi
35324123 prefer_static_libs=yes
35334124 ;;
38154406
38164407 case $arg in
38174408 -all-static)
3818 # The effects of -all-static are defined in a previous loop.
4409 if test -n "$link_static_flag"; then
4410 # See comment for -static flag below, for more details.
4411 func_append compile_command " $link_static_flag"
4412 func_append finalize_command " $link_static_flag"
4413 fi
38194414 continue
38204415 ;;
38214416
38814476 -L*)
38824477 func_stripname '-L' '' "$arg"
38834478 dir=$func_stripname_result
4479 if test -z "$dir"; then
4480 if test "$#" -gt 0; then
4481 func_fatal_error "require no space between \`-L' and \`$1'"
4482 else
4483 func_fatal_error "need path for \`-L' option"
4484 fi
4485 fi
38844486 # We need an absolute path.
38854487 case $dir in
38864488 [\\/]* | [A-Za-z]:[\\/]*) ;;
38994501 ;;
39004502 esac
39014503 case $host in
3902 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
4504 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
39034505 testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'`
39044506 case :$dllsearchpath: in
39054507 *":$dir:"*) ;;
4508 ::) dllsearchpath=$dir;;
39064509 *) dllsearchpath="$dllsearchpath:$dir";;
39074510 esac
39084511 case :$dllsearchpath: in
39094512 *":$testbindir:"*) ;;
4513 ::) dllsearchpath=$testbindir;;
39104514 *) dllsearchpath="$dllsearchpath:$testbindir";;
39114515 esac
39124516 ;;
39174521 -l*)
39184522 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
39194523 case $host in
3920 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
4524 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc*)
39214525 # These systems don't actually have a C or math library (as such)
39224526 continue
39234527 ;;
39944598
39954599 -no-install)
39964600 case $host in
3997 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*)
4601 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
39984602 # The PATH hackery in wrapper scripts is required on Windows
39994603 # and Darwin in order for the loader to find any dlls it needs.
40004604 func_warning "\`-no-install' is ignored for $host"
49515555 if test -n "$library_names" &&
49525556 { test "$use_static_libs" = no || test -z "$old_library"; }; then
49535557 case $host in
4954 *cygwin* | *mingw*)
5558 *cygwin* | *mingw* | *cegcc*)
49555559 # No point in relinking DLLs because paths are not encoded
49565560 notinst_deplibs="$notinst_deplibs $lib"
49575561 need_relink=no
50215625 elif test -n "$soname_spec"; then
50225626 # bleh windows
50235627 case $host in
5024 *cygwin* | mingw*)
5025 major=`expr $current - $age`
5628 *cygwin* | mingw* | *cegcc*)
5629 func_arith $current - $age
5630 major=$func_arith_result
50265631 versuffix="-$major"
50275632 ;;
50285633 esac
53145919 done
53155920 if test -f "$absdir/$objdir/$depdepl" ; then
53165921 depdepl="$absdir/$objdir/$depdepl"
5317 darwin_install_name=`otool -L $depdepl | $SED -n -e '3q;2,2p' | $SED -e 's/(.*//'`
5318 darwin_install_name=`$ECHO $darwin_install_name`
5922 darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
53195923 if test -z "$darwin_install_name"; then
5320 darwin_install_name=`otool64 -L $depdepl | $SED -n -e '3q;2,2p' | $SED -e 's/(.*//'`
5321 darwin_install_name=`$ECHO $darwin_install_name`
5924 darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
53225925 fi
53235926 compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
53245927 linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}"
55856188 #
55866189 case $version_type in
55876190 darwin|linux|osf|windows|none)
5588 current=`expr $number_major + $number_minor`
6191 func_arith $number_major + $number_minor
6192 current=$func_arith_result
55896193 age="$number_minor"
55906194 revision="$number_revision"
55916195 ;;
55956199 age="0"
55966200 ;;
55976201 irix|nonstopux)
5598 current=`expr $number_major + $number_minor`
6202 func_arith $number_major + $number_minor
6203 current=$func_arith_result
55996204 age="$number_minor"
56006205 revision="$number_minor"
56016206 lt_irix_increment=no
56496254 darwin)
56506255 # Like Linux, but with the current version available in
56516256 # verstring for coding it into the library header
5652 major=.`expr $current - $age`
6257 func_arith $current - $age
6258 major=.$func_arith_result
56536259 versuffix="$major.$age.$revision"
56546260 # Darwin ld doesn't like 0 for these options...
5655 minor_current=`expr $current + 1`
6261 func_arith $current + 1
6262 minor_current=$func_arith_result
56566263 xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
56576264 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
56586265 ;;
56696276
56706277 irix | nonstopux)
56716278 if test "X$lt_irix_increment" = "Xno"; then
5672 major=`expr $current - $age`
6279 func_arith $current - $age
56736280 else
5674 major=`expr $current - $age + 1`
6281 func_arith $current - $age + 1
56756282 fi
6283 major=$func_arith_result
56766284
56776285 case $version_type in
56786286 nonstopux) verstring_prefix=nonstopux ;;
56836291 # Add in all the interfaces that we are compatible with.
56846292 loop=$revision
56856293 while test "$loop" -ne 0; do
5686 iface=`expr $revision - $loop`
5687 loop=`expr $loop - 1`
6294 func_arith $revision - $loop
6295 iface=$func_arith_result
6296 func_arith $loop - 1
6297 loop=$func_arith_result
56886298 verstring="$verstring_prefix$major.$iface:$verstring"
56896299 done
56906300
56946304 ;;
56956305
56966306 linux)
5697 major=.`expr $current - $age`
6307 func_arith $current - $age
6308 major=.$func_arith_result
56986309 versuffix="$major.$age.$revision"
56996310 ;;
57006311
57016312 osf)
5702 major=.`expr $current - $age`
6313 func_arith $current - $age
6314 major=.$func_arith_result
57036315 versuffix=".$current.$age.$revision"
57046316 verstring="$current.$age.$revision"
57056317
57066318 # Add in all the interfaces that we are compatible with.
57076319 loop=$age
57086320 while test "$loop" -ne 0; do
5709 iface=`expr $current - $loop`
5710 loop=`expr $loop - 1`
6321 func_arith $current - $loop
6322 iface=$func_arith_result
6323 func_arith $loop - 1
6324 loop=$func_arith_result
57116325 verstring="$verstring:${iface}.0"
57126326 done
57136327
57286342 windows)
57296343 # Use '-' rather than '.', since we only want one
57306344 # extension on DOS 8.3 filesystems.
5731 major=`expr $current - $age`
6345 func_arith $current - $age
6346 major=$func_arith_result
57326347 versuffix="-$major"
57336348 ;;
57346349
57896404 tempremovelist=`$ECHO "$output_objdir/*"`
57906405 for p in $tempremovelist; do
57916406 case $p in
5792 *.$objext)
6407 *.$objext | *.gcno)
57936408 ;;
57946409 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
57956410 if test "X$precious_files_regex" != "X"; then
58606475 if test "$build_libtool_libs" = yes; then
58616476 if test -n "$rpath"; then
58626477 case $host in
5863 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
6478 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc*)
58646479 # these systems don't actually have a c library (as such)!
58656480 ;;
58666481 *-*-rhapsody* | *-*-darwin1.[012])
59246539 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
59256540 ldd_output=`ldd conftest`
59266541 for i in $deplibs; do
5927 name=`expr $i : '-l\(.*\)'`
5928 # If $name is empty we are operating on a -L argument.
5929 if test "$name" != "" && test "$name" != "0"; then
6542 case $i in
6543 -l*)
6544 func_stripname -l '' "$i"
6545 name=$func_stripname_result
59306546 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
59316547 case " $predeps $postdeps " in
59326548 *" $i "*)
59536569 $ECHO "*** its dynamic dependency list that programs get resolved with at runtime."
59546570 fi
59556571 fi
5956 else
6572 ;;
6573 *)
59576574 newdeplibs="$newdeplibs $i"
5958 fi
6575 ;;
6576 esac
59596577 done
59606578 else
59616579 # Error occurred in the first compile. Let's try to salvage
59626580 # the situation: Compile a separate program for each library.
59636581 for i in $deplibs; do
5964 name=`expr $i : '-l\(.*\)'`
5965 # If $name is empty we are operating on a -L argument.
5966 if test "$name" != "" && test "$name" != "0"; then
6582 case $i in
6583 -l*)
6584 func_stripname -l '' "$i"
6585 name=$func_stripname_result
59676586 $opt_dry_run || $RM conftest
59686587 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
59696588 ldd_output=`ldd conftest`
60016620 $ECHO "*** library that it depends on before this library will be fully"
60026621 $ECHO "*** functional. Installing it before continuing would be even better."
60036622 fi
6004 else
6623 ;;
6624 *)
60056625 newdeplibs="$newdeplibs $i"
6006 fi
6626 ;;
6627 esac
60076628 done
60086629 fi
60096630 ;;
60116632 set dummy $deplibs_check_method; shift
60126633 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
60136634 for a_deplib in $deplibs; do
6014 name=`expr $a_deplib : '-l\(.*\)'`
6015 # If $name is empty we are operating on a -L argument.
6016 if test "$name" != "" && test "$name" != "0"; then
6635 case $a_deplib in
6636 -l*)
6637 func_stripname -l '' "$a_deplib"
6638 name=$func_stripname_result
60176639 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
60186640 case " $predeps $postdeps " in
60196641 *" $a_deplib "*)
60706692 $ECHO "*** using a file magic. Last file checked: $potlib"
60716693 fi
60726694 fi
6073 else
6695 ;;
6696 *)
60746697 # Add a -L argument.
60756698 newdeplibs="$newdeplibs $a_deplib"
6076 fi
6699 ;;
6700 esac
60776701 done # Gone through all deplibs.
60786702 ;;
60796703 match_pattern*)
60806704 set dummy $deplibs_check_method; shift
60816705 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
60826706 for a_deplib in $deplibs; do
6083 name=`expr $a_deplib : '-l\(.*\)'`
6084 # If $name is empty we are operating on a -L argument.
6085 if test -n "$name" && test "$name" != "0"; then
6707 case $a_deplib in
6708 -l*)
6709 func_stripname -l '' "$a_deplib"
6710 name=$func_stripname_result
60866711 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
60876712 case " $predeps $postdeps " in
60886713 *" $a_deplib "*)
61216746 $ECHO "*** using a regex pattern. Last file checked: $potlib"
61226747 fi
61236748 fi
6124 else
6749 ;;
6750 *)
61256751 # Add a -L argument.
61266752 newdeplibs="$newdeplibs $a_deplib"
6127 fi
6753 ;;
6754 esac
61286755 done # Gone through all deplibs.
61296756 ;;
61306757 none | unknown | *)
63476974
63486975 orig_export_symbols=
63496976 case $host_os in
6350 cygwin* | mingw*)
6977 cygwin* | mingw* | cegcc*)
63516978 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
63526979 # exporting using user supplied symfile
63536980 if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
63767003 for cmd in $cmds; do
63777004 IFS="$save_ifs"
63787005 eval cmd=\"$cmd\"
6379 if len=`expr "X$cmd" : ".*"` &&
6380 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
7006 func_len " $cmd"
7007 len=$func_len_result
7008 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
63817009 func_show_eval "$cmd" 'exit $?'
63827010 skipped_export=false
63837011 else
64807108 fi
64817109
64827110 if test "X$skipped_export" != "X:" &&
6483 len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
6484 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
7111 func_len " $test_cmds" &&
7112 len=$func_len_result &&
7113 test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
64857114 :
64867115 else
64877116 # The command line is too long to link in one step, link piecewise
65417170 if test -n "$save_libobjs"; then
65427171 func_verbose "creating reloadable object files..."
65437172 output=$output_objdir/$output_la-${k}.$objext
7173 eval test_cmds=\"$reload_cmds\"
7174 func_len " $test_cmds"
7175 len0=$func_len_result
7176 len=$len0
7177
65447178 # Loop over the list of objects to be linked.
65457179 for obj in $save_libobjs
65467180 do
6547 eval test_cmds=\"$reload_cmds $objlist $last_robj\"
7181 func_len " $obj"
7182 func_arith $len + $func_len_result
7183 len=$func_arith_result
65487184 if test "X$objlist" = X ||
6549 { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
6550 test "$len" -le "$max_cmd_len"; }; then
6551 objlist="$objlist $obj"
7185 test "$len" -lt "$max_cmd_len"; then
7186 func_append objlist " $obj"
65527187 else
65537188 # The command $test_cmds is almost too long, add a
65547189 # command to the queue.
65617196 eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj~\$RM $last_robj\"
65627197 fi
65637198 last_robj=$output_objdir/$output_la-${k}.$objext
6564 k=`expr $k + 1`
7199 func_arith $k + 1
7200 k=$func_arith_result
65657201 output=$output_objdir/$output_la-${k}.$objext
65667202 objlist=$obj
6567 len=1
7203 func_len " $last_robj"
7204 func_arith $len0 + $func_len_result
7205 len=$func_arith_result
65687206 fi
65697207 done
65707208 # Handle the remaining objects by creating one last
69617599 esac
69627600 fi
69637601 case $host in
6964 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
7602 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
69657603 testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
69667604 case :$dllsearchpath: in
69677605 *":$libdir:"*) ;;
7606 ::) dllsearchpath=$libdir;;
69687607 *) dllsearchpath="$dllsearchpath:$libdir";;
69697608 esac
69707609 case :$dllsearchpath: in
69717610 *":$testbindir:"*) ;;
7611 ::) dllsearchpath=$testbindir;;
69727612 *) dllsearchpath="$dllsearchpath:$testbindir";;
69737613 esac
69747614 ;;
70387678 wrappers_required=no
70397679 fi
70407680 ;;
7681 *cegcc)
7682 # Disable wrappers for cegcc, we are cross compiling anyway.
7683 wrappers_required=no
7684 ;;
70417685 *)
70427686 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
70437687 wrappers_required=no
71907834
71917835 func_emit_cwrapperexe_src > $cwrappersource
71927836
7193 # we should really use a build-platform specific compiler
7194 # here, but OTOH, the wrappers (shell script and this C one)
7195 # are only useful if you want to execute the "real" binary.
7196 # Since the "real" binary is built for $host, then this
7197 # wrapper might as well be built for $host, too.
7837 # The wrapper executable is built using the $host compiler,
7838 # because it contains $host paths and files. If cross-
7839 # compiling, it, like the target executable, must be
7840 # executed on the $host or under an emulation environment.
71987841 $opt_dry_run || {
71997842 $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
72007843 $STRIP $cwrapper
72057848 $RM $func_ltwrapper_scriptname_result
72067849 trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
72077850 $opt_dry_run || {
7208 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
7851 # note: this script will not be executed, so do not chmod.
7852 if test "x$build" = "x$host" ; then
7853 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
7854 else
7855 func_emit_wrapper no > $func_ltwrapper_scriptname_result
7856 fi
72097857 }
72107858 ;;
72117859 * )
72947942 # Make sure we don't pick an alternate name that also
72957943 # overlaps.
72967944 newobj=lt$counter-$objbase
7297 counter=`expr $counter + 1`
7945 func_arith $counter + 1
7946 counter=$func_arith_result
72987947 case " $oldobjs " in
72997948 *[\ /]"$newobj "*) ;;
73007949 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
73097958 fi
73107959 eval cmds=\"$old_archive_cmds\"
73117960
7312 if len=`expr "X$cmds" : ".*" 2>/dev/null` &&
7313 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
7961 func_len " $cmds"
7962 len=$func_len_result
7963 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
73147964 cmds=$old_archive_cmds
73157965 else
73167966 # the command line is too long to link in one step, link in parts
73207970 objlist=
73217971 concat_cmds=
73227972 save_oldobjs=$oldobjs
7973 oldobjs=
73237974 # Is there a better way of finding the last object in the list?
73247975 for obj in $save_oldobjs
73257976 do
73267977 last_oldobj=$obj
73277978 done
7979 eval test_cmds=\"$old_archive_cmds\"
7980 func_len " $test_cmds"
7981 len0=$func_len_result
7982 len=$len0
73287983 for obj in $save_oldobjs
73297984 do
7330 oldobjs="$objlist $obj"
7331 objlist="$objlist $obj"
7332 eval test_cmds=\"$old_archive_cmds\"
7333 if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
7334 test "$len" -le "$max_cmd_len"; then
7985 func_len " $obj"
7986 func_arith $len + $func_len_result
7987 len=$func_arith_result
7988 func_append objlist " $obj"
7989 if test "$len" -lt "$max_cmd_len"; then
73357990 :
73367991 else
73377992 # the above command should be used before it gets too long
73427997 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
73437998 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
73447999 objlist=
8000 len=$len0
73458001 fi
73468002 done
73478003 RANLIB=$save_RANLIB
74668122 # place dlname in correct position for cygwin
74678123 tdlname=$dlname
74688124 case $host,$output,$installed,$module,$dlname in
7469 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
8125 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
74708126 esac
74718127 $ECHO > $output "\
74728128 # $outputname - a libtool library file
0 2008-07-03 Brian Gough <bjg@hp2.network-theory.co.uk>
1
2 * matrix.c: compile all the inline matrix functions from header
3
4 * gsl_matrix.h and all related files: use new inline declarations
5
6 * Makefile.am (INCLUDES): use top_srcdir, remove top_builddir
7 (noinst_HEADERS): remove matrix_source.c
8
09 2007-08-21 Brian Gough <bjg@network-theory.co.uk>
110
211 * prop_source.c (FUNCTION): added gsl_matrix_isnonneg
33
44 pkginclude_HEADERS = gsl_matrix.h gsl_matrix_char.h gsl_matrix_complex_double.h gsl_matrix_complex_float.h gsl_matrix_complex_long_double.h gsl_matrix_double.h gsl_matrix_float.h gsl_matrix_int.h gsl_matrix_long.h gsl_matrix_long_double.h gsl_matrix_short.h gsl_matrix_uchar.h gsl_matrix_uint.h gsl_matrix_ulong.h gsl_matrix_ushort.h
55
6 INCLUDES= -I$(top_builddir) -I$(top_srcdir)
6 INCLUDES = -I$(top_srcdir)
77
88 TESTS = $(check_PROGRAMS)
99
1616
1717 CLEANFILES = test.txt test.dat
1818
19 noinst_HEADERS = matrix_source.c init_source.c file_source.c rowcol_source.c swap_source.c copy_source.c test_complex_source.c test_source.c minmax_source.c prop_source.c oper_source.c getset_source.c view_source.c submatrix_source.c oper_complex_source.c
19 noinst_HEADERS = init_source.c file_source.c rowcol_source.c swap_source.c copy_source.c test_complex_source.c test_source.c minmax_source.c prop_source.c oper_source.c getset_source.c view_source.c submatrix_source.c oper_complex_source.c
2020
2121 libgslmatrix_la_SOURCES = init.c matrix.c file.c rowcol.c swap.c copy.c minmax.c prop.c oper.c getset.c view.c submatrix.c view.h
2222
142142 LIBOBJS = @LIBOBJS@
143143 LIBS = @LIBS@
144144 LIBTOOL = @LIBTOOL@
145 LIPO = @LIPO@
145146 LN_S = @LN_S@
146147 LTLIBOBJS = @LTLIBOBJS@
147148 MAINT = @MAINT@
149150 MKDIR_P = @MKDIR_P@
150151 NM = @NM@
151152 NMEDIT = @NMEDIT@
153 OBJDUMP = @OBJDUMP@
152154 OBJEXT = @OBJEXT@
155 OTOOL = @OTOOL@
156 OTOOL64 = @OTOOL64@
153157 PACKAGE = @PACKAGE@
154158 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
155159 PACKAGE_NAME = @PACKAGE_NAME@
214218 top_srcdir = @top_srcdir@
215219 noinst_LTLIBRARIES = libgslmatrix.la
216220 pkginclude_HEADERS = gsl_matrix.h gsl_matrix_char.h gsl_matrix_complex_double.h gsl_matrix_complex_float.h gsl_matrix_complex_long_double.h gsl_matrix_double.h gsl_matrix_float.h gsl_matrix_int.h gsl_matrix_long.h gsl_matrix_long_double.h gsl_matrix_short.h gsl_matrix_uchar.h gsl_matrix_uint.h gsl_matrix_ulong.h gsl_matrix_ushort.h
217 INCLUDES = -I$(top_builddir) -I$(top_srcdir)
221 INCLUDES = -I$(top_srcdir)
218222 TESTS = $(check_PROGRAMS)
219223 test_LDADD = libgslmatrix.la ../vector/libgslvector.la ../block/libgslblock.la ../ieee-utils/libgslieeeutils.la ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la ../utils/libutils.la
220224 test_static_LDADD = libgslmatrix.la ../vector/libgslvector.la ../block/libgslblock.la ../ieee-utils/libgslieeeutils.la ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la ../utils/libutils.la
221225 test_SOURCES = test.c
222226 test_static_SOURCES = test_static.c
223227 CLEANFILES = test.txt test.dat
224 noinst_HEADERS = matrix_source.c init_source.c file_source.c rowcol_source.c swap_source.c copy_source.c test_complex_source.c test_source.c minmax_source.c prop_source.c oper_source.c getset_source.c view_source.c submatrix_source.c oper_complex_source.c
228 noinst_HEADERS = init_source.c file_source.c rowcol_source.c swap_source.c copy_source.c test_complex_source.c test_source.c minmax_source.c prop_source.c oper_source.c getset_source.c view_source.c submatrix_source.c oper_complex_source.c
225229 libgslmatrix_la_SOURCES = init.c matrix.c file.c rowcol.c swap.c copy.c minmax.c prop.c oper.c getset.c view.c submatrix.c view.h
226230 all: all-am
227231
2222 #include <stdlib.h>
2323 #include <gsl/gsl_types.h>
2424 #include <gsl/gsl_errno.h>
25 #include <gsl/gsl_inline.h>
2526 #include <gsl/gsl_check_range.h>
2627 #include <gsl/gsl_vector_char.h>
2728
203204
204205 /* Operations */
205206
206 char gsl_matrix_char_get(const gsl_matrix_char * m, const size_t i, const size_t j);
207 void gsl_matrix_char_set(gsl_matrix_char * m, const size_t i, const size_t j, const char x);
208
209 char * gsl_matrix_char_ptr(gsl_matrix_char * m, const size_t i, const size_t j);
210 const char * gsl_matrix_char_const_ptr(const gsl_matrix_char * m, const size_t i, const size_t j);
211
212207 void gsl_matrix_char_set_zero (gsl_matrix_char * m);
213208 void gsl_matrix_char_set_identity (gsl_matrix_char * m);
214209 void gsl_matrix_char_set_all (gsl_matrix_char * m, char x);
255250 int gsl_matrix_char_get_col(gsl_vector_char * v, const gsl_matrix_char * m, const size_t j);
256251 int gsl_matrix_char_set_row(gsl_matrix_char * m, const size_t i, const gsl_vector_char * v);
257252 int gsl_matrix_char_set_col(gsl_matrix_char * m, const size_t j, const gsl_vector_char * v);
253 /***********************************************************************/
258254
259255 /* inline functions if you are using GCC */
260256
257 INLINE_DECL char gsl_matrix_char_get(const gsl_matrix_char * m, const size_t i, const size_t j);
258 INLINE_DECL void gsl_matrix_char_set(gsl_matrix_char * m, const size_t i, const size_t j, const char x);
259 INLINE_DECL char * gsl_matrix_char_ptr(gsl_matrix_char * m, const size_t i, const size_t j);
260 INLINE_DECL const char * gsl_matrix_char_const_ptr(const gsl_matrix_char * m, const size_t i, const size_t j);
261
261262 #ifdef HAVE_INLINE
262 extern inline
263 INLINE_FUN
263264 char
264265 gsl_matrix_char_get(const gsl_matrix_char * m, const size_t i, const size_t j)
265266 {
266267 #if GSL_RANGE_CHECK
267 if (i >= m->size1)
268 if (GSL_RANGE_COND(1))
268269 {
269 GSL_ERROR_VAL("first index out of range", GSL_EINVAL, 0) ;
270 }
271 else if (j >= m->size2)
272 {
273 GSL_ERROR_VAL("second index out of range", GSL_EINVAL, 0) ;
270 if (i >= m->size1)
271 {
272 GSL_ERROR_VAL("first index out of range", GSL_EINVAL, 0) ;
273 }
274 else if (j >= m->size2)
275 {
276 GSL_ERROR_VAL("second index out of range", GSL_EINVAL, 0) ;
277 }
274278 }
275279 #endif
276280 return m->data[i * m->tda + j] ;
277281 }
278282
279 extern inline
283 INLINE_FUN
280284 void
281285 gsl_matrix_char_set(gsl_matrix_char * m, const size_t i, const size_t j, const char x)
282286 {
283287 #if GSL_RANGE_CHECK
284 if (i >= m->size1)
288 if (GSL_RANGE_COND(1))
285289 {
286 GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ;
287 }
288 else if (j >= m->size2)
289 {
290 GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ;
290 if (i >= m->size1)
291 {
292 GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ;
293 }
294 else if (j >= m->size2)
295 {
296 GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ;
297 }
291298 }
292299 #endif
293300 m->data[i * m->tda + j] = x ;
294301 }
295302
296 extern inline
303 INLINE_FUN
297304 char *
298305 gsl_matrix_char_ptr(gsl_matrix_char * m, const size_t i, const size_t j)
299306 {
300307 #if GSL_RANGE_CHECK
301 if (i >= m->size1)
308 if (GSL_RANGE_COND(1))
302309 {
303 GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
304 }
305 else if (j >= m->size2)
306 {
307 GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
310 if (i >= m->size1)
311 {
312 GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
313 }
314 else if (j >= m->size2)
315 {
316 GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
317 }
308318 }
309319 #endif
310320 return (char *) (m->data + (i * m->tda + j)) ;
311321 }
312322
313 extern inline
323 INLINE_FUN
314324 const char *
315325 gsl_matrix_char_const_ptr(const gsl_matrix_char * m, const size_t i, const size_t j)
316326 {
317327 #if GSL_RANGE_CHECK
318 if (i >= m->size1)
328 if (GSL_RANGE_COND(1))
319329 {
320 GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
321 }
322 else if (j >= m->size2)
323 {
324 GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
330 if (i >= m->size1)
331 {
332 GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
333 }
334 else if (j >= m->size2)
335 {
336 GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
337 }
325338 }
326339 #endif
327340 return (const char *) (m->data + (i * m->tda + j)) ;
204204
205205 /* Operations */
206206
207 gsl_complex gsl_matrix_complex_get(const gsl_matrix_complex * m, const size_t i, const size_t j);
208 void gsl_matrix_complex_set(gsl_matrix_complex * m, const size_t i, const size_t j, const gsl_complex x);
209
210 gsl_complex * gsl_matrix_complex_ptr(gsl_matrix_complex * m, const size_t i, const size_t j);
211 const gsl_complex * gsl_matrix_complex_const_ptr(const gsl_matrix_complex * m, const size_t i, const size_t j);
212
213207 void gsl_matrix_complex_set_zero (gsl_matrix_complex * m);
214208 void gsl_matrix_complex_set_identity (gsl_matrix_complex * m);
215209 void gsl_matrix_complex_set_all (gsl_matrix_complex * m, gsl_complex x);
232226 int gsl_matrix_complex_isnull (const gsl_matrix_complex * m);
233227 int gsl_matrix_complex_ispos (const gsl_matrix_complex * m);
234228 int gsl_matrix_complex_isneg (const gsl_matrix_complex * m);
229 int gsl_matrix_complex_isnonneg (const gsl_matrix_complex * m);
235230
236231 int gsl_matrix_complex_add (gsl_matrix_complex * a, const gsl_matrix_complex * b);
237232 int gsl_matrix_complex_sub (gsl_matrix_complex * a, const gsl_matrix_complex * b);
248243 int gsl_matrix_complex_get_col(gsl_vector_complex * v, const gsl_matrix_complex * m, const size_t j);
249244 int gsl_matrix_complex_set_row(gsl_matrix_complex * m, const size_t i, const gsl_vector_complex * v);
250245 int gsl_matrix_complex_set_col(gsl_matrix_complex * m, const size_t j, const gsl_vector_complex * v);
246 /***********************************************************************/
247
248 /* inline functions if you are using GCC */
249
250 INLINE_DECL gsl_complex gsl_matrix_complex_get(const gsl_matrix_complex * m, const size_t i, const size_t j);
251 INLINE_DECL void gsl_matrix_complex_set(gsl_matrix_complex * m, const size_t i, const size_t j, const gsl_complex x);
252
253 INLINE_DECL gsl_complex * gsl_matrix_complex_ptr(gsl_matrix_complex * m, const size_t i, const size_t j);
254 INLINE_DECL const gsl_complex * gsl_matrix_complex_const_ptr(const gsl_matrix_complex * m, const size_t i, const size_t j);
251255
252256 #ifdef HAVE_INLINE
253257
254 extern inline
258 INLINE_FUN
255259 gsl_complex
256260 gsl_matrix_complex_get(const gsl_matrix_complex * m,
257261 const size_t i, const size_t j)
258262 {
259263 #if GSL_RANGE_CHECK
260 gsl_complex zero = {{0,0}};
261
262 if (i >= m->size1)
264 if (GSL_RANGE_COND(1))
263265 {
264 GSL_ERROR_VAL("first index out of range", GSL_EINVAL, zero) ;
265 }
266 else if (j >= m->size2)
267 {
268 GSL_ERROR_VAL("second index out of range", GSL_EINVAL, zero) ;
266 gsl_complex zero = {{0,0}};
267
268 if (i >= m->size1)
269 {
270 GSL_ERROR_VAL("first index out of range", GSL_EINVAL, zero) ;
271 }
272 else if (j >= m->size2)
273 {
274 GSL_ERROR_VAL("second index out of range", GSL_EINVAL, zero) ;
275 }
269276 }
270277 #endif
271278 return *(gsl_complex *)(m->data + 2*(i * m->tda + j)) ;
272279 }
273280
274 extern inline
281 INLINE_FUN
275282 void
276283 gsl_matrix_complex_set(gsl_matrix_complex * m,
277284 const size_t i, const size_t j, const gsl_complex x)
278285 {
279286 #if GSL_RANGE_CHECK
280 if (i >= m->size1)
287 if (GSL_RANGE_COND(1))
281288 {
282 GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ;
283 }
284 else if (j >= m->size2)
285 {
286 GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ;
289 if (i >= m->size1)
290 {
291 GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ;
292 }
293 else if (j >= m->size2)
294 {
295 GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ;
296 }
287297 }
288298 #endif
289299 *(gsl_complex *)(m->data + 2*(i * m->tda + j)) = x ;
290300 }
291301
292 extern inline
302 INLINE_FUN
293303 gsl_complex *
294304 gsl_matrix_complex_ptr(gsl_matrix_complex * m,
295305 const size_t i, const size_t j)
296306 {
297307 #if GSL_RANGE_CHECK
298 if (i >= m->size1)
308 if (GSL_RANGE_COND(1))
299309 {
300 GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
301 }
302 else if (j >= m->size2)
303 {
304 GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
310 if (i >= m->size1)
311 {
312 GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
313 }
314 else if (j >= m->size2)
315 {
316 GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
317 }
305318 }
306319 #endif
307320 return (gsl_complex *)(m->data + 2*(i * m->tda + j)) ;
308321 }
309322
310 extern inline
323 INLINE_FUN
311324 const gsl_complex *
312325 gsl_matrix_complex_const_ptr(const gsl_matrix_complex * m,
313326 const size_t i, const size_t j)
314327 {
315328 #if GSL_RANGE_CHECK
316 if (i >= m->size1)
329 if (GSL_RANGE_COND(1))
317330 {
318 GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
319 }
320 else if (j >= m->size2)
321 {
322 GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
331 if (i >= m->size1)
332 {
333 GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
334 }
335 else if (j >= m->size2)
336 {
337 GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
338 }
323339 }
324340 #endif
325341 return (const gsl_complex *)(m->data + 2*(i * m->tda + j)) ;
204204
205205 /* Operations */
206206
207 gsl_complex_float gsl_matrix_complex_float_get(const gsl_matrix_complex_float * m, const size_t i, const size_t j);
208 void gsl_matrix_complex_float_set(gsl_matrix_complex_float * m, const size_t i, const size_t j, const gsl_complex_float x);
209
210 gsl_complex_float * gsl_matrix_complex_float_ptr(gsl_matrix_complex_float * m, const size_t i, const size_t j);
211 const gsl_complex_float * gsl_matrix_complex_float_const_ptr(const gsl_matrix_complex_float * m, const size_t i, const size_t j);
212
213207 void gsl_matrix_complex_float_set_zero (gsl_matrix_complex_float * m);
214208 void gsl_matrix_complex_float_set_identity (gsl_matrix_complex_float * m);
215209 void gsl_matrix_complex_float_set_all (gsl_matrix_complex_float * m, gsl_complex_float x);
232226 int gsl_matrix_complex_float_isnull (const gsl_matrix_complex_float * m);
233227 int gsl_matrix_complex_float_ispos (const gsl_matrix_complex_float * m);
234228 int gsl_matrix_complex_float_isneg (const gsl_matrix_complex_float * m);
229 int gsl_matrix_complex_float_isnonneg (const gsl_matrix_complex_float * m);
235230
236231 int gsl_matrix_complex_float_add (gsl_matrix_complex_float * a, const gsl_matrix_complex_float * b);
237232 int gsl_matrix_complex_float_sub (gsl_matrix_complex_float * a, const gsl_matrix_complex_float * b);
248243 int gsl_matrix_complex_float_get_col(gsl_vector_complex_float * v, const gsl_matrix_complex_float * m, const size_t j);
249244 int gsl_matrix_complex_float_set_row(gsl_matrix_complex_float * m, const size_t i, const gsl_vector_complex_float * v);
250245 int gsl_matrix_complex_float_set_col(gsl_matrix_complex_float * m, const size_t j, const gsl_vector_complex_float * v);
246 /***********************************************************************/
247
248 /* inline functions if you are using GCC */
249
250 INLINE_DECL gsl_complex_float gsl_matrix_complex_float_get(const gsl_matrix_complex_float * m, const size_t i, const size_t j);
251 INLINE_DECL void gsl_matrix_complex_float_set(gsl_matrix_complex_float * m, const size_t i, const size_t j, const gsl_complex_float x);
252
253 INLINE_DECL gsl_complex_float * gsl_matrix_complex_float_ptr(gsl_matrix_complex_float * m, const size_t i, const size_t j);
254 INLINE_DECL const gsl_complex_float * gsl_matrix_complex_float_const_ptr(const gsl_matrix_complex_float * m, const size_t i, const size_t j);
251255
252256 #ifdef HAVE_INLINE
253257
254 extern inline
258 INLINE_FUN
255259 gsl_complex_float
256260 gsl_matrix_complex_float_get(const gsl_matrix_complex_float * m,
257261 const size_t i, const size_t j)
258262 {
259263 #if GSL_RANGE_CHECK
260 gsl_complex_float zero = {{0,0}};
261
262 if (i >= m->size1)
264 if (GSL_RANGE_COND(1))
263265 {
264 GSL_ERROR_VAL("first index out of range", GSL_EINVAL, zero) ;
265 }
266 else if (j >= m->size2)
267 {
268 GSL_ERROR_VAL("second index out of range", GSL_EINVAL, zero) ;
266 gsl_complex_float zero = {{0,0}};
267
268 if (i >= m->size1)
269 {
270 GSL_ERROR_VAL("first index out of range", GSL_EINVAL, zero) ;
271 }
272 else if (j >= m->size2)
273 {
274 GSL_ERROR_VAL("second index out of range", GSL_EINVAL, zero) ;
275 }
269276 }
270277 #endif
271278 return *(gsl_complex_float *)(m->data + 2*(i * m->tda + j)) ;
272279 }
273280
274 extern inline
281 INLINE_FUN
275282 void
276283 gsl_matrix_complex_float_set(gsl_matrix_complex_float * m,
277284 const size_t i, const size_t j, const gsl_complex_float x)
278285 {
279286 #if GSL_RANGE_CHECK
280 if (i >= m->size1)
287 if (GSL_RANGE_COND(1))
281288 {
282 GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ;
283 }
284 else if (j >= m->size2)
285 {
286 GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ;
289 if (i >= m->size1)
290 {
291 GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ;
292 }
293 else if (j >= m->size2)
294 {
295 GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ;
296 }
287297 }
288298 #endif
289299 *(gsl_complex_float *)(m->data + 2*(i * m->tda + j)) = x ;
290300 }
291301
292 extern inline
302 INLINE_FUN
293303 gsl_complex_float *
294304 gsl_matrix_complex_float_ptr(gsl_matrix_complex_float * m,
295305 const size_t i, const size_t j)
296306 {
297307 #if GSL_RANGE_CHECK
298 if (i >= m->size1)
308 if (GSL_RANGE_COND(1))
299309 {
300 GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
301 }
302 else if (j >= m->size2)
303 {
304 GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
310 if (i >= m->size1)
311 {
312 GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
313 }
314 else if (j >= m->size2)
315 {
316 GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
317 }
305318 }
306319 #endif
307320 return (gsl_complex_float *)(m->data + 2*(i * m->tda + j)) ;
308321 }
309322
310 extern inline
323 INLINE_FUN
311324 const gsl_complex_float *
312325 gsl_matrix_complex_float_const_ptr(const gsl_matrix_complex_float * m,
313326 const size_t i, const size_t j)
314327 {
315328 #if GSL_RANGE_CHECK
316 if (i >= m->size1)
329 if (GSL_RANGE_COND(1))
317330 {
318 GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
319 }
320 else if (j >= m->size2)
321 {
322 GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
331 if (i >= m->size1)
332 {
333 GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
334 }
335 else if (j >= m->size2)
336 {
337 GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
338 }
323339 }
324340 #endif
325341 return (const gsl_complex_float *)(m->data + 2*(i * m->tda + j)) ;
204204
205205 /* Operations */
206206
207 gsl_complex_long_double gsl_matrix_complex_long_double_get(const gsl_matrix_complex_long_double * m, const size_t i, const size_t j);
208 void gsl_matrix_complex_long_double_set(gsl_matrix_complex_long_double * m, const size_t i, const size_t j, const gsl_complex_long_double x);
209
210 gsl_complex_long_double * gsl_matrix_complex_long_double_ptr(gsl_matrix_complex_long_double * m, const size_t i, const size_t j);
211 const gsl_complex_long_double * gsl_matrix_complex_long_double_const_ptr(const gsl_matrix_complex_long_double * m, const size_t i, const size_t j);
212
213207 void gsl_matrix_complex_long_double_set_zero (gsl_matrix_complex_long_double * m);
214208 void gsl_matrix_complex_long_double_set_identity (gsl_matrix_complex_long_double * m);
215209 void gsl_matrix_complex_long_double_set_all (gsl_matrix_complex_long_double * m, gsl_complex_long_double x);
232226 int gsl_matrix_complex_long_double_isnull (const gsl_matrix_complex_long_double * m);
233227 int gsl_matrix_complex_long_double_ispos (const gsl_matrix_complex_long_double * m);
234228 int gsl_matrix_complex_long_double_isneg (const gsl_matrix_complex_long_double * m);
229 int gsl_matrix_complex_long_double_isnonneg (const gsl_matrix_complex_long_double * m);
235230
236231 int gsl_matrix_complex_long_double_add (gsl_matrix_complex_long_double * a, const gsl_matrix_complex_long_double * b);
237232 int gsl_matrix_complex_long_double_sub (gsl_matrix_complex_long_double * a, const gsl_matrix_complex_long_double * b);
248243 int gsl_matrix_complex_long_double_get_col(gsl_vector_complex_long_double * v, const gsl_matrix_complex_long_double * m, const size_t j);
249244 int gsl_matrix_complex_long_double_set_row(gsl_matrix_complex_long_double * m, const size_t i, const gsl_vector_complex_long_double * v);
250245 int gsl_matrix_complex_long_double_set_col(gsl_matrix_complex_long_double * m, const size_t j, const gsl_vector_complex_long_double * v);
246 /***********************************************************************/
247
248 /* inline functions if you are using GCC */
249
250 INLINE_DECL gsl_complex_long_double gsl_matrix_complex_long_double_get(const gsl_matrix_complex_long_double * m, const size_t i, const size_t j);
251 INLINE_DECL void gsl_matrix_complex_long_double_set(gsl_matrix_complex_long_double * m, const size_t i, const size_t j, const gsl_complex_long_double x);
252
253 INLINE_DECL gsl_complex_long_double * gsl_matrix_complex_long_double_ptr(gsl_matrix_complex_long_double * m, const size_t i, const size_t j);
254 INLINE_DECL const gsl_complex_long_double * gsl_matrix_complex_long_double_const_ptr(const gsl_matrix_complex_long_double * m, const size_t i, const size_t j);
251255
252256 #ifdef HAVE_INLINE
253257
254 extern inline
258 INLINE_FUN
255259 gsl_complex_long_double
256260 gsl_matrix_complex_long_double_get(const gsl_matrix_complex_long_double * m,
257261 const size_t i, const size_t j)
258262 {
259263 #if GSL_RANGE_CHECK
260 gsl_complex_long_double zero = {{0,0}};
261
262 if (i >= m->size1)
264 if (GSL_RANGE_COND(1))
263265 {
264 GSL_ERROR_VAL("first index out of range", GSL_EINVAL, zero) ;
265 }
266 else if (j >= m->size2)
267 {
268 GSL_ERROR_VAL("second index out of range", GSL_EINVAL, zero) ;
266 gsl_complex_long_double zero = {{0,0}};
267
268 if (i >= m->size1)
269 {
270 GSL_ERROR_VAL("first index out of range", GSL_EINVAL, zero) ;
271 }
272 else if (j >= m->size2)
273 {
274 GSL_ERROR_VAL("second index out of range", GSL_EINVAL, zero) ;
275 }
269276 }
270277 #endif
271278 return *(gsl_complex_long_double *)(m->data + 2*(i * m->tda + j)) ;
272279 }
273280
274 extern inline
281 INLINE_FUN
275282 void
276283 gsl_matrix_complex_long_double_set(gsl_matrix_complex_long_double * m,
277284 const size_t i, const size_t j, const gsl_complex_long_double x)
278285 {
279286 #if GSL_RANGE_CHECK
280 if (i >= m->size1)
287 if (GSL_RANGE_COND(1))
281288 {
282 GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ;
283 }
284 else if (j >= m->size2)
285 {
286 GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ;
289 if (i >= m->size1)
290 {
291 GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ;
292 }
293 else if (j >= m->size2)
294 {
295 GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ;
296 }
287297 }
288298 #endif
289299 *(gsl_complex_long_double *)(m->data + 2*(i * m->tda + j)) = x ;
290300 }
291301
292 extern inline
302 INLINE_FUN
293303 gsl_complex_long_double *
294304 gsl_matrix_complex_long_double_ptr(gsl_matrix_complex_long_double * m,
295305 const size_t i, const size_t j)
296306 {
297307 #if GSL_RANGE_CHECK
298 if (i >= m->size1)
308 if (GSL_RANGE_COND(1))
299309 {
300 GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
301 }
302 else if (j >= m->size2)
303 {
304 GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
310 if (i >= m->size1)
311 {
312 GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
313 }
314 else if (j >= m->size2)
315 {
316 GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
317 }
305318 }
306319 #endif
307320 return (gsl_complex_long_double *)(m->data + 2*(i * m->tda + j)) ;
308321 }
309322
310 extern inline
323 INLINE_FUN
311324 const gsl_complex_long_double *
312325 gsl_matrix_complex_long_double_const_ptr(const gsl_matrix_complex_long_double * m,
313326 const size_t i, const size_t j)
314327 {
315328 #if GSL_RANGE_CHECK
316 if (i >= m->size1)
329 if (GSL_RANGE_COND(1))
317330 {
318 GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
319 }
320 else if (j >= m->size2)
321 {
322 GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
331 if (i >= m->size1)
332 {
333 GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
334 }
335 else if (j >= m->size2)
336 {
337 GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
338 }
323339 }
324340 #endif
325341 return (const gsl_complex_long_double *)(m->data + 2*(i * m->tda + j)) ;
2222 #include <stdlib.h>
2323 #include <gsl/gsl_types.h>
2424 #include <gsl/gsl_errno.h>
25 #include <gsl/gsl_inline.h>
2526 #include <gsl/gsl_check_range.h>
2627 #include <gsl/gsl_vector_double.h>
2728
203204
204205 /* Operations */
205206
206 double gsl_matrix_get(const gsl_matrix * m, const size_t i, const size_t j);
207 void gsl_matrix_set(gsl_matrix * m, const size_t i, const size_t j, const double x);
208
209 double * gsl_matrix_ptr(gsl_matrix * m, const size_t i, const size_t j);
210 const double * gsl_matrix_const_ptr(const gsl_matrix * m, const size_t i, const size_t j);
211
212207 void gsl_matrix_set_zero (gsl_matrix * m);
213208 void gsl_matrix_set_identity (gsl_matrix * m);
214209 void gsl_matrix_set_all (gsl_matrix * m, double x);
255250 int gsl_matrix_get_col(gsl_vector * v, const gsl_matrix * m, const size_t j);
256251 int gsl_matrix_set_row(gsl_matrix * m, const size_t i, const gsl_vector * v);
257252 int gsl_matrix_set_col(gsl_matrix * m, const size_t j, const gsl_vector * v);
253 /***********************************************************************/
258254
259255 /* inline functions if you are using GCC */
260256
257 INLINE_DECL double gsl_matrix_get(const gsl_matrix * m, const size_t i, const size_t j);
258 INLINE_DECL void gsl_matrix_set(gsl_matrix * m, const size_t i, const size_t j, const double x);
259 INLINE_DECL double * gsl_matrix_ptr(gsl_matrix * m, const size_t i, const size_t j);
260 INLINE_DECL const double * gsl_matrix_const_ptr(const gsl_matrix * m, const size_t i, const size_t j);
261
261262 #ifdef HAVE_INLINE
262 extern inline
263 INLINE_FUN
263264 double
264265 gsl_matrix_get(const gsl_matrix * m, const size_t i, const size_t j)
265266 {
266267 #if GSL_RANGE_CHECK
267 if (i >= m->size1)
268 if (GSL_RANGE_COND(1))
268269 {
269 GSL_ERROR_VAL("first index out of range", GSL_EINVAL, 0) ;
270 }
271 else if (j >= m->size2)
272 {
273 GSL_ERROR_VAL("second index out of range", GSL_EINVAL, 0) ;
270 if (i >= m->size1)
271 {
272 GSL_ERROR_VAL("first index out of range", GSL_EINVAL, 0) ;
273 }
274 else if (j >= m->size2)
275 {
276 GSL_ERROR_VAL("second index out of range", GSL_EINVAL, 0) ;
277 }
274278 }
275279 #endif
276280 return m->data[i * m->tda + j] ;
277281 }
278282
279 extern inline
283 INLINE_FUN
280284 void
281285 gsl_matrix_set(gsl_matrix * m, const size_t i, const size_t j, const double x)
282286 {
283287 #if GSL_RANGE_CHECK
284 if (i >= m->size1)
288 if (GSL_RANGE_COND(1))
285289 {
286 GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ;
287 }
288 else if (j >= m->size2)
289 {
290 GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ;
290 if (i >= m->size1)
291 {
292 GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ;
293 }
294 else if (j >= m->size2)
295 {
296 GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ;
297 }
291298 }
292299 #endif
293300 m->data[i * m->tda + j] = x ;
294301 }
295302
296 extern inline
303 INLINE_FUN
297304 double *
298305 gsl_matrix_ptr(gsl_matrix * m, const size_t i, const size_t j)
299306 {
300307 #if GSL_RANGE_CHECK
301 if (i >= m->size1)
308 if (GSL_RANGE_COND(1))
302309 {
303 GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
304 }
305 else if (j >= m->size2)
306 {
307 GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
310 if (i >= m->size1)
311 {
312 GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
313 }
314 else if (j >= m->size2)
315 {
316 GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
317 }
308318 }
309319 #endif
310320 return (double *) (m->data + (i * m->tda + j)) ;
311321 }
312322
313 extern inline
323 INLINE_FUN
314324 const double *
315325 gsl_matrix_const_ptr(const gsl_matrix * m, const size_t i, const size_t j)
316326 {
317327 #if GSL_RANGE_CHECK
318 if (i >= m->size1)
328 if (GSL_RANGE_COND(1))
319329 {
320 GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
321 }
322 else if (j >= m->size2)
323 {
324 GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
330 if (i >= m->size1)
331 {
332 GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
333 }
334 else if (j >= m->size2)
335 {
336 GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
337 }
325338 }
326339 #endif
327340 return (const double *) (m->data + (i * m->tda + j)) ;
2222 #include <stdlib.h>
2323 #include <gsl/gsl_types.h>
2424 #include <gsl/gsl_errno.h>
25 #include <gsl/gsl_inline.h>
2526 #include <gsl/gsl_check_range.h>
2627 #include <gsl/gsl_vector_float.h>
2728
203204
204205 /* Operations */
205206
206 float gsl_matrix_float_get(const gsl_matrix_float * m, const size_t i, const size_t j);
207 void gsl_matrix_float_set(gsl_matrix_float * m, const size_t i, const size_t j, const float x);
208
209 float * gsl_matrix_float_ptr(gsl_matrix_float * m, const size_t i, const size_t j);
210 const float * gsl_matrix_float_const_ptr(const gsl_matrix_float * m, const size_t i, const size_t j);
211
212207 void gsl_matrix_float_set_zero (gsl_matrix_float * m);
213208 void gsl_matrix_float_set_identity (gsl_matrix_float * m);
214209 void gsl_matrix_float_set_all (gsl_matrix_float * m, float x);
255250 int gsl_matrix_float_get_col(gsl_vector_float * v, const gsl_matrix_float * m, const size_t j);
256251 int gsl_matrix_float_set_row(gsl_matrix_float * m, const size_t i, const gsl_vector_float * v);
257252 int gsl_matrix_float_set_col(gsl_matrix_float * m, const size_t j, const gsl_vector_float * v);
253 /***********************************************************************/
258254
259255 /* inline functions if you are using GCC */
260256
257 INLINE_DECL float gsl_matrix_float_get(const gsl_matrix_float * m, const size_t i, const size_t j);
258 INLINE_DECL void gsl_matrix_float_set(gsl_matrix_float * m, const size_t i, const size_t j, const float x);
259 INLINE_DECL float * gsl_matrix_float_ptr(gsl_matrix_float * m, const size_t i, const size_t j);
260 INLINE_DECL const float * gsl_matrix_float_const_ptr(const gsl_matrix_float * m, const size_t i, const size_t j);
261
261262 #ifdef HAVE_INLINE
262 extern inline
263 INLINE_FUN
263264 float
264265 gsl_matrix_float_get(const gsl_matrix_float * m, const size_t i, const size_t j)
265266 {
266267 #if GSL_RANGE_CHECK
267 if (i >= m->size1)
268 if (GSL_RANGE_COND(1))
268269 {
269 GSL_ERROR_VAL("first index out of range", GSL_EINVAL, 0) ;
270 }
271 else if (j >= m->size2)
272 {
273 GSL_ERROR_VAL("second index out of range", GSL_EINVAL, 0) ;
270 if (i >= m->size1)
271 {
272 GSL_ERROR_VAL("first index out of range", GSL_EINVAL, 0) ;
273 }
274 else if (j >= m->size2)
275 {
276 GSL_ERROR_VAL("second index out of range", GSL_EINVAL, 0) ;
277 }
274278 }
275279 #endif
276280 return m->data[i * m->tda + j] ;
277281 }
278282
279 extern inline
283 INLINE_FUN
280284 void
281285 gsl_matrix_float_set(gsl_matrix_float * m, const size_t i, const size_t j, const float x)
282286 {
283287 #if GSL_RANGE_CHECK
284 if (i >= m->size1)
288 if (GSL_RANGE_COND(1))
285289 {
286 GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ;
287 }
288 else if (j >= m->size2)
289 {
290 GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ;
290 if (i >= m->size1)
291 {
292 GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ;
293 }
294 else if (j >= m->size2)
295 {
296 GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ;
297 }
291298 }
292299 #endif
293300 m->data[i * m->tda + j] = x ;
294301 }
295302
296 extern inline
303 INLINE_FUN
297304 float *
298305 gsl_matrix_float_ptr(gsl_matrix_float * m, const size_t i, const size_t j)
299306 {
300307 #if GSL_RANGE_CHECK
301 if (i >= m->size1)
308 if (GSL_RANGE_COND(1))
302309 {
303 GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
304 }
305 else if (j >= m->size2)
306 {
307 GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
310 if (i >= m->size1)
311 {
312 GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
313 }
314 else if (j >= m->size2)
315 {
316 GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
317 }
308318 }
309319 #endif
310320 return (float *) (m->data + (i * m->tda + j)) ;
311321 }
312322
313 extern inline
323 INLINE_FUN
314324 const float *
315325 gsl_matrix_float_const_ptr(const gsl_matrix_float * m, const size_t i, const size_t j)
316326 {
317327 #if GSL_RANGE_CHECK
318 if (i >= m->size1)
328 if (GSL_RANGE_COND(1))
319329 {
320 GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
321 }
322 else if (j >= m->size2)
323 {
324 GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
330 if (i >= m->size1)
331 {
332 GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
333 }
334 else if (j >= m->size2)
335 {
336 GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
337 }
325338 }
326339 #endif
327340 return (const float *) (m->data + (i * m->tda + j)) ;
2222 #include <stdlib.h>
2323 #include <gsl/gsl_types.h>
2424 #include <gsl/gsl_errno.h>
25 #include <gsl/gsl_inline.h>
2526 #include <gsl/gsl_check_range.h>
2627 #include <gsl/gsl_vector_int.h>
2728
203204
204205 /* Operations */
205206
206 int gsl_matrix_int_get(const gsl_matrix_int * m, const size_t i, const size_t j);
207 void gsl_matrix_int_set(gsl_matrix_int * m, const size_t i, const size_t j, const int x);
208
209 int * gsl_matrix_int_ptr(gsl_matrix_int * m, const size_t i, const size_t j);
210 const int * gsl_matrix_int_const_ptr(const gsl_matrix_int * m, const size_t i, const size_t j);
211
212207 void gsl_matrix_int_set_zero (gsl_matrix_int * m);
213208 void gsl_matrix_int_set_identity (gsl_matrix_int * m);
214209 void gsl_matrix_int_set_all (gsl_matrix_int * m, int x);
255250 int gsl_matrix_int_get_col(gsl_vector_int * v, const gsl_matrix_int * m, const size_t j);
256251 int gsl_matrix_int_set_row(gsl_matrix_int * m, const size_t i, const gsl_vector_int * v);
257252 int gsl_matrix_int_set_col(gsl_matrix_int * m, const size_t j, const gsl_vector_int * v);
253 /***********************************************************************/
258254
259255 /* inline functions if you are using GCC */
260256
257 INLINE_DECL int gsl_matrix_int_get(const gsl_matrix_int * m, const size_t i, const size_t j);
258 INLINE_DECL void gsl_matrix_int_set(gsl_matrix_int * m, const size_t i, const size_t j, const int x);
259 INLINE_DECL int * gsl_matrix_int_ptr(gsl_matrix_int * m, const size_t i, const size_t j);
260 INLINE_DECL const int * gsl_matrix_int_const_ptr(const gsl_matrix_int * m, const size_t i, const size_t j);
261
261262 #ifdef HAVE_INLINE
262 extern inline
263 INLINE_FUN
263264 int
264265 gsl_matrix_int_get(const gsl_matrix_int * m, const size_t i, const size_t j)
265266 {
266267 #if GSL_RANGE_CHECK
267 if (i >= m->size1)
268 if (GSL_RANGE_COND(1))
268269 {
269 GSL_ERROR_VAL("first index out of range", GSL_EINVAL, 0) ;
270 }
271 else if (j >= m->size2)
272 {
273 GSL_ERROR_VAL("second index out of range", GSL_EINVAL, 0) ;
270 if (i >= m->size1)
271 {
272 GSL_ERROR_VAL("first index out of range", GSL_EINVAL, 0) ;
273 }
274 else if (j >= m->size2)
275 {
276 GSL_ERROR_VAL("second index out of range", GSL_EINVAL, 0) ;
277 }
274278 }
275279 #endif
276280 return m->data[i * m->tda + j] ;
277281 }
278282
279 extern inline
283 INLINE_FUN
280284 void
281285 gsl_matrix_int_set(gsl_matrix_int * m, const size_t i, const size_t j, const int x)
282286 {
283287 #if GSL_RANGE_CHECK
284 if (i >= m->size1)
288 if (GSL_RANGE_COND(1))
285289 {
286 GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ;
287 }
288 else if (j >= m->size2)
289 {
290 GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ;
290 if (i >= m->size1)
291 {
292 GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ;
293 }
294 else if (j >= m->size2)
295 {
296 GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ;
297 }
291298 }
292299 #endif
293300 m->data[i * m->tda + j] = x ;
294301 }
295302
296 extern inline
303 INLINE_FUN
297304 int *
298305 gsl_matrix_int_ptr(gsl_matrix_int * m, const size_t i, const size_t j)
299306 {
300307 #if GSL_RANGE_CHECK
301 if (i >= m->size1)
308 if (GSL_RANGE_COND(1))
302309 {
303 GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
304 }
305 else if (j >= m->size2)
306 {
307 GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
310 if (i >= m->size1)
311 {
312 GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
313 }
314 else if (j >= m->size2)
315 {
316 GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
317 }
308318 }
309319 #endif
310320 return (int *) (m->data + (i * m->tda + j)) ;
311321 }
312322
313 extern inline
323 INLINE_FUN
314324 const int *
315325 gsl_matrix_int_const_ptr(const gsl_matrix_int * m, const size_t i, const size_t j)
316326 {
317327 #if GSL_RANGE_CHECK
318 if (i >= m->size1)
328 if (GSL_RANGE_COND(1))
319329 {
320 GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
321 }
322 else if (j >= m->size2)
323 {
324 GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
330 if (i >= m->size1)
331 {
332 GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
333 }
334 else if (j >= m->size2)
335 {
336 GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
337 }
325338 }
326339 #endif
327340 return (const int *) (m->data + (i * m->tda + j)) ;
2222 #include <stdlib.h>
2323 #include <gsl/gsl_types.h>
2424 #include <gsl/gsl_errno.h>
25 #include <gsl/gsl_inline.h>
2526 #include <gsl/gsl_check_range.h>
2627 #include <gsl/gsl_vector_long.h>
2728
203204
204205 /* Operations */
205206
206 long gsl_matrix_long_get(const gsl_matrix_long * m, const size_t i, const size_t j);
207 void gsl_matrix_long_set(gsl_matrix_long * m, const size_t i, const size_t j, const long x);
208
209 long * gsl_matrix_long_ptr(gsl_matrix_long * m, const size_t i, const size_t j);
210 const long * gsl_matrix_long_const_ptr(const gsl_matrix_long * m, const size_t i, const size_t j);
211
212207 void gsl_matrix_long_set_zero (gsl_matrix_long * m);
213208 void gsl_matrix_long_set_identity (gsl_matrix_long * m);
214209 void gsl_matrix_long_set_all (gsl_matrix_long * m, long x);
255250 int gsl_matrix_long_get_col(gsl_vector_long * v, const gsl_matrix_long * m, const size_t j);
256251 int gsl_matrix_long_set_row(gsl_matrix_long * m, const size_t i, const gsl_vector_long * v);
257252 int gsl_matrix_long_set_col(gsl_matrix_long * m, const size_t j, const gsl_vector_long * v);
253 /***********************************************************************/
258254
259255 /* inline functions if you are using GCC */
260256
257 INLINE_DECL long gsl_matrix_long_get(const gsl_matrix_long * m, const size_t i, const size_t j);
258 INLINE_DECL void gsl_matrix_long_set(gsl_matrix_long * m, const size_t i, const size_t j, const long x);
259 INLINE_DECL long * gsl_matrix_long_ptr(gsl_matrix_long * m, const size_t i, const size_t j);
260 INLINE_DECL const long * gsl_matrix_long_const_ptr(const gsl_matrix_long * m, const size_t i, const size_t j);
261
261262 #ifdef HAVE_INLINE
262 extern inline
263 INLINE_FUN
263264 long
264265 gsl_matrix_long_get(const gsl_matrix_long * m, const size_t i, const size_t j)
265266 {
266267 #if GSL_RANGE_CHECK
267 if (i >= m->size1)
268 if (GSL_RANGE_COND(1))
268269 {
269 GSL_ERROR_VAL("first index out of range", GSL_EINVAL, 0) ;
270 }
271 else if (j >= m->size2)
272 {
273 GSL_ERROR_VAL("second index out of range", GSL_EINVAL, 0) ;
270 if (i >= m->size1)
271 {
272 GSL_ERROR_VAL("first index out of range", GSL_EINVAL, 0) ;
273 }
274 else if (j >= m->size2)
275 {
276 GSL_ERROR_VAL("second index out of range", GSL_EINVAL, 0) ;
277 }
274278 }
275279 #endif
276280 return m->data[i * m->tda + j] ;
277281 }
278282
279 extern inline
283 INLINE_FUN
280284 void
281285 gsl_matrix_long_set(gsl_matrix_long * m, const size_t i, const size_t j, const long x)
282286 {
283287 #if GSL_RANGE_CHECK
284 if (i >= m->size1)
288 if (GSL_RANGE_COND(1))
285289 {
286 GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ;
287 }
288 else if (j >= m->size2)
289 {
290 GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ;
290 if (i >= m->size1)
291 {
292 GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ;
293 }
294 else if (j >= m->size2)
295 {
296 GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ;
297 }
291298 }
292299 #endif
293300 m->data[i * m->tda + j] = x ;
294301 }
295302
296 extern inline
303 INLINE_FUN
297304 long *
298305 gsl_matrix_long_ptr(gsl_matrix_long * m, const size_t i, const size_t j)
299306 {
300307 #if GSL_RANGE_CHECK
301 if (i >= m->size1)
308 if (GSL_RANGE_COND(1))
302309 {
303 GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
304 }
305 else if (j >= m->size2)
306 {
307 GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
310 if (i >= m->size1)
311 {
312 GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
313 }
314 else if (j >= m->size2)
315 {
316 GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
317 }
308318 }
309319 #endif
310320 return (long *) (m->data + (i * m->tda + j)) ;
311321 }
312322
313 extern inline
323 INLINE_FUN
314324 const long *
315325 gsl_matrix_long_const_ptr(const gsl_matrix_long * m, const size_t i, const size_t j)
316326 {
317327 #if GSL_RANGE_CHECK
318 if (i >= m->size1)
328 if (GSL_RANGE_COND(1))
319329 {
320 GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
321 }
322 else if (j >= m->size2)
323 {
324 GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
330 if (i >= m->size1)
331 {
332 GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
333 }
334 else if (j >= m->size2)
335 {
336 GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
337 }
325338 }
326339 #endif
327340 return (const long *) (m->data + (i * m->tda + j)) ;
2222 #include <stdlib.h>
2323 #include <gsl/gsl_types.h>
2424 #include <gsl/gsl_errno.h>
25 #include <gsl/gsl_inline.h>
2526 #include <gsl/gsl_check_range.h>
2627 #include <gsl/gsl_vector_long_double.h>
2728
203204
204205 /* Operations */
205206
206 long double gsl_matrix_long_double_get(const gsl_matrix_long_double * m, const size_t i, const size_t j);
207 void gsl_matrix_long_double_set(gsl_matrix_long_double * m, const size_t i, const size_t j, const long double x);
208
209 long double * gsl_matrix_long_double_ptr(gsl_matrix_long_double * m, const size_t i, const size_t j);
210 const long double * gsl_matrix_long_double_const_ptr(const gsl_matrix_long_double * m, const size_t i, const size_t j);
211
212207 void gsl_matrix_long_double_set_zero (gsl_matrix_long_double * m);
213208 void gsl_matrix_long_double_set_identity (gsl_matrix_long_double * m);
214209 void gsl_matrix_long_double_set_all (gsl_matrix_long_double * m, long double x);
255250 int gsl_matrix_long_double_get_col(gsl_vector_long_double * v, const gsl_matrix_long_double * m, const size_t j);
256251 int gsl_matrix_long_double_set_row(gsl_matrix_long_double * m, const size_t i, const gsl_vector_long_double * v);
257252 int gsl_matrix_long_double_set_col(gsl_matrix_long_double * m, const size_t j, const gsl_vector_long_double * v);
253 /***********************************************************************/
258254
259255 /* inline functions if you are using GCC */
260256
257 INLINE_DECL long double gsl_matrix_long_double_get(const gsl_matrix_long_double * m, const size_t i, const size_t j);
258 INLINE_DECL void gsl_matrix_long_double_set(gsl_matrix_long_double * m, const size_t i, const size_t j, const long double x);
259 INLINE_DECL long double * gsl_matrix_long_double_ptr(gsl_matrix_long_double * m, const size_t i, const size_t j);
260 INLINE_DECL const long double * gsl_matrix_long_double_const_ptr(const gsl_matrix_long_double * m, const size_t i, const size_t j);
261
261262 #ifdef HAVE_INLINE
262 extern inline
263 INLINE_FUN
263264 long double
264265 gsl_matrix_long_double_get(const gsl_matrix_long_double * m, const size_t i, const size_t j)
265266 {
266267 #if GSL_RANGE_CHECK
267 if (i >= m->size1)
268 if (GSL_RANGE_COND(1))
268269 {
269 GSL_ERROR_VAL("first index out of range", GSL_EINVAL, 0) ;
270 }
271 else if (j >= m->size2)
272 {
273 GSL_ERROR_VAL("second index out of range", GSL_EINVAL, 0) ;
270 if (i >= m->size1)
271 {
272 GSL_ERROR_VAL("first index out of range", GSL_EINVAL, 0) ;
273 }
274 else if (j >= m->size2)
275 {
276 GSL_ERROR_VAL("second index out of range", GSL_EINVAL, 0) ;
277 }
274278 }
275279 #endif
276280 return m->data[i * m->tda + j] ;
277281 }
278282
279 extern inline
283 INLINE_FUN
280284 void
281285 gsl_matrix_long_double_set(gsl_matrix_long_double * m, const size_t i, const size_t j, const long double x)
282286 {
283287 #if GSL_RANGE_CHECK
284 if (i >= m->size1)
288 if (GSL_RANGE_COND(1))
285289 {
286 GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ;
287 }
288 else if (j >= m->size2)
289 {
290 GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ;
290 if (i >= m->size1)
291 {
292 GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ;
293 }
294 else if (j >= m->size2)
295 {
296 GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ;
297 }
291298 }
292299 #endif
293300 m->data[i * m->tda + j] = x ;
294301 }
295302
296 extern inline
303 INLINE_FUN
297304 long double *
298305 gsl_matrix_long_double_ptr(gsl_matrix_long_double * m, const size_t i, const size_t j)
299306 {
300307 #if GSL_RANGE_CHECK
301 if (i >= m->size1)
308 if (GSL_RANGE_COND(1))
302309 {
303 GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
304 }
305 else if (j >= m->size2)
306 {
307 GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
310 if (i >= m->size1)
311 {
312 GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
313 }
314 else if (j >= m->size2)
315 {
316 GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
317 }
308318 }
309319 #endif
310320 return (long double *) (m->data + (i * m->tda + j)) ;
311321 }
312322
313 extern inline
323 INLINE_FUN
314324 const long double *
315325 gsl_matrix_long_double_const_ptr(const gsl_matrix_long_double * m, const size_t i, const size_t j)
316326 {
317327 #if GSL_RANGE_CHECK
318 if (i >= m->size1)
328 if (GSL_RANGE_COND(1))
319329 {
320 GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
321 }
322 else if (j >= m->size2)
323 {
324 GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
330 if (i >= m->size1)
331 {
332 GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
333 }
334 else if (j >= m->size2)
335 {
336 GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
337 }
325338 }
326339 #endif
327340 return (const long double *) (m->data + (i * m->tda + j)) ;
2222 #include <stdlib.h>
2323 #include <gsl/gsl_types.h>
2424 #include <gsl/gsl_errno.h>
25 #include <gsl/gsl_inline.h>
2526 #include <gsl/gsl_check_range.h>
2627 #include <gsl/gsl_vector_short.h>
2728
203204
204205 /* Operations */
205206
206 short gsl_matrix_short_get(const gsl_matrix_short * m, const size_t i, const size_t j);
207 void gsl_matrix_short_set(gsl_matrix_short * m, const size_t i, const size_t j, const short x);
208
209 short * gsl_matrix_short_ptr(gsl_matrix_short * m, const size_t i, const size_t j);
210 const short * gsl_matrix_short_const_ptr(const gsl_matrix_short * m, const size_t i, const size_t j);
211
212207 void gsl_matrix_short_set_zero (gsl_matrix_short * m);
213208 void gsl_matrix_short_set_identity (gsl_matrix_short * m);
214209 void gsl_matrix_short_set_all (gsl_matrix_short * m, short x);
255250 int gsl_matrix_short_get_col(gsl_vector_short * v, const gsl_matrix_short * m, const size_t j);
256251 int gsl_matrix_short_set_row(gsl_matrix_short * m, const size_t i, const gsl_vector_short * v);
257252 int gsl_matrix_short_set_col(gsl_matrix_short * m, const size_t j, const gsl_vector_short * v);
253 /***********************************************************************/
258254
259255 /* inline functions if you are using GCC */
260256
257 INLINE_DECL short gsl_matrix_short_get(const gsl_matrix_short * m, const size_t i, const size_t j);
258 INLINE_DECL void gsl_matrix_short_set(gsl_matrix_short * m, const size_t i, const size_t j, const short x);
259 INLINE_DECL short * gsl_matrix_short_ptr(gsl_matrix_short * m, const size_t i, const size_t j);
260 INLINE_DECL const short * gsl_matrix_short_const_ptr(const gsl_matrix_short * m, const size_t i, const size_t j);
261
261262 #ifdef HAVE_INLINE
262 extern inline
263 INLINE_FUN
263264 short
264265 gsl_matrix_short_get(const gsl_matrix_short * m, const size_t i, const size_t j)
265266 {
266267 #if GSL_RANGE_CHECK
267 if (i >= m->size1)
268 if (GSL_RANGE_COND(1))
268269 {
269 GSL_ERROR_VAL("first index out of range", GSL_EINVAL, 0) ;
270 }
271 else if (j >= m->size2)
272 {
273 GSL_ERROR_VAL("second index out of range", GSL_EINVAL, 0) ;
270 if (i >= m->size1)
271 {
272 GSL_ERROR_VAL("first index out of range", GSL_EINVAL, 0) ;
273 }
274 else if (j >= m->size2)
275 {
276 GSL_ERROR_VAL("second index out of range", GSL_EINVAL, 0) ;
277 }
274278 }
275279 #endif
276280 return m->data[i * m->tda + j] ;
277281 }
278282
279 extern inline
283 INLINE_FUN
280284 void
281285 gsl_matrix_short_set(gsl_matrix_short * m, const size_t i, const size_t j, const short x)
282286 {
283287 #if GSL_RANGE_CHECK
284 if (i >= m->size1)
288 if (GSL_RANGE_COND(1))
285289 {
286 GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ;
287 }
288 else if (j >= m->size2)
289 {
290 GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ;
290 if (i >= m->size1)
291 {
292 GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ;
293 }
294 else if (j >= m->size2)
295 {
296 GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ;
297 }
291298 }
292299 #endif
293300 m->data[i * m->tda + j] = x ;
294301 }
295302
296 extern inline
303 INLINE_FUN
297304 short *
298305 gsl_matrix_short_ptr(gsl_matrix_short * m, const size_t i, const size_t j)
299306 {
300307 #if GSL_RANGE_CHECK
301 if (i >= m->size1)
308 if (GSL_RANGE_COND(1))
302309 {
303 GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
304 }
305 else if (j >= m->size2)
306 {
307 GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
310 if (i >= m->size1)
311 {
312 GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
313 }
314 else if (j >= m->size2)
315 {
316 GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
317 }
308318 }
309319 #endif
310320 return (short *) (m->data + (i * m->tda + j)) ;
311321 }
312322
313 extern inline
323 INLINE_FUN
314324 const short *
315325 gsl_matrix_short_const_ptr(const gsl_matrix_short * m, const size_t i, const size_t j)
316326 {
317327 #if GSL_RANGE_CHECK
318 if (i >= m->size1)
328 if (GSL_RANGE_COND(1))
319329 {
320 GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
321 }
322 else if (j >= m->size2)
323 {
324 GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
330 if (i >= m->size1)
331 {
332 GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
333 }
334 else if (j >= m->size2)
335 {
336 GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
337 }
325338 }
326339 #endif
327340 return (const short *) (m->data + (i * m->tda + j)) ;
2222 #include <stdlib.h>
2323 #include <gsl/gsl_types.h>
2424 #include <gsl/gsl_errno.h>
25 #include <gsl/gsl_inline.h>
2526 #include <gsl/gsl_check_range.h>
2627 #include <gsl/gsl_vector_uchar.h>
2728
203204
204205 /* Operations */
205206
206 unsigned char gsl_matrix_uchar_get(const gsl_matrix_uchar * m, const size_t i, const size_t j);
207 void gsl_matrix_uchar_set(gsl_matrix_uchar * m, const size_t i, const size_t j, const unsigned char x);
208
209 unsigned char * gsl_matrix_uchar_ptr(gsl_matrix_uchar * m, const size_t i, const size_t j);
210 const unsigned char * gsl_matrix_uchar_const_ptr(const gsl_matrix_uchar * m, const size_t i, const size_t j);
211
212207 void gsl_matrix_uchar_set_zero (gsl_matrix_uchar * m);
213208 void gsl_matrix_uchar_set_identity (gsl_matrix_uchar * m);
214209 void gsl_matrix_uchar_set_all (gsl_matrix_uchar * m, unsigned char x);
255250 int gsl_matrix_uchar_get_col(gsl_vector_uchar * v, const gsl_matrix_uchar * m, const size_t j);
256251 int gsl_matrix_uchar_set_row(gsl_matrix_uchar * m, const size_t i, const gsl_vector_uchar * v);
257252 int gsl_matrix_uchar_set_col(gsl_matrix_uchar * m, const size_t j, const gsl_vector_uchar * v);
253 /***********************************************************************/
258254
259255 /* inline functions if you are using GCC */
260256
257 INLINE_DECL unsigned char gsl_matrix_uchar_get(const gsl_matrix_uchar * m, const size_t i, const size_t j);
258 INLINE_DECL void gsl_matrix_uchar_set(gsl_matrix_uchar * m, const size_t i, const size_t j, const unsigned char x);
259 INLINE_DECL unsigned char * gsl_matrix_uchar_ptr(gsl_matrix_uchar * m, const size_t i, const size_t j);
260 INLINE_DECL const unsigned char * gsl_matrix_uchar_const_ptr(const gsl_matrix_uchar * m, const size_t i, const size_t j);
261
261262 #ifdef HAVE_INLINE
262 extern inline
263 INLINE_FUN
263264 unsigned char
264265 gsl_matrix_uchar_get(const gsl_matrix_uchar * m, const size_t i, const size_t j)
265266 {
266267 #if GSL_RANGE_CHECK
267 if (i >= m->size1)
268 if (GSL_RANGE_COND(1))
268269 {
269 GSL_ERROR_VAL("first index out of range", GSL_EINVAL, 0) ;
270 }
271 else if (j >= m->size2)
272 {
273 GSL_ERROR_VAL("second index out of range", GSL_EINVAL, 0) ;
270 if (i >= m->size1)
271 {
272 GSL_ERROR_VAL("first index out of range", GSL_EINVAL, 0) ;
273 }
274 else if (j >= m->size2)
275 {
276 GSL_ERROR_VAL("second index out of range", GSL_EINVAL, 0) ;
277 }
274278 }
275279 #endif
276280 return m->data[i * m->tda + j] ;
277281 }
278282
279 extern inline
283 INLINE_FUN
280284 void
281285 gsl_matrix_uchar_set(gsl_matrix_uchar * m, const size_t i, const size_t j, const unsigned char x)
282286 {
283287 #if GSL_RANGE_CHECK
284 if (i >= m->size1)
288 if (GSL_RANGE_COND(1))
285289 {
286 GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ;
287 }
288 else if (j >= m->size2)
289 {
290 GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ;
290 if (i >= m->size1)
291 {
292 GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ;
293 }
294 else if (j >= m->size2)
295 {
296 GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ;
297 }
291298 }
292299 #endif
293300 m->data[i * m->tda + j] = x ;
294301 }
295302
296 extern inline
303 INLINE_FUN
297304 unsigned char *
298305 gsl_matrix_uchar_ptr(gsl_matrix_uchar * m, const size_t i, const size_t j)
299306 {
300307 #if GSL_RANGE_CHECK
301 if (i >= m->size1)
308 if (GSL_RANGE_COND(1))
302309 {
303 GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
304 }
305 else if (j >= m->size2)
306 {
307 GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
310 if (i >= m->size1)
311 {
312 GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
313 }
314 else if (j >= m->size2)
315 {
316 GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
317 }
308318 }
309319 #endif
310320 return (unsigned char *) (m->data + (i * m->tda + j)) ;
311321 }
312322
313 extern inline
323 INLINE_FUN
314324 const unsigned char *
315325 gsl_matrix_uchar_const_ptr(const gsl_matrix_uchar * m, const size_t i, const size_t j)
316326 {
317327 #if GSL_RANGE_CHECK
318 if (i >= m->size1)
328 if (GSL_RANGE_COND(1))
319329 {
320 GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
321 }
322 else if (j >= m->size2)
323 {
324 GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
330 if (i >= m->size1)
331 {
332 GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
333 }
334 else if (j >= m->size2)
335 {
336 GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
337 }
325338 }
326339 #endif
327340 return (const unsigned char *) (m->data + (i * m->tda + j)) ;
2222 #include <stdlib.h>
2323 #include <gsl/gsl_types.h>
2424 #include <gsl/gsl_errno.h>
25 #include <gsl/gsl_inline.h>
2526 #include <gsl/gsl_check_range.h>
2627 #include <gsl/gsl_vector_uint.h>
2728
203204
204205 /* Operations */
205206
206 unsigned int gsl_matrix_uint_get(const gsl_matrix_uint * m, const size_t i, const size_t j);
207 void gsl_matrix_uint_set(gsl_matrix_uint * m, const size_t i, const size_t j, const unsigned int x);
208
209 unsigned int * gsl_matrix_uint_ptr(gsl_matrix_uint * m, const size_t i, const size_t j);
210 const unsigned int * gsl_matrix_uint_const_ptr(const gsl_matrix_uint * m, const size_t i, const size_t j);
211
212207 void gsl_matrix_uint_set_zero (gsl_matrix_uint * m);
213208 void gsl_matrix_uint_set_identity (gsl_matrix_uint * m);
214209 void gsl_matrix_uint_set_all (gsl_matrix_uint * m, unsigned int x);
255250 int gsl_matrix_uint_get_col(gsl_vector_uint * v, const gsl_matrix_uint * m, const size_t j);
256251 int gsl_matrix_uint_set_row(gsl_matrix_uint * m, const size_t i, const gsl_vector_uint * v);
257252 int gsl_matrix_uint_set_col(gsl_matrix_uint * m, const size_t j, const gsl_vector_uint * v);
253 /***********************************************************************/
258254
259255 /* inline functions if you are using GCC */
260256
257 INLINE_DECL unsigned int gsl_matrix_uint_get(const gsl_matrix_uint * m, const size_t i, const size_t j);
258 INLINE_DECL void gsl_matrix_uint_set(gsl_matrix_uint * m, const size_t i, const size_t j, const unsigned int x);
259 INLINE_DECL unsigned int * gsl_matrix_uint_ptr(gsl_matrix_uint * m, const size_t i, const size_t j);
260 INLINE_DECL const unsigned int * gsl_matrix_uint_const_ptr(const gsl_matrix_uint * m, const size_t i, const size_t j);
261
261262 #ifdef HAVE_INLINE
262 extern inline
263 INLINE_FUN
263264 unsigned int
264265 gsl_matrix_uint_get(const gsl_matrix_uint * m, const size_t i, const size_t j)
265266 {
266267 #if GSL_RANGE_CHECK
267 if (i >= m->size1)
268 if (GSL_RANGE_COND(1))
268269 {
269 GSL_ERROR_VAL("first index out of range", GSL_EINVAL, 0) ;
270 }
271 else if (j >= m->size2)
272 {
273 GSL_ERROR_VAL("second index out of range", GSL_EINVAL, 0) ;
270 if (i >= m->size1)
271 {
272 GSL_ERROR_VAL("first index out of range", GSL_EINVAL, 0) ;
273 }
274 else if (j >= m->size2)
275 {
276 GSL_ERROR_VAL("second index out of range", GSL_EINVAL, 0) ;
277 }
274278 }
275279 #endif
276280 return m->data[i * m->tda + j] ;
277281 }
278282
279 extern inline
283 INLINE_FUN
280284 void
281285 gsl_matrix_uint_set(gsl_matrix_uint * m, const size_t i, const size_t j, const unsigned int x)
282286 {
283287 #if GSL_RANGE_CHECK
284 if (i >= m->size1)
288 if (GSL_RANGE_COND(1))
285289 {
286 GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ;
287 }
288 else if (j >= m->size2)
289 {
290 GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ;
290 if (i >= m->size1)
291 {
292 GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ;
293 }
294 else if (j >= m->size2)
295 {
296 GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ;
297 }
291298 }
292299 #endif
293300 m->data[i * m->tda + j] = x ;
294301 }
295302
296 extern inline
303 INLINE_FUN
297304 unsigned int *
298305 gsl_matrix_uint_ptr(gsl_matrix_uint * m, const size_t i, const size_t j)
299306 {
300307 #if GSL_RANGE_CHECK
301 if (i >= m->size1)
308 if (GSL_RANGE_COND(1))
302309 {
303 GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
304 }
305 else if (j >= m->size2)
306 {
307 GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
310 if (i >= m->size1)
311 {
312 GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
313 }
314 else if (j >= m->size2)
315 {
316 GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
317 }
308318 }
309319 #endif
310320 return (unsigned int *) (m->data + (i * m->tda + j)) ;
311321 }
312322
313 extern inline
323 INLINE_FUN
314324 const unsigned int *
315325 gsl_matrix_uint_const_ptr(const gsl_matrix_uint * m, const size_t i, const size_t j)
316326 {
317327 #if GSL_RANGE_CHECK
318 if (i >= m->size1)
328 if (GSL_RANGE_COND(1))
319329 {
320 GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
321 }
322 else if (j >= m->size2)
323 {
324 GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
330 if (i >= m->size1)
331 {
332 GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
333 }
334 else if (j >= m->size2)
335 {
336 GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
337 }
325338 }
326339 #endif
327340 return (const unsigned int *) (m->data + (i * m->tda + j)) ;
2222 #include <stdlib.h>
2323 #include <gsl/gsl_types.h>
2424 #include <gsl/gsl_errno.h>
25 #include <gsl/gsl_inline.h>
2526 #include <gsl/gsl_check_range.h>
2627 #include <gsl/gsl_vector_ulong.h>
2728
203204
204205 /* Operations */
205206
206 unsigned long gsl_matrix_ulong_get(const gsl_matrix_ulong * m, const size_t i, const size_t j);
207 void gsl_matrix_ulong_set(gsl_matrix_ulong * m, const size_t i, const size_t j, const unsigned long x);
208
209 unsigned long * gsl_matrix_ulong_ptr(gsl_matrix_ulong * m, const size_t i, const size_t j);
210 const unsigned long * gsl_matrix_ulong_const_ptr(const gsl_matrix_ulong * m, const size_t i, const size_t j);
211
212207 void gsl_matrix_ulong_set_zero (gsl_matrix_ulong * m);
213208 void gsl_matrix_ulong_set_identity (gsl_matrix_ulong * m);
214209 void gsl_matrix_ulong_set_all (gsl_matrix_ulong * m, unsigned long x);
255250 int gsl_matrix_ulong_get_col(gsl_vector_ulong * v, const gsl_matrix_ulong * m, const size_t j);
256251 int gsl_matrix_ulong_set_row(gsl_matrix_ulong * m, const size_t i, const gsl_vector_ulong * v);
257252 int gsl_matrix_ulong_set_col(gsl_matrix_ulong * m, const size_t j, const gsl_vector_ulong * v);
253 /***********************************************************************/
258254
259255 /* inline functions if you are using GCC */
260256
257 INLINE_DECL unsigned long gsl_matrix_ulong_get(const gsl_matrix_ulong * m, const size_t i, const size_t j);
258 INLINE_DECL void gsl_matrix_ulong_set(gsl_matrix_ulong * m, const size_t i, const size_t j, const unsigned long x);
259 INLINE_DECL unsigned long * gsl_matrix_ulong_ptr(gsl_matrix_ulong * m, const size_t i, const size_t j);
260 INLINE_DECL const unsigned long * gsl_matrix_ulong_const_ptr(const gsl_matrix_ulong * m, const size_t i, const size_t j);
261
261262 #ifdef HAVE_INLINE
262 extern inline
263 INLINE_FUN
263264 unsigned long
264265 gsl_matrix_ulong_get(const gsl_matrix_ulong * m, const size_t i, const size_t j)
265266 {
266267 #if GSL_RANGE_CHECK
267 if (i >= m->size1)
268 if (GSL_RANGE_COND(1))
268269 {
269 GSL_ERROR_VAL("first index out of range", GSL_EINVAL, 0) ;
270 }
271 else if (j >= m->size2)
272 {
273 GSL_ERROR_VAL("second index out of range", GSL_EINVAL, 0) ;
270 if (i >= m->size1)
271 {
272 GSL_ERROR_VAL("first index out of range", GSL_EINVAL, 0) ;
273 }
274 else if (j >= m->size2)
275 {
276 GSL_ERROR_VAL("second index out of range", GSL_EINVAL, 0) ;
277 }
274278 }
275279 #endif
276280 return m->data[i * m->tda + j] ;
277281 }
278282
279 extern inline
283 INLINE_FUN
280284 void
281285 gsl_matrix_ulong_set(gsl_matrix_ulong * m, const size_t i, const size_t j, const unsigned long x)
282286 {
283287 #if GSL_RANGE_CHECK
284 if (i >= m->size1)
288 if (GSL_RANGE_COND(1))
285289 {
286 GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ;
287 }
288 else if (j >= m->size2)
289 {
290 GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ;
290 if (i >= m->size1)
291 {
292 GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ;
293 }
294 else if (j >= m->size2)
295 {
296 GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ;
297 }
291298 }
292299 #endif
293300 m->data[i * m->tda + j] = x ;
294301 }
295302
296 extern inline
303 INLINE_FUN
297304 unsigned long *
298305 gsl_matrix_ulong_ptr(gsl_matrix_ulong * m, const size_t i, const size_t j)
299306 {
300307 #if GSL_RANGE_CHECK
301 if (i >= m->size1)
308 if (GSL_RANGE_COND(1))
302309 {
303 GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
304 }
305 else if (j >= m->size2)
306 {
307 GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
310 if (i >= m->size1)
311 {
312 GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
313 }
314 else if (j >= m->size2)
315 {
316 GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
317 }
308318 }
309319 #endif
310320 return (unsigned long *) (m->data + (i * m->tda + j)) ;
311321 }
312322
313 extern inline
323 INLINE_FUN
314324 const unsigned long *
315325 gsl_matrix_ulong_const_ptr(const gsl_matrix_ulong * m, const size_t i, const size_t j)
316326 {
317327 #if GSL_RANGE_CHECK
318 if (i >= m->size1)
328 if (GSL_RANGE_COND(1))
319329 {
320 GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
321 }
322 else if (j >= m->size2)
323 {
324 GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
330 if (i >= m->size1)
331 {
332 GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
333 }
334 else if (j >= m->size2)
335 {
336 GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
337 }
325338 }
326339 #endif
327340 return (const unsigned long *) (m->data + (i * m->tda + j)) ;
2222 #include <stdlib.h>
2323 #include <gsl/gsl_types.h>
2424 #include <gsl/gsl_errno.h>
25 #include <gsl/gsl_inline.h>
2526 #include <gsl/gsl_check_range.h>
2627 #include <gsl/gsl_vector_ushort.h>
2728
203204
204205 /* Operations */
205206
206 unsigned short gsl_matrix_ushort_get(const gsl_matrix_ushort * m, const size_t i, const size_t j);
207 void gsl_matrix_ushort_set(gsl_matrix_ushort * m, const size_t i, const size_t j, const unsigned short x);
208
209 unsigned short * gsl_matrix_ushort_ptr(gsl_matrix_ushort * m, const size_t i, const size_t j);
210 const unsigned short * gsl_matrix_ushort_const_ptr(const gsl_matrix_ushort * m, const size_t i, const size_t j);
211
212207 void gsl_matrix_ushort_set_zero (gsl_matrix_ushort * m);
213208 void gsl_matrix_ushort_set_identity (gsl_matrix_ushort * m);
214209 void gsl_matrix_ushort_set_all (gsl_matrix_ushort * m, unsigned short x);
255250 int gsl_matrix_ushort_get_col(gsl_vector_ushort * v, const gsl_matrix_ushort * m, const size_t j);
256251 int gsl_matrix_ushort_set_row(gsl_matrix_ushort * m, const size_t i, const gsl_vector_ushort * v);
257252 int gsl_matrix_ushort_set_col(gsl_matrix_ushort * m, const size_t j, const gsl_vector_ushort * v);
253 /***********************************************************************/
258254
259255 /* inline functions if you are using GCC */
260256
257 INLINE_DECL unsigned short gsl_matrix_ushort_get(const gsl_matrix_ushort * m, const size_t i, const size_t j);
258 INLINE_DECL void gsl_matrix_ushort_set(gsl_matrix_ushort * m, const size_t i, const size_t j, const unsigned short x);
259 INLINE_DECL unsigned short * gsl_matrix_ushort_ptr(gsl_matrix_ushort * m, const size_t i, const size_t j);
260 INLINE_DECL const unsigned short * gsl_matrix_ushort_const_ptr(const gsl_matrix_ushort * m, const size_t i, const size_t j);
261
261262 #ifdef HAVE_INLINE
262 extern inline
263 INLINE_FUN
263264 unsigned short
264265 gsl_matrix_ushort_get(const gsl_matrix_ushort * m, const size_t i, const size_t j)
265266 {
266267 #if GSL_RANGE_CHECK
267 if (i >= m->size1)
268 if (GSL_RANGE_COND(1))
268269 {
269 GSL_ERROR_VAL("first index out of range", GSL_EINVAL, 0) ;
270 }
271 else if (j >= m->size2)
272 {
273 GSL_ERROR_VAL("second index out of range", GSL_EINVAL, 0) ;
270 if (i >= m->size1)
271 {
272 GSL_ERROR_VAL("first index out of range", GSL_EINVAL, 0) ;
273 }
274 else if (j >= m->size2)
275 {
276 GSL_ERROR_VAL("second index out of range", GSL_EINVAL, 0) ;
277 }
274278 }
275279 #endif
276280 return m->data[i * m->tda + j] ;
277281 }
278282
279 extern inline
283 INLINE_FUN
280284 void
281285 gsl_matrix_ushort_set(gsl_matrix_ushort * m, const size_t i, const size_t j, const unsigned short x)
282286 {
283287 #if GSL_RANGE_CHECK
284 if (i >= m->size1)
288 if (GSL_RANGE_COND(1))
285289 {
286 GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ;
287 }
288 else if (j >= m->size2)
289 {
290 GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ;
290 if (i >= m->size1)
291 {
292 GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ;
293 }
294 else if (j >= m->size2)
295 {
296 GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ;
297 }
291298 }
292299 #endif
293300 m->data[i * m->tda + j] = x ;
294301 }
295302
296 extern inline
303 INLINE_FUN
297304 unsigned short *
298305 gsl_matrix_ushort_ptr(gsl_matrix_ushort * m, const size_t i, const size_t j)
299306 {
300307 #if GSL_RANGE_CHECK
301 if (i >= m->size1)
308 if (GSL_RANGE_COND(1))
302309 {
303 GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
304 }
305 else if (j >= m->size2)
306 {
307 GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
310 if (i >= m->size1)
311 {
312 GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
313 }
314 else if (j >= m->size2)
315 {
316 GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
317 }
308318 }
309319 #endif
310320 return (unsigned short *) (m->data + (i * m->tda + j)) ;
311321 }
312322
313 extern inline
323 INLINE_FUN
314324 const unsigned short *
315325 gsl_matrix_ushort_const_ptr(const gsl_matrix_ushort * m, const size_t i, const size_t j)
316326 {
317327 #if GSL_RANGE_CHECK
318 if (i >= m->size1)
328 if (GSL_RANGE_COND(1))
319329 {
320 GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
321 }
322 else if (j >= m->size2)
323 {
324 GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
330 if (i >= m->size1)
331 {
332 GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
333 }
334 else if (j >= m->size2)
335 {
336 GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
337 }
325338 }
326339 #endif
327340 return (const unsigned short *) (m->data + (i * m->tda + j)) ;
00 #include <config.h>
11 #include <gsl/gsl_errno.h>
2 #include <gsl/gsl_vector.h>
3
4 /* Compile all the inline matrix functions */
5
6 #define COMPILE_INLINE_STATIC
7 #include "build.h"
28 #include <gsl/gsl_matrix.h>
39
4 #define BASE_GSL_COMPLEX_LONG
5 #include "templates_on.h"
6 #include "matrix_source.c"
7 #include "templates_off.h"
8 #undef BASE_GSL_COMPLEX_LONG
9
10 #define BASE_GSL_COMPLEX
11 #include "templates_on.h"
12 #include "matrix_source.c"
13 #include "templates_off.h"
14 #undef BASE_GSL_COMPLEX
15
16 #define BASE_GSL_COMPLEX_FLOAT
17 #include "templates_on.h"
18 #include "matrix_source.c"
19 #include "templates_off.h"
20 #undef BASE_GSL_COMPLEX_FLOAT
21
22 #define BASE_LONG_DOUBLE
23 #include "templates_on.h"
24 #include "matrix_source.c"
25 #include "templates_off.h"
26 #undef BASE_LONG_DOUBLE
27
28 #define BASE_DOUBLE
29 #include "templates_on.h"
30 #include "matrix_source.c"
31 #include "templates_off.h"
32 #undef BASE_DOUBLE
33
34 #define BASE_FLOAT
35 #include "templates_on.h"
36 #include "matrix_source.c"
37 #include "templates_off.h"
38 #undef BASE_FLOAT
39
40 #define BASE_ULONG
41 #include "templates_on.h"
42 #include "matrix_source.c"
43 #include "templates_off.h"
44 #undef BASE_ULONG
45
46 #define BASE_LONG
47 #include "templates_on.h"
48 #include "matrix_source.c"
49 #include "templates_off.h"
50 #undef BASE_LONG
51
52 #define BASE_UINT
53 #include "templates_on.h"
54 #include "matrix_source.c"
55 #include "templates_off.h"
56 #undef BASE_UINT
57
58 #define BASE_INT
59 #include "templates_on.h"
60 #include "matrix_source.c"
61 #include "templates_off.h"
62 #undef BASE_INT
63
64 #define BASE_USHORT
65 #include "templates_on.h"
66 #include "matrix_source.c"
67 #include "templates_off.h"
68 #undef BASE_USHORT
69
70 #define BASE_SHORT
71 #include "templates_on.h"
72 #include "matrix_source.c"
73 #include "templates_off.h"
74 #undef BASE_SHORT
75
76 #define BASE_UCHAR
77 #include "templates_on.h"
78 #include "matrix_source.c"
79 #include "templates_off.h"
80 #undef BASE_UCHAR
81
82 #define BASE_CHAR
83 #include "templates_on.h"
84 #include "matrix_source.c"
85 #include "templates_off.h"
86 #undef BASE_CHAR
+0
-97
matrix/matrix_source.c less more
0 /* matrix/matrix_source.c
1 *
2 * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 3 of the License, or (at
7 * your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18
19 #ifndef HIDE_INLINE_STATIC
20 BASE
21 FUNCTION (gsl_matrix, get) (const TYPE (gsl_matrix) * m,
22 const size_t i, const size_t j)
23 {
24 BASE zero = ZERO;
25
26 if (gsl_check_range)
27 {
28 if (i >= m->size1) /* size_t is unsigned, can't be negative */
29 {
30 GSL_ERROR_VAL ("first index out of range", GSL_EINVAL, zero);
31 }
32 else if (j >= m->size2) /* size_t is unsigned, can't be negative */
33 {
34 GSL_ERROR_VAL ("second index out of range", GSL_EINVAL, zero);
35 }
36 }
37 return *(BASE *) (m->data + MULTIPLICITY * (i * m->tda + j));
38 }
39
40 void
41 FUNCTION (gsl_matrix, set) (TYPE (gsl_matrix) * m,
42 const size_t i, const size_t j,
43 const BASE x)
44 {
45 if (gsl_check_range)
46 {
47 if (i >= m->size1) /* size_t is unsigned, can't be negative */
48 {
49 GSL_ERROR_VOID ("first index out of range", GSL_EINVAL);
50 }
51 else if (j >= m->size2) /* size_t is unsigned, can't be negative */
52 {
53 GSL_ERROR_VOID ("second index out of range", GSL_EINVAL);
54 }
55 }
56 *(BASE *) (m->data + MULTIPLICITY * (i * m->tda + j)) = x;
57 }
58
59
60 BASE *
61 FUNCTION (gsl_matrix, ptr) (TYPE (gsl_matrix) * m,
62 const size_t i, const size_t j)
63 {
64 if (gsl_check_range)
65 {
66 if (i >= m->size1) /* size_t is unsigned, can't be negative */
67 {
68 GSL_ERROR_NULL ("first index out of range", GSL_EINVAL);
69 }
70 else if (j >= m->size2) /* size_t is unsigned, can't be negative */
71 {
72 GSL_ERROR_NULL ("second index out of range", GSL_EINVAL);
73 }
74 }
75 return (BASE *) (m->data + MULTIPLICITY * (i * m->tda + j));
76 }
77
78
79 const BASE *
80 FUNCTION (gsl_matrix, const_ptr) (const TYPE (gsl_matrix) * m,
81 const size_t i, const size_t j)
82 {
83 if (gsl_check_range)
84 {
85 if (i >= m->size1) /* size_t is unsigned, can't be negative */
86 {
87 GSL_ERROR_NULL ("first index out of range", GSL_EINVAL);
88 }
89 else if (j >= m->size2) /* size_t is unsigned, can't be negative */
90 {
91 GSL_ERROR_NULL ("second index out of range", GSL_EINVAL);
92 }
93 }
94 return (const BASE *) (m->data + MULTIPLICITY * (i * m->tda + j));
95 }
96 #endif
145145 GSL_ERROR_VAL ("vector length n must be positive integer",
146146 GSL_EINVAL, view);
147147 }
148 else if (offset + n > m->size1)
148 else if (offset + n > m->size2)
149149 {
150150 GSL_ERROR_VAL ("dimension n overflows matrix", GSL_EINVAL, view);
151151 }
178178 GSL_ERROR_VAL ("vector length n must be positive integer",
179179 GSL_EINVAL, view);
180180 }
181 else if (offset + n > m->size2)
181 else if (offset + n > m->size1)
182182 {
183183 GSL_ERROR_VAL ("dimension n overflows matrix", GSL_EINVAL, view);
184184 }
589589 gsl_test (status, NAME (gsl_matrix) "_div_elements division");
590590 }
591591
592 {
593 BASE s;
594 GSL_SET_COMPLEX(&s, 2.0, 3.0);
595
596 FUNCTION (gsl_matrix, memcpy) (m, a);
597 FUNCTION (gsl_matrix, scale) (m, s);
598
599 k = 0;
600 status = 0;
601
602 for (i = 0; i < P; i++)
603 {
604 for (j = 0; j < Q; j++)
605 {
606 ATOMIC real = (ATOMIC) (-(ATOMIC)k - 30);
607 ATOMIC imag = (ATOMIC) (5 * (ATOMIC)k + 20);
608 BASE z = FUNCTION (gsl_matrix, get) (m, i, j);
609 if (GSL_REAL (z) != real || GSL_IMAG (z) != imag)
610 {
611 status = 1;
612 }
613 k++;
614 }
615 }
616 gsl_test (status, NAME (gsl_matrix) "_scale");
617 }
618
619 {
620 BASE s;
621 GSL_SET_COMPLEX(&s, 2.0, 3.0);
622
623 FUNCTION (gsl_matrix, memcpy) (m, a);
624 FUNCTION (gsl_matrix, add_constant) (m, s);
625
626 k = 0;
627 status = 0;
628
629 for (i = 0; i < P; i++)
630 {
631 for (j = 0; j < Q; j++)
632 {
633 ATOMIC real = (ATOMIC) ((ATOMIC)k + 2);
634 ATOMIC imag = (ATOMIC) ((ATOMIC)k + 10 + 3);
635 BASE z = FUNCTION (gsl_matrix, get) (m, i, j);
636 if (GSL_REAL (z) != real || GSL_IMAG (z) != imag)
637 {
638 status = 1;
639 }
640 k++;
641 }
642 }
643 gsl_test (status, NAME (gsl_matrix) "_add_constant");
644 }
645
646 {
647 BASE s;
648 GSL_SET_COMPLEX(&s, 2.0, 3.0);
649
650 FUNCTION (gsl_matrix, memcpy) (m, a);
651 FUNCTION (gsl_matrix, add_diagonal) (m, s);
652
653 k = 0;
654 status = 0;
655
656 for (i = 0; i < P; i++)
657 {
658 for (j = 0; j < Q; j++)
659 {
660 ATOMIC real = (ATOMIC) ((ATOMIC)k + ((i==j) ? 2 : 0));
661 ATOMIC imag = (ATOMIC) ((ATOMIC)k + 10 +((i==j) ? 3 : 0));
662 BASE z = FUNCTION (gsl_matrix, get) (m, i, j);
663 if (GSL_REAL (z) != real || GSL_IMAG (z) != imag)
664 {
665 status = 1;
666 }
667 k++;
668 }
669 }
670 gsl_test (status, NAME (gsl_matrix) "_add_diagonal");
671 }
672
673 {
674 FUNCTION (gsl_matrix, swap) (a, b);
675
676 k = 0;
677 status = 0;
678
679 for (i = 0; i < P; i++)
680 {
681 for (j = 0; j < Q; j++)
682 {
683 BASE x = FUNCTION (gsl_matrix, get) (a, i, j);
684 BASE y = FUNCTION (gsl_matrix, get) (b, i, j);
685 if (GSL_REAL (x) != (ATOMIC) (k + 5) || GSL_IMAG (x) != (ATOMIC) (k + 20) ||
686 GSL_REAL (y) != (ATOMIC) (k) || GSL_IMAG (y) != (ATOMIC) (k + 10))
687 {
688 status = 1;
689 }
690 k++;
691 }
692 }
693 gsl_test (status, NAME (gsl_matrix) "_swap");
694 }
695
696
697
592698 FUNCTION (gsl_matrix, free) (a);
593699 FUNCTION (gsl_matrix, free) (b);
594700 FUNCTION (gsl_matrix, free) (m);
505505 }
506506
507507
508 FUNCTION(gsl_matrix, memcpy) (m, a);
509 FUNCTION(gsl_matrix, scale) (m, 2.0);
510
511 {
512 int status = 0;
513
514 for (i = 0; i < M; i++)
515 {
516 for (j = 0; j < N; j++)
517 {
518 BASE r = FUNCTION(gsl_matrix,get) (m,i,j);
519 BASE x = FUNCTION(gsl_matrix,get) (a,i,j);
520 if (r != (ATOMIC)(2*x))
521 status = 1;
522 }
523 }
524 gsl_test (status, NAME (gsl_matrix) "_scale");
525 }
526
527 FUNCTION(gsl_matrix, memcpy) (m, a);
528 FUNCTION(gsl_matrix, add_constant) (m, 3.0);
529
530 {
531 int status = 0;
532
533 for (i = 0; i < M; i++)
534 {
535 for (j = 0; j < N; j++)
536 {
537 BASE r = FUNCTION(gsl_matrix,get) (m,i,j);
538 BASE x = FUNCTION(gsl_matrix,get) (a,i,j);
539 BASE y = x + 3.0;
540 if (fabs(r - y) > 2 * GSL_FLT_EPSILON * fabs(y))
541 status = 1;
542 }
543 }
544 gsl_test (status, NAME (gsl_matrix) "_add_constant");
545 }
546
547 FUNCTION(gsl_matrix, memcpy) (m, a);
548 FUNCTION(gsl_matrix, add_diagonal) (m, 5.0);
549
550 {
551 int status = 0;
552
553 for (i = 0; i < M; i++)
554 {
555 for (j = 0; j < N; j++)
556 {
557 BASE r = FUNCTION(gsl_matrix,get) (m,i,j);
558 BASE x = FUNCTION(gsl_matrix,get) (a,i,j);
559 BASE y = (i == j) ? (x + 5.0) : x;
560 if (fabs(r - y) > 2 * GSL_FLT_EPSILON * fabs(y))
561 status = 1;
562 }
563 }
564 gsl_test (status, NAME (gsl_matrix) "_add_diagonal");
565 }
566
567
568 FUNCTION(gsl_matrix, swap) (a, b);
569
570 {
571 int status = 0;
572
573 for (i = 0; i < M; i++)
574 {
575 for (j = 0; j < N; j++)
576 {
577 BASE x = FUNCTION(gsl_matrix,get) (a,i,j);
578 BASE y = FUNCTION(gsl_matrix,get) (b,i,j);
579 if (y != (BASE)(3 + i + 5 * j) || x != (BASE)(3 + 2 * i + 4 * j))
580 status = 1;
581 }
582 }
583 gsl_test (status, NAME (gsl_matrix) "_swap");
584 }
585
586
508587 FUNCTION(gsl_matrix, free) (a);
509588 FUNCTION(gsl_matrix, free) (b);
510589 }
511
512590
513591 FUNCTION (gsl_matrix, free) (m);
514592 FUNCTION (gsl_vector, free) (v);
0 2008-07-03 Brian Gough <bjg@hp2.network-theory.co.uk>
1
2 * Makefile.am (INCLUDES): use top_srcdir instead of top_builddir
3
04 2008-01-09 Brian Gough <bjg@network-theory.co.uk>
15
26 * brent.c (brent_iterate): remove spurious early return
33
44 noinst_HEADERS = min.h
55
6 INCLUDES= -I$(top_builddir)
6 INCLUDES = -I$(top_srcdir)
77
88 libgslmin_la_SOURCES = fsolver.c golden.c brent.c convergence.c bracketing.c
99
132132 LIBOBJS = @LIBOBJS@
133133 LIBS = @LIBS@
134134 LIBTOOL = @LIBTOOL@
135 LIPO = @LIPO@
135136 LN_S = @LN_S@
136137 LTLIBOBJS = @LTLIBOBJS@
137138 MAINT = @MAINT@
139140 MKDIR_P = @MKDIR_P@
140141 NM = @NM@
141142 NMEDIT = @NMEDIT@
143 OBJDUMP = @OBJDUMP@
142144 OBJEXT = @OBJEXT@
145 OTOOL = @OTOOL@
146 OTOOL64 = @OTOOL64@
143147 PACKAGE = @PACKAGE@
144148 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
145149 PACKAGE_NAME = @PACKAGE_NAME@
205209 noinst_LTLIBRARIES = libgslmin.la
206210 pkginclude_HEADERS = gsl_min.h
207211 noinst_HEADERS = min.h
208 INCLUDES = -I$(top_builddir)
212 INCLUDES = -I$(top_srcdir)
209213 libgslmin_la_SOURCES = fsolver.c golden.c brent.c convergence.c bracketing.c
210214 TESTS = $(check_PROGRAMS)
211215 test_SOURCES = test.c test_funcs.c test.h
0 2008-11-20 Brian Gough <bjg@network-theory.co.uk>
1
2 * vegas.c (gsl_monte_vegas_integrate): improve the chisq
3 calculation to avoid cancellation errors in the original
4 formula (fixes bug #24510)
5
6 * test.c (MONTE_ERROR_TEST): added test cases for negative chisq
7 in vegas
8
9 2008-07-03 Brian Gough <bjg@hp2.network-theory.co.uk>
10
11 * Makefile.am (INCLUDES): use top_srcdir instead of top_builddir
12
13 2008-04-26 Brian Gough <bjg@network-theory.co.uk>
14
15 * vegas.c (gsl_monte_vegas_integrate): compute running totals as
16 volatile double to prevent problems with excess precision, use
17 meaningful variable names for sum of squares, variance and sigma.
18
19 * test_main.c: compute the ensemble mean more accurately for the tests
20
21 * test.c: added a test for warm-start vegas, as well as cold-start
22
23 * miser.c (gsl_monte_miser_integrate): catch zero weights to avoid
24 division by zero
25
26 * test.c (main): added test for step-type function
27
028 2004-06-02 Brian Gough <bjg@network-theory.co.uk>
129
230 * test_main.c: handle the case where sd==0 && error[i] !=0 more
33
44 pkginclude_HEADERS = gsl_monte.h gsl_monte_vegas.h gsl_monte_miser.h gsl_monte_plain.h
55
6 INCLUDES= -I$(top_builddir) -I$(top_srcdir)
6 INCLUDES = -I$(top_srcdir)
77
88 TESTS = $(check_PROGRAMS)
99
131131 LIBOBJS = @LIBOBJS@
132132 LIBS = @LIBS@
133133 LIBTOOL = @LIBTOOL@
134 LIPO = @LIPO@
134135 LN_S = @LN_S@
135136 LTLIBOBJS = @LTLIBOBJS@
136137 MAINT = @MAINT@
138139 MKDIR_P = @MKDIR_P@
139140 NM = @NM@
140141 NMEDIT = @NMEDIT@
142 OBJDUMP = @OBJDUMP@
141143 OBJEXT = @OBJEXT@
144 OTOOL = @OTOOL@
145 OTOOL64 = @OTOOL64@
142146 PACKAGE = @PACKAGE@
143147 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
144148 PACKAGE_NAME = @PACKAGE_NAME@
204208 noinst_LTLIBRARIES = libgslmonte.la
205209 libgslmonte_la_SOURCES = miser.c plain.c gsl_monte_vegas.h gsl_monte_miser.h gsl_monte_plain.h gsl_monte.h vegas.c
206210 pkginclude_HEADERS = gsl_monte.h gsl_monte_vegas.h gsl_monte_miser.h gsl_monte_plain.h
207 INCLUDES = -I$(top_builddir) -I$(top_srcdir)
211 INCLUDES = -I$(top_srcdir)
208212 TESTS = $(check_PROGRAMS)
209213 test_SOURCES = test.c
210214 test_LDADD = libgslmonte.la ../rng/libgslrng.la ../ieee-utils/libgslieeeutils.la ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la ../utils/libutils.la
192192 i_bisect = i;
193193 weight_l = pow (sigma_l[i], beta);
194194 weight_r = pow (sigma_r[i], beta);
195
196 if (weight_l == 0 && weight_r == 0)
197 {
198 weight_l = 1;
199 weight_r = 1;
200 }
195201 }
196202 }
197203 else
3333 #include <gsl/gsl_monte_vegas.h>
3434
3535 #define CONSTANT
36 #define STEP
3637 #define PRODUCT
3738 #define GAUSSIAN
3839 #define DBLGAUSSIAN
4849 double xu3[2] = { GSL_DBL_MAX, GSL_DBL_MAX };
4950
5051 double fconst (double x[], size_t d, void *params);
52 double fstep (double x[], size_t d, void *params);
5153 double f0 (double x[], size_t d, void *params);
5254 double f1 (double x[], size_t d, void *params);
5355 double f2 (double x[], size_t d, void *params);
115117 double c = (1.0 + sqrt (10.0)) / 9.0;
116118
117119 gsl_monte_function Fc = make_function(&fconst, 0, 0);
120 gsl_monte_function Fs = make_function(&fstep, 0, 0);
118121 gsl_monte_function F0 = make_function(&f0, 0, &a);
119122 gsl_monte_function F1 = make_function(&f1, 0, &a);
120123 gsl_monte_function F2 = make_function(&f2, 0, &a);
146149 add(problems,&n, &Fc, xl, xu, 8, 1000, 1.0, 0.0, "constant, 8d");
147150 add(problems,&n, &Fc, xl, xu, 9, 1000, 1.0, 0.0, "constant, 9d");
148151 add(problems,&n, &Fc, xl, xu, 10, 1000, 1.0, 0.0, "constant, 10d");
152 #endif
153
154 #ifdef STEP
155 /* variance(Fs) = 0.4/sqrt(1000) */
156 add(problems,&n, &Fs, xl, xu, 1, 100000, 0.8, 1.264e-3, "step, 1d");
157 add(problems,&n, &Fs, xl, xu, 2, 100000, 0.8, 1.264e-3, "step, 2d");
158 add(problems,&n, &Fs, xl, xu, 3, 100000, 0.8, 1.264e-3, "step, 3d");
159 add(problems,&n, &Fs, xl, xu, 4, 100000, 0.8, 1.264e-3, "step, 4d");
160 add(problems,&n, &Fs, xl, xu, 5, 100000, 0.8, 1.264e-3, "step, 5d");
161 add(problems,&n, &Fs, xl, xu, 6, 100000, 0.8, 1.264e-3, "step, 6d");
162 add(problems,&n, &Fs, xl, xu, 7, 100000, 0.8, 1.264e-3, "step, 7d");
163 add(problems,&n, &Fs, xl, xu, 8, 100000, 0.8, 1.264e-3, "step, 8d");
164 add(problems,&n, &Fs, xl, xu, 9, 100000, 0.8, 1.264e-3, "step, 9d");
165 add(problems,&n, &Fs, xl, xu, 10, 100000, 0.8, 1.264e-3, "step, 10d");
149166 #endif
150167
151168 #ifdef PRODUCT
268285 #define NAME "vegas"
269286 #define MONTE_STATE gsl_monte_vegas_state
270287 #define MONTE_ALLOC gsl_monte_vegas_alloc
271 #define MONTE_INTEGRATE(f,xl,xu,dim,calls,r,s,res,err) { gsl_monte_vegas_integrate(f,xl,xu,dim,calls,r,s,res,err) ; if (s->chisq < 0.5 || s->chisq > 2) gsl_monte_vegas_integrate(f,xl,xu,dim,calls,r,s,res,err); }
288 #define MONTE_INTEGRATE(f,xl,xu,dim,calls,r,s,res,err) { gsl_monte_vegas_integrate(f,xl,xu,dim,calls,r,s,res,err) ; }
272289 #define MONTE_FREE gsl_monte_vegas_free
273290 #define MONTE_SPEEDUP 3
274 #define MONTE_ERROR_TEST(err,expected) gsl_test(err > 3.0 * (expected == 0 ? 1.0/(I->calls/MONTE_SPEEDUP) : expected), NAME ", %s, abserr[%d] (obs %g vs exp %g)", I->description, i, err, expected)
291 #define MONTE_ERROR_TEST(err,expected) gsl_test(err > 3.0 * (expected == 0 ? 1.0/(I->calls/MONTE_SPEEDUP) : expected), NAME ", %s, abserr[%d] (obs %g vs exp %g)", I->description, i, err, expected) ; gsl_test(s->chisq < 0, NAME " returns valid chisq (%g)", s->chisq)
275292 #include "test_main.c"
276293 #undef NAME
277294 #undef MONTE_STATE
281298 #undef MONTE_ERROR_TEST
282299 #undef MONTE_SPEEDUP
283300 #endif
301
302
303 #ifdef VEGAS
304 #define NAME "vegas(warm)"
305 #define MONTE_STATE gsl_monte_vegas_state
306 #define MONTE_ALLOC gsl_monte_vegas_alloc
307 #define MONTE_INTEGRATE(f,xl,xu,dim,calls,r,s,res,err) { gsl_monte_vegas_integrate(f,xl,xu,dim,calls,r,s,res,err) ; gsl_monte_vegas_integrate(f,xl,xu,dim,calls,r,s,res,err); }
308 #define MONTE_FREE gsl_monte_vegas_free
309 #define MONTE_SPEEDUP 3
310 #define MONTE_ERROR_TEST(err,expected) gsl_test(err > 3.0 * (expected == 0 ? 1.0/(I->calls/MONTE_SPEEDUP) : expected), NAME ", %s, abserr[%d] (obs %g vs exp %g)", I->description, i, err, expected); gsl_test(s->chisq < 0, NAME " returns valid chisq (%g)", s->chisq)
311 #include "test_main.c"
312 #undef NAME
313 #undef MONTE_STATE
314 #undef MONTE_ALLOC
315 #undef MONTE_INTEGRATE
316 #undef MONTE_FREE
317 #undef MONTE_ERROR_TEST
318 #undef MONTE_SPEEDUP
319 #endif
320
284321
285322 exit (gsl_test_summary ());
286323 }
290327 fconst (double x[], size_t num_dim, void *params)
291328 {
292329 return 1;
330 }
331
332
333 /* Step-type (pulse) function */
334 double
335 fstep (double x[], size_t num_dim, void *params)
336 {
337 return (x[0] > 0.1 && x[0] < 0.9) ? 1 : 0;
293338 }
294339
295340 /* Simple product function */
00 for (I = problems ; I->f != 0; I++)
11 {
22 size_t i;
3 double sum = 0, mean, sumd2 = 0, sd, res, err;
3 double res, err;
44
55 gsl_rng * r;
66
3333 MONTE_FREE (s);
3434 }
3535
36 for (i = 0; i < TRIALS; i++)
37 {
38 sum += result[i];
39 }
36
37 /* Check the results for consistency as an ensemble */
4038
41 mean = sum / TRIALS ;
39 {
40 double mean = 0, sumd2 = 0, sd;
4241
43 for (i = 0; i < TRIALS; i++)
44 {
45 sumd2 += pow(result[i] - mean, 2.0);
46 }
42 /* We need to compute the mean exactly when all terms are equal,
43 to get an exact zero for the standard deviation (this is a
44 common case when integrating a constant). */
4745
48 sd = sqrt(sumd2 / (TRIALS-1.0)) ;
49
50 if (sd < TRIALS * GSL_DBL_EPSILON * fabs (mean))
51 {
52 sd = 0;
53 }
46 for (i = 0; i < TRIALS; i++)
47 {
48 mean += (result[i] - mean) / (i + 1.0);
49 }
5450
55 for (i = 0; i < TRIALS; i++)
56 {
57 if (sd == 0 && fabs(error[i]) < GSL_DBL_EPSILON * fabs(result[i]))
58 {
59 error[i] = 0.0;
60 }
61
62 gsl_test_factor (error[i], sd, 5.0,
63 NAME ", %s, abserr[%d] vs sd", I->description, i);
64 }
65
51 for (i = 0; i < TRIALS; i++)
52 {
53 sumd2 += pow(result[i] - mean, 2.0);
54 }
55
56 sd = sqrt(sumd2 / (TRIALS-1.0)) ;
57
58 for (i = 0; i < TRIALS; i++)
59 {
60 gsl_test_factor (error[i], sd, 5.0,
61 NAME ", %s, abserr[%d] vs sd", I->description, i);
62 }
63 }
6664
6765 gsl_rng_free (r);
6866 }
7070 #define NEW_COORD(s,i) ((s)->xin[(i)])
7171 #define VALUE(s,i,j) ((s)->d[(i)*(s)->dim + (j)])
7272
73 #define USE_ORIGINAL_CHISQ_FORMULA 0
74
7375 /* predeclare functions */
7476
7577 typedef int coord;
148150 state->chi_sum = 0;
149151 state->it_num = 1;
150152 state->samples = 0;
153 state->chisq = 0;
151154 }
152155
153156 if (state->stage <= 2)
211214 cum_int = 0.0;
212215 cum_sig = 0.0;
213216
214 state->chisq = 0.0;
215
216217 for (it = 0; it < state->iterations; it++)
217218 {
218219 double intgrl = 0.0, intgrl_sq = 0.0;
219 double sig = 0.0;
220 double wgt;
220 double tss = 0.0;
221 double wgt, var, sig;
221222 size_t calls_per_box = state->calls_per_box;
222223 double jacbin = state->jac;
223224 double *x = state->x;
230231
231232 do
232233 {
233 double m = 0, q = 0;
234 volatile double m = 0, q = 0;
234235 double f_sq_sum = 0.0;
235236
236237 for (k = 0; k < calls_per_box; k++)
237238 {
238 double fval, bin_vol;
239 volatile double fval;
240 double bin_vol;
239241
240242 random_point (x, bin, &bin_vol, state->box, xl, xu, state, r);
241243
242244 fval = jacbin * bin_vol * GSL_MONTE_FN_EVAL (f, x);
243245
244 /* recurrence for mean and variance */
246 /* recurrence for mean and variance (sum of squares) */
245247
246248 {
247249 double d = fval - m;
258260
259261 intgrl += m * calls_per_box;
260262
261 f_sq_sum = q * calls_per_box ;
262
263 sig += f_sq_sum ;
263 f_sq_sum = q * calls_per_box;
264
265 tss += f_sq_sum;
264266
265267 if (state->mode == GSL_VEGAS_MODE_STRATIFIED)
266268 {
271273
272274 /* Compute final results for this iteration */
273275
274 sig = sig / (calls_per_box - 1.0) ;
275
276 if (sig > 0)
277 {
278 wgt = 1.0 / sig;
276 var = tss / (calls_per_box - 1.0) ;
277
278 if (var > 0)
279 {
280 wgt = 1.0 / var;
279281 }
280282 else if (state->sum_wgts > 0)
281283 {
288290
289291 intgrl_sq = intgrl * intgrl;
290292
293 sig = sqrt (var);
294
291295 state->result = intgrl;
292 state->sigma = sqrt(sig);
296 state->sigma = sig;
293297
294298 if (wgt > 0.0)
295299 {
300 double sum_wgts = state->sum_wgts;
301 double wtd_int_sum = state->wtd_int_sum;
302 double m = (sum_wgts > 0) ? (wtd_int_sum / sum_wgts) : 0;
303 double q = intgrl - m;
304
296305 state->samples++ ;
297306 state->sum_wgts += wgt;
298307 state->wtd_int_sum += intgrl * wgt;
301310 cum_int = state->wtd_int_sum / state->sum_wgts;
302311 cum_sig = sqrt (1 / state->sum_wgts);
303312
313 #if USE_ORIGINAL_CHISQ_FORMULA
314 /* This is the chisq formula from the original Lepage paper. It
315 computes the variance from <x^2> - <x>^2 and can suffer from
316 catastrophic cancellations, e.g. returning negative chisq. */
304317 if (state->samples > 1)
305318 {
306319 state->chisq = (state->chi_sum - state->wtd_int_sum * cum_int) /
307320 (state->samples - 1.0);
308321 }
322 #else
323 /* The new formula below computes exactly the same quantity as above
324 but using a stable recurrence */
325 if (state->samples == 1) {
326 state->chisq = 0;
327 } else {
328 state->chisq *= (state->samples - 2.0);
329 state->chisq += (wgt / (1 + (wgt / sum_wgts))) * q * q;
330 state->chisq /= (state->samples - 1.0);
331 }
332 #endif
309333 }
310334 else
311335 {
317341 if (state->verbose >= 0)
318342 {
319343 print_res (state,
320 state->it_num, intgrl, sqrt (sig), cum_int, cum_sig,
344 state->it_num, intgrl, sig, cum_int, cum_sig,
321345 state->chisq);
322346 if (it + 1 == state->iterations && state->verbose > 0)
323347 {
0 2008-07-03 Brian Gough <bjg@hp2.network-theory.co.uk>
1
2 * Makefile.am (INCLUDES): use top_srcdir instead of top_builddir
3
04 2007-07-29 Brian Gough <bjg@network-theory.co.uk>
15
26 * lmset.c (set): ensure internal state is zeroed after a set
11
22 pkginclude_HEADERS = gsl_multifit.h gsl_multifit_nlin.h
33
4 INCLUDES= -I$(top_builddir)
4 INCLUDES = -I$(top_srcdir)
55
66 libgslmultifit_la_SOURCES = multilinear.c work.c lmder.c fsolver.c fdfsolver.c convergence.c gradient.c covar.c
77
136136 LIBOBJS = @LIBOBJS@
137137 LIBS = @LIBS@
138138 LIBTOOL = @LIBTOOL@
139 LIPO = @LIPO@
139140 LN_S = @LN_S@
140141 LTLIBOBJS = @LTLIBOBJS@
141142 MAINT = @MAINT@
143144 MKDIR_P = @MKDIR_P@
144145 NM = @NM@
145146 NMEDIT = @NMEDIT@
147 OBJDUMP = @OBJDUMP@
146148 OBJEXT = @OBJEXT@
149 OTOOL = @OTOOL@
150 OTOOL64 = @OTOOL64@
147151 PACKAGE = @PACKAGE@
148152 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
149153 PACKAGE_NAME = @PACKAGE_NAME@
208212 top_srcdir = @top_srcdir@
209213 noinst_LTLIBRARIES = libgslmultifit.la
210214 pkginclude_HEADERS = gsl_multifit.h gsl_multifit_nlin.h
211 INCLUDES = -I$(top_builddir)
215 INCLUDES = -I$(top_srcdir)
212216 libgslmultifit_la_SOURCES = multilinear.c work.c lmder.c fsolver.c fdfsolver.c convergence.c gradient.c covar.c
213217 noinst_HEADERS = lmutil.c lmpar.c lmset.c lmiterate.c qrsolv.c test_brown.c test_enso.c test_filip.c test_fn.c test_hahn1.c test_kirby2.c test_longley.c test_nelson.c test_pontius.c test_estimator.c
214218 TESTS = $(check_PROGRAMS)
0 2008-11-29 Brian Gough <bjg@network-theory.co.uk>
1
2 * test.c (test_f): extended fminimizer test to allow type to be
3 passed in as a parameter
4
5 * simplex2.c: use BLAS, keep track of center in state to avoid
6 unnecessary computation, compute size as RMS value to allow linear
7 update.
8
9 2008-07-03 Brian Gough <bjg@hp2.network-theory.co.uk>
10
11 * Makefile.am (INCLUDES): use top_srcdir instead of top_builddir
12
13 2008-05-06 Brian Gough <bjg@network-theory.co.uk>
14
15 * simplex.c (nmsimplex_iterate): fix search for second highest
16 point
17
018 2007-07-30 Brian Gough <bjg@network-theory.co.uk>
119
220 * history.c: removed (unused file)
11
22 pkginclude_HEADERS = gsl_multimin.h
33
4 INCLUDES= -I$(top_builddir)
4 INCLUDES = -I$(top_srcdir)
55
6 libgslmultimin_la_SOURCES = fdfminimizer.c steepest_descent.c conjugate_fr.c conjugate_pr.c convergence.c diff.c vector_bfgs.c vector_bfgs2.c fminimizer.c simplex.c
6 libgslmultimin_la_SOURCES = fdfminimizer.c steepest_descent.c conjugate_fr.c conjugate_pr.c convergence.c diff.c vector_bfgs.c vector_bfgs2.c fminimizer.c simplex.c simplex2.c
77
88 noinst_HEADERS = directional_minimize.c linear_minimize.c linear_wrapper.c
99
4747 libgslmultimin_la_LIBADD =
4848 am_libgslmultimin_la_OBJECTS = fdfminimizer.lo steepest_descent.lo \
4949 conjugate_fr.lo conjugate_pr.lo convergence.lo diff.lo \
50 vector_bfgs.lo vector_bfgs2.lo fminimizer.lo simplex.lo
50 vector_bfgs.lo vector_bfgs2.lo fminimizer.lo simplex.lo \
51 simplex2.lo
5152 libgslmultimin_la_OBJECTS = $(am_libgslmultimin_la_OBJECTS)
5253 am_test_OBJECTS = test.$(OBJEXT) test_funcs.$(OBJEXT)
5354 test_OBJECTS = $(am_test_OBJECTS)
138139 LIBOBJS = @LIBOBJS@
139140 LIBS = @LIBS@
140141 LIBTOOL = @LIBTOOL@
142 LIPO = @LIPO@
141143 LN_S = @LN_S@
142144 LTLIBOBJS = @LTLIBOBJS@
143145 MAINT = @MAINT@
145147 MKDIR_P = @MKDIR_P@
146148 NM = @NM@
147149 NMEDIT = @NMEDIT@
150 OBJDUMP = @OBJDUMP@
148151 OBJEXT = @OBJEXT@
152 OTOOL = @OTOOL@
153 OTOOL64 = @OTOOL64@
149154 PACKAGE = @PACKAGE@
150155 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
151156 PACKAGE_NAME = @PACKAGE_NAME@
210215 top_srcdir = @top_srcdir@
211216 noinst_LTLIBRARIES = libgslmultimin.la
212217 pkginclude_HEADERS = gsl_multimin.h
213 INCLUDES = -I$(top_builddir)
214 libgslmultimin_la_SOURCES = fdfminimizer.c steepest_descent.c conjugate_fr.c conjugate_pr.c convergence.c diff.c vector_bfgs.c vector_bfgs2.c fminimizer.c simplex.c
218 INCLUDES = -I$(top_srcdir)
219 libgslmultimin_la_SOURCES = fdfminimizer.c steepest_descent.c conjugate_fr.c conjugate_pr.c convergence.c diff.c vector_bfgs.c vector_bfgs2.c fminimizer.c simplex.c simplex2.c
215220 noinst_HEADERS = directional_minimize.c linear_minimize.c linear_wrapper.c
216221 TESTS = $(check_PROGRAMS)
217222 test_SOURCES = test.c test_funcs.c test_funcs.h
8989
9090 gsl_vector_memcpy (s->x,x);
9191
92 s->simplex_size_valid = 0;
93
94 return (s->type->set) (s->state, s->f, s->x, step_size);
92 return (s->type->set) (s->state, s->f, s->x, &(s->size), step_size);
9593 }
9694
9795 void
106104 int
107105 gsl_multimin_fminimizer_iterate (gsl_multimin_fminimizer * s)
108106 {
109 s->simplex_size_valid = 0;
110
111 return (s->type->iterate) (s->state, s->f, s->x, &(s->fval));
107 return (s->type->iterate) (s->state, s->f, s->x, &(s->size), &(s->fval));
112108 }
113109
114110 const char *
131127 }
132128
133129 double
134 gsl_multimin_fminimizer_size (gsl_multimin_fminimizer * s)
130 gsl_multimin_fminimizer_size (const gsl_multimin_fminimizer * s)
135131 {
136 if (!s->simplex_size_valid)
137 {
138 s->simplex_size = (s->type->get_size) (s->state);
139 s->simplex_size_valid = 1;
140 }
141 return s->simplex_size;
132 return s->size;
142133 }
8383 int (*alloc) (void *state, size_t n);
8484 int (*set) (void *state, gsl_multimin_function * f,
8585 const gsl_vector * x,
86 double * size,
8687 const gsl_vector * step_size);
8788 int (*iterate) (void *state, gsl_multimin_function * f,
8889 gsl_vector * x,
90 double * size,
8991 double * fval);
9092 void (*free) (void *state);
91 double (*get_size) (void *state);
9293 }
9394 gsl_multimin_fminimizer_type;
9495
101102 double fval;
102103 gsl_vector * x;
103104
104 int simplex_size_valid;
105 double simplex_size;
105 double size;
106106
107107 void *state;
108108 }
134134 gsl_multimin_fminimizer_minimum (const gsl_multimin_fminimizer * s);
135135
136136 double
137 gsl_multimin_fminimizer_size (gsl_multimin_fminimizer * s);
137 gsl_multimin_fminimizer_size (const gsl_multimin_fminimizer * s);
138138
139139 /* Convergence test functions */
140140
217217 GSL_VAR const gsl_multimin_fdfminimizer_type *gsl_multimin_fdfminimizer_vector_bfgs;
218218 GSL_VAR const gsl_multimin_fdfminimizer_type *gsl_multimin_fdfminimizer_vector_bfgs2;
219219 GSL_VAR const gsl_multimin_fminimizer_type *gsl_multimin_fminimizer_nmsimplex;
220
220 GSL_VAR const gsl_multimin_fminimizer_type *gsl_multimin_fminimizer_nmsimplex2;
221221
222222 __END_DECLS
223223
156156 }
157157
158158 static double
159 nmsimplex_get_size (void *vstate)
160 {
161 nmsimplex_state_t *state = (nmsimplex_state_t *) vstate;
162
159 nmsimplex_size (nmsimplex_state_t * state)
160 {
163161 /* calculates simplex size as average sum of length of vectors
164162 from simplex center to corner points:
165163
237235 static int
238236 nmsimplex_set (void *vstate, gsl_multimin_function * f,
239237 const gsl_vector * x,
240 const gsl_vector * step_size)
238 double *size, const gsl_vector * step_size)
241239 {
242240 int status;
243241 size_t i;
293291 gsl_vector_set (state->y1, i + 1, val);
294292 }
295293
294 /* Initialize simplex size */
295
296 *size = nmsimplex_size (state);
297
296298 return GSL_SUCCESS;
297299 }
298300
309311
310312 static int
311313 nmsimplex_iterate (void *vstate, gsl_multimin_function * f,
312 gsl_vector * x, double *fval)
314 gsl_vector * x, double *size, double *fval)
313315 {
314316
315317 /* Simplex iteration tries to minimize function f value */
326328
327329 size_t n = y1->size;
328330 size_t i;
329 size_t hi = 0, s_hi = 0, lo = 0;
331 size_t hi, s_hi, lo;
330332 double dhi, ds_hi, dlo;
331333 int status;
332334 double val, val2;
339341
340342 /* get index of highest, second highest and lowest point */
341343
342 dhi = ds_hi = dlo = gsl_vector_get (y1, 0);
344 dhi = dlo = gsl_vector_get (y1, 0);
345 hi = 0; lo = 0;
346
347 ds_hi = gsl_vector_get(y1, 1);
348 s_hi = 1;
343349
344350 for (i = 1; i < n; i++)
345351 {
439445 lo = gsl_vector_min_index (y1);
440446 gsl_matrix_get_row (x, x1, lo);
441447 *fval = gsl_vector_get (y1, lo);
448
449 /* Update simplex size */
450
451 *size = nmsimplex_size (state);
442452
443453 return GSL_SUCCESS;
444454 }
449459 &nmsimplex_alloc,
450460 &nmsimplex_set,
451461 &nmsimplex_iterate,
452 &nmsimplex_free,
453 &nmsimplex_get_size
462 &nmsimplex_free
454463 };
455464
456465 const gsl_multimin_fminimizer_type
0 /* multimin/simplex2.c
1 *
2 * Copyright (C) 2007, 2008 Brian Gough
3 * Copyright (C) 2002 Tuomo Keskitalo, Ivo Alxneit
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or (at
8 * your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19
20 /*
21 - Originally written by Tuomo Keskitalo <tuomo.keskitalo@iki.fi>
22 - Corrections to nmsimplex_iterate and other functions
23 by Ivo Alxneit <ivo.alxneit@psi.ch>
24 - Additional help by Brian Gough <bjg@network-theory.co.uk>
25 - Optimisations added by Brian Gough <bjg@network-theory.co.uk>
26 + use BLAS for frequently-called functions
27 + keep track of the center to avoid unnecessary computation
28 + compute size as RMS value, allowing linear update on each step
29 instead of recomputing from all N+1 vectors.
30 */
31
32 /* The Simplex method of Nelder and Mead, also known as the polytope
33 search alogorithm. Ref: Nelder, J.A., Mead, R., Computer Journal 7
34 (1965) pp. 308-313.
35
36 This implementation uses n+1 corner points in the simplex.
37 */
38
39 #include <config.h>
40 #include <stdlib.h>
41 #include <gsl/gsl_blas.h>
42 #include <gsl/gsl_multimin.h>
43
44 typedef struct
45 {
46 gsl_matrix *x1; /* simplex corner points */
47 gsl_vector *y1; /* function value at corner points */
48 gsl_vector *ws1; /* workspace 1 for algorithm */
49 gsl_vector *ws2; /* workspace 2 for algorithm */
50 gsl_vector *center; /* center of all points */
51 gsl_vector *delta; /* current step */
52 gsl_vector *xmc; /* x - center (workspace) */
53 double S2;
54 }
55 nmsimplex_state_t;
56
57 static double
58 try_corner_move (const double coeff,
59 const nmsimplex_state_t * state,
60 size_t corner,
61 gsl_vector * xc, const gsl_multimin_function * f)
62 {
63 /* moves a simplex corner scaled by coeff (negative value represents
64 mirroring by the middle point of the "other" corner points)
65 and gives new corner in xc and function value at xc as a
66 return value
67 */
68
69 gsl_matrix *x1 = state->x1;
70 const size_t P = x1->size1;
71 double newval;
72
73 /* xc = (1-coeff)*(P/(P-1)) * center(all) + ((P*coeff-1)/(P-1))*x_corner */
74 {
75 double alpha = (1 - coeff) * P / (P - 1.0);
76 double beta = (P * coeff - 1.0) / (P - 1.0);
77 gsl_vector_const_view row = gsl_matrix_const_row (x1, corner);
78
79 gsl_vector_memcpy (xc, state->center);
80 gsl_blas_dscal (alpha, xc);
81 gsl_blas_daxpy (beta, &row.vector, xc);
82 }
83
84 newval = GSL_MULTIMIN_FN_EVAL (f, xc);
85
86 return newval;
87 }
88
89
90 static void
91 update_point (nmsimplex_state_t * state, size_t i,
92 const gsl_vector * x, double val)
93 {
94 gsl_vector_const_view x_orig = gsl_matrix_const_row (state->x1, i);
95 const size_t P = state->x1->size1;
96
97 /* Compute delta = x - x_orig */
98 gsl_vector_memcpy (state->delta, x);
99 gsl_blas_daxpy (-1.0, &x_orig.vector, state->delta);
100
101 /* Compute xmc = x_orig - c */
102 gsl_vector_memcpy (state->xmc, &x_orig.vector);
103 gsl_blas_daxpy (-1.0, state->center, state->xmc);
104
105 /* Update size: S2' = S2 + (2/P) * (x_orig - c).delta + (P-1)*(delta/P)^2 */
106 {
107 double d = gsl_blas_dnrm2 (state->delta);
108 double xmcd;
109 gsl_blas_ddot (state->xmc, state->delta, &xmcd);
110 state->S2 += (2.0 / P) * xmcd + ((P - 1.0) / P) * (d * d / P);
111 }
112
113 /* Update center: c' = c + (x - x_orig) / P */
114
115 {
116 double alpha = 1.0 / P;
117 gsl_blas_daxpy (-alpha, &x_orig.vector, state->center);
118 gsl_blas_daxpy (alpha, x, state->center);
119 }
120
121 gsl_matrix_set_row (state->x1, i, x);
122 gsl_vector_set (state->y1, i, val);
123 }
124
125 static int
126 contract_by_best (nmsimplex_state_t * state, size_t best,
127 gsl_vector * xc, gsl_multimin_function * f)
128 {
129
130 /* Function contracts the simplex in respect to best valued
131 corner. That is, all corners besides the best corner are moved.
132 (This function is rarely called in practice, since it is the last
133 choice, hence not optimised - BJG) */
134
135 /* the xc vector is simply work space here */
136
137 gsl_matrix *x1 = state->x1;
138 gsl_vector *y1 = state->y1;
139
140 size_t i, j;
141 double newval;
142
143 int status = GSL_SUCCESS;
144
145 for (i = 0; i < x1->size1; i++)
146 {
147 if (i != best)
148 {
149 for (j = 0; j < x1->size2; j++)
150 {
151 newval = 0.5 * (gsl_matrix_get (x1, i, j)
152 + gsl_matrix_get (x1, best, j));
153 gsl_matrix_set (x1, i, j, newval);
154 }
155
156 /* evaluate function in the new point */
157
158 gsl_matrix_get_row (xc, x1, i);
159 newval = GSL_MULTIMIN_FN_EVAL (f, xc);
160 gsl_vector_set (y1, i, newval);
161
162 /* notify caller that we found at least one bad function value.
163 we finish the contraction (and do not abort) to allow the user
164 to handle the situation */
165
166 if (!gsl_finite (newval))
167 {
168 status = GSL_EBADFUNC;
169 }
170 }
171 }
172
173 return status;
174 }
175
176 static int
177 compute_center (const nmsimplex_state_t * state, gsl_vector * center)
178 {
179 /* calculates the center of the simplex and stores in center */
180
181 gsl_matrix *x1 = state->x1;
182 const size_t P = x1->size1;
183 size_t i;
184
185 gsl_vector_set_zero (center);
186
187 for (i = 0; i < P; i++)
188 {
189 gsl_vector_const_view row = gsl_matrix_const_row (x1, i);
190 gsl_blas_daxpy (1.0, &row.vector, center);
191 }
192
193 {
194 const double alpha = 1.0 / P;
195 gsl_blas_dscal (alpha, center);
196 }
197
198 return GSL_SUCCESS;
199 }
200
201 static double
202 compute_size (nmsimplex_state_t * state, const gsl_vector * center)
203 {
204 /* calculates simplex size as rms sum of length of vectors
205 from simplex center to corner points:
206
207 sqrt( sum ( || y - y_middlepoint ||^2 ) / n )
208 */
209
210 gsl_vector *s = state->ws1;
211 gsl_matrix *x1 = state->x1;
212 const size_t P = x1->size1;
213 size_t i;
214
215 double ss = 0.0;
216
217 for (i = 0; i < P; i++)
218 {
219 double t;
220 gsl_matrix_get_row (s, x1, i);
221 gsl_blas_daxpy (-1.0, center, s);
222 t = gsl_blas_dnrm2 (s);
223 ss += t * t;
224 }
225
226 /* Store squared size in the state */
227 state->S2 = (ss / P);
228
229 return sqrt (ss / P);
230 }
231
232 static int
233 nmsimplex_alloc (void *vstate, size_t n)
234 {
235 nmsimplex_state_t *state = (nmsimplex_state_t *) vstate;
236
237 if (n == 0)
238 {
239 GSL_ERROR ("invalid number of parameters specified", GSL_EINVAL);
240 }
241
242 state->x1 = gsl_matrix_alloc (n + 1, n);
243
244 if (state->x1 == NULL)
245 {
246 GSL_ERROR ("failed to allocate space for x1", GSL_ENOMEM);
247 }
248
249 state->y1 = gsl_vector_alloc (n + 1);
250
251 if (state->y1 == NULL)
252 {
253 gsl_matrix_free (state->x1);
254 GSL_ERROR ("failed to allocate space for y", GSL_ENOMEM);
255 }
256
257 state->ws1 = gsl_vector_alloc (n);
258
259 if (state->ws1 == NULL)
260 {
261 gsl_matrix_free (state->x1);
262 gsl_vector_free (state->y1);
263 GSL_ERROR ("failed to allocate space for ws1", GSL_ENOMEM);
264 }
265
266 state->ws2 = gsl_vector_alloc (n);
267
268 if (state->ws2 == NULL)
269 {
270 gsl_matrix_free (state->x1);
271 gsl_vector_free (state->y1);
272 gsl_vector_free (state->ws1);
273 GSL_ERROR ("failed to allocate space for ws2", GSL_ENOMEM);
274 }
275
276 state->center = gsl_vector_alloc (n);
277
278 if (state->center == NULL)
279 {
280 gsl_matrix_free (state->x1);
281 gsl_vector_free (state->y1);
282 gsl_vector_free (state->ws1);
283 gsl_vector_free (state->ws2);
284 GSL_ERROR ("failed to allocate space for center", GSL_ENOMEM);
285 }
286
287 state->delta = gsl_vector_alloc (n);
288
289 if (state->delta == NULL)
290 {
291 gsl_matrix_free (state->x1);
292 gsl_vector_free (state->y1);
293 gsl_vector_free (state->ws1);
294 gsl_vector_free (state->ws2);
295 gsl_vector_free (state->center);
296 GSL_ERROR ("failed to allocate space for delta", GSL_ENOMEM);
297 }
298
299 state->xmc = gsl_vector_alloc (n);
300
301 if (state->xmc == NULL)
302 {
303 gsl_matrix_free (state->x1);
304 gsl_vector_free (state->y1);
305 gsl_vector_free (state->ws1);
306 gsl_vector_free (state->ws2);
307 gsl_vector_free (state->center);
308 gsl_vector_free (state->delta);
309 GSL_ERROR ("failed to allocate space for xmc", GSL_ENOMEM);
310 }
311
312
313 return GSL_SUCCESS;
314 }
315
316 static void
317 nmsimplex_free (void *vstate)
318 {
319 nmsimplex_state_t *state = (nmsimplex_state_t *) vstate;
320
321 gsl_matrix_free (state->x1);
322 gsl_vector_free (state->y1);
323 gsl_vector_free (state->ws1);
324 gsl_vector_free (state->ws2);
325 gsl_vector_free (state->center);
326 gsl_vector_free (state->delta);
327 gsl_vector_free (state->xmc);
328 }
329
330 static int
331 nmsimplex_set (void *vstate, gsl_multimin_function * f,
332 const gsl_vector * x,
333 double *size, const gsl_vector * step_size)
334 {
335 int status;
336 size_t i;
337 double val;
338
339 nmsimplex_state_t *state = (nmsimplex_state_t *) vstate;
340
341 gsl_vector *xtemp = state->ws1;
342
343 if (xtemp->size != x->size)
344 {
345 GSL_ERROR ("incompatible size of x", GSL_EINVAL);
346 }
347
348 if (xtemp->size != step_size->size)
349 {
350 GSL_ERROR ("incompatible size of step_size", GSL_EINVAL);
351 }
352
353 /* first point is the original x0 */
354
355 val = GSL_MULTIMIN_FN_EVAL (f, x);
356
357 if (!gsl_finite (val))
358 {
359 GSL_ERROR ("non-finite function value encountered", GSL_EBADFUNC);
360 }
361
362 gsl_matrix_set_row (state->x1, 0, x);
363 gsl_vector_set (state->y1, 0, val);
364
365 /* following points are initialized to x0 + step_size */
366
367 for (i = 0; i < x->size; i++)
368 {
369 status = gsl_vector_memcpy (xtemp, x);
370
371 if (status != 0)
372 {
373 GSL_ERROR ("vector memcopy failed", GSL_EFAILED);
374 }
375
376 {
377 double xi = gsl_vector_get (x, i);
378 double si = gsl_vector_get (step_size, i);
379
380 gsl_vector_set (xtemp, i, xi + si);
381 val = GSL_MULTIMIN_FN_EVAL (f, xtemp);
382 }
383
384 if (!gsl_finite (val))
385 {
386 GSL_ERROR ("non-finite function value encountered", GSL_EBADFUNC);
387 }
388
389 gsl_matrix_set_row (state->x1, i + 1, xtemp);
390 gsl_vector_set (state->y1, i + 1, val);
391 }
392
393 compute_center (state, state->center);
394
395 /* Initialize simplex size */
396 *size = compute_size (state, state->center);
397
398 return GSL_SUCCESS;
399 }
400
401 static int
402 nmsimplex_iterate (void *vstate, gsl_multimin_function * f,
403 gsl_vector * x, double *size, double *fval)
404 {
405
406 /* Simplex iteration tries to minimize function f value */
407 /* Includes corrections from Ivo Alxneit <ivo.alxneit@psi.ch> */
408
409 nmsimplex_state_t *state = (nmsimplex_state_t *) vstate;
410
411 /* xc and xc2 vectors store tried corner point coordinates */
412
413 gsl_vector *xc = state->ws1;
414 gsl_vector *xc2 = state->ws2;
415 gsl_vector *y1 = state->y1;
416 gsl_matrix *x1 = state->x1;
417
418 const size_t n = y1->size;
419 size_t i;
420 size_t hi, s_hi, lo;
421 double dhi, ds_hi, dlo;
422 int status;
423 double val, val2;
424
425 if (xc->size != x->size)
426 {
427 GSL_ERROR ("incompatible size of x", GSL_EINVAL);
428 }
429
430 /* get index of highest, second highest and lowest point */
431
432 dhi = dlo = gsl_vector_get (y1, 0);
433 hi = 0;
434 lo = 0;
435
436 ds_hi = gsl_vector_get (y1, 1);
437 s_hi = 1;
438
439 for (i = 1; i < n; i++)
440 {
441 val = (gsl_vector_get (y1, i));
442 if (val < dlo)
443 {
444 dlo = val;
445 lo = i;
446 }
447 else if (val > dhi)
448 {
449 ds_hi = dhi;
450 s_hi = hi;
451 dhi = val;
452 hi = i;
453 }
454 else if (val > ds_hi)
455 {
456 ds_hi = val;
457 s_hi = i;
458 }
459 }
460
461 /* try reflecting the highest value point */
462
463 val = try_corner_move (-1.0, state, hi, xc, f);
464
465 if (gsl_finite (val) && val < gsl_vector_get (y1, lo))
466 {
467 /* reflected point is lowest, try expansion */
468
469 val2 = try_corner_move (-2.0, state, hi, xc2, f);
470
471 if (gsl_finite (val2) && val2 < gsl_vector_get (y1, lo))
472 {
473 update_point (state, hi, xc2, val2);
474 }
475 else
476 {
477 update_point (state, hi, xc, val);
478 }
479 }
480 else if (!gsl_finite (val) || val > gsl_vector_get (y1, s_hi))
481 {
482 /* reflection does not improve things enough, or we got a
483 non-finite function value */
484
485 if (gsl_finite (val) && val <= gsl_vector_get (y1, hi))
486 {
487 /* if trial point is better than highest point, replace
488 highest point */
489
490 update_point (state, hi, xc, val);
491 }
492
493 /* try one-dimensional contraction */
494
495 val2 = try_corner_move (0.5, state, hi, xc2, f);
496
497 if (gsl_finite (val2) && val2 <= gsl_vector_get (y1, hi))
498 {
499 update_point (state, hi, xc2, val2);
500 }
501 else
502 {
503 /* contract the whole simplex about the best point */
504
505 status = contract_by_best (state, lo, xc, f);
506
507 if (status != GSL_SUCCESS)
508 {
509 GSL_ERROR ("contraction failed", GSL_EFAILED);
510 }
511 }
512 }
513 else
514 {
515 /* trial point is better than second highest point. Replace
516 highest point by it */
517
518 update_point (state, hi, xc, val);
519 }
520
521 /* return lowest point of simplex as x */
522
523 lo = gsl_vector_min_index (y1);
524 gsl_matrix_get_row (x, x1, lo);
525 *fval = gsl_vector_get (y1, lo);
526
527 /* Update simplex size */
528
529 {
530 double S2 = state->S2;
531
532 if (S2 > 0)
533 {
534 *size = sqrt (S2);
535 }
536 else
537 {
538 /* recompute if accumulated error has made size invalid */
539 *size = compute_size (state, state->center);
540 }
541 }
542
543 return GSL_SUCCESS;
544 }
545
546 static const gsl_multimin_fminimizer_type nmsimplex_type =
547 { "nmsimplex2", /* name */
548 sizeof (nmsimplex_state_t),
549 &nmsimplex_alloc,
550 &nmsimplex_set,
551 &nmsimplex_iterate,
552 &nmsimplex_free
553 };
554
555 const gsl_multimin_fminimizer_type
556 * gsl_multimin_fminimizer_nmsimplex2 = &nmsimplex_type;
3434 initpt_function initpt, const gsl_multimin_fdfminimizer_type *T);
3535
3636 int
37 test_f(const char * desc, gsl_multimin_function *f, initpt_function initpt);
37 test_f(const char * desc, gsl_multimin_function *f, initpt_function initpt,
38 const gsl_multimin_fminimizer_type *T);
3839
3940 int
4041 main (void)
4142 {
42 const gsl_multimin_fdfminimizer_type *fdfminimizers[6];
43 const gsl_multimin_fdfminimizer_type ** T;
44
4543 gsl_ieee_env_setup ();
4644
47 fdfminimizers[0] = gsl_multimin_fdfminimizer_steepest_descent;
48 fdfminimizers[1] = gsl_multimin_fdfminimizer_conjugate_pr;
49 fdfminimizers[2] = gsl_multimin_fdfminimizer_conjugate_fr;
50 fdfminimizers[3] = gsl_multimin_fdfminimizer_vector_bfgs;
51 fdfminimizers[4] = gsl_multimin_fdfminimizer_vector_bfgs2;
52 fdfminimizers[5] = 0;
53
54 T = fdfminimizers;
55
56 while (*T != 0)
57 {
58 test_fdf("Roth", &roth, roth_initpt,*T);
59 test_fdf("Wood", &wood, wood_initpt,*T);
60 test_fdf("Rosenbrock", &rosenbrock, rosenbrock_initpt,*T);
61 T++;
62 }
63
64 test_f("Roth", &roth_fmin, roth_initpt);
65 test_f("Wood", &wood_fmin, wood_initpt);
66 test_f("Rosenbrock", &rosenbrock_fmin, rosenbrock_initpt);
67
68 T = fdfminimizers;
69
70 while (*T != 0)
71 {
72 test_fdf("NRoth", &Nroth, roth_initpt,*T);
73 test_fdf("NWood", &Nwood, wood_initpt,*T);
74 test_fdf("NRosenbrock", &Nrosenbrock, rosenbrock_initpt,*T);
75 T++;
76 }
45 {
46 const gsl_multimin_fdfminimizer_type *fdfminimizers[6];
47 const gsl_multimin_fdfminimizer_type ** T;
48
49 fdfminimizers[0] = gsl_multimin_fdfminimizer_steepest_descent;
50 fdfminimizers[1] = gsl_multimin_fdfminimizer_conjugate_pr;
51 fdfminimizers[2] = gsl_multimin_fdfminimizer_conjugate_fr;
52 fdfminimizers[3] = gsl_multimin_fdfminimizer_vector_bfgs;
53 fdfminimizers[4] = gsl_multimin_fdfminimizer_vector_bfgs2;
54 fdfminimizers[5] = 0;
55
56 T = fdfminimizers;
57
58 while (*T != 0)
59 {
60 test_fdf("Roth", &roth, roth_initpt,*T);
61 test_fdf("Wood", &wood, wood_initpt,*T);
62 test_fdf("Rosenbrock", &rosenbrock, rosenbrock_initpt,*T);
63 T++;
64 }
65
66 T = fdfminimizers;
67
68 while (*T != 0)
69 {
70 test_fdf("NRoth", &Nroth, roth_initpt,*T);
71 test_fdf("NWood", &Nwood, wood_initpt,*T);
72 test_fdf("NRosenbrock", &Nrosenbrock, rosenbrock_initpt,*T);
73 T++;
74 }
75 }
76
77
78 {
79 const gsl_multimin_fminimizer_type *fminimizers[3];
80 const gsl_multimin_fminimizer_type ** T;
81
82 fminimizers[0] = gsl_multimin_fminimizer_nmsimplex;
83 fminimizers[1] = gsl_multimin_fminimizer_nmsimplex2;
84 fminimizers[2] = 0;
85
86 T = fminimizers;
87
88 while (*T != 0)
89 {
90 test_f("Roth", &roth_fmin, roth_initpt,*T);
91 test_f("Wood", &wood_fmin, wood_initpt,*T);
92 test_f("Rosenbrock", &rosenbrock_fmin, rosenbrock_initpt,*T);
93 T++;
94 }
95 }
96
7797
7898 exit (gsl_test_summary());
7999 }
136156 }
137157
138158 int
139 test_f(const char * desc, gsl_multimin_function *f, initpt_function initpt)
159 test_f(const char * desc, gsl_multimin_function *f, initpt_function initpt,
160 const gsl_multimin_fminimizer_type *T)
140161 {
141 /* currently this function tests only nmsimplex */
142
143162 int status;
144163 size_t i, iter = 0;
145 const gsl_multimin_fminimizer_type *T = gsl_multimin_fminimizer_nmsimplex;
146164
147165 gsl_vector *x = gsl_vector_alloc (f->n);
148166
0 2008-07-03 Brian Gough <bjg@hp2.network-theory.co.uk>
1
2 * Makefile.am (INCLUDES): use top_srcdir instead of top_builddir
3
04 2007-11-09 Brian Gough <bjg@network-theory.co.uk>
15
26 * convergence.c (gsl_multiroot_test_delta): accept dxi = 0
55
66 noinst_HEADERS = enorm.c dogleg.c
77
8 INCLUDES= -I$(top_builddir)
8 INCLUDES = -I$(top_srcdir)
99
1010 libgslmultiroots_la_SOURCES = fdjac.c fsolver.c fdfsolver.c convergence.c newton.c gnewton.c dnewton.c broyden.c hybrid.c hybridj.c
1111
139139 LIBOBJS = @LIBOBJS@
140140 LIBS = @LIBS@
141141 LIBTOOL = @LIBTOOL@
142 LIPO = @LIPO@
142143 LN_S = @LN_S@
143144 LTLIBOBJS = @LTLIBOBJS@
144145 MAINT = @MAINT@
146147 MKDIR_P = @MKDIR_P@
147148 NM = @NM@
148149 NMEDIT = @NMEDIT@
150 OBJDUMP = @OBJDUMP@
149151 OBJEXT = @OBJEXT@
152 OTOOL = @OTOOL@
153 OTOOL64 = @OTOOL64@
150154 PACKAGE = @PACKAGE@
151155 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
152156 PACKAGE_NAME = @PACKAGE_NAME@
212216 noinst_LTLIBRARIES = libgslmultiroots.la
213217 pkginclude_HEADERS = gsl_multiroots.h
214218 noinst_HEADERS = enorm.c dogleg.c
215 INCLUDES = -I$(top_builddir)
219 INCLUDES = -I$(top_srcdir)
216220 libgslmultiroots_la_SOURCES = fdjac.c fsolver.c fdfsolver.c convergence.c newton.c gnewton.c dnewton.c broyden.c hybrid.c hybridj.c
217221 TESTS = $(check_PROGRAMS)
218222 test_SOURCES = test.c test_funcs.c test_funcs.h
6363 gsl_vector * x, gsl_vector * f, gsl_vector * dx);
6464 static int hybrids_set (void *vstate, gsl_multiroot_function * func,
6565 gsl_vector * x, gsl_vector * f, gsl_vector * dx);
66 static int set (void *vstate, gsl_multiroot_function * func, gsl_vector * x,
66 static int hybrid_set_impl (void *vstate, gsl_multiroot_function * func, gsl_vector * x,
6767 gsl_vector * f, gsl_vector * dx, int scale);
6868 static int hybrid_iterate (void *vstate, gsl_multiroot_function * func,
6969 gsl_vector * x, gsl_vector * f, gsl_vector * dx);
7070 static void hybrid_free (void *vstate);
71 static int iterate (void *vstate, gsl_multiroot_function * func,
71 static int hybrid_iterate_impl (void *vstate, gsl_multiroot_function * func,
7272 gsl_vector * x, gsl_vector * f, gsl_vector * dx,
7373 int scale);
7474
342342 hybrid_set (void *vstate, gsl_multiroot_function * func, gsl_vector * x,
343343 gsl_vector * f, gsl_vector * dx)
344344 {
345 int status = set (vstate, func, x, f, dx, 0);
345 int status = hybrid_set_impl (vstate, func, x, f, dx, 0);
346346 return status;
347347 }
348348
350350 hybrids_set (void *vstate, gsl_multiroot_function * func, gsl_vector * x,
351351 gsl_vector * f, gsl_vector * dx)
352352 {
353 int status = set (vstate, func, x, f, dx, 1);
353 int status = hybrid_set_impl (vstate, func, x, f, dx, 1);
354354 return status;
355355 }
356356
357357 static int
358 set (void *vstate, gsl_multiroot_function * func, gsl_vector * x,
358 hybrid_set_impl (void *vstate, gsl_multiroot_function * func, gsl_vector * x,
359359 gsl_vector * f, gsl_vector * dx, int scale)
360360 {
361361 hybrid_state_t *state = (hybrid_state_t *) vstate;
420420 hybrid_iterate (void *vstate, gsl_multiroot_function * func, gsl_vector * x,
421421 gsl_vector * f, gsl_vector * dx)
422422 {
423 int status = iterate (vstate, func, x, f, dx, 0);
423 int status = hybrid_iterate_impl (vstate, func, x, f, dx, 0);
424424 return status;
425425 }
426426
428428 hybrids_iterate (void *vstate, gsl_multiroot_function * func, gsl_vector * x,
429429 gsl_vector * f, gsl_vector * dx)
430430 {
431 int status = iterate (vstate, func, x, f, dx, 1);
431 int status = hybrid_iterate_impl (vstate, func, x, f, dx, 1);
432432 return status;
433433 }
434434
435435 static int
436 iterate (void *vstate, gsl_multiroot_function * func, gsl_vector * x,
437 gsl_vector * f, gsl_vector * dx, int scale)
436 hybrid_iterate_impl (void *vstate, gsl_multiroot_function * func,
437 gsl_vector * x,
438 gsl_vector * f, gsl_vector * dx, int scale)
438439 {
439440 hybrid_state_t *state = (hybrid_state_t *) vstate;
440441
6060 static int hybridj_alloc (void *vstate, size_t n);
6161 static int hybridj_set (void *vstate, gsl_multiroot_function_fdf * fdf, gsl_vector * x, gsl_vector * f, gsl_matrix * J, gsl_vector * dx);
6262 static int hybridsj_set (void *vstate, gsl_multiroot_function_fdf * fdf, gsl_vector * x, gsl_vector * f, gsl_matrix * J, gsl_vector * dx);
63 static int set (void *vstate, gsl_multiroot_function_fdf * fdf, gsl_vector * x, gsl_vector * f, gsl_matrix * J, gsl_vector * dx, int scale);
63 static int hybridj_set_impl (void *vstate, gsl_multiroot_function_fdf * fdf, gsl_vector * x, gsl_vector * f, gsl_matrix * J, gsl_vector * dx, int scale);
6464 static int hybridj_iterate (void *vstate, gsl_multiroot_function_fdf * fdf, gsl_vector * x, gsl_vector * f, gsl_matrix * J, gsl_vector * dx);
6565 static void hybridj_free (void *vstate);
66 static int iterate (void *vstate, gsl_multiroot_function_fdf * fdf, gsl_vector * x, gsl_vector * f, gsl_matrix * J, gsl_vector * dx, int scale);
66 static int hybridj_iterate_impl (void *vstate, gsl_multiroot_function_fdf * fdf, gsl_vector * x, gsl_vector * f, gsl_matrix * J, gsl_vector * dx, int scale);
6767
6868 static int
6969 hybridj_alloc (void *vstate, size_t n)
310310 static int
311311 hybridj_set (void *vstate, gsl_multiroot_function_fdf * fdf, gsl_vector * x, gsl_vector * f, gsl_matrix * J, gsl_vector * dx)
312312 {
313 int status = set (vstate, fdf, x, f, J, dx, 0);
313 int status = hybridj_set_impl (vstate, fdf, x, f, J, dx, 0);
314314 return status ;
315315 }
316316
317317 static int
318318 hybridsj_set (void *vstate, gsl_multiroot_function_fdf * fdf, gsl_vector * x, gsl_vector * f, gsl_matrix * J, gsl_vector * dx)
319319 {
320 int status = set (vstate, fdf, x, f, J, dx, 1);
320 int status = hybridj_set_impl (vstate, fdf, x, f, J, dx, 1);
321321 return status ;
322322 }
323323
324324 static int
325 set (void *vstate, gsl_multiroot_function_fdf * fdf, gsl_vector * x, gsl_vector * f, gsl_matrix * J, gsl_vector * dx, int scale)
325 hybridj_set_impl (void *vstate, gsl_multiroot_function_fdf * fdf, gsl_vector * x, gsl_vector * f, gsl_matrix * J, gsl_vector * dx, int scale)
326326 {
327327 hybridj_state_t *state = (hybridj_state_t *) vstate;
328328
364364 static int
365365 hybridj_iterate (void *vstate, gsl_multiroot_function_fdf * fdf, gsl_vector * x, gsl_vector * f, gsl_matrix * J, gsl_vector * dx)
366366 {
367 int status = iterate (vstate, fdf, x, f, J, dx, 0);
367 int status = hybridj_iterate_impl (vstate, fdf, x, f, J, dx, 0);
368368 return status;
369369 }
370370
371371 static int
372372 hybridsj_iterate (void *vstate, gsl_multiroot_function_fdf * fdf, gsl_vector * x, gsl_vector * f, gsl_matrix * J, gsl_vector * dx)
373373 {
374 int status = iterate (vstate, fdf, x, f, J, dx, 1);
374 int status = hybridj_iterate_impl (vstate, fdf, x, f, J, dx, 1);
375375 return status;
376376 }
377377
378378 static int
379 iterate (void *vstate, gsl_multiroot_function_fdf * fdf, gsl_vector * x, gsl_vector * f, gsl_matrix * J, gsl_vector * dx, int scale)
379 hybridj_iterate_impl (void *vstate, gsl_multiroot_function_fdf * fdf, gsl_vector * x, gsl_vector * f, gsl_matrix * J, gsl_vector * dx, int scale)
380380 {
381381 hybridj_state_t *state = (hybridj_state_t *) vstate;
382382
0 2008-07-03 Brian Gough <bjg@hp2.network-theory.co.uk>
1
2 * Makefile.am (INCLUDES): use top_srcdir instead of top_builddir
3
04 2004-05-30 Brian Gough <bjg@network-theory.co.uk>
15
26 * ntuple/test.c (main): choose ratio 1/(i+1.5) to avoid values
11
22 pkginclude_HEADERS = gsl_ntuple.h
33
4 INCLUDES= -I$(top_builddir)
4 INCLUDES = -I$(top_srcdir)
55
66 libgslntuple_la_SOURCES = ntuple.c
77
132132 LIBOBJS = @LIBOBJS@
133133 LIBS = @LIBS@
134134 LIBTOOL = @LIBTOOL@
135 LIPO = @LIPO@
135136 LN_S = @LN_S@
136137 LTLIBOBJS = @LTLIBOBJS@
137138 MAINT = @MAINT@
139140 MKDIR_P = @MKDIR_P@
140141 NM = @NM@
141142 NMEDIT = @NMEDIT@
143 OBJDUMP = @OBJDUMP@
142144 OBJEXT = @OBJEXT@
145 OTOOL = @OTOOL@
146 OTOOL64 = @OTOOL64@
143147 PACKAGE = @PACKAGE@
144148 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
145149 PACKAGE_NAME = @PACKAGE_NAME@
204208 top_srcdir = @top_srcdir@
205209 noinst_LTLIBRARIES = libgslntuple.la
206210 pkginclude_HEADERS = gsl_ntuple.h
207 INCLUDES = -I$(top_builddir)
211 INCLUDES = -I$(top_srcdir)
208212 libgslntuple_la_SOURCES = ntuple.c
209213 TESTS = $(check_PROGRAMS)
210214 test_SOURCES = test.c
0 2008-07-03 Brian Gough <bjg@hp2.network-theory.co.uk>
1
2 * Makefile.am (INCLUDES): use top_srcdir instead of top_builddir
3
04 2008-01-28 Brian Gough <bjg@network-theory.co.uk>
15
26 * test.c (test_evolve_negative_h): test evolution with negative
11
22 pkginclude_HEADERS = gsl_odeiv.h
33
4 INCLUDES= -I$(top_builddir)
4 INCLUDES = -I$(top_srcdir)
55
66 libgslodeiv_la_SOURCES = control.c cstd.c cscal.c evolve.c step.c rk2.c rk2imp.c rk2simp.c rk4.c rk4imp.c rkf45.c rk8pd.c rkck.c bsimp.c gear1.c gear2.c
77
137137 LIBOBJS = @LIBOBJS@
138138 LIBS = @LIBS@
139139 LIBTOOL = @LIBTOOL@
140 LIPO = @LIPO@
140141 LN_S = @LN_S@
141142 LTLIBOBJS = @LTLIBOBJS@
142143 MAINT = @MAINT@
144145 MKDIR_P = @MKDIR_P@
145146 NM = @NM@
146147 NMEDIT = @NMEDIT@
148 OBJDUMP = @OBJDUMP@
147149 OBJEXT = @OBJEXT@
150 OTOOL = @OTOOL@
151 OTOOL64 = @OTOOL64@
148152 PACKAGE = @PACKAGE@
149153 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
150154 PACKAGE_NAME = @PACKAGE_NAME@
209213 top_srcdir = @top_srcdir@
210214 noinst_LTLIBRARIES = libgslodeiv.la
211215 pkginclude_HEADERS = gsl_odeiv.h
212 INCLUDES = -I$(top_builddir)
216 INCLUDES = -I$(top_srcdir)
213217 libgslodeiv_la_SOURCES = control.c cstd.c cscal.c evolve.c step.c rk2.c rk2imp.c rk2simp.c rk4.c rk4imp.c rkf45.c rk8pd.c rkck.c bsimp.c gear1.c gear2.c
214218 noinst_HEADERS = odeiv_util.h
215219 TESTS = $(check_PROGRAMS)
88 existing workspaces
99
1010 * Implement other stepping methods from well-known packages such as
11 RKSUITE, etc
11 RKSUITE, VODE, DASSL, etc
1212
1313 * Roundoff error needs to be taken into account to prevent the
1414 step-size being made arbitrarily small
0 2008-07-03 Brian Gough <bjg@hp2.network-theory.co.uk>
1
2 * permutation.c: move gsl_permutation_get to inline.c
3
4 * gsl_permutation.h: use new inline declarations
5
6 * inline.c: handle inline functions separately
7
8 * Makefile.am (INCLUDES): use top_srcdir instead of top_builddir
9
010 2003-02-17 Brian Gough <bjg@network-theory.co.uk>
111
212 * canonical.c (gsl_permutation_canonical_to_linear): fixed bug
11
22 pkginclude_HEADERS = gsl_permutation.h gsl_permute.h gsl_permute_char.h gsl_permute_complex_double.h gsl_permute_complex_float.h gsl_permute_complex_long_double.h gsl_permute_double.h gsl_permute_float.h gsl_permute_int.h gsl_permute_long.h gsl_permute_long_double.h gsl_permute_short.h gsl_permute_uchar.h gsl_permute_uint.h gsl_permute_ulong.h gsl_permute_ushort.h gsl_permute_vector.h gsl_permute_vector_char.h gsl_permute_vector_complex_double.h gsl_permute_vector_complex_float.h gsl_permute_vector_complex_long_double.h gsl_permute_vector_double.h gsl_permute_vector_float.h gsl_permute_vector_int.h gsl_permute_vector_long.h gsl_permute_vector_long_double.h gsl_permute_vector_short.h gsl_permute_vector_uchar.h gsl_permute_vector_uint.h gsl_permute_vector_ulong.h gsl_permute_vector_ushort.h
33
4 INCLUDES= -I$(top_builddir) -I$(top_srcdir)
4 INCLUDES = -I$(top_srcdir)
55
6 libgslpermutation_la_SOURCES = init.c file.c permutation.c permute.c canonical.c
6 libgslpermutation_la_SOURCES = init.c file.c permutation.c permute.c canonical.c inline.c
77
88 noinst_HEADERS = permute_source.c
99
4646 LTLIBRARIES = $(noinst_LTLIBRARIES)
4747 libgslpermutation_la_LIBADD =
4848 am_libgslpermutation_la_OBJECTS = init.lo file.lo permutation.lo \
49 permute.lo canonical.lo
49 permute.lo canonical.lo inline.lo
5050 libgslpermutation_la_OBJECTS = $(am_libgslpermutation_la_OBJECTS)
5151 am_test_OBJECTS = test.$(OBJEXT)
5252 test_OBJECTS = $(am_test_OBJECTS)
133133 LIBOBJS = @LIBOBJS@
134134 LIBS = @LIBS@
135135 LIBTOOL = @LIBTOOL@
136 LIPO = @LIPO@
136137 LN_S = @LN_S@
137138 LTLIBOBJS = @LTLIBOBJS@
138139 MAINT = @MAINT@
140141 MKDIR_P = @MKDIR_P@
141142 NM = @NM@
142143 NMEDIT = @NMEDIT@
144 OBJDUMP = @OBJDUMP@
143145 OBJEXT = @OBJEXT@
146 OTOOL = @OTOOL@
147 OTOOL64 = @OTOOL64@
144148 PACKAGE = @PACKAGE@
145149 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
146150 PACKAGE_NAME = @PACKAGE_NAME@
205209 top_srcdir = @top_srcdir@
206210 noinst_LTLIBRARIES = libgslpermutation.la
207211 pkginclude_HEADERS = gsl_permutation.h gsl_permute.h gsl_permute_char.h gsl_permute_complex_double.h gsl_permute_complex_float.h gsl_permute_complex_long_double.h gsl_permute_double.h gsl_permute_float.h gsl_permute_int.h gsl_permute_long.h gsl_permute_long_double.h gsl_permute_short.h gsl_permute_uchar.h gsl_permute_uint.h gsl_permute_ulong.h gsl_permute_ushort.h gsl_permute_vector.h gsl_permute_vector_char.h gsl_permute_vector_complex_double.h gsl_permute_vector_complex_float.h gsl_permute_vector_complex_long_double.h gsl_permute_vector_double.h gsl_permute_vector_float.h gsl_permute_vector_int.h gsl_permute_vector_long.h gsl_permute_vector_long_double.h gsl_permute_vector_short.h gsl_permute_vector_uchar.h gsl_permute_vector_uint.h gsl_permute_vector_ulong.h gsl_permute_vector_ushort.h
208 INCLUDES = -I$(top_builddir) -I$(top_srcdir)
209 libgslpermutation_la_SOURCES = init.c file.c permutation.c permute.c canonical.c
212 INCLUDES = -I$(top_srcdir)
213 libgslpermutation_la_SOURCES = init.c file.c permutation.c permute.c canonical.c inline.c
210214 noinst_HEADERS = permute_source.c
211215 TESTS = $(check_PROGRAMS)
212216 test_SOURCES = test.c
2222 #include <stdlib.h>
2323 #include <gsl/gsl_types.h>
2424 #include <gsl/gsl_errno.h>
25 #include <gsl/gsl_inline.h>
2526 #include <gsl/gsl_check_range.h>
2627
2728 #undef __BEGIN_DECLS
5859 size_t gsl_permutation_size (const gsl_permutation * p);
5960 size_t * gsl_permutation_data (const gsl_permutation * p);
6061
61 size_t gsl_permutation_get (const gsl_permutation * p, const size_t i);
6262 int gsl_permutation_swap (gsl_permutation * p, const size_t i, const size_t j);
6363
6464 int gsl_permutation_valid (const gsl_permutation * p);
7575 size_t gsl_permutation_linear_cycles (const gsl_permutation * p);
7676 size_t gsl_permutation_canonical_cycles (const gsl_permutation * q);
7777
78 INLINE_DECL size_t gsl_permutation_get (const gsl_permutation * p, const size_t i);
79
7880 #ifdef HAVE_INLINE
7981
80 extern inline
82 INLINE_FUN
8183 size_t
8284 gsl_permutation_get (const gsl_permutation * p, const size_t i)
8385 {
8486 #if GSL_RANGE_CHECK
85 if (i >= p->size)
87 if (GSL_RANGE_COND(i >= p->size))
8688 {
8789 GSL_ERROR_VAL ("index out of range", GSL_EINVAL, 0);
8890 }
0 /* permutation/inline.c
1 *
2 * Copyright (C) 2008 Brian Gough
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 3 of the License, or (at
7 * your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18
19 #include <config.h>
20 #include <gsl/gsl_errno.h>
21
22 /* Compile all the inline functions */
23
24 #define COMPILE_INLINE_STATIC
25 #include "build.h"
26 #include <gsl/gsl_permutation.h>
3131 {
3232 return p->data ;
3333 }
34
35 #ifndef HIDE_INLINE_STATIC
36 size_t
37 gsl_permutation_get (const gsl_permutation * p, const size_t i)
38 {
39 if (gsl_check_range)
40 {
41 if (i >= p->size) /* size_t is unsigned, can't be negative */
42 {
43 GSL_ERROR_VAL ("index out of range", GSL_EINVAL, 0);
44 }
45 }
46
47 return p->data[i];
48 }
49 #endif
5034
5135 int
5236 gsl_permutation_swap (gsl_permutation * p, const size_t i, const size_t j)
0 2008-07-03 Brian Gough <bjg@hp2.network-theory.co.uk>
1
2 * gsl_poly.h: use new inline declarations
3
4 * inline.c: handle inline functions in separate file
5
6 * dd.c: move gsl_poly_dd_eval to inline.c
7
8 * Makefile.am (INCLUDES): use top_srcdir instead of top_builddir
9
10 2008-04-28 Brian Gough <bjg@network-theory.co.uk>
11
12 * dd.c (gsl_poly_dd_taylor): use new descending loop convention
13
014 2007-12-17 Brian Gough <bjg@network-theory.co.uk>
115
216 * eval.c: added functions for complex polynomials
11
22 pkginclude_HEADERS = gsl_poly.h
33
4 INCLUDES= -I$(top_builddir)
4 INCLUDES = -I$(top_srcdir)
55
66 libgslpoly_la_SOURCES = dd.c eval.c solve_quadratic.c solve_cubic.c zsolve_quadratic.c zsolve_cubic.c zsolve.c zsolve_init.c
77
133133 LIBOBJS = @LIBOBJS@
134134 LIBS = @LIBS@
135135 LIBTOOL = @LIBTOOL@
136 LIPO = @LIPO@
136137 LN_S = @LN_S@
137138 LTLIBOBJS = @LTLIBOBJS@
138139 MAINT = @MAINT@
140141 MKDIR_P = @MKDIR_P@
141142 NM = @NM@
142143 NMEDIT = @NMEDIT@
144 OBJDUMP = @OBJDUMP@
143145 OBJEXT = @OBJEXT@
146 OTOOL = @OTOOL@
147 OTOOL64 = @OTOOL64@
144148 PACKAGE = @PACKAGE@
145149 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
146150 PACKAGE_NAME = @PACKAGE_NAME@
205209 top_srcdir = @top_srcdir@
206210 noinst_LTLIBRARIES = libgslpoly.la
207211 pkginclude_HEADERS = gsl_poly.h
208 INCLUDES = -I$(top_builddir)
212 INCLUDES = -I$(top_srcdir)
209213 libgslpoly_la_SOURCES = dd.c eval.c solve_quadratic.c solve_cubic.c zsolve_quadratic.c zsolve_cubic.c zsolve.c zsolve_init.c
210214 noinst_HEADERS = balance.c companion.c qr.c
211215 TESTS = $(check_PROGRAMS)
4848 return GSL_SUCCESS;
4949 }
5050
51 #ifndef HIDE_INLINE_STATIC
52 double
53 gsl_poly_dd_eval (const double dd[], const double xa[], const size_t size, const double x)
54 {
55 size_t i;
56 double y = dd[size - 1];
57
58 for (i = size - 1; i--;)
59 {
60 y = dd[i] + (x - xa[i]) * y;
61 }
62
63 return y;
64 }
65 #endif
66
6751 int
6852 gsl_poly_dd_taylor (double c[], double xp,
6953 const double dd[], const double xa[], size_t size,
8165
8266 c[0] = dd[0];
8367
84 for (i = size - 1; i > 0 && i--;)
68 for (i = size - 1; i-- > 0;)
8569 {
8670 w[i] = -w[i + 1] * (xa[size - 2 - i] - xp);
8771
1818 */
1919
2020 #include <config.h>
21
22 /* Compile all the inline functions */
23
24 #define COMPILE_INLINE_STATIC
25 #include "build.h"
2126 #include <gsl/gsl_poly.h>
22
23 /*-*-*-*-*-*-*-*-*-*-*-* Functions w/ Natural Prototypes *-*-*-*-*-*-*-*-*-*-*-*/
24
25 /* checked OK [GJ] Tue May 5 12:19:56 MDT 1998 */
26
27 #ifndef HIDE_INLINE_STATIC
28 double
29 gsl_poly_eval(const double c[], const int len, const double x)
30 {
31 int i;
32 double ans = c[len-1];
33 for(i=len-1; i>0; i--) ans = c[i-1] + x * ans;
34 return ans;
35 }
36
37 gsl_complex
38 gsl_poly_complex_eval(const double c[], const int len, const gsl_complex z)
39 {
40 int i;
41 gsl_complex ans;
42 GSL_SET_COMPLEX (&ans, c[len-1], 0.0);
43 for(i=len-1; i>0; i--) {
44 /* The following three lines are equivalent to
45 ans = gsl_complex_add_real (gsl_complex_mul (z, ans), c[i-1]);
46 but faster */
47 double tmp = c[i-1] + GSL_REAL (z) * GSL_REAL (ans) - GSL_IMAG (z) * GSL_IMAG (ans);
48 GSL_SET_IMAG (&ans, GSL_IMAG (z) * GSL_REAL (ans) + GSL_REAL (z) * GSL_IMAG (ans));
49 GSL_SET_REAL (&ans, tmp);
50 }
51 return ans;
52 }
53
54 gsl_complex
55 gsl_complex_poly_complex_eval(const gsl_complex c[], const int len, const gsl_complex z)
56 {
57 int i;
58 gsl_complex ans = c[len-1];
59 for(i=len-1; i>0; i--) {
60 /* The following three lines are equivalent to
61 ans = gsl_complex_add (c[i-1], gsl_complex_mul (z, ans));
62 but faster */
63 double tmp = GSL_REAL (c[i-1]) + GSL_REAL (z) * GSL_REAL (ans) - GSL_IMAG (z) * GSL_IMAG (ans);
64 GSL_SET_IMAG (&ans, GSL_IMAG (c[i-1]) + GSL_IMAG (z) * GSL_REAL (ans) + GSL_REAL (z) * GSL_IMAG (ans));
65 GSL_SET_REAL (&ans, tmp);
66 }
67 return ans;
68 }
69 #endif
2020 #define __GSL_POLY_H__
2121
2222 #include <stdlib.h>
23 #include <gsl/gsl_inline.h>
2324 #include <gsl/gsl_complex.h>
2425
2526 #undef __BEGIN_DECLS
4344 */
4445
4546 /* real polynomial, real x */
46 double gsl_poly_eval(const double c[], const int len, const double x);
47 INLINE_DECL double gsl_poly_eval(const double c[], const int len, const double x);
4748
4849 /* real polynomial, complex x */
49 gsl_complex gsl_poly_complex_eval (const double c [], const int len, const gsl_complex z);
50 INLINE_DECL gsl_complex gsl_poly_complex_eval (const double c [], const int len, const gsl_complex z);
5051
5152 /* complex polynomial, complex x */
52 gsl_complex gsl_complex_poly_complex_eval (const gsl_complex c [], const int len, const gsl_complex z);
53
53 INLINE_DECL gsl_complex gsl_complex_poly_complex_eval (const gsl_complex c [], const int len, const gsl_complex z);
5454
5555 #ifdef HAVE_INLINE
56 extern inline
56 INLINE_FUN
5757 double
5858 gsl_poly_eval(const double c[], const int len, const double x)
5959 {
6363 return ans;
6464 }
6565
66 extern inline
66 INLINE_FUN
6767 gsl_complex
6868 gsl_poly_complex_eval(const double c[], const int len, const gsl_complex z)
6969 {
8181 return ans;
8282 }
8383
84 extern inline
84 INLINE_FUN
8585 gsl_complex
8686 gsl_complex_poly_complex_eval(const gsl_complex c[], const int len, const gsl_complex z)
8787 {
105105 gsl_poly_dd_init (double dd[], const double x[], const double y[],
106106 size_t size);
107107
108 double
108 INLINE_DECL double
109109 gsl_poly_dd_eval (const double dd[], const double xa[], const size_t size, const double x);
110110
111111 #ifdef HAVE_INLINE
112 extern inline
112 INLINE_FUN
113113 double
114114 gsl_poly_dd_eval(const double dd[], const double xa[], const size_t size, const double x)
115115 {
0 2008-07-03 Brian Gough <bjg@hp2.network-theory.co.uk>
1
2 * qrng.c: moved gsl_qrng_get to inline.c
3
4 * gsl_qrng.h (gsl_qrng_get): new inline declaration
5
6 * inline.c: handle inline functions separately
7
8 * Makefile.am (INCLUDES): use top_srcdir instead of top_builddir
9
010 2008-03-17 Brian Gough <bjg@network-theory.co.uk>
111
212 * reversehalton.c (reversehalton_init): removed unused variable i
11
22 pkginclude_HEADERS = gsl_qrng.h
33
4 INCLUDES= -I$(top_builddir)
4 INCLUDES = -I$(top_srcdir)
55
6 libgslqrng_la_SOURCES = gsl_qrng.h qrng.c niederreiter-2.c sobol.c halton.c reversehalton.c
6 libgslqrng_la_SOURCES = gsl_qrng.h qrng.c niederreiter-2.c sobol.c halton.c reversehalton.c inline.c
77
88 TESTS = $(check_PROGRAMS)
99 check_PROGRAMS = test
4646 LTLIBRARIES = $(noinst_LTLIBRARIES)
4747 libgslqrng_la_LIBADD =
4848 am_libgslqrng_la_OBJECTS = qrng.lo niederreiter-2.lo sobol.lo \
49 halton.lo reversehalton.lo
49 halton.lo reversehalton.lo inline.lo
5050 libgslqrng_la_OBJECTS = $(am_libgslqrng_la_OBJECTS)
5151 am_test_OBJECTS = test.$(OBJEXT)
5252 test_OBJECTS = $(am_test_OBJECTS)
132132 LIBOBJS = @LIBOBJS@
133133 LIBS = @LIBS@
134134 LIBTOOL = @LIBTOOL@
135 LIPO = @LIPO@
135136 LN_S = @LN_S@
136137 LTLIBOBJS = @LTLIBOBJS@
137138 MAINT = @MAINT@
139140 MKDIR_P = @MKDIR_P@
140141 NM = @NM@
141142 NMEDIT = @NMEDIT@
143 OBJDUMP = @OBJDUMP@
142144 OBJEXT = @OBJEXT@
145 OTOOL = @OTOOL@
146 OTOOL64 = @OTOOL64@
143147 PACKAGE = @PACKAGE@
144148 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
145149 PACKAGE_NAME = @PACKAGE_NAME@
204208 top_srcdir = @top_srcdir@
205209 noinst_LTLIBRARIES = libgslqrng.la
206210 pkginclude_HEADERS = gsl_qrng.h
207 INCLUDES = -I$(top_builddir)
208 libgslqrng_la_SOURCES = gsl_qrng.h qrng.c niederreiter-2.c sobol.c halton.c reversehalton.c
211 INCLUDES = -I$(top_srcdir)
212 libgslqrng_la_SOURCES = gsl_qrng.h qrng.c niederreiter-2.c sobol.c halton.c reversehalton.c inline.c
209213 TESTS = $(check_PROGRAMS)
210214 test_SOURCES = test.c
211215 test_LDADD = libgslqrng.la ../ieee-utils/libgslieeeutils.la ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la ../utils/libutils.la
55 #include <stdlib.h>
66 #include <gsl/gsl_types.h>
77 #include <gsl/gsl_errno.h>
8 #include <gsl/gsl_inline.h>
89
910 #undef __BEGIN_DECLS
1011 #undef __END_DECLS
9293
9394
9495 /* Retrieve next vector in sequence. */
95 int gsl_qrng_get (const gsl_qrng * q, double x[]);
96
96 INLINE_DECL int gsl_qrng_get (const gsl_qrng * q, double x[]);
9797
9898 #ifdef HAVE_INLINE
99 extern inline int gsl_qrng_get (const gsl_qrng * q, double x[]);
100 extern inline int gsl_qrng_get (const gsl_qrng * q, double x[])
99 INLINE_FUN int gsl_qrng_get (const gsl_qrng * q, double x[])
101100 {
102101 return (q->type->get) (q->state, q->dimension, x);
103102 }
0 /* Author: G. Jungman
1 */
2 #include <config.h>
3 #include <stdlib.h>
4 #include <string.h>
5 #include <gsl/gsl_errno.h>
6
7 /* Compile all the inline functions */
8
9 #define COMPILE_INLINE_STATIC
10 #include "build.h"
11 #include <gsl/gsl_qrng.h>
12
8787 return r;
8888 }
8989
90 #ifndef HIDE_INLINE_STATIC
91 int
92 gsl_qrng_get (const gsl_qrng * q, double x[])
93 {
94 return (q->type->get) (q->state, q->dimension, x);
95 }
96 #endif
97
9890 const char *
9991 gsl_qrng_name (const gsl_qrng * q)
10092 {
0 2008-11-30 Brian Gough <bjg@network-theory.co.uk>
1
2 * test.c (test_gamma_vlarge): added test for a >= UINT_MAX.
3
4 * gamma.c (gsl_ran_gamma_knuth): handle the case a >= UINT_MAX.
5
6 2008-07-03 Brian Gough <bjg@hp2.network-theory.co.uk>
7
8 * Makefile.am (INCLUDES): use top_srcdir instead of top_builddir
9
010 2008-02-09 Brian Gough <bjg@network-theory.co.uk>
111
212 * gausszig.c (gsl_ran_gaussian_ziggurat): handle different
11
22 pkginclude_HEADERS= gsl_randist.h
33
4 INCLUDES= -I$(top_builddir)
4 INCLUDES = -I$(top_srcdir)
55
66 libgslrandist_la_SOURCES = bernoulli.c beta.c bigauss.c binomial.c cauchy.c chisq.c dirichlet.c discrete.c erlang.c exponential.c exppow.c fdist.c flat.c gamma.c gauss.c gausszig.c gausstail.c geometric.c gumbel.c hyperg.c laplace.c levy.c logarithmic.c logistic.c lognormal.c multinomial.c nbinomial.c pareto.c pascal.c poisson.c rayleigh.c shuffle.c sphere.c tdist.c weibull.c landau.c binomial_tpe.c
77
141141 LIBOBJS = @LIBOBJS@
142142 LIBS = @LIBS@
143143 LIBTOOL = @LIBTOOL@
144 LIPO = @LIPO@
144145 LN_S = @LN_S@
145146 LTLIBOBJS = @LTLIBOBJS@
146147 MAINT = @MAINT@
148149 MKDIR_P = @MKDIR_P@
149150 NM = @NM@
150151 NMEDIT = @NMEDIT@
152 OBJDUMP = @OBJDUMP@
151153 OBJEXT = @OBJEXT@
154 OTOOL = @OTOOL@
155 OTOOL64 = @OTOOL64@
152156 PACKAGE = @PACKAGE@
153157 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
154158 PACKAGE_NAME = @PACKAGE_NAME@
213217 top_srcdir = @top_srcdir@
214218 noinst_LTLIBRARIES = libgslrandist.la
215219 pkginclude_HEADERS = gsl_randist.h
216 INCLUDES = -I$(top_builddir)
220 INCLUDES = -I$(top_srcdir)
217221 libgslrandist_la_SOURCES = bernoulli.c beta.c bigauss.c binomial.c cauchy.c chisq.c dirichlet.c discrete.c erlang.c exponential.c exppow.c fdist.c flat.c gamma.c gauss.c gausszig.c gausstail.c geometric.c gumbel.c hyperg.c laplace.c levy.c logarithmic.c logistic.c lognormal.c multinomial.c nbinomial.c pareto.c pascal.c poisson.c rayleigh.c shuffle.c sphere.c tdist.c weibull.c landau.c binomial_tpe.c
218222 TESTS = $(check_PROGRAMS)
219223 test_SOURCES = test.c
4242 /* assume a > 0 */
4343 unsigned int na = floor (a);
4444
45 if (a == na)
45 if(a >= UINT_MAX)
46 {
47 return b * (gamma_large (r, floor (a)) + gamma_frac (r, a - floor (a)));
48 }
49 else if (a == na)
4650 {
4751 return b * gsl_ran_gamma_int (r, na);
4852 }
109109 double test_gamma_int_pdf (double x);
110110 double test_gamma_large (void);
111111 double test_gamma_large_pdf (double x);
112 double test_gamma_vlarge (void);
113 double test_gamma_vlarge_pdf (double x);
112114 double test_gamma_small (void);
113115 double test_gamma_small_pdf (double x);
114116 double test_gamma_mt (void);
121123 double test_gamma_mt_large_pdf (double x);
122124 double test_gamma_mt_small (void);
123125 double test_gamma_mt_small_pdf (double x);
126 double test_gamma_knuth_vlarge (void);
127 double test_gamma_knuth_vlarge_pdf (double x);
124128 double test_gaussian (void);
125129 double test_gaussian_pdf (double x);
126130 double test_gaussian_ratio_method (void);
297301 testPDF (FUNC2 (gamma1));
298302 testPDF (FUNC2 (gamma_int));
299303 testPDF (FUNC2 (gamma_large));
304 testPDF (FUNC2 (gamma_vlarge));
305 testPDF (FUNC2 (gamma_knuth_vlarge));
300306 testPDF (FUNC2 (gamma_small));
301307 testPDF (FUNC2 (gamma_mt));
302308 testPDF (FUNC2 (gamma_mt1));
545551 for (i = 0; i < N; i++)
546552 {
547553 double r = f ();
548
549554 total += r;
550555
551556 if (r < b && r > a)
13061311 return gsl_ran_gamma_pdf (x, 0.92, 2.17);
13071312 }
13081313
1314 double
1315 test_gamma_vlarge (void)
1316 {
1317 /* Scale the distribution to get it into the range [-5,5] */
1318 double c = 2.71828181565;
1319 double b = 6.32899304917e-10;
1320 double d = 1e4;
1321 return (gsl_ran_gamma (r_global, 4294967296.0, b) - c) * d;
1322 }
1323
1324 double
1325 test_gamma_vlarge_pdf (double x)
1326 {
1327 double c = 2.71828181565;
1328 double b = 6.32899304917e-10;
1329 double d = 1e4;
1330 return gsl_ran_gamma_pdf ((x / d) + c, 4294967296.0, b) / d;
1331 }
13091332
13101333 double
13111334 test_gamma_mt (void)
13701393 return gsl_ran_gamma_pdf (x, 0.92, 2.17);
13711394 }
13721395
1396
1397 double
1398 test_gamma_knuth_vlarge (void)
1399 {
1400 /* Scale the distribution to get it into the range [-5,5] */
1401 double c = 2.71828181565;
1402 double b = 6.32899304917e-10;
1403 double d = 1e4;
1404 return (gsl_ran_gamma_knuth (r_global, 4294967296.0, b) - c) * d;
1405 }
1406
1407 double
1408 test_gamma_knuth_vlarge_pdf (double x)
1409 {
1410 double c = 2.71828181565;
1411 double b = 6.32899304917e-10;
1412 double d = 1e4;
1413 return gsl_ran_gamma_pdf ((x / d) + c, 4294967296.0, b) / d;
1414 }
13731415
13741416 double
13751417 test_gaussian (void)
0 2008-10-13 Brian Gough <bjg@network-theory.co.uk>
1
2 * file.c: added (char *) to allow compilation with C++ compiler
3
4 2008-07-03 Brian Gough <bjg@hp2.network-theory.co.uk>
5
6 * rng.c: moved inline functions to inline.c
7
8 * gsl_rng.h: use new inline declarations
9
10 * inline.c: handle inline functions separately
11
12 * Makefile.am (INCLUDES): use top_srcdir instead of top_builddir
13
014 2007-01-28 Brian Gough <bjg@network-theory.co.uk>
115
216 * knuthran2002.c: added revised version from 9th printing
11
22 pkginclude_HEADERS = gsl_rng.h
33
4 INCLUDES= -I$(top_builddir)
4 INCLUDES = -I$(top_srcdir)
55
6 libgslrng_la_SOURCES = borosh13.c cmrg.c coveyou.c default.c file.c fishman18.c fishman20.c fishman2x.c gfsr4.c knuthran2.c knuthran.c knuthran2002.c lecuyer21.c minstd.c mrg.c mt.c r250.c ran0.c ran1.c ran2.c ran3.c rand48.c rand.c random.c randu.c ranf.c ranlux.c ranlxd.c ranlxs.c ranmar.c rng.c slatec.c taus.c taus113.c transputer.c tt.c types.c uni32.c uni.c vax.c waterman14.c zuf.c
6 libgslrng_la_SOURCES = borosh13.c cmrg.c coveyou.c default.c file.c fishman18.c fishman20.c fishman2x.c gfsr4.c knuthran2.c knuthran.c knuthran2002.c lecuyer21.c minstd.c mrg.c mt.c r250.c ran0.c ran1.c ran2.c ran3.c rand48.c rand.c random.c randu.c ranf.c ranlux.c ranlxd.c ranlxs.c ranmar.c rng.c slatec.c taus.c taus113.c transputer.c tt.c types.c uni32.c uni.c vax.c waterman14.c zuf.c inline.c
77
88 CLEANFILES = test.dat
99
5252 rand48.lo rand.lo random.lo randu.lo ranf.lo ranlux.lo \
5353 ranlxd.lo ranlxs.lo ranmar.lo rng.lo slatec.lo taus.lo \
5454 taus113.lo transputer.lo tt.lo types.lo uni32.lo uni.lo vax.lo \
55 waterman14.lo zuf.lo
55 waterman14.lo zuf.lo inline.lo
5656 libgslrng_la_OBJECTS = $(am_libgslrng_la_OBJECTS)
5757 am_test_OBJECTS = test.$(OBJEXT)
5858 test_OBJECTS = $(am_test_OBJECTS)
138138 LIBOBJS = @LIBOBJS@
139139 LIBS = @LIBS@
140140 LIBTOOL = @LIBTOOL@
141 LIPO = @LIPO@
141142 LN_S = @LN_S@
142143 LTLIBOBJS = @LTLIBOBJS@
143144 MAINT = @MAINT@
145146 MKDIR_P = @MKDIR_P@
146147 NM = @NM@
147148 NMEDIT = @NMEDIT@
149 OBJDUMP = @OBJDUMP@
148150 OBJEXT = @OBJEXT@
151 OTOOL = @OTOOL@
152 OTOOL64 = @OTOOL64@
149153 PACKAGE = @PACKAGE@
150154 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
151155 PACKAGE_NAME = @PACKAGE_NAME@
210214 top_srcdir = @top_srcdir@
211215 noinst_LTLIBRARIES = libgslrng.la
212216 pkginclude_HEADERS = gsl_rng.h
213 INCLUDES = -I$(top_builddir)
214 libgslrng_la_SOURCES = borosh13.c cmrg.c coveyou.c default.c file.c fishman18.c fishman20.c fishman2x.c gfsr4.c knuthran2.c knuthran.c knuthran2002.c lecuyer21.c minstd.c mrg.c mt.c r250.c ran0.c ran1.c ran2.c ran3.c rand48.c rand.c random.c randu.c ranf.c ranlux.c ranlxd.c ranlxs.c ranmar.c rng.c slatec.c taus.c taus113.c transputer.c tt.c types.c uni32.c uni.c vax.c waterman14.c zuf.c
217 INCLUDES = -I$(top_srcdir)
218 libgslrng_la_SOURCES = borosh13.c cmrg.c coveyou.c default.c file.c fishman18.c fishman20.c fishman2x.c gfsr4.c knuthran2.c knuthran.c knuthran2002.c lecuyer21.c minstd.c mrg.c mt.c r250.c ran0.c ran1.c ran2.c ran3.c rand48.c rand.c random.c randu.c ranf.c ranlux.c ranlxd.c ranlxs.c ranmar.c rng.c slatec.c taus.c taus113.c transputer.c tt.c types.c uni32.c uni.c vax.c waterman14.c zuf.c inline.c
215219 CLEANFILES = test.dat
216220 noinst_HEADERS = schrage.c
217221 test_SOURCES = test.c
2626 {
2727 size_t n = r->type->size ;
2828
29 char * state = r->state;
29 char * state = (char *)r->state;
3030
3131 size_t items = fread (state, 1, n, stream);
3232
4343 {
4444 size_t n = r->type->size ;
4545
46 char * state = r->state;
46 char * state = (char *)r->state;
4747
4848 size_t items = fwrite (state, 1, n, stream);
4949
2121 #include <stdlib.h>
2222 #include <gsl/gsl_types.h>
2323 #include <gsl/gsl_errno.h>
24 #include <gsl/gsl_inline.h>
2425
2526 #undef __BEGIN_DECLS
2627 #undef __END_DECLS
146147
147148 const gsl_rng_type * gsl_rng_env_setup (void);
148149
149 unsigned long int gsl_rng_get (const gsl_rng * r);
150 double gsl_rng_uniform (const gsl_rng * r);
151 double gsl_rng_uniform_pos (const gsl_rng * r);
152 unsigned long int gsl_rng_uniform_int (const gsl_rng * r, unsigned long int n);
153
150 INLINE_DECL unsigned long int gsl_rng_get (const gsl_rng * r);
151 INLINE_DECL double gsl_rng_uniform (const gsl_rng * r);
152 INLINE_DECL double gsl_rng_uniform_pos (const gsl_rng * r);
153 INLINE_DECL unsigned long int gsl_rng_uniform_int (const gsl_rng * r, unsigned long int n);
154154
155155 #ifdef HAVE_INLINE
156 extern inline unsigned long int gsl_rng_get (const gsl_rng * r);
157
158 extern inline unsigned long int
156
157 INLINE_FUN unsigned long int
159158 gsl_rng_get (const gsl_rng * r)
160159 {
161160 return (r->type->get) (r->state);
162161 }
163162
164 extern inline double gsl_rng_uniform (const gsl_rng * r);
165
166 extern inline double
163 INLINE_FUN double
167164 gsl_rng_uniform (const gsl_rng * r)
168165 {
169166 return (r->type->get_double) (r->state);
170167 }
171168
172 extern inline double gsl_rng_uniform_pos (const gsl_rng * r);
173
174 extern inline double
169 INLINE_FUN double
175170 gsl_rng_uniform_pos (const gsl_rng * r)
176171 {
177172 double x ;
184179 return x ;
185180 }
186181
187 extern inline unsigned long int gsl_rng_uniform_int (const gsl_rng * r, unsigned long int n);
188
189 extern inline unsigned long int
182 /* Note: to avoid integer overflow in (range+1) we work with scale =
183 range/n = (max-min)/n rather than scale=(max-min+1)/n, this reduces
184 efficiency slightly but avoids having to check for the out of range
185 value. Note that range is typically O(2^32) so the addition of 1
186 is negligible in most usage. */
187
188 INLINE_FUN unsigned long int
190189 gsl_rng_uniform_int (const gsl_rng * r, unsigned long int n)
191190 {
192191 unsigned long int offset = r->type->min;
0 /* rng/inline.c
1 *
2 * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 James Theiler, Brian Gough
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 3 of the License, or (at
7 * your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18
19 #include <config.h>
20 #include <stdlib.h>
21 #include <stdio.h>
22 #include <string.h>
23 #include <gsl/gsl_errno.h>
24
25 /* Compile all the inline functions */
26
27 #define COMPILE_INLINE_STATIC
28 #include "build.h"
29 #include <gsl/gsl_rng.h>
9999 (r->type->set) (r->state, seed);
100100 }
101101
102 #ifndef HIDE_INLINE_STATIC
103 unsigned long int
104 gsl_rng_get (const gsl_rng * r)
105 {
106 return (r->type->get) (r->state);
107 }
108
109 double
110 gsl_rng_uniform (const gsl_rng * r)
111 {
112 return (r->type->get_double) (r->state);
113 }
114
115 double
116 gsl_rng_uniform_pos (const gsl_rng * r)
117 {
118 double x ;
119 do
120 {
121 x = (r->type->get_double) (r->state) ;
122 }
123 while (x == 0) ;
124
125 return x ;
126 }
127
128 /* Note: to avoid integer overflow in (range+1) we work with scale =
129 range/n = (max-min)/n rather than scale=(max-min+1)/n, this reduces
130 efficiency slightly but avoids having to check for the out of range
131 value. Note that range is typically O(2^32) so the addition of 1
132 is negligible in most usage. */
133
134 unsigned long int
135 gsl_rng_uniform_int (const gsl_rng * r, unsigned long int n)
136 {
137 unsigned long int offset = r->type->min;
138 unsigned long int range = r->type->max - offset;
139 unsigned long int scale;
140 unsigned long int k;
141
142 if (n > range || n == 0)
143 {
144 GSL_ERROR_VAL ("invalid n, either 0 or exceeds maximum value of generator",
145 GSL_EINVAL, 0) ;
146 }
147
148 scale = range / n;
149
150 do
151 {
152 k = (((r->type->get) (r->state)) - offset) / scale;
153 }
154 while (k >= n);
155
156 return k;
157 }
158 #endif
159
160102 unsigned long int
161103 gsl_rng_max (const gsl_rng * r)
162104 {
0 2008-07-03 Brian Gough <bjg@hp2.network-theory.co.uk>
1
2 * Makefile.am (INCLUDES): use top_srcdir instead of top_builddir
3
04 2007-07-30 Brian Gough <bjg@network-theory.co.uk>
15
26 * newton.c (newton_iterate): use gsl_finite instead of finite
55
66 noinst_HEADERS = roots.h
77
8 INCLUDES= -I$(top_builddir)
8 INCLUDES = -I$(top_srcdir)
99
1010 libgslroots_la_SOURCES = bisection.c brent.c falsepos.c newton.c secant.c steffenson.c convergence.c fsolver.c fdfsolver.c
1111
135135 LIBOBJS = @LIBOBJS@
136136 LIBS = @LIBS@
137137 LIBTOOL = @LIBTOOL@
138 LIPO = @LIPO@
138139 LN_S = @LN_S@
139140 LTLIBOBJS = @LTLIBOBJS@
140141 MAINT = @MAINT@
142143 MKDIR_P = @MKDIR_P@
143144 NM = @NM@
144145 NMEDIT = @NMEDIT@
146 OBJDUMP = @OBJDUMP@
145147 OBJEXT = @OBJEXT@
148 OTOOL = @OTOOL@
149 OTOOL64 = @OTOOL64@
146150 PACKAGE = @PACKAGE@
147151 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
148152 PACKAGE_NAME = @PACKAGE_NAME@
208212 noinst_LTLIBRARIES = libgslroots.la
209213 pkginclude_HEADERS = gsl_roots.h
210214 noinst_HEADERS = roots.h
211 INCLUDES = -I$(top_builddir)
215 INCLUDES = -I$(top_srcdir)
212216 libgslroots_la_SOURCES = bisection.c brent.c falsepos.c newton.c secant.c steffenson.c convergence.c fsolver.c fdfsolver.c
213217 TESTS = $(check_PROGRAMS)
214218 test_SOURCES = test.c test_funcs.c test.h
0 2008-07-03 Brian Gough <bjg@hp2.network-theory.co.uk>
1
2 * Makefile.am (INCLUDES): use top_srcdir instead of top_builddir
3
04 2007-05-30 Brian Gough <bjg@network-theory.co.uk>
15
26 * siman.c (boltzmann): moved safe_exp into boltzmann
1717 libgslsiman_la_SOURCES = siman.c
1818 pkginclude_HEADERS = gsl_siman.h
1919
20 INCLUDES= -I$(top_builddir)
20 INCLUDES = -I$(top_srcdir)
141141 LIBOBJS = @LIBOBJS@
142142 LIBS = @LIBS@
143143 LIBTOOL = @LIBTOOL@
144 LIPO = @LIPO@
144145 LN_S = @LN_S@
145146 LTLIBOBJS = @LTLIBOBJS@
146147 MAINT = @MAINT@
148149 MKDIR_P = @MKDIR_P@
149150 NM = @NM@
150151 NMEDIT = @NMEDIT@
152 OBJDUMP = @OBJDUMP@
151153 OBJEXT = @OBJEXT@
154 OTOOL = @OTOOL@
155 OTOOL64 = @OTOOL64@
152156 PACKAGE = @PACKAGE@
153157 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
154158 PACKAGE_NAME = @PACKAGE_NAME@
221225 CLEANFILES = siman_test.out
222226 libgslsiman_la_SOURCES = siman.c
223227 pkginclude_HEADERS = gsl_siman.h
224 INCLUDES = -I$(top_builddir)
228 INCLUDES = -I$(top_srcdir)
225229 all: all-am
226230
227231 .SUFFIXES:
0 2008-07-03 Brian Gough <bjg@hp2.network-theory.co.uk>
1
2 * Makefile.am (INCLUDES): use top_srcdir instead of top_builddir
3
04 2008-02-09 Brian Gough <bjg@network-theory.co.uk>
15
26 * test_source.c: prevent signed overflow in tests
11
22 pkginclude_HEADERS = gsl_heapsort.h gsl_sort.h gsl_sort_char.h gsl_sort_double.h gsl_sort_float.h gsl_sort_int.h gsl_sort_long.h gsl_sort_long_double.h gsl_sort_short.h gsl_sort_uchar.h gsl_sort_uint.h gsl_sort_ulong.h gsl_sort_ushort.h gsl_sort_vector.h gsl_sort_vector_char.h gsl_sort_vector_double.h gsl_sort_vector_float.h gsl_sort_vector_int.h gsl_sort_vector_long.h gsl_sort_vector_long_double.h gsl_sort_vector_short.h gsl_sort_vector_uchar.h gsl_sort_vector_uint.h gsl_sort_vector_ulong.h gsl_sort_vector_ushort.h
33
4 INCLUDES= -I$(top_builddir) -I$(top_srcdir)
4 INCLUDES = -I$(top_srcdir)
55
66 libgslsort_la_SOURCES = sort.c sortind.c sortvec.c sortvecind.c subset.c subsetind.c
77 noinst_HEADERS = sortvec_source.c sortvecind_source.c subset_source.c subsetind_source.c test_source.c test_heapsort.c
133133 LIBOBJS = @LIBOBJS@
134134 LIBS = @LIBS@
135135 LIBTOOL = @LIBTOOL@
136 LIPO = @LIPO@
136137 LN_S = @LN_S@
137138 LTLIBOBJS = @LTLIBOBJS@
138139 MAINT = @MAINT@
140141 MKDIR_P = @MKDIR_P@
141142 NM = @NM@
142143 NMEDIT = @NMEDIT@
144 OBJDUMP = @OBJDUMP@
143145 OBJEXT = @OBJEXT@
146 OTOOL = @OTOOL@
147 OTOOL64 = @OTOOL64@
144148 PACKAGE = @PACKAGE@
145149 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
146150 PACKAGE_NAME = @PACKAGE_NAME@
205209 top_srcdir = @top_srcdir@
206210 noinst_LTLIBRARIES = libgslsort.la
207211 pkginclude_HEADERS = gsl_heapsort.h gsl_sort.h gsl_sort_char.h gsl_sort_double.h gsl_sort_float.h gsl_sort_int.h gsl_sort_long.h gsl_sort_long_double.h gsl_sort_short.h gsl_sort_uchar.h gsl_sort_uint.h gsl_sort_ulong.h gsl_sort_ushort.h gsl_sort_vector.h gsl_sort_vector_char.h gsl_sort_vector_double.h gsl_sort_vector_float.h gsl_sort_vector_int.h gsl_sort_vector_long.h gsl_sort_vector_long_double.h gsl_sort_vector_short.h gsl_sort_vector_uchar.h gsl_sort_vector_uint.h gsl_sort_vector_ulong.h gsl_sort_vector_ushort.h
208 INCLUDES = -I$(top_builddir) -I$(top_srcdir)
212 INCLUDES = -I$(top_srcdir)
209213 libgslsort_la_SOURCES = sort.c sortind.c sortvec.c sortvecind.c subset.c subsetind.c
210214 noinst_HEADERS = sortvec_source.c sortvecind_source.c subset_source.c subsetind_source.c test_source.c test_heapsort.c
211215 TESTS = $(check_PROGRAMS)
4242 TYPE (gsl_vector) * data = FUNCTION (gsl_vector, alloc_from_block) (b2, 0, N, stride);
4343 TYPE (gsl_vector) * data2 = FUNCTION (gsl_vector, alloc_from_block) (b3, 0, N, stride);
4444
45 BASE * small = malloc(k * sizeof(BASE));
46 BASE * large = malloc(k * sizeof(BASE));
47 size_t * index = malloc(k * sizeof(size_t));
45 BASE * small = (BASE *)malloc(k * sizeof(BASE));
46 BASE * large = (BASE *)malloc(k * sizeof(BASE));
47 size_t * index = (size_t *)malloc(k * sizeof(size_t));
4848
4949 gsl_permutation *p = gsl_permutation_alloc (N);
5050
0 2008-12-04 Brian Gough <bjg@network-theory.co.uk>
1
2 * gamma_inc.c (gamma_inc_D): propagate cancellation error
3 in (x-a)/x for x close to a
4
5 2008-12-03 Brian Gough <bjg@network-theory.co.uk>
6
7 * exp.c (exprel_n_CF): changed N to double, to allow non-integer
8 usage for gamma_inc, double error factor to allow for two
9 parameters in recurrence.
10 (gsl_sf_exprel_n_CF_e): exported function to allow calls to
11 exprel_n_CF
12
13 * gamma_inc.c (gamma_inc_P_series): improved convergence condition
14 using estimate of the remainder of the series, added continued
15 fraction as a fallback, increased nmax to 10000
16
17 2008-08-26 Brian Gough <bjg@network-theory.co.uk>
18
19 * ellint.c (gsl_sf_ellint_Kcomp_e): corrected taylor expansion for
20 k close to 1.
21
22 2008-07-03 Brian Gough <bjg@hp2.network-theory.co.uk>
23
24 * Makefile.am (INCLUDES): use top_srcdir instead of top_builddir
25
26 2008-06-27 Brian Gough <bjg@network-theory.co.uk>
27
28 * legendre_poly.c (gsl_sf_legendre_array_size): removed inline
29 version of this function in gsl_sf_legendre.h
30
031 2008-03-17 Brian Gough <bjg@network-theory.co.uk>
132
233 * hyperg_2F1.c (gsl_sf_hyperg_2F1_e): replace duplicate error
33
44 noinst_HEADERS = bessel_amp_phase.h bessel_olver.h bessel_temme.h bessel.h hyperg.h legendre.h eval.h chebyshev.h cheb_eval.c cheb_eval_mode.c check.h error.h
55
6 INCLUDES= -I$(top_builddir)
6 INCLUDES = -I$(top_srcdir)
77
88 libgslspecfunc_la_SOURCES = airy.c airy_der.c airy_zero.c atanint.c bessel.c bessel.h bessel_I0.c bessel_I1.c bessel_In.c bessel_Inu.c bessel_J0.c bessel_J1.c bessel_Jn.c bessel_Jnu.c bessel_K0.c bessel_K1.c bessel_Kn.c bessel_Knu.c bessel_Y0.c bessel_Y1.c bessel_Yn.c bessel_Ynu.c bessel_amp_phase.c bessel_amp_phase.h bessel_i.c bessel_j.c bessel_k.c bessel_olver.c bessel_temme.c bessel_y.c bessel_zero.c bessel_sequence.c beta.c beta_inc.c clausen.c coulomb.c coupling.c coulomb_bound.c dawson.c debye.c dilog.c elementary.c ellint.c elljac.c erfc.c exp.c expint.c expint3.c fermi_dirac.c gegenbauer.c gamma.c gamma_inc.c hyperg_0F1.c hyperg_2F0.c hyperg_1F1.c hyperg_2F1.c hyperg_U.c hyperg.c laguerre.c lambert.c legendre_H3d.c legendre_Qn.c legendre_con.c legendre_poly.c log.c mathieu_angfunc.c mathieu_charv.c mathieu_coeff.c mathieu_radfunc.c mathieu_workspace.c poch.c pow_int.c psi.c recurse.h result.c shint.c sinint.c synchrotron.c transport.c trig.c zeta.c
99
156156 LIBOBJS = @LIBOBJS@
157157 LIBS = @LIBS@
158158 LIBTOOL = @LIBTOOL@
159 LIPO = @LIPO@
159160 LN_S = @LN_S@
160161 LTLIBOBJS = @LTLIBOBJS@
161162 MAINT = @MAINT@
163164 MKDIR_P = @MKDIR_P@
164165 NM = @NM@
165166 NMEDIT = @NMEDIT@
167 OBJDUMP = @OBJDUMP@
166168 OBJEXT = @OBJEXT@
169 OTOOL = @OTOOL@
170 OTOOL64 = @OTOOL64@
167171 PACKAGE = @PACKAGE@
168172 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
169173 PACKAGE_NAME = @PACKAGE_NAME@
229233 noinst_LTLIBRARIES = libgslspecfunc.la
230234 pkginclude_HEADERS = gsl_sf.h gsl_sf_airy.h gsl_sf_bessel.h gsl_sf_clausen.h gsl_sf_coulomb.h gsl_sf_coupling.h gsl_sf_dawson.h gsl_sf_debye.h gsl_sf_dilog.h gsl_sf_elementary.h gsl_sf_ellint.h gsl_sf_elljac.h gsl_sf_erf.h gsl_sf_exp.h gsl_sf_expint.h gsl_sf_fermi_dirac.h gsl_sf_gamma.h gsl_sf_gegenbauer.h gsl_sf_hyperg.h gsl_sf_laguerre.h gsl_sf_lambert.h gsl_sf_legendre.h gsl_sf_log.h gsl_sf_mathieu.h gsl_sf_pow_int.h gsl_sf_psi.h gsl_sf_result.h gsl_sf_synchrotron.h gsl_sf_transport.h gsl_sf_trig.h gsl_sf_zeta.h gsl_specfunc.h
231235 noinst_HEADERS = bessel_amp_phase.h bessel_olver.h bessel_temme.h bessel.h hyperg.h legendre.h eval.h chebyshev.h cheb_eval.c cheb_eval_mode.c check.h error.h
232 INCLUDES = -I$(top_builddir)
236 INCLUDES = -I$(top_srcdir)
233237 libgslspecfunc_la_SOURCES = airy.c airy_der.c airy_zero.c atanint.c bessel.c bessel.h bessel_I0.c bessel_I1.c bessel_In.c bessel_Inu.c bessel_J0.c bessel_J1.c bessel_Jn.c bessel_Jnu.c bessel_K0.c bessel_K1.c bessel_Kn.c bessel_Knu.c bessel_Y0.c bessel_Y1.c bessel_Yn.c bessel_Ynu.c bessel_amp_phase.c bessel_amp_phase.h bessel_i.c bessel_j.c bessel_k.c bessel_olver.c bessel_temme.c bessel_y.c bessel_zero.c bessel_sequence.c beta.c beta_inc.c clausen.c coulomb.c coupling.c coulomb_bound.c dawson.c debye.c dilog.c elementary.c ellint.c elljac.c erfc.c exp.c expint.c expint3.c fermi_dirac.c gegenbauer.c gamma.c gamma_inc.c hyperg_0F1.c hyperg_2F0.c hyperg_1F1.c hyperg_2F1.c hyperg_U.c hyperg.c laguerre.c lambert.c legendre_H3d.c legendre_Qn.c legendre_con.c legendre_poly.c log.c mathieu_angfunc.c mathieu_charv.c mathieu_coeff.c mathieu_radfunc.c mathieu_workspace.c poch.c pow_int.c psi.c recurse.h result.c shint.c sinint.c synchrotron.c transport.c trig.c zeta.c
234238 TESTS = $(check_PROGRAMS)
235239 test_LDADD = libgslspecfunc.la ../eigen/libgsleigen.la ../linalg/libgsllinalg.la ../sort/libgslsort.la ../matrix/libgslmatrix.la ../vector/libgslvector.la ../blas/libgslblas.la ../cblas/libgslcblas.la ../block/libgslblock.la ../complex/libgslcomplex.la ../ieee-utils/libgslieeeutils.la ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la ../utils/libutils.la
480480 DOMAIN_ERROR(result);
481481 }
482482 else if(k*k >= 1.0 - GSL_SQRT_DBL_EPSILON) {
483 /* [Abramowitz+Stegun, 17.3.33] */
483 /* [Abramowitz+Stegun, 17.3.34] */
484484 const double y = 1.0 - k*k;
485485 const double a[] = { 1.38629436112, 0.09666344259, 0.03590092383 };
486486 const double b[] = { 0.5, 0.12498593597, 0.06880248576 };
487487 const double ta = a[0] + y*(a[1] + y*a[2]);
488 const double tb = -log(y) * (b[0] * y*(b[1] + y*b[2]));
488 const double tb = -log(y) * (b[0] + y*(b[1] + y*b[2]));
489489 result->val = ta + tb;
490 result->err = 2.0 * GSL_DBL_EPSILON * result->val;
490 result->err = 2.0 * GSL_DBL_EPSILON * (fabs(result->val) + fabs(k/y));
491491 return GSL_SUCCESS;
492492 }
493493 else {
3131 */
3232 static
3333 int
34 exprel_n_CF(const int N, const double x, gsl_sf_result * result)
34 exprel_n_CF(const double N, const double x, gsl_sf_result * result)
3535 {
3636 const double RECUR_BIG = GSL_SQRT_DBL_MAX;
3737 const int maxiter = 5000;
9292 }
9393
9494 result->val = fn;
95 result->err = 2.0*(n+1.0)*GSL_DBL_EPSILON*fabs(fn);
95 result->err = 4.0*(n+1.0)*GSL_DBL_EPSILON*fabs(fn);
9696
9797 if(n == maxiter)
9898 GSL_ERROR ("error", GSL_EMAXITER);
411411 }
412412 }
413413
414
415 int
416 gsl_sf_exprel_n_CF_e(const double N, const double x, gsl_sf_result * result)
417 {
418 return exprel_n_CF(N, x, result);
419 }
414420
415421 int
416422 gsl_sf_exprel_n_e(const int N, const double x, gsl_sf_result * result)
5858 } else {
5959 double mu = (x-a)/a;
6060 gsl_sf_log_1plusx_mx_e(mu, &ln_term); /* log(1+mu) - mu */
61 /* Propagate cancellation error from x-a, since the absolute
62 error of mu=x-a is DBL_EPSILON */
63 ln_term.err += GSL_DBL_EPSILON * fabs(mu);
6164 };
6265 gsl_sf_gammastar_e(a, &gstar);
6366 term1 = exp(a*ln_term.val)/sqrt(2.0*M_PI*a);
6467 result->val = term1/gstar.val;
6568 result->err = 2.0 * GSL_DBL_EPSILON * (fabs(a*ln_term.val) + 1.0) * fabs(result->val);
69 /* Include propagated error from log term */
70 result->err += fabs(a) * ln_term.err * fabs(result->val);
6671 result->err += gstar.err/fabs(gstar.val) * fabs(result->val);
6772 return GSL_SUCCESS;
6873 }
7681 int
7782 gamma_inc_P_series(const double a, const double x, gsl_sf_result * result)
7883 {
79 const int nmax = 5000;
84 const int nmax = 10000;
8085
8186 gsl_sf_result D;
8287 int stat_D = gamma_inc_D(a, x, &D);
8388
84 double sum = 1.0;
85 double term = 1.0;
86 int n;
87 for(n=1; n<nmax; n++) {
88 term *= x/(a+n);
89 sum += term;
90 if(fabs(term/sum) < GSL_DBL_EPSILON) break;
91 }
92
93 result->val = D.val * sum;
94 result->err = D.err * fabs(sum);
95 result->err += (1.0 + n) * GSL_DBL_EPSILON * fabs(result->val);
96
97 if(n == nmax)
98 GSL_ERROR ("error", GSL_EMAXITER);
99 else
100 return stat_D;
89 /* Approximating the terms of the series using Stirling's
90 approximation gives t_n = (x/a)^n * exp(-n(n+1)/(2a)), so the
91 convergence condition is n^2 / (2a) + (1-(x/a) + (1/2a)) n >>
92 -log(GSL_DBL_EPS) if we want t_n < O(1e-16) t_0. The condition
93 below detects cases where the minimum value of n is > 5000 */
94
95 if (x > 0.995 * a && a > 1e5) { /* Difficult case: try continued fraction */
96 gsl_sf_result cf_res;
97 int status = gsl_sf_exprel_n_CF_e(a, x, &cf_res);
98 result->val = D.val * cf_res.val;
99 result->err = fabs(D.val * cf_res.err) + fabs(D.err * cf_res.val);
100 return status;
101 }
102
103 /* Series would require excessive number of terms */
104
105 if (x > (a + nmax)) {
106 GSL_ERROR ("gamma_inc_P_series x>>a exceeds range", GSL_EMAXITER);
107 }
108
109 /* Normal case: sum the series */
110
111 {
112 double sum = 1.0;
113 double term = 1.0;
114 double remainder;
115 int n;
116
117 /* Handle lower part of the series where t_n is increasing, |x| > a+n */
118
119 int nlow = (x > a) ? (x - a): 0;
120
121 for(n=1; n < nlow; n++) {
122 term *= x/(a+n);
123 sum += term;
124 }
125
126 /* Handle upper part of the series where t_n is decreasing, |x| < a+n */
127
128 for (/* n = previous n */ ; n<nmax; n++) {
129 term *= x/(a+n);
130 sum += term;
131 if(fabs(term/sum) < GSL_DBL_EPSILON) break;
132 }
133
134 /* Estimate remainder of series ~ t_(n+1)/(1-x/(a+n+1)) */
135 {
136 double tnp1 = (x/(a+n)) * term;
137 remainder = tnp1 / (1.0 - x/(a + n + 1.0));
138 }
139
140 result->val = D.val * sum;
141 result->err = D.err * fabs(sum) + fabs(D.val * remainder);
142 result->err += (1.0 + n) * GSL_DBL_EPSILON * fabs(result->val);
143
144 if(n == nmax && fabs(remainder/sum) > GSL_SQRT_DBL_EPSILON)
145 GSL_ERROR ("gamma_inc_P_series failed to converge", GSL_EMAXITER);
146 else
147 return stat_D;
148 }
101149 }
102150
103151
101101 int gsl_sf_exprel_n_e(const int n, const double x, gsl_sf_result * result);
102102 double gsl_sf_exprel_n(const int n, const double x);
103103
104 int gsl_sf_exprel_n_CF_e(const double n, const double x, gsl_sf_result * result);
105
104106
105107 /* Exponentiate a quantity with an associated error.
106108 */
192192 */
193193 int gsl_sf_legendre_array_size(const int lmax, const int m);
194194
195
196195 /* Irregular Spherical Conical Function
197196 * P^{1/2}_{-1/2 + I lambda}(x)
198197 *
310309 int gsl_sf_legendre_H3d_array(const int lmax, const double lambda, const double eta, double * result_array);
311310
312311
313 #ifdef HAVE_INLINE
314 extern inline
315 int
316 gsl_sf_legendre_array_size(const int lmax, const int m)
317 {
318 return lmax-m+1;
319 }
320 #endif /* HAVE_INLINE */
321
322
323312 __END_DECLS
324313
325314 #endif /* __GSL_SF_LEGENDRE_H__ */
736736 }
737737 }
738738
739
740 #ifndef HIDE_INLINE_STATIC
741739 int
742740 gsl_sf_legendre_array_size(const int lmax, const int m)
743741 {
744742 return lmax-m+1;
745743 }
746 #endif
747
748744
749745 /*-*-*-*-*-*-*-*-*-* Functions w/ Natural Prototypes *-*-*-*-*-*-*-*-*-*-*/
750746
201201
202202 /* Regression test Martin Jansche <jansche@ling.ohio-state.edu> BUG#12 */
203203 TEST_SF(s, gsl_sf_gamma_inc_P_e, (10, 1e-16, &r), 2.755731922398588814734648067e-167, TEST_TOL2, GSL_SUCCESS);
204
205 /* Regression test for gsl_cdf_chisq_Pinv, (0.05, 1263131.0) */
206 TEST_SF(s, gsl_sf_gamma_inc_P_e, (1263131.0, 1261282.3637, &r), 0.04994777516935182963821362168, TEST_TOL4, GSL_SUCCESS);
207 TEST_SF(s, gsl_sf_gamma_inc_P_e, (1263131.0, 1263131.0, &r), 0.500118321758657770672882362502514254, TEST_TOL4, GSL_SUCCESS);
204208
205209 TEST_SF(s, gsl_sf_gamma_inc_Q_e, (0.0, 0.001, &r), 0.0, TEST_TOL0, GSL_SUCCESS);
206210 TEST_SF(s, gsl_sf_gamma_inc_Q_e, (0.001, 0.001, &r), 0.006312353291139709793, TEST_TOL0, GSL_SUCCESS);
258258
259259 TEST_SF(s, gsl_sf_hyperg_1F1_e, (-26, 2.0, 100.0, &r), 1.444786781107436954e+19, TEST_TOL3, GSL_SUCCESS);
260260
261 #if 0
261 #ifdef FIXME
262262 /* This one is computed with a huge error, there is loss of
263263 precision but the error estimate flags the problem (assuming the
264264 user looks at it). We should probably trap any return with
275275
276276 TEST_SF(s, gsl_sf_hyperg_1F1_e, (1.0, 1000000.5, 1001000.5, &r), 3480.3699557431856166, TEST_TOL4, GSL_SUCCESS);
277277
278 #if 0 /* FIX THESE NEXT RELEASE */
278 #ifdef FIXME /* FIX THESE NEXT RELEASE */
279279 TEST_SF(s, gsl_sf_hyperg_1F1_e, (1.1, 1000000.5, 1001000.5, &r), 7304.6126942641350122, TEST_TOL3, GSL_SUCCESS);
280280 TEST_SF(s, gsl_sf_hyperg_1F1_e, (0.9, 1000000.5, 1001000.5, &r), 1645.4879293475410982, TEST_TOL3, GSL_SUCCESS);
281281 #endif
423423 TEST_SF(s, gsl_sf_hyperg_U_e, (-50.5, 100.1, 70, &r), 3.249026971618851e+84, TEST_TOL2, GSL_SUCCESS);
424424 TEST_SF(s, gsl_sf_hyperg_U_e, (-50.5, 100.1, 100, &r), 1.003401902126641e+85, TEST_TOL1, GSL_SUCCESS);
425425
426 /* Bug report from Stefan Gerlach */
427
428 #ifdef FIXME
429 TEST_SF(s, gsl_sf_hyperg_U_e, (-2.0, 4.0, 1.0, &r), 11.0, TEST_TOL0, GSL_SUCCESS);
430 #endif
426431
427432 /* 2F1 */
428433
460465
461466 /* added special handling with x == 1.0 , Richard J. Mathar, 2008-01-09 */
462467
463 TEST_SF(s, gsl_sf_hyperg_2F1_e, (1.5, 0.5, 3.0, 1.0, &r), 1.6976527263135502482014268 , TEST_TOL0, GSL_SUCCESS);
464 TEST_SF(s, gsl_sf_hyperg_2F1_e, (1.5, -4.2, 3.0, 1.0, &r), .15583601560025710649555254 , TEST_TOL0, GSL_SUCCESS);
465 TEST_SF(s, gsl_sf_hyperg_2F1_e, (-7.4, 0.7, -1.5, 1.0, &r), -.34478866959246584996859 , TEST_TOL0, GSL_SUCCESS);
466 TEST_SF(s, gsl_sf_hyperg_2F1_e, (0.1, -2.7, -1.5, 1.0, &r), 1.059766766063610122925 , TEST_TOL0, GSL_SUCCESS);
468 TEST_SF(s, gsl_sf_hyperg_2F1_e, (1.5, 0.5, 3.0, 1.0, &r), 1.6976527263135502482014268 , TEST_TOL2, GSL_SUCCESS);
469 TEST_SF(s, gsl_sf_hyperg_2F1_e, (1.5, -4.2, 3.0, 1.0, &r), .15583601560025710649555254 , TEST_TOL2, GSL_SUCCESS);
470 TEST_SF(s, gsl_sf_hyperg_2F1_e, (-7.4, 0.7, -1.5, 1.0, &r), -.34478866959246584996859 , TEST_TOL2, GSL_SUCCESS);
471 TEST_SF(s, gsl_sf_hyperg_2F1_e, (0.1, -2.7, -1.5, 1.0, &r), 1.059766766063610122925 , TEST_TOL2, GSL_SUCCESS);
467472
468473 /* 2F1 conj */
469474
489489 TEST_SF(s, gsl_sf_legendre_H3d_e, (5, 1.0e+08, 1.0e-08, &r), 0.00009256115861125841299, TEST_TOL2, GSL_SUCCESS);
490490 TEST_SF(s, gsl_sf_legendre_H3d_e, (5, 1.0e+08, 100.0, &r), -6.496143209092860765e-52 , 128.0*TEST_SQRT_TOL0, GSL_SUCCESS);
491491
492 #if 0
492 #if FIXME
493493 sa = 0;
494494 gsl_sf_legendre_H3d_array(100, 1.0, 3.0, L);
495495 TEST_SF_VAL(sa, L[0], +0.0, gsl_sf_legendre_H3d(0, 1.0, 3.0), 1.0e-12);
535535 TEST_SF(s, gsl_sf_ellint_Kcomp_e, ( 0.50, mode, &r), 1.6857503548125960429, TEST_TOL0, GSL_SUCCESS);
536536 TEST_SF(s, gsl_sf_ellint_Kcomp_e, (0.010, mode, &r), 1.5708355989121522360, TEST_TOL0, GSL_SUCCESS);
537537
538 /* Bug report from Thies Heidecke */
539 TEST_SF(s, gsl_sf_ellint_Kcomp_e, ( 0.99999999906867742538, mode, &r), 11.4369284843320018031, TEST_SNGL, GSL_SUCCESS);
540
538541 TEST_SF(s, gsl_sf_ellint_Ecomp_e, (0.99, mode, &r), 1.0284758090288040010, TEST_TOL0, GSL_SUCCESS);
539542 TEST_SF(s, gsl_sf_ellint_Ecomp_e, (0.50, mode, &r), 1.4674622093394271555, TEST_TOL0, GSL_SUCCESS);
540543 TEST_SF(s, gsl_sf_ellint_Ecomp_e, (0.01, mode, &r), 1.5707570561503852873, TEST_TOL0, GSL_SUCCESS);
996999 /* Test cases from Szymon Jaroszewicz */
9971000
9981001 TEST_SF_E10(s, gsl_sf_exp_mult_e10_e, (10000.0, 1.0, &re), 8.806818225662921587261496007, 4342, TEST_TOL5, GSL_SUCCESS);
999 TEST_SF_E10(s, gsl_sf_exp_mult_e10_e, (100.0, 1.0, &re), 2.688117141816135448412625551e43, 0, TEST_TOL1, GSL_SUCCESS);
1000 TEST_SF_E10(s, gsl_sf_exp_e10_e, (100.0, &re), 2.688117141816135448412625551e43, 0, TEST_TOL1, GSL_SUCCESS);
1001 TEST_SF_E10(s, gsl_sf_exp_e10_e, (1000.0, &re), 1.970071114017046993888879352, 434, TEST_TOL1, GSL_SUCCESS);
1002 TEST_SF_E10(s, gsl_sf_exp_e10_e, (-100.0, &re), 3.720075976020835962959695803e-44, 0, TEST_TOL1, GSL_SUCCESS);
1003 TEST_SF_E10(s, gsl_sf_exp_e10_e, (-1000.0, &re), 5.075958897549456765291809479, -435, TEST_TOL1, GSL_SUCCESS);
1002 TEST_SF_E10(s, gsl_sf_exp_mult_e10_e, (100.0, 1.0, &re), 2.688117141816135448412625551e43, 0, TEST_TOL2, GSL_SUCCESS);
1003 TEST_SF_E10(s, gsl_sf_exp_e10_e, (100.0, &re), 2.688117141816135448412625551e43, 0, TEST_TOL2, GSL_SUCCESS);
1004 TEST_SF_E10(s, gsl_sf_exp_e10_e, (1000.0, &re), 1.970071114017046993888879352, 434, TEST_TOL3, GSL_SUCCESS);
1005 TEST_SF_E10(s, gsl_sf_exp_e10_e, (-100.0, &re), 3.720075976020835962959695803e-44, 0, TEST_TOL2, GSL_SUCCESS);
1006 TEST_SF_E10(s, gsl_sf_exp_e10_e, (-1000.0, &re), 5.075958897549456765291809479, -435, TEST_TOL3, GSL_SUCCESS);
10041007
10051008 TEST_SF(s, gsl_sf_expm1_e, (-10.0, &r), exp(-10.0)-1.0, TEST_TOL0, GSL_SUCCESS);
10061009 TEST_SF(s, gsl_sf_expm1_e, (-0.001, &r), -0.00099950016662500845, TEST_TOL0, GSL_SUCCESS);
10641067 TEST_SF(s, gsl_sf_exprel_n_e, (500, 500.0, &r), 28.363019877927630858, TEST_TOL2, GSL_SUCCESS);
10651068 TEST_SF(s, gsl_sf_exprel_n_e, (500, 1000.0, &r), 2.4037563160335300322e+68, TEST_TOL4, GSL_SUCCESS);
10661069 TEST_SF(s, gsl_sf_exprel_n_e, (500, 1600.0, &r), 7.899293535320607403e+226, TEST_TOL4, GSL_SUCCESS);
1070
1071 TEST_SF(s, gsl_sf_exprel_n_e, (1263131.0, 1261282.3637, &r), 545.0113107238425900305428360, TEST_TOL4, GSL_SUCCESS);
1072 TEST_SF(s, gsl_sf_exprel_n_CF_e, (6.315655e+05, 6.302583168053568806e+05, &r), 385.425369029433473098652465720, TEST_TOL4, GSL_SUCCESS);
10671073
10681074 return s;
10691075 }
0 2008-07-03 Brian Gough <bjg@hp2.network-theory.co.uk>
1
2 * Makefile.am (INCLUDES): use top_srcdir instead of top_builddir
3
04 2007-10-02 Brian Gough <bjg@network-theory.co.uk>
15
26 * variance_source.c: added functions for sum of squares and
33
44 pkginclude_HEADERS = gsl_statistics.h gsl_statistics_char.h gsl_statistics_double.h gsl_statistics_float.h gsl_statistics_int.h gsl_statistics_long.h gsl_statistics_long_double.h gsl_statistics_short.h gsl_statistics_uchar.h gsl_statistics_uint.h gsl_statistics_ulong.h gsl_statistics_ushort.h
55
6 INCLUDES= -I$(top_builddir) -I$(top_srcdir)
6 INCLUDES = -I$(top_srcdir)
77
88 libgslstatistics_la_SOURCES = mean.c variance.c absdev.c skew.c kurtosis.c lag1.c p_variance.c minmax.c ttest.c median.c covariance.c quantiles.c wmean.c wvariance.c wabsdev.c wskew.c wkurtosis.c
99
134134 LIBOBJS = @LIBOBJS@
135135 LIBS = @LIBS@
136136 LIBTOOL = @LIBTOOL@
137 LIPO = @LIPO@
137138 LN_S = @LN_S@
138139 LTLIBOBJS = @LTLIBOBJS@
139140 MAINT = @MAINT@
141142 MKDIR_P = @MKDIR_P@
142143 NM = @NM@
143144 NMEDIT = @NMEDIT@
145 OBJDUMP = @OBJDUMP@
144146 OBJEXT = @OBJEXT@
147 OTOOL = @OTOOL@
148 OTOOL64 = @OTOOL64@
145149 PACKAGE = @PACKAGE@
146150 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
147151 PACKAGE_NAME = @PACKAGE_NAME@
206210 top_srcdir = @top_srcdir@
207211 noinst_LTLIBRARIES = libgslstatistics.la
208212 pkginclude_HEADERS = gsl_statistics.h gsl_statistics_char.h gsl_statistics_double.h gsl_statistics_float.h gsl_statistics_int.h gsl_statistics_long.h gsl_statistics_long_double.h gsl_statistics_short.h gsl_statistics_uchar.h gsl_statistics_uint.h gsl_statistics_ulong.h gsl_statistics_ushort.h
209 INCLUDES = -I$(top_builddir) -I$(top_srcdir)
213 INCLUDES = -I$(top_srcdir)
210214 libgslstatistics_la_SOURCES = mean.c variance.c absdev.c skew.c kurtosis.c lag1.c p_variance.c minmax.c ttest.c median.c covariance.c quantiles.c wmean.c wvariance.c wabsdev.c wskew.c wkurtosis.c
211215 noinst_HEADERS = mean_source.c variance_source.c covariance_source.c absdev_source.c skew_source.c kurtosis_source.c lag1_source.c p_variance_source.c minmax_source.c ttest_source.c median_source.c quantiles_source.c wmean_source.c wvariance_source.c wabsdev_source.c wskew_source.c wkurtosis_source.c test_float_source.c test_int_source.c
212216 TESTS = $(check_PROGRAMS)
0 2008-07-03 Brian Gough <bjg@hp2.network-theory.co.uk>
1
2 * Makefile.am (INCLUDES): use top_srcdir instead of top_builddir
3
04 Thu Dec 21 21:46:54 2000 Brian Gough <bjg@network-theory.co.uk>
15
26 * changed err to abserr, to make it clear that it is an absolute
11
22 pkginclude_HEADERS = gsl_sum.h
33
4 INCLUDES= -I$(top_builddir)
4 INCLUDES = -I$(top_srcdir)
55
66 libgslsum_la_SOURCES = levin_u.c levin_utrunc.c work_u.c work_utrunc.c
77
132132 LIBOBJS = @LIBOBJS@
133133 LIBS = @LIBS@
134134 LIBTOOL = @LIBTOOL@
135 LIPO = @LIPO@
135136 LN_S = @LN_S@
136137 LTLIBOBJS = @LTLIBOBJS@
137138 MAINT = @MAINT@
139140 MKDIR_P = @MKDIR_P@
140141 NM = @NM@
141142 NMEDIT = @NMEDIT@
143 OBJDUMP = @OBJDUMP@
142144 OBJEXT = @OBJEXT@
145 OTOOL = @OTOOL@
146 OTOOL64 = @OTOOL64@
143147 PACKAGE = @PACKAGE@
144148 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
145149 PACKAGE_NAME = @PACKAGE_NAME@
204208 top_srcdir = @top_srcdir@
205209 noinst_LTLIBRARIES = libgslsum.la
206210 pkginclude_HEADERS = gsl_sum.h
207 INCLUDES = -I$(top_builddir)
211 INCLUDES = -I$(top_srcdir)
208212 libgslsum_la_SOURCES = levin_u.c levin_utrunc.c work_u.c work_utrunc.c
209213 TESTS = $(check_PROGRAMS)
210214 test_LDADD = libgslsum.la ../ieee-utils/libgslieeeutils.la ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la ../utils/libutils.la
0 2008-10-13 Brian Gough <bjg@network-theory.co.uk>
1
2 * log1p.c: use gsl_sys.h header file
3
4 * infnan.c: use gsl_sys.h header file
5
6 * hypot.c: use gsl_sys.h header file
7
8 * fdiv.c: use gsl_sys.h header file
9
10 * coerce.c: use gsl_sys.h header file
11
12 2008-10-08 Brian Gough <bjg@network-theory.co.uk>
13
14 * infnan.c (gsl_isinf): handle the case where isinf(-inf)
15 returns +1
16
17 2008-07-03 Brian Gough <bjg@hp2.network-theory.co.uk>
18
19 * prec.c: compile inline functions from header here
20
21 * pow_int.c: compile inline functions from header here
22
23 * minmax.c: compile inline functions from header here
24
025 2008-03-18 Brian Gough <bjg@network-theory.co.uk>
126
227 * test.c (main): use volatile to avoid extended precision in loop
33
44 libgslsys_la_SOURCES = minmax.c prec.c hypot.c log1p.c expm1.c coerce.c invhyp.c pow_int.c infnan.c fdiv.c fcmp.c ldfrexp.c
55
6 INCLUDES = -I$(top_builddir)
6 INCLUDES = -I$(top_srcdir)
77
88 check_PROGRAMS = test
99 TESTS = $(check_PROGRAMS)
133133 LIBOBJS = @LIBOBJS@
134134 LIBS = @LIBS@
135135 LIBTOOL = @LIBTOOL@
136 LIPO = @LIPO@
136137 LN_S = @LN_S@
137138 LTLIBOBJS = @LTLIBOBJS@
138139 MAINT = @MAINT@
140141 MKDIR_P = @MKDIR_P@
141142 NM = @NM@
142143 NMEDIT = @NMEDIT@
144 OBJDUMP = @OBJDUMP@
143145 OBJEXT = @OBJEXT@
146 OTOOL = @OTOOL@
147 OTOOL64 = @OTOOL64@
144148 PACKAGE = @PACKAGE@
145149 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
146150 PACKAGE_NAME = @PACKAGE_NAME@
206210 noinst_LTLIBRARIES = libgslsys.la
207211 pkginclude_HEADERS = gsl_sys.h
208212 libgslsys_la_SOURCES = minmax.c prec.c hypot.c log1p.c expm1.c coerce.c invhyp.c pow_int.c infnan.c fdiv.c fcmp.c ldfrexp.c
209 INCLUDES = -I$(top_builddir)
213 INCLUDES = -I$(top_srcdir)
210214 TESTS = $(check_PROGRAMS)
211215 test_SOURCES = test.c
212216 test_LDADD = libgslsys.la ../ieee-utils/libgslieeeutils.la ../err/libgslerr.la ../test/libgsltest.la libgslsys.la ../utils/libutils.la
1818
1919 #include <config.h>
2020 #include <math.h>
21
22 double gsl_coerce_double (const double x);
21 #include <gsl/gsl_sys.h>
2322
2423 double
2524 gsl_coerce_double (const double x)
2827 y = x;
2928 return y;
3029 }
31
32 float gsl_coerce_float (const float x);
3330
3431 float
3532 gsl_coerce_float (const float x)
4138
4239 /* The following function is not needed, but is included for completeness */
4340
44 long double gsl_coerce_long_double (const long double x);
45
4641 long double
4742 gsl_coerce_long_double (const long double x)
4843 {
1818
1919 #include <config.h>
2020 #include <math.h>
21
22 double gsl_fdiv (const double x, const double y);
21 #include <gsl/gsl_sys.h>
2322
2423 double
2524 gsl_fdiv (const double x, const double y)
1919 #include <config.h>
2020 #include <math.h>
2121 #include <gsl/gsl_math.h>
22
23 double gsl_hypot (const double x, const double y);
24 double gsl_hypot3 (const double x, const double y, const double z);
2522
2623 double gsl_hypot (const double x, const double y)
2724 {
2323 #include <ieeefp.h>
2424 #endif
2525
26 double gsl_nan (void);
27 double gsl_posinf (void);
28 double gsl_neginf (void);
29 double gsl_fdiv (const double x, const double y);
26 #include <gsl/gsl_sys.h>
3027
3128 double gsl_nan (void)
3229 {
117114 int
118115 gsl_isinf (const double x)
119116 {
120 return isinf(x);
117 /* isinf(3): In glibc 2.01 and earlier, isinf() returns a
118 non-zero value (actually: 1) if x is an infinity (positive or
119 negative). (This is all that C99 requires.) */
120
121 if (isinf(x))
122 {
123 return (x > 0) ? 1 : -1;
124 }
125 else
126 {
127 return 0;
128 }
121129 }
122130 # else
123131
1818
1919 #include <config.h>
2020 #include <math.h>
21
22 double gsl_log1p (const double x);
21 #include <gsl/gsl_sys.h>
2322
2423 double gsl_log1p (const double x)
2524 {
1818
1919 #include <config.h>
2020
21 #define GSL_MAX(a,b) ((a) > (b) ? (a) : (b))
22 #define GSL_MIN(a,b) ((a) < (b) ? (a) : (b))
21 /* Compile all the inline functions */
2322
24 #ifndef HIDE_INLINE_STATIC
25 int GSL_MAX_INT (int a, int b);
26 int GSL_MIN_INT (int a, int b);
27 double GSL_MAX_DBL (double a, double b);
28 double GSL_MIN_DBL (double a, double b);
29 long double GSL_MAX_LDBL (long double a, long double b);
30 long double GSL_MIN_LDBL (long double a, long double b);
31
32 int
33 GSL_MAX_INT (int a, int b)
34 {
35 return GSL_MAX (a, b);
36 }
37
38 int
39 GSL_MIN_INT (int a, int b)
40 {
41 return GSL_MIN (a, b);
42 }
43
44 double
45 GSL_MAX_DBL (double a, double b)
46 {
47 return GSL_MAX (a, b);
48 }
49
50 double
51 GSL_MIN_DBL (double a, double b)
52 {
53 return GSL_MIN (a, b);
54 }
55
56 long double
57 GSL_MAX_LDBL (long double a, long double b)
58 {
59 return GSL_MAX (a, b);
60 }
61
62 long double
63 GSL_MIN_LDBL (long double a, long double b)
64 {
65 return GSL_MIN (a, b);
66 }
67 #endif
23 #define COMPILE_INLINE_STATIC
24 #include "build.h"
25 #include <gsl/gsl_minmax.h>
6826
6927 /* Define some static functions which are always available */
70
71 double gsl_max (double a, double b);
72 double gsl_min (double a, double b);
7328
7429 double gsl_max (double a, double b)
7530 {
1717 */
1818 #include <config.h>
1919 #include <math.h>
20
21 /* Compile all the inline functions */
22
23 #define COMPILE_INLINE_STATIC
24 #include "build.h"
2025 #include <gsl/gsl_pow_int.h>
21
22 #ifndef HIDE_INLINE_STATIC
23 double gsl_pow_2(const double x) { return x*x; }
24 double gsl_pow_3(const double x) { return x*x*x; }
25 double gsl_pow_4(const double x) { double x2 = x*x; return x2*x2; }
26 double gsl_pow_5(const double x) { double x2 = x*x; return x2*x2*x; }
27 double gsl_pow_6(const double x) { double x2 = x*x; return x2*x2*x2; }
28 double gsl_pow_7(const double x) { double x3 = x*x*x; return x3*x3*x; }
29 double gsl_pow_8(const double x) { double x2 = x*x; double x4 = x2*x2; return x4*x4; }
30 double gsl_pow_9(const double x) { double x3 = x*x*x; return x3*x3*x3; }
31 #endif
3226
3327 double gsl_pow_int(double x, int n)
3428 {
2020
2121 #include <config.h>
2222 #include <gsl/gsl_machine.h>
23
24 /* Compile all the inline functions */
25
26 #define COMPILE_INLINE_STATIC
27 #include "build.h"
2328 #include <gsl/gsl_precision.h>
29 #include <gsl/gsl_mode.h>
2430
2531 const double gsl_prec_eps[_GSL_PREC_T_NUM] = {
2632 GSL_DBL_EPSILON,
5864 GSL_ROOT6_SFLT_EPSILON
5965 };
6066
61 typedef unsigned int gsl_mode_t;
62
63 #ifndef HIDE_INLINE_STATIC
64 /* We need this somewhere, in case the inline is ignored.
65 */
66
67 unsigned int GSL_MODE_PREC(gsl_mode_t mt);
68
69 unsigned int
70 GSL_MODE_PREC(gsl_mode_t mt)
71 {
72 return (mt & (unsigned int)7);
73 }
74 #endif
454454 s = gsl_isinf (inf);
455455 gsl_test_int (s, 1, "gsl_isinf(inf)");
456456
457 /* isinf(3): In glibc 2.01 and earlier, isinf() returns a
458 non-zero value (actually: 1) if x is an infinity (positive or
459 negative). (This is all that C99 requires.) */
460
461457 s = gsl_isinf (-inf);
462 gsl_test (s == 0, "gsl_isinf(-inf) is non-zero");
458 gsl_test_int (s, -1, "gsl_isinf(-inf)");
463459
464460 s = gsl_isinf (nan);
465461 gsl_test_int (s, 0, "gsl_isinf(nan)");
125125 LIBOBJS = @LIBOBJS@
126126 LIBS = @LIBS@
127127 LIBTOOL = @LIBTOOL@
128 LIPO = @LIPO@
128129 LN_S = @LN_S@
129130 LTLIBOBJS = @LTLIBOBJS@
130131 MAINT = @MAINT@
132133 MKDIR_P = @MKDIR_P@
133134 NM = @NM@
134135 NMEDIT = @NMEDIT@
136 OBJDUMP = @OBJDUMP@
135137 OBJEXT = @OBJEXT@
138 OTOOL = @OTOOL@
139 OTOOL64 = @OTOOL64@
136140 PACKAGE = @PACKAGE@
137141 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
138142 PACKAGE_NAME = @PACKAGE_NAME@
115115 LIBOBJS = @LIBOBJS@
116116 LIBS = @LIBS@
117117 LIBTOOL = @LIBTOOL@
118 LIPO = @LIPO@
118119 LN_S = @LN_S@
119120 LTLIBOBJS = @LTLIBOBJS@
120121 MAINT = @MAINT@
122123 MKDIR_P = @MKDIR_P@
123124 NM = @NM@
124125 NMEDIT = @NMEDIT@
126 OBJDUMP = @OBJDUMP@
125127 OBJEXT = @OBJEXT@
128 OTOOL = @OTOOL@
129 OTOOL64 = @OTOOL64@
126130 PACKAGE = @PACKAGE@
127131 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
128132 PACKAGE_NAME = @PACKAGE_NAME@
0 2008-09-27 Brian Gough <bjg@network-theory.co.uk>
1
2 * gsl_vector_complex_double.h: added missing functions isnonneg,
3 add, sub, mul, div, scale, add_constant
4
5 2008-07-03 Brian Gough <bjg@hp2.network-theory.co.uk>
6
7 * gsl_vector.h: use new inline declarations in all header files
8
9 * vector.c: compile inline functions from header here
10
11 * vector_source.c: removed
12
13 * Makefile.am (INCLUDES): use top_srcdir instead of top_builddir
14
015 2007-08-21 Brian Gough <bjg@network-theory.co.uk>
116
217 * prop_source.c (FUNCTION): added gsl_vector_isnonneg
33
44 pkginclude_HEADERS = gsl_vector.h gsl_vector_char.h gsl_vector_complex.h gsl_vector_complex_double.h gsl_vector_complex_float.h gsl_vector_complex_long_double.h gsl_vector_double.h gsl_vector_float.h gsl_vector_int.h gsl_vector_long.h gsl_vector_long_double.h gsl_vector_short.h gsl_vector_uchar.h gsl_vector_uint.h gsl_vector_ulong.h gsl_vector_ushort.h
55
6 INCLUDES= -I$(top_builddir) -I$(top_srcdir)
6 INCLUDES = -I$(top_srcdir)
77
88 TESTS = $(check_PROGRAMS)
99
1515
1616 CLEANFILES = test.txt test.dat
1717
18 noinst_HEADERS = vector_source.c init_source.c file_source.c copy_source.c swap_source.c prop_source.c test_complex_source.c test_source.c minmax_source.c oper_source.c reim_source.c subvector_source.c view_source.c
18 noinst_HEADERS = init_source.c file_source.c copy_source.c swap_source.c prop_source.c test_complex_source.c test_source.c minmax_source.c oper_source.c oper_complex_source.c reim_source.c subvector_source.c view_source.c
1919
2020 libgslvector_la_SOURCES = init.c file.c vector.c copy.c swap.c prop.c minmax.c oper.c reim.c subvector.c view.c view.h
139139 LIBOBJS = @LIBOBJS@
140140 LIBS = @LIBS@
141141 LIBTOOL = @LIBTOOL@
142 LIPO = @LIPO@
142143 LN_S = @LN_S@
143144 LTLIBOBJS = @LTLIBOBJS@
144145 MAINT = @MAINT@
146147 MKDIR_P = @MKDIR_P@
147148 NM = @NM@
148149 NMEDIT = @NMEDIT@
150 OBJDUMP = @OBJDUMP@
149151 OBJEXT = @OBJEXT@
152 OTOOL = @OTOOL@
153 OTOOL64 = @OTOOL64@
150154 PACKAGE = @PACKAGE@
151155 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
152156 PACKAGE_NAME = @PACKAGE_NAME@
211215 top_srcdir = @top_srcdir@
212216 noinst_LTLIBRARIES = libgslvector.la
213217 pkginclude_HEADERS = gsl_vector.h gsl_vector_char.h gsl_vector_complex.h gsl_vector_complex_double.h gsl_vector_complex_float.h gsl_vector_complex_long_double.h gsl_vector_double.h gsl_vector_float.h gsl_vector_int.h gsl_vector_long.h gsl_vector_long_double.h gsl_vector_short.h gsl_vector_uchar.h gsl_vector_uint.h gsl_vector_ulong.h gsl_vector_ushort.h
214 INCLUDES = -I$(top_builddir) -I$(top_srcdir)
218 INCLUDES = -I$(top_srcdir)
215219 TESTS = $(check_PROGRAMS)
216220 test_LDADD = libgslvector.la ../block/libgslblock.la ../ieee-utils/libgslieeeutils.la ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la ../utils/libutils.la
217221 test_static_LDADD = libgslvector.la ../block/libgslblock.la ../ieee-utils/libgslieeeutils.la ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la ../utils/libutils.la
218222 test_SOURCES = test.c
219223 test_static_SOURCES = test_static.c
220224 CLEANFILES = test.txt test.dat
221 noinst_HEADERS = vector_source.c init_source.c file_source.c copy_source.c swap_source.c prop_source.c test_complex_source.c test_source.c minmax_source.c oper_source.c reim_source.c subvector_source.c view_source.c
225 noinst_HEADERS = init_source.c file_source.c copy_source.c swap_source.c prop_source.c test_complex_source.c test_source.c minmax_source.c oper_source.c oper_complex_source.c reim_source.c subvector_source.c view_source.c
222226 libgslvector_la_SOURCES = init.c file.c vector.c copy.c swap.c prop.c minmax.c oper.c reim.c subvector.c view.c view.h
223227 all: all-am
224228
2222 #include <stdlib.h>
2323 #include <gsl/gsl_types.h>
2424 #include <gsl/gsl_errno.h>
25 #include <gsl/gsl_inline.h>
2526 #include <gsl/gsl_check_range.h>
2627 #include <gsl/gsl_block_char.h>
2728
121122
122123 /* Operations */
123124
124 char gsl_vector_char_get (const gsl_vector_char * v, const size_t i);
125 void gsl_vector_char_set (gsl_vector_char * v, const size_t i, char x);
126
127 char *gsl_vector_char_ptr (gsl_vector_char * v, const size_t i);
128 const char *gsl_vector_char_const_ptr (const gsl_vector_char * v, const size_t i);
129
130125 void gsl_vector_char_set_zero (gsl_vector_char * v);
131126 void gsl_vector_char_set_all (gsl_vector_char * v, char x);
132127 int gsl_vector_char_set_basis (gsl_vector_char * v, size_t i);
164159 int gsl_vector_char_isneg (const gsl_vector_char * v);
165160 int gsl_vector_char_isnonneg (const gsl_vector_char * v);
166161
162 INLINE_DECL char gsl_vector_char_get (const gsl_vector_char * v, const size_t i);
163 INLINE_DECL void gsl_vector_char_set (gsl_vector_char * v, const size_t i, char x);
164 INLINE_DECL char * gsl_vector_char_ptr (gsl_vector_char * v, const size_t i);
165 INLINE_DECL const char * gsl_vector_char_const_ptr (const gsl_vector_char * v, const size_t i);
166
167167 #ifdef HAVE_INLINE
168168
169 extern inline
169 INLINE_FUN
170170 char
171171 gsl_vector_char_get (const gsl_vector_char * v, const size_t i)
172172 {
173173 #if GSL_RANGE_CHECK
174 if (i >= v->size)
174 if (GSL_RANGE_COND(i >= v->size))
175175 {
176176 GSL_ERROR_VAL ("index out of range", GSL_EINVAL, 0);
177177 }
179179 return v->data[i * v->stride];
180180 }
181181
182 extern inline
182 INLINE_FUN
183183 void
184184 gsl_vector_char_set (gsl_vector_char * v, const size_t i, char x)
185185 {
186186 #if GSL_RANGE_CHECK
187 if (i >= v->size)
187 if (GSL_RANGE_COND(i >= v->size))
188188 {
189189 GSL_ERROR_VOID ("index out of range", GSL_EINVAL);
190190 }
192192 v->data[i * v->stride] = x;
193193 }
194194
195 extern inline
195 INLINE_FUN
196196 char *
197197 gsl_vector_char_ptr (gsl_vector_char * v, const size_t i)
198198 {
199199 #if GSL_RANGE_CHECK
200 if (i >= v->size)
200 if (GSL_RANGE_COND(i >= v->size))
201201 {
202202 GSL_ERROR_NULL ("index out of range", GSL_EINVAL);
203203 }
205205 return (char *) (v->data + i * v->stride);
206206 }
207207
208 extern inline
208 INLINE_FUN
209209 const char *
210210 gsl_vector_char_const_ptr (const gsl_vector_char * v, const size_t i)
211211 {
212212 #if GSL_RANGE_CHECK
213 if (i >= v->size)
213 if (GSL_RANGE_COND(i >= v->size))
214214 {
215215 GSL_ERROR_NULL ("index out of range", GSL_EINVAL);
216216 }
217217 #endif
218218 return (const char *) (v->data + i * v->stride);
219219 }
220
221
222220 #endif /* HAVE_INLINE */
223221
224222 __END_DECLS
140140
141141
142142 /* Operations */
143
144 gsl_complex
145 gsl_vector_complex_get (const gsl_vector_complex * v, const size_t i);
146
147 void gsl_vector_complex_set (gsl_vector_complex * v, const size_t i,
148 gsl_complex z);
149
150 gsl_complex
151 *gsl_vector_complex_ptr (gsl_vector_complex * v, const size_t i);
152
153 const gsl_complex
154 *gsl_vector_complex_const_ptr (const gsl_vector_complex * v, const size_t i);
155143
156144 void gsl_vector_complex_set_zero (gsl_vector_complex * v);
157145 void gsl_vector_complex_set_all (gsl_vector_complex * v,
178166 int gsl_vector_complex_isnull (const gsl_vector_complex * v);
179167 int gsl_vector_complex_ispos (const gsl_vector_complex * v);
180168 int gsl_vector_complex_isneg (const gsl_vector_complex * v);
169 int gsl_vector_complex_isnonneg (const gsl_vector_complex * v);
170
171 int gsl_vector_complex_add (gsl_vector_complex * a, const gsl_vector_complex * b);
172 int gsl_vector_complex_sub (gsl_vector_complex * a, const gsl_vector_complex * b);
173 int gsl_vector_complex_mul (gsl_vector_complex * a, const gsl_vector_complex * b);
174 int gsl_vector_complex_div (gsl_vector_complex * a, const gsl_vector_complex * b);
175 int gsl_vector_complex_scale (gsl_vector_complex * a, const gsl_complex x);
176 int gsl_vector_complex_add_constant (gsl_vector_complex * a, const gsl_complex x);
177
178 INLINE_DECL gsl_complex gsl_vector_complex_get (const gsl_vector_complex * v, const size_t i);
179 INLINE_DECL void gsl_vector_complex_set (gsl_vector_complex * v, const size_t i, gsl_complex z);
180 INLINE_DECL gsl_complex *gsl_vector_complex_ptr (gsl_vector_complex * v, const size_t i);
181 INLINE_DECL const gsl_complex *gsl_vector_complex_const_ptr (const gsl_vector_complex * v, const size_t i);
181182
182183 #ifdef HAVE_INLINE
183184
184 extern inline
185 INLINE_FUN
185186 gsl_complex
186187 gsl_vector_complex_get (const gsl_vector_complex * v,
187188 const size_t i)
188189 {
189190 #if GSL_RANGE_CHECK
190 if (i >= v->size)
191 if (GSL_RANGE_COND(i >= v->size))
191192 {
192193 gsl_complex zero = {{0, 0}};
193194 GSL_ERROR_VAL ("index out of range", GSL_EINVAL, zero);
196197 return *GSL_COMPLEX_AT (v, i);
197198 }
198199
199 extern inline
200 INLINE_FUN
200201 void
201202 gsl_vector_complex_set (gsl_vector_complex * v,
202203 const size_t i, gsl_complex z)
203204 {
204205 #if GSL_RANGE_CHECK
205 if (i >= v->size)
206 if (GSL_RANGE_COND(i >= v->size))
206207 {
207208 GSL_ERROR_VOID ("index out of range", GSL_EINVAL);
208209 }
210211 *GSL_COMPLEX_AT (v, i) = z;
211212 }
212213
213 extern inline
214 INLINE_FUN
214215 gsl_complex *
215216 gsl_vector_complex_ptr (gsl_vector_complex * v,
216217 const size_t i)
217218 {
218219 #if GSL_RANGE_CHECK
219 if (i >= v->size)
220 if (GSL_RANGE_COND(i >= v->size))
220221 {
221222 GSL_ERROR_NULL ("index out of range", GSL_EINVAL);
222223 }
224225 return GSL_COMPLEX_AT (v, i);
225226 }
226227
227 extern inline
228 INLINE_FUN
228229 const gsl_complex *
229230 gsl_vector_complex_const_ptr (const gsl_vector_complex * v,
230231 const size_t i)
231232 {
232233 #if GSL_RANGE_CHECK
233 if (i >= v->size)
234 if (GSL_RANGE_COND(i >= v->size))
234235 {
235236 GSL_ERROR_NULL ("index out of range", GSL_EINVAL);
236237 }
140140
141141
142142 /* Operations */
143
144 gsl_complex_float
145 gsl_vector_complex_float_get (const gsl_vector_complex_float * v, const size_t i);
146
147 void gsl_vector_complex_float_set (gsl_vector_complex_float * v, const size_t i,
148 gsl_complex_float z);
149
150 gsl_complex_float
151 *gsl_vector_complex_float_ptr (gsl_vector_complex_float * v, const size_t i);
152
153 const gsl_complex_float
154 *gsl_vector_complex_float_const_ptr (const gsl_vector_complex_float * v, const size_t i);
155143
156144 void gsl_vector_complex_float_set_zero (gsl_vector_complex_float * v);
157145 void gsl_vector_complex_float_set_all (gsl_vector_complex_float * v,
178166 int gsl_vector_complex_float_isnull (const gsl_vector_complex_float * v);
179167 int gsl_vector_complex_float_ispos (const gsl_vector_complex_float * v);
180168 int gsl_vector_complex_float_isneg (const gsl_vector_complex_float * v);
169 int gsl_vector_complex_float_isnonneg (const gsl_vector_complex_float * v);
170
171 int gsl_vector_complex_float_add (gsl_vector_complex_float * a, const gsl_vector_complex_float * b);
172 int gsl_vector_complex_float_sub (gsl_vector_complex_float * a, const gsl_vector_complex_float * b);
173 int gsl_vector_complex_float_mul (gsl_vector_complex_float * a, const gsl_vector_complex_float * b);
174 int gsl_vector_complex_float_div (gsl_vector_complex_float * a, const gsl_vector_complex_float * b);
175 int gsl_vector_complex_float_scale (gsl_vector_complex_float * a, const gsl_complex_float x);
176 int gsl_vector_complex_float_add_constant (gsl_vector_complex_float * a, const gsl_complex_float x);
177
178 INLINE_DECL gsl_complex_float gsl_vector_complex_float_get (const gsl_vector_complex_float * v, const size_t i);
179 INLINE_DECL void gsl_vector_complex_float_set (gsl_vector_complex_float * v, const size_t i, gsl_complex_float z);
180 INLINE_DECL gsl_complex_float *gsl_vector_complex_float_ptr (gsl_vector_complex_float * v, const size_t i);
181 INLINE_DECL const gsl_complex_float *gsl_vector_complex_float_const_ptr (const gsl_vector_complex_float * v, const size_t i);
181182
182183 #ifdef HAVE_INLINE
183184
184 extern inline
185 INLINE_FUN
185186 gsl_complex_float
186187 gsl_vector_complex_float_get (const gsl_vector_complex_float * v,
187188 const size_t i)
188189 {
189190 #if GSL_RANGE_CHECK
190 if (i >= v->size)
191 if (GSL_RANGE_COND(i >= v->size))
191192 {
192193 gsl_complex_float zero = {{0, 0}};
193194 GSL_ERROR_VAL ("index out of range", GSL_EINVAL, zero);
196197 return *GSL_COMPLEX_FLOAT_AT (v, i);
197198 }
198199
199 extern inline
200 INLINE_FUN
200201 void
201202 gsl_vector_complex_float_set (gsl_vector_complex_float * v,
202203 const size_t i, gsl_complex_float z)
203204 {
204205 #if GSL_RANGE_CHECK
205 if (i >= v->size)
206 if (GSL_RANGE_COND(i >= v->size))
206207 {
207208 GSL_ERROR_VOID ("index out of range", GSL_EINVAL);
208209 }
210211 *GSL_COMPLEX_FLOAT_AT (v, i) = z;
211212 }
212213
213 extern inline
214 INLINE_FUN
214215 gsl_complex_float *
215216 gsl_vector_complex_float_ptr (gsl_vector_complex_float * v,
216217 const size_t i)
217218 {
218219 #if GSL_RANGE_CHECK
219 if (i >= v->size)
220 if (GSL_RANGE_COND(i >= v->size))
220221 {
221222 GSL_ERROR_NULL ("index out of range", GSL_EINVAL);
222223 }
224225 return GSL_COMPLEX_FLOAT_AT (v, i);
225226 }
226227
227 extern inline
228 INLINE_FUN
228229 const gsl_complex_float *
229230 gsl_vector_complex_float_const_ptr (const gsl_vector_complex_float * v,
230231 const size_t i)
231232 {
232233 #if GSL_RANGE_CHECK
233 if (i >= v->size)
234 if (GSL_RANGE_COND(i >= v->size))
234235 {
235236 GSL_ERROR_NULL ("index out of range", GSL_EINVAL);
236237 }
140140
141141
142142 /* Operations */
143
144 gsl_complex_long_double
145 gsl_vector_complex_long_double_get (const gsl_vector_complex_long_double * v, const size_t i);
146
147 void gsl_vector_complex_long_double_set (gsl_vector_complex_long_double * v, const size_t i,
148 gsl_complex_long_double z);
149
150 gsl_complex_long_double
151 *gsl_vector_complex_long_double_ptr (gsl_vector_complex_long_double * v, const size_t i);
152
153 const gsl_complex_long_double
154 *gsl_vector_complex_long_double_const_ptr (const gsl_vector_complex_long_double * v, const size_t i);
155143
156144 void gsl_vector_complex_long_double_set_zero (gsl_vector_complex_long_double * v);
157145 void gsl_vector_complex_long_double_set_all (gsl_vector_complex_long_double * v,
178166 int gsl_vector_complex_long_double_isnull (const gsl_vector_complex_long_double * v);
179167 int gsl_vector_complex_long_double_ispos (const gsl_vector_complex_long_double * v);
180168 int gsl_vector_complex_long_double_isneg (const gsl_vector_complex_long_double * v);
169 int gsl_vector_complex_long_double_isnonneg (const gsl_vector_complex_long_double * v);
170
171 int gsl_vector_complex_long_double_add (gsl_vector_complex_long_double * a, const gsl_vector_complex_long_double * b);
172 int gsl_vector_complex_long_double_sub (gsl_vector_complex_long_double * a, const gsl_vector_complex_long_double * b);
173 int gsl_vector_complex_long_double_mul (gsl_vector_complex_long_double * a, const gsl_vector_complex_long_double * b);
174 int gsl_vector_complex_long_double_div (gsl_vector_complex_long_double * a, const gsl_vector_complex_long_double * b);
175 int gsl_vector_complex_long_double_scale (gsl_vector_complex_long_double * a, const gsl_complex_long_double x);
176 int gsl_vector_complex_long_double_add_constant (gsl_vector_complex_long_double * a, const gsl_complex_long_double x);
177
178 INLINE_DECL gsl_complex_long_double gsl_vector_complex_long_double_get (const gsl_vector_complex_long_double * v, const size_t i);
179 INLINE_DECL void gsl_vector_complex_long_double_set (gsl_vector_complex_long_double * v, const size_t i, gsl_complex_long_double z);
180 INLINE_DECL gsl_complex_long_double *gsl_vector_complex_long_double_ptr (gsl_vector_complex_long_double * v, const size_t i);
181 INLINE_DECL const gsl_complex_long_double *gsl_vector_complex_long_double_const_ptr (const gsl_vector_complex_long_double * v, const size_t i);
181182
182183 #ifdef HAVE_INLINE
183184
184 extern inline
185 INLINE_FUN
185186 gsl_complex_long_double
186187 gsl_vector_complex_long_double_get (const gsl_vector_complex_long_double * v,
187188 const size_t i)
188189 {
189190 #if GSL_RANGE_CHECK
190 if (i >= v->size)
191 if (GSL_RANGE_COND(i >= v->size))
191192 {
192193 gsl_complex_long_double zero = {{0, 0}};
193194 GSL_ERROR_VAL ("index out of range", GSL_EINVAL, zero);
196197 return *GSL_COMPLEX_LONG_DOUBLE_AT (v, i);
197198 }
198199
199 extern inline
200 INLINE_FUN
200201 void
201202 gsl_vector_complex_long_double_set (gsl_vector_complex_long_double * v,
202203 const size_t i, gsl_complex_long_double z)
203204 {
204205 #if GSL_RANGE_CHECK
205 if (i >= v->size)
206 if (GSL_RANGE_COND(i >= v->size))
206207 {
207208 GSL_ERROR_VOID ("index out of range", GSL_EINVAL);
208209 }
210211 *GSL_COMPLEX_LONG_DOUBLE_AT (v, i) = z;
211212 }
212213
213 extern inline
214 INLINE_FUN
214215 gsl_complex_long_double *
215216 gsl_vector_complex_long_double_ptr (gsl_vector_complex_long_double * v,
216217 const size_t i)
217218 {
218219 #if GSL_RANGE_CHECK
219 if (i >= v->size)
220 if (GSL_RANGE_COND(i >= v->size))
220221 {
221222 GSL_ERROR_NULL ("index out of range", GSL_EINVAL);
222223 }
224225 return GSL_COMPLEX_LONG_DOUBLE_AT (v, i);
225226 }
226227
227 extern inline
228 INLINE_FUN
228229 const gsl_complex_long_double *
229230 gsl_vector_complex_long_double_const_ptr (const gsl_vector_complex_long_double * v,
230231 const size_t i)
231232 {
232233 #if GSL_RANGE_CHECK
233 if (i >= v->size)
234 if (GSL_RANGE_COND(i >= v->size))
234235 {
235236 GSL_ERROR_NULL ("index out of range", GSL_EINVAL);
236237 }
2222 #include <stdlib.h>
2323 #include <gsl/gsl_types.h>
2424 #include <gsl/gsl_errno.h>
25 #include <gsl/gsl_inline.h>
2526 #include <gsl/gsl_check_range.h>
2627 #include <gsl/gsl_block_double.h>
2728
121122
122123 /* Operations */
123124
124 double gsl_vector_get (const gsl_vector * v, const size_t i);
125 void gsl_vector_set (gsl_vector * v, const size_t i, double x);
126
127 double *gsl_vector_ptr (gsl_vector * v, const size_t i);
128 const double *gsl_vector_const_ptr (const gsl_vector * v, const size_t i);
129
130125 void gsl_vector_set_zero (gsl_vector * v);
131126 void gsl_vector_set_all (gsl_vector * v, double x);
132127 int gsl_vector_set_basis (gsl_vector * v, size_t i);
164159 int gsl_vector_isneg (const gsl_vector * v);
165160 int gsl_vector_isnonneg (const gsl_vector * v);
166161
162 INLINE_DECL double gsl_vector_get (const gsl_vector * v, const size_t i);
163 INLINE_DECL void gsl_vector_set (gsl_vector * v, const size_t i, double x);
164 INLINE_DECL double * gsl_vector_ptr (gsl_vector * v, const size_t i);
165 INLINE_DECL const double * gsl_vector_const_ptr (const gsl_vector * v, const size_t i);
166
167167 #ifdef HAVE_INLINE
168168
169 extern inline
169 INLINE_FUN
170170 double
171171 gsl_vector_get (const gsl_vector * v, const size_t i)
172172 {
173173 #if GSL_RANGE_CHECK
174 if (i >= v->size)
174 if (GSL_RANGE_COND(i >= v->size))
175175 {
176176 GSL_ERROR_VAL ("index out of range", GSL_EINVAL, 0);
177177 }
179179 return v->data[i * v->stride];
180180 }
181181
182 extern inline
182 INLINE_FUN
183183 void
184184 gsl_vector_set (gsl_vector * v, const size_t i, double x)
185185 {
186186 #if GSL_RANGE_CHECK
187 if (i >= v->size)
187 if (GSL_RANGE_COND(i >= v->size))
188188 {
189189 GSL_ERROR_VOID ("index out of range", GSL_EINVAL);
190190 }
192192 v->data[i * v->stride] = x;
193193 }
194194
195 extern inline
195 INLINE_FUN
196196 double *
197197 gsl_vector_ptr (gsl_vector * v, const size_t i)
198198 {
199199 #if GSL_RANGE_CHECK
200 if (i >= v->size)
200 if (GSL_RANGE_COND(i >= v->size))
201201 {
202202 GSL_ERROR_NULL ("index out of range", GSL_EINVAL);
203203 }
205205 return (double *) (v->data + i * v->stride);
206206 }
207207
208 extern inline
208 INLINE_FUN
209209 const double *
210210 gsl_vector_const_ptr (const gsl_vector * v, const size_t i)
211211 {
212212 #if GSL_RANGE_CHECK
213 if (i >= v->size)
213 if (GSL_RANGE_COND(i >= v->size))
214214 {
215215 GSL_ERROR_NULL ("index out of range", GSL_EINVAL);
216216 }
217217 #endif
218218 return (const double *) (v->data + i * v->stride);
219219 }
220
221
222220 #endif /* HAVE_INLINE */
223221
224222 __END_DECLS
2222 #include <stdlib.h>
2323 #include <gsl/gsl_types.h>
2424 #include <gsl/gsl_errno.h>
25 #include <gsl/gsl_inline.h>
2526 #include <gsl/gsl_check_range.h>
2627 #include <gsl/gsl_block_float.h>
2728
121122
122123 /* Operations */
123124
124 float gsl_vector_float_get (const gsl_vector_float * v, const size_t i);
125 void gsl_vector_float_set (gsl_vector_float * v, const size_t i, float x);
126
127 float *gsl_vector_float_ptr (gsl_vector_float * v, const size_t i);
128 const float *gsl_vector_float_const_ptr (const gsl_vector_float * v, const size_t i);
129
130125 void gsl_vector_float_set_zero (gsl_vector_float * v);
131126 void gsl_vector_float_set_all (gsl_vector_float * v, float x);
132127 int gsl_vector_float_set_basis (gsl_vector_float * v, size_t i);
164159 int gsl_vector_float_isneg (const gsl_vector_float * v);
165160 int gsl_vector_float_isnonneg (const gsl_vector_float * v);
166161
162 INLINE_DECL float gsl_vector_float_get (const gsl_vector_float * v, const size_t i);
163 INLINE_DECL void gsl_vector_float_set (gsl_vector_float * v, const size_t i, float x);
164 INLINE_DECL float * gsl_vector_float_ptr (gsl_vector_float * v, const size_t i);
165 INLINE_DECL const float * gsl_vector_float_const_ptr (const gsl_vector_float * v, const size_t i);
166
167167 #ifdef HAVE_INLINE
168168
169 extern inline
169 INLINE_FUN
170170 float
171171 gsl_vector_float_get (const gsl_vector_float * v, const size_t i)
172172 {
173173 #if GSL_RANGE_CHECK
174 if (i >= v->size)
174 if (GSL_RANGE_COND(i >= v->size))
175175 {
176176 GSL_ERROR_VAL ("index out of range", GSL_EINVAL, 0);
177177 }
179179 return v->data[i * v->stride];
180180 }
181181
182 extern inline
182 INLINE_FUN
183183 void
184184 gsl_vector_float_set (gsl_vector_float * v, const size_t i, float x)
185185 {
186186 #if GSL_RANGE_CHECK
187 if (i >= v->size)
187 if (GSL_RANGE_COND(i >= v->size))
188188 {
189189 GSL_ERROR_VOID ("index out of range", GSL_EINVAL);
190190 }
192192 v->data[i * v->stride] = x;
193193 }
194194
195 extern inline
195 INLINE_FUN
196196 float *
197197 gsl_vector_float_ptr (gsl_vector_float * v, const size_t i)
198198 {
199199 #if GSL_RANGE_CHECK
200 if (i >= v->size)
200 if (GSL_RANGE_COND(i >= v->size))
201201 {
202202 GSL_ERROR_NULL ("index out of range", GSL_EINVAL);
203203 }
205205 return (float *) (v->data + i * v->stride);
206206 }
207207
208 extern inline
208 INLINE_FUN
209209 const float *
210210 gsl_vector_float_const_ptr (const gsl_vector_float * v, const size_t i)
211211 {
212212 #if GSL_RANGE_CHECK
213 if (i >= v->size)
213 if (GSL_RANGE_COND(i >= v->size))
214214 {
215215 GSL_ERROR_NULL ("index out of range", GSL_EINVAL);
216216 }
217217 #endif
218218 return (const float *) (v->data + i * v->stride);
219219 }
220
221
222220 #endif /* HAVE_INLINE */
223221
224222 __END_DECLS
2222 #include <stdlib.h>
2323 #include <gsl/gsl_types.h>
2424 #include <gsl/gsl_errno.h>
25 #include <gsl/gsl_inline.h>
2526 #include <gsl/gsl_check_range.h>
2627 #include <gsl/gsl_block_int.h>
2728
121122
122123 /* Operations */
123124
124 int gsl_vector_int_get (const gsl_vector_int * v, const size_t i);
125 void gsl_vector_int_set (gsl_vector_int * v, const size_t i, int x);
126
127 int *gsl_vector_int_ptr (gsl_vector_int * v, const size_t i);
128 const int *gsl_vector_int_const_ptr (const gsl_vector_int * v, const size_t i);
129
130125 void gsl_vector_int_set_zero (gsl_vector_int * v);
131126 void gsl_vector_int_set_all (gsl_vector_int * v, int x);
132127 int gsl_vector_int_set_basis (gsl_vector_int * v, size_t i);
164159 int gsl_vector_int_isneg (const gsl_vector_int * v);
165160 int gsl_vector_int_isnonneg (const gsl_vector_int * v);
166161
162 INLINE_DECL int gsl_vector_int_get (const gsl_vector_int * v, const size_t i);
163 INLINE_DECL void gsl_vector_int_set (gsl_vector_int * v, const size_t i, int x);
164 INLINE_DECL int * gsl_vector_int_ptr (gsl_vector_int * v, const size_t i);
165 INLINE_DECL const int * gsl_vector_int_const_ptr (const gsl_vector_int * v, const size_t i);
166
167167 #ifdef HAVE_INLINE
168168
169 extern inline
169 INLINE_FUN
170170 int
171171 gsl_vector_int_get (const gsl_vector_int * v, const size_t i)
172172 {
173173 #if GSL_RANGE_CHECK
174 if (i >= v->size)
174 if (GSL_RANGE_COND(i >= v->size))
175175 {
176176 GSL_ERROR_VAL ("index out of range", GSL_EINVAL, 0);
177177 }
179179 return v->data[i * v->stride];
180180 }
181181
182 extern inline
182 INLINE_FUN
183183 void
184184 gsl_vector_int_set (gsl_vector_int * v, const size_t i, int x)
185185 {
186186 #if GSL_RANGE_CHECK
187 if (i >= v->size)
187 if (GSL_RANGE_COND(i >= v->size))
188188 {
189189 GSL_ERROR_VOID ("index out of range", GSL_EINVAL);
190190 }
192192 v->data[i * v->stride] = x;
193193 }
194194
195 extern inline
195 INLINE_FUN
196196 int *
197197 gsl_vector_int_ptr (gsl_vector_int * v, const size_t i)
198198 {
199199 #if GSL_RANGE_CHECK
200 if (i >= v->size)
200 if (GSL_RANGE_COND(i >= v->size))
201201 {
202202 GSL_ERROR_NULL ("index out of range", GSL_EINVAL);
203203 }
205205 return (int *) (v->data + i * v->stride);
206206 }
207207
208 extern inline
208 INLINE_FUN
209209 const int *
210210 gsl_vector_int_const_ptr (const gsl_vector_int * v, const size_t i)
211211 {
212212 #if GSL_RANGE_CHECK
213 if (i >= v->size)
213 if (GSL_RANGE_COND(i >= v->size))
214214 {
215215 GSL_ERROR_NULL ("index out of range", GSL_EINVAL);
216216 }
217217 #endif
218218 return (const int *) (v->data + i * v->stride);
219219 }
220
221
222220 #endif /* HAVE_INLINE */
223221
224222 __END_DECLS
2222 #include <stdlib.h>
2323 #include <gsl/gsl_types.h>
2424 #include <gsl/gsl_errno.h>
25 #include <gsl/gsl_inline.h>
2526 #include <gsl/gsl_check_range.h>
2627 #include <gsl/gsl_block_long.h>
2728
121122
122123 /* Operations */
123124
124 long gsl_vector_long_get (const gsl_vector_long * v, const size_t i);
125 void gsl_vector_long_set (gsl_vector_long * v, const size_t i, long x);
126
127 long *gsl_vector_long_ptr (gsl_vector_long * v, const size_t i);
128 const long *gsl_vector_long_const_ptr (const gsl_vector_long * v, const size_t i);
129
130125 void gsl_vector_long_set_zero (gsl_vector_long * v);
131126 void gsl_vector_long_set_all (gsl_vector_long * v, long x);
132127 int gsl_vector_long_set_basis (gsl_vector_long * v, size_t i);
164159 int gsl_vector_long_isneg (const gsl_vector_long * v);
165160 int gsl_vector_long_isnonneg (const gsl_vector_long * v);
166161
162 INLINE_DECL long gsl_vector_long_get (const gsl_vector_long * v, const size_t i);
163 INLINE_DECL void gsl_vector_long_set (gsl_vector_long * v, const size_t i, long x);
164 INLINE_DECL long * gsl_vector_long_ptr (gsl_vector_long * v, const size_t i);
165 INLINE_DECL const long * gsl_vector_long_const_ptr (const gsl_vector_long * v, const size_t i);
166
167167 #ifdef HAVE_INLINE
168168
169 extern inline
169 INLINE_FUN
170170 long
171171 gsl_vector_long_get (const gsl_vector_long * v, const size_t i)
172172 {
173173 #if GSL_RANGE_CHECK
174 if (i >= v->size)
174 if (GSL_RANGE_COND(i >= v->size))
175175 {
176176 GSL_ERROR_VAL ("index out of range", GSL_EINVAL, 0);
177177 }
179179 return v->data[i * v->stride];
180180 }
181181
182 extern inline
182 INLINE_FUN
183183 void
184184 gsl_vector_long_set (gsl_vector_long * v, const size_t i, long x)
185185 {
186186 #if GSL_RANGE_CHECK
187 if (i >= v->size)
187 if (GSL_RANGE_COND(i >= v->size))
188188 {
189189 GSL_ERROR_VOID ("index out of range", GSL_EINVAL);
190190 }
192192 v->data[i * v->stride] = x;
193193 }
194194
195 extern inline
195 INLINE_FUN
196196 long *
197197 gsl_vector_long_ptr (gsl_vector_long * v, const size_t i)
198198 {
199199 #if GSL_RANGE_CHECK
200 if (i >= v->size)
200 if (GSL_RANGE_COND(i >= v->size))
201201 {
202202 GSL_ERROR_NULL ("index out of range", GSL_EINVAL);
203203 }
205205 return (long *) (v->data + i * v->stride);
206206 }
207207
208 extern inline
208 INLINE_FUN
209209 const long *
210210 gsl_vector_long_const_ptr (const gsl_vector_long * v, const size_t i)
211211 {
212212 #if GSL_RANGE_CHECK
213 if (i >= v->size)
213 if (GSL_RANGE_COND(i >= v->size))
214214 {
215215 GSL_ERROR_NULL ("index out of range", GSL_EINVAL);
216216 }
217217 #endif
218218 return (const long *) (v->data + i * v->stride);
219219 }
220
221
222220 #endif /* HAVE_INLINE */
223221
224222 __END_DECLS
2222 #include <stdlib.h>
2323 #include <gsl/gsl_types.h>
2424 #include <gsl/gsl_errno.h>
25 #include <gsl/gsl_inline.h>
2526 #include <gsl/gsl_check_range.h>
2627 #include <gsl/gsl_block_long_double.h>
2728
121122
122123 /* Operations */
123124
124 long double gsl_vector_long_double_get (const gsl_vector_long_double * v, const size_t i);
125 void gsl_vector_long_double_set (gsl_vector_long_double * v, const size_t i, long double x);
126
127 long double *gsl_vector_long_double_ptr (gsl_vector_long_double * v, const size_t i);
128 const long double *gsl_vector_long_double_const_ptr (const gsl_vector_long_double * v, const size_t i);
129
130125 void gsl_vector_long_double_set_zero (gsl_vector_long_double * v);
131126 void gsl_vector_long_double_set_all (gsl_vector_long_double * v, long double x);
132127 int gsl_vector_long_double_set_basis (gsl_vector_long_double * v, size_t i);
164159 int gsl_vector_long_double_isneg (const gsl_vector_long_double * v);
165160 int gsl_vector_long_double_isnonneg (const gsl_vector_long_double * v);
166161
162 INLINE_DECL long double gsl_vector_long_double_get (const gsl_vector_long_double * v, const size_t i);
163 INLINE_DECL void gsl_vector_long_double_set (gsl_vector_long_double * v, const size_t i, long double x);
164 INLINE_DECL long double * gsl_vector_long_double_ptr (gsl_vector_long_double * v, const size_t i);
165 INLINE_DECL const long double * gsl_vector_long_double_const_ptr (const gsl_vector_long_double * v, const size_t i);
166
167167 #ifdef HAVE_INLINE
168168
169 extern inline
169 INLINE_FUN
170170 long double
171171 gsl_vector_long_double_get (const gsl_vector_long_double * v, const size_t i)
172172 {
173173 #if GSL_RANGE_CHECK
174 if (i >= v->size)
174 if (GSL_RANGE_COND(i >= v->size))
175175 {
176176 GSL_ERROR_VAL ("index out of range", GSL_EINVAL, 0);
177177 }
179179 return v->data[i * v->stride];
180180 }
181181
182 extern inline
182 INLINE_FUN
183183 void
184184 gsl_vector_long_double_set (gsl_vector_long_double * v, const size_t i, long double x)
185185 {
186186 #if GSL_RANGE_CHECK
187 if (i >= v->size)
187 if (GSL_RANGE_COND(i >= v->size))
188188 {
189189 GSL_ERROR_VOID ("index out of range", GSL_EINVAL);
190190 }
192192 v->data[i * v->stride] = x;
193193 }
194194
195 extern inline
195 INLINE_FUN
196196 long double *
197197 gsl_vector_long_double_ptr (gsl_vector_long_double * v, const size_t i)
198198 {
199199 #if GSL_RANGE_CHECK
200 if (i >= v->size)
200 if (GSL_RANGE_COND(i >= v->size))
201201 {
202202 GSL_ERROR_NULL ("index out of range", GSL_EINVAL);
203203 }
205205 return (long double *) (v->data + i * v->stride);
206206 }
207207
208 extern inline
208 INLINE_FUN
209209 const long double *
210210 gsl_vector_long_double_const_ptr (const gsl_vector_long_double * v, const size_t i)
211211 {
212212 #if GSL_RANGE_CHECK
213 if (i >= v->size)
213 if (GSL_RANGE_COND(i >= v->size))
214214 {
215215 GSL_ERROR_NULL ("index out of range", GSL_EINVAL);
216216 }
217217 #endif
218218 return (const long double *) (v->data + i * v->stride);
219219 }
220
221
222220 #endif /* HAVE_INLINE */
223221
224222 __END_DECLS
2222 #include <stdlib.h>
2323 #include <gsl/gsl_types.h>
2424 #include <gsl/gsl_errno.h>
25 #include <gsl/gsl_inline.h>
2526 #include <gsl/gsl_check_range.h>
2627 #include <gsl/gsl_block_short.h>
2728
121122
122123 /* Operations */
123124
124 short gsl_vector_short_get (const gsl_vector_short * v, const size_t i);
125 void gsl_vector_short_set (gsl_vector_short * v, const size_t i, short x);
126
127 short *gsl_vector_short_ptr (gsl_vector_short * v, const size_t i);
128 const short *gsl_vector_short_const_ptr (const gsl_vector_short * v, const size_t i);
129
130125 void gsl_vector_short_set_zero (gsl_vector_short * v);
131126 void gsl_vector_short_set_all (gsl_vector_short * v, short x);
132127 int gsl_vector_short_set_basis (gsl_vector_short * v, size_t i);
164159 int gsl_vector_short_isneg (const gsl_vector_short * v);
165160 int gsl_vector_short_isnonneg (const gsl_vector_short * v);
166161
162 INLINE_DECL short gsl_vector_short_get (const gsl_vector_short * v, const size_t i);
163 INLINE_DECL void gsl_vector_short_set (gsl_vector_short * v, const size_t i, short x);
164 INLINE_DECL short * gsl_vector_short_ptr (gsl_vector_short * v, const size_t i);
165 INLINE_DECL const short * gsl_vector_short_const_ptr (const gsl_vector_short * v, const size_t i);
166
167167 #ifdef HAVE_INLINE
168168
169 extern inline
169 INLINE_FUN
170170 short
171171 gsl_vector_short_get (const gsl_vector_short * v, const size_t i)
172172 {
173173 #if GSL_RANGE_CHECK
174 if (i >= v->size)
174 if (GSL_RANGE_COND(i >= v->size))
175175 {
176176 GSL_ERROR_VAL ("index out of range", GSL_EINVAL, 0);
177177 }
179179 return v->data[i * v->stride];
180180 }
181181
182 extern inline
182 INLINE_FUN
183183 void
184184 gsl_vector_short_set (gsl_vector_short * v, const size_t i, short x)
185185 {
186186 #if GSL_RANGE_CHECK
187 if (i >= v->size)
187 if (GSL_RANGE_COND(i >= v->size))
188188 {
189189 GSL_ERROR_VOID ("index out of range", GSL_EINVAL);
190190 }
192192 v->data[i * v->stride] = x;
193193 }
194194
195 extern inline
195 INLINE_FUN
196196 short *
197197 gsl_vector_short_ptr (gsl_vector_short * v, const size_t i)
198198 {
199199 #if GSL_RANGE_CHECK
200 if (i >= v->size)
200 if (GSL_RANGE_COND(i >= v->size))
201201 {
202202 GSL_ERROR_NULL ("index out of range", GSL_EINVAL);
203203 }
205205 return (short *) (v->data + i * v->stride);
206206 }
207207
208 extern inline
208 INLINE_FUN
209209 const short *
210210 gsl_vector_short_const_ptr (const gsl_vector_short * v, const size_t i)
211211 {
212212 #if GSL_RANGE_CHECK
213 if (i >= v->size)
213 if (GSL_RANGE_COND(i >= v->size))
214214 {
215215 GSL_ERROR_NULL ("index out of range", GSL_EINVAL);
216216 }
217217 #endif
218218 return (const short *) (v->data + i * v->stride);
219219 }
220
221
222220 #endif /* HAVE_INLINE */
223221
224222 __END_DECLS
2222 #include <stdlib.h>
2323 #include <gsl/gsl_types.h>
2424 #include <gsl/gsl_errno.h>
25 #include <gsl/gsl_inline.h>
2526 #include <gsl/gsl_check_range.h>
2627 #include <gsl/gsl_block_uchar.h>
2728
121122
122123 /* Operations */
123124
124 unsigned char gsl_vector_uchar_get (const gsl_vector_uchar * v, const size_t i);
125 void gsl_vector_uchar_set (gsl_vector_uchar * v, const size_t i, unsigned char x);
126
127 unsigned char *gsl_vector_uchar_ptr (gsl_vector_uchar * v, const size_t i);
128 const unsigned char *gsl_vector_uchar_const_ptr (const gsl_vector_uchar * v, const size_t i);
129
130125 void gsl_vector_uchar_set_zero (gsl_vector_uchar * v);
131126 void gsl_vector_uchar_set_all (gsl_vector_uchar * v, unsigned char x);
132127 int gsl_vector_uchar_set_basis (gsl_vector_uchar * v, size_t i);
164159 int gsl_vector_uchar_isneg (const gsl_vector_uchar * v);
165160 int gsl_vector_uchar_isnonneg (const gsl_vector_uchar * v);
166161
162 INLINE_DECL unsigned char gsl_vector_uchar_get (const gsl_vector_uchar * v, const size_t i);
163 INLINE_DECL void gsl_vector_uchar_set (gsl_vector_uchar * v, const size_t i, unsigned char x);
164 INLINE_DECL unsigned char * gsl_vector_uchar_ptr (gsl_vector_uchar * v, const size_t i);
165 INLINE_DECL const unsigned char * gsl_vector_uchar_const_ptr (const gsl_vector_uchar * v, const size_t i);
166
167167 #ifdef HAVE_INLINE
168168
169 extern inline
169 INLINE_FUN
170170 unsigned char
171171 gsl_vector_uchar_get (const gsl_vector_uchar * v, const size_t i)
172172 {
173173 #if GSL_RANGE_CHECK
174 if (i >= v->size)
174 if (GSL_RANGE_COND(i >= v->size))
175175 {
176176 GSL_ERROR_VAL ("index out of range", GSL_EINVAL, 0);
177177 }
179179 return v->data[i * v->stride];
180180 }
181181
182 extern inline
182 INLINE_FUN
183183 void
184184 gsl_vector_uchar_set (gsl_vector_uchar * v, const size_t i, unsigned char x)
185185 {
186186 #if GSL_RANGE_CHECK
187 if (i >= v->size)
187 if (GSL_RANGE_COND(i >= v->size))
188188 {
189189 GSL_ERROR_VOID ("index out of range", GSL_EINVAL);
190190 }
192192 v->data[i * v->stride] = x;
193193 }
194194
195 extern inline
195 INLINE_FUN
196196 unsigned char *
197197 gsl_vector_uchar_ptr (gsl_vector_uchar * v, const size_t i)
198198 {
199199 #if GSL_RANGE_CHECK
200 if (i >= v->size)
200 if (GSL_RANGE_COND(i >= v->size))
201201 {
202202 GSL_ERROR_NULL ("index out of range", GSL_EINVAL);
203203 }
205205 return (unsigned char *) (v->data + i * v->stride);
206206 }
207207
208 extern inline
208 INLINE_FUN
209209 const unsigned char *
210210 gsl_vector_uchar_const_ptr (const gsl_vector_uchar * v, const size_t i)
211211 {
212212 #if GSL_RANGE_CHECK
213 if (i >= v->size)
213 if (GSL_RANGE_COND(i >= v->size))
214214 {
215215 GSL_ERROR_NULL ("index out of range", GSL_EINVAL);
216216 }
217217 #endif
218218 return (const unsigned char *) (v->data + i * v->stride);
219219 }
220
221
222220 #endif /* HAVE_INLINE */
223221
224222 __END_DECLS
2222 #include <stdlib.h>
2323 #include <gsl/gsl_types.h>
2424 #include <gsl/gsl_errno.h>
25 #include <gsl/gsl_inline.h>
2526 #include <gsl/gsl_check_range.h>
2627 #include <gsl/gsl_block_uint.h>
2728
121122
122123 /* Operations */
123124
124 unsigned int gsl_vector_uint_get (const gsl_vector_uint * v, const size_t i);
125 void gsl_vector_uint_set (gsl_vector_uint * v, const size_t i, unsigned int x);
126
127 unsigned int *gsl_vector_uint_ptr (gsl_vector_uint * v, const size_t i);
128 const unsigned int *gsl_vector_uint_const_ptr (const gsl_vector_uint * v, const size_t i);
129
130125 void gsl_vector_uint_set_zero (gsl_vector_uint * v);
131126 void gsl_vector_uint_set_all (gsl_vector_uint * v, unsigned int x);
132127 int gsl_vector_uint_set_basis (gsl_vector_uint * v, size_t i);
164159 int gsl_vector_uint_isneg (const gsl_vector_uint * v);
165160 int gsl_vector_uint_isnonneg (const gsl_vector_uint * v);
166161
162 INLINE_DECL unsigned int gsl_vector_uint_get (const gsl_vector_uint * v, const size_t i);
163 INLINE_DECL void gsl_vector_uint_set (gsl_vector_uint * v, const size_t i, unsigned int x);
164 INLINE_DECL unsigned int * gsl_vector_uint_ptr (gsl_vector_uint * v, const size_t i);
165 INLINE_DECL const unsigned int * gsl_vector_uint_const_ptr (const gsl_vector_uint * v, const size_t i);
166
167167 #ifdef HAVE_INLINE
168168
169 extern inline
169 INLINE_FUN
170170 unsigned int
171171 gsl_vector_uint_get (const gsl_vector_uint * v, const size_t i)
172172 {
173173 #if GSL_RANGE_CHECK
174 if (i >= v->size)
174 if (GSL_RANGE_COND(i >= v->size))
175175 {
176176 GSL_ERROR_VAL ("index out of range", GSL_EINVAL, 0);
177177 }
179179 return v->data[i * v->stride];
180180 }
181181
182 extern inline
182 INLINE_FUN
183183 void
184184 gsl_vector_uint_set (gsl_vector_uint * v, const size_t i, unsigned int x)
185185 {
186186 #if GSL_RANGE_CHECK
187 if (i >= v->size)
187 if (GSL_RANGE_COND(i >= v->size))
188188 {
189189 GSL_ERROR_VOID ("index out of range", GSL_EINVAL);
190190 }
192192 v->data[i * v->stride] = x;
193193 }
194194
195 extern inline
195 INLINE_FUN
196196 unsigned int *
197197 gsl_vector_uint_ptr (gsl_vector_uint * v, const size_t i)
198198 {
199199 #if GSL_RANGE_CHECK
200 if (i >= v->size)
200 if (GSL_RANGE_COND(i >= v->size))
201201 {
202202 GSL_ERROR_NULL ("index out of range", GSL_EINVAL);
203203 }
205205 return (unsigned int *) (v->data + i * v->stride);
206206 }
207207
208 extern inline
208 INLINE_FUN
209209 const unsigned int *
210210 gsl_vector_uint_const_ptr (const gsl_vector_uint * v, const size_t i)
211211 {
212212 #if GSL_RANGE_CHECK
213 if (i >= v->size)
213 if (GSL_RANGE_COND(i >= v->size))
214214 {
215215 GSL_ERROR_NULL ("index out of range", GSL_EINVAL);
216216 }
217217 #endif
218218 return (const unsigned int *) (v->data + i * v->stride);
219219 }
220
221
222220 #endif /* HAVE_INLINE */
223221
224222 __END_DECLS
2222 #include <stdlib.h>
2323 #include <gsl/gsl_types.h>
2424 #include <gsl/gsl_errno.h>
25 #include <gsl/gsl_inline.h>
2526 #include <gsl/gsl_check_range.h>
2627 #include <gsl/gsl_block_ulong.h>
2728
121122
122123 /* Operations */
123124
124 unsigned long gsl_vector_ulong_get (const gsl_vector_ulong * v, const size_t i);
125 void gsl_vector_ulong_set (gsl_vector_ulong * v, const size_t i, unsigned long x);
126
127 unsigned long *gsl_vector_ulong_ptr (gsl_vector_ulong * v, const size_t i);
128 const unsigned long *gsl_vector_ulong_const_ptr (const gsl_vector_ulong * v, const size_t i);
129
130125 void gsl_vector_ulong_set_zero (gsl_vector_ulong * v);
131126 void gsl_vector_ulong_set_all (gsl_vector_ulong * v, unsigned long x);
132127 int gsl_vector_ulong_set_basis (gsl_vector_ulong * v, size_t i);
164159 int gsl_vector_ulong_isneg (const gsl_vector_ulong * v);
165160 int gsl_vector_ulong_isnonneg (const gsl_vector_ulong * v);
166161
162 INLINE_DECL unsigned long gsl_vector_ulong_get (const gsl_vector_ulong * v, const size_t i);
163 INLINE_DECL void gsl_vector_ulong_set (gsl_vector_ulong * v, const size_t i, unsigned long x);
164 INLINE_DECL unsigned long * gsl_vector_ulong_ptr (gsl_vector_ulong * v, const size_t i);
165 INLINE_DECL const unsigned long * gsl_vector_ulong_const_ptr (const gsl_vector_ulong * v, const size_t i);
166
167167 #ifdef HAVE_INLINE
168168
169 extern inline
169 INLINE_FUN
170170 unsigned long
171171 gsl_vector_ulong_get (const gsl_vector_ulong * v, const size_t i)
172172 {
173173 #if GSL_RANGE_CHECK
174 if (i >= v->size)
174 if (GSL_RANGE_COND(i >= v->size))
175175 {
176176 GSL_ERROR_VAL ("index out of range", GSL_EINVAL, 0);
177177 }
179179 return v->data[i * v->stride];
180180 }
181181
182 extern inline
182 INLINE_FUN
183183 void
184184 gsl_vector_ulong_set (gsl_vector_ulong * v, const size_t i, unsigned long x)
185185 {
186186 #if GSL_RANGE_CHECK
187 if (i >= v->size)
187 if (GSL_RANGE_COND(i >= v->size))
188188 {
189189 GSL_ERROR_VOID ("index out of range", GSL_EINVAL);
190190 }
192192 v->data[i * v->stride] = x;
193193 }
194194
195 extern inline
195 INLINE_FUN
196196 unsigned long *
197197 gsl_vector_ulong_ptr (gsl_vector_ulong * v, const size_t i)
198198 {
199199 #if GSL_RANGE_CHECK
200 if (i >= v->size)
200 if (GSL_RANGE_COND(i >= v->size))
201201 {
202202 GSL_ERROR_NULL ("index out of range", GSL_EINVAL);
203203 }
205205 return (unsigned long *) (v->data + i * v->stride);
206206 }
207207
208 extern inline
208 INLINE_FUN
209209 const unsigned long *
210210 gsl_vector_ulong_const_ptr (const gsl_vector_ulong * v, const size_t i)
211211 {
212212 #if GSL_RANGE_CHECK
213 if (i >= v->size)
213 if (GSL_RANGE_COND(i >= v->size))
214214 {
215215 GSL_ERROR_NULL ("index out of range", GSL_EINVAL);
216216 }
217217 #endif
218218 return (const unsigned long *) (v->data + i * v->stride);
219219 }
220
221
222220 #endif /* HAVE_INLINE */
223221
224222 __END_DECLS
2222 #include <stdlib.h>
2323 #include <gsl/gsl_types.h>
2424 #include <gsl/gsl_errno.h>
25 #include <gsl/gsl_inline.h>
2526 #include <gsl/gsl_check_range.h>
2627 #include <gsl/gsl_block_ushort.h>
2728
121122
122123 /* Operations */
123124
124 unsigned short gsl_vector_ushort_get (const gsl_vector_ushort * v, const size_t i);
125 void gsl_vector_ushort_set (gsl_vector_ushort * v, const size_t i, unsigned short x);
126
127 unsigned short *gsl_vector_ushort_ptr (gsl_vector_ushort * v, const size_t i);
128 const unsigned short *gsl_vector_ushort_const_ptr (const gsl_vector_ushort * v, const size_t i);
129
130125 void gsl_vector_ushort_set_zero (gsl_vector_ushort * v);
131126 void gsl_vector_ushort_set_all (gsl_vector_ushort * v, unsigned short x);
132127 int gsl_vector_ushort_set_basis (gsl_vector_ushort * v, size_t i);
164159 int gsl_vector_ushort_isneg (const gsl_vector_ushort * v);
165160 int gsl_vector_ushort_isnonneg (const gsl_vector_ushort * v);
166161
162 INLINE_DECL unsigned short gsl_vector_ushort_get (const gsl_vector_ushort * v, const size_t i);
163 INLINE_DECL void gsl_vector_ushort_set (gsl_vector_ushort * v, const size_t i, unsigned short x);
164 INLINE_DECL unsigned short * gsl_vector_ushort_ptr (gsl_vector_ushort * v, const size_t i);
165 INLINE_DECL const unsigned short * gsl_vector_ushort_const_ptr (const gsl_vector_ushort * v, const size_t i);
166
167167 #ifdef HAVE_INLINE
168168
169 extern inline
169 INLINE_FUN
170170 unsigned short
171171 gsl_vector_ushort_get (const gsl_vector_ushort * v, const size_t i)
172172 {
173173 #if GSL_RANGE_CHECK
174 if (i >= v->size)
174 if (GSL_RANGE_COND(i >= v->size))
175175 {
176176 GSL_ERROR_VAL ("index out of range", GSL_EINVAL, 0);
177177 }
179179 return v->data[i * v->stride];
180180 }
181181
182 extern inline
182 INLINE_FUN
183183 void
184184 gsl_vector_ushort_set (gsl_vector_ushort * v, const size_t i, unsigned short x)
185185 {
186186 #if GSL_RANGE_CHECK
187 if (i >= v->size)
187 if (GSL_RANGE_COND(i >= v->size))
188188 {
189189 GSL_ERROR_VOID ("index out of range", GSL_EINVAL);
190190 }
192192 v->data[i * v->stride] = x;
193193 }
194194
195 extern inline
195 INLINE_FUN
196196 unsigned short *
197197 gsl_vector_ushort_ptr (gsl_vector_ushort * v, const size_t i)
198198 {
199199 #if GSL_RANGE_CHECK
200 if (i >= v->size)
200 if (GSL_RANGE_COND(i >= v->size))
201201 {
202202 GSL_ERROR_NULL ("index out of range", GSL_EINVAL);
203203 }
205205 return (unsigned short *) (v->data + i * v->stride);
206206 }
207207
208 extern inline
208 INLINE_FUN
209209 const unsigned short *
210210 gsl_vector_ushort_const_ptr (const gsl_vector_ushort * v, const size_t i)
211211 {
212212 #if GSL_RANGE_CHECK
213 if (i >= v->size)
213 if (GSL_RANGE_COND(i >= v->size))
214214 {
215215 GSL_ERROR_NULL ("index out of range", GSL_EINVAL);
216216 }
217217 #endif
218218 return (const unsigned short *) (v->data + i * v->stride);
219219 }
220
221
222220 #endif /* HAVE_INLINE */
223221
224222 __END_DECLS
00 #include <config.h>
11 #include <stdlib.h>
2 #include <math.h>
3 #include <gsl/gsl_math.h>
24 #include <gsl/gsl_vector.h>
5
6 #define BASE_GSL_COMPLEX_LONG
7 #include "templates_on.h"
8 #include "oper_complex_source.c"
9 #include "templates_off.h"
10 #undef BASE_GSL_COMPLEX_LONG
11
12 #define BASE_GSL_COMPLEX
13 #include "templates_on.h"
14 #include "oper_complex_source.c"
15 #include "templates_off.h"
16 #undef BASE_GSL_COMPLEX
17
18 #define BASE_GSL_COMPLEX_FLOAT
19 #include "templates_on.h"
20 #include "oper_complex_source.c"
21 #include "templates_off.h"
22 #undef BASE_GSL_COMPLEX_FLOAT
323
424 #define BASE_LONG_DOUBLE
525 #include "templates_on.h"
0 /* vector/oper_source.c
1 *
2 * Copyright (C) 2008 Brian Gough
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 3 of the License, or (at
7 * your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18
19 int
20 FUNCTION(gsl_vector, add) (TYPE(gsl_vector) * a, const TYPE(gsl_vector) * b)
21 {
22 const size_t N = a->size;
23
24 if (b->size != N)
25 {
26 GSL_ERROR ("vectors must have same length", GSL_EBADLEN);
27 }
28 else
29 {
30 const size_t stride_a = a->stride;
31 const size_t stride_b = b->stride;
32
33 size_t i;
34
35 for (i = 0; i < N; i++)
36 {
37 a->data[2 * i * stride_a] += b->data[2 * i * stride_b];
38 a->data[2 * i * stride_a + 1] += b->data[2 * i * stride_b + 1];
39 }
40
41 return GSL_SUCCESS;
42 }
43 }
44
45 int
46 FUNCTION(gsl_vector, sub) (TYPE(gsl_vector) * a, const TYPE(gsl_vector) * b)
47 {
48 const size_t N = a->size;
49
50 if (b->size != N)
51 {
52 GSL_ERROR ("vectors must have same length", GSL_EBADLEN);
53 }
54 else
55 {
56 const size_t stride_a = a->stride;
57 const size_t stride_b = b->stride;
58
59 size_t i;
60
61 for (i = 0; i < N; i++)
62 {
63 a->data[2 * i * stride_a] -= b->data[2 * i * stride_b];
64 a->data[2 * i * stride_a + 1] -= b->data[2 * i * stride_b + 1];
65 }
66
67 return GSL_SUCCESS;
68 }
69 }
70
71 int
72 FUNCTION(gsl_vector, mul) (TYPE(gsl_vector) * a, const TYPE(gsl_vector) * b)
73 {
74 const size_t N = a->size;
75
76 if (b->size != N)
77 {
78 GSL_ERROR ("vectors must have same length", GSL_EBADLEN);
79 }
80 else
81 {
82 const size_t stride_a = a->stride;
83 const size_t stride_b = b->stride;
84
85 size_t i;
86
87 for (i = 0; i < N; i++)
88 {
89 ATOMIC ar = a->data[2 * i * stride_a];
90 ATOMIC ai = a->data[2 * i * stride_a + 1];
91
92 ATOMIC br = b->data[2 * i * stride_b];
93 ATOMIC bi = b->data[2 * i * stride_b + 1];
94
95 a->data[2 * i * stride_a] = ar * br - ai * bi;
96 a->data[2 * i * stride_a + 1] = ar * bi + ai * br;
97 }
98
99 return GSL_SUCCESS;
100 }
101 }
102
103 int
104 FUNCTION(gsl_vector, div) (TYPE(gsl_vector) * a, const TYPE(gsl_vector) * b)
105 {
106 const size_t N = a->size;
107
108 if (b->size != N)
109 {
110 GSL_ERROR ("vectors must have same length", GSL_EBADLEN);
111 }
112 else
113 {
114 const size_t stride_a = a->stride;
115 const size_t stride_b = b->stride;
116
117 size_t i;
118
119 for (i = 0; i < N; i++)
120 {
121 ATOMIC ar = a->data[2 * i * stride_a];
122 ATOMIC ai = a->data[2 * i * stride_a + 1];
123
124 ATOMIC br = b->data[2 * i * stride_b];
125 ATOMIC bi = b->data[2 * i * stride_b + 1];
126
127 ATOMIC s = 1.0 / hypot(br, bi);
128
129 ATOMIC sbr = s * br;
130 ATOMIC sbi = s * bi;
131
132 a->data[2 * i * stride_a] = (ar * sbr + ai * sbi) * s;
133 a->data[2 * i * stride_a + 1] = (ai * sbr - ar * sbi) * s;
134 }
135
136 return GSL_SUCCESS;
137 }
138 }
139
140 int
141 FUNCTION(gsl_vector, scale) (TYPE(gsl_vector) * a, const BASE x)
142 {
143 const size_t N = a->size;
144 const size_t stride = a->stride;
145
146 size_t i;
147
148 ATOMIC xr = GSL_REAL(x);
149 ATOMIC xi = GSL_IMAG(x);
150
151 for (i = 0; i < N; i++)
152 {
153 ATOMIC ar = a->data[2 * i * stride];
154 ATOMIC ai = a->data[2 * i * stride + 1];
155
156 a->data[2 * i * stride] = ar * xr - ai * xi;
157 a->data[2 * i * stride + 1] = ar * xi + ai * xr;
158 }
159
160 return GSL_SUCCESS;
161 }
162
163 int
164 FUNCTION(gsl_vector, add_constant) (TYPE(gsl_vector) * a, const BASE x)
165 {
166 const size_t N = a->size;
167 const size_t stride = a->stride;
168
169 size_t i;
170
171 ATOMIC xr = GSL_REAL(x);
172 ATOMIC xi = GSL_IMAG(x);
173
174 for (i = 0; i < N; i++)
175 {
176 a->data[2 * i * stride] += xr;
177 a->data[2 * i * stride + 1] += xi;
178 }
179
180 return GSL_SUCCESS;
181 }
3737 #define DESC ""
3838 #endif
3939
40
4140 #define BASE_GSL_COMPLEX_LONG
4241 #include "templates_on.h"
4342 #include "test_complex_source.c"
4443 #include "templates_off.h"
4544 #undef BASE_GSL_COMPLEX_LONG
46
4745
4846 #define BASE_GSL_COMPLEX
4947 #include "templates_on.h"
166164 test_short_ops (stride, ostride, N);
167165 test_uchar_ops (stride, ostride, N);
168166 test_char_ops (stride, ostride, N);
167 test_complex_ops (stride, ostride, N);
168 test_complex_float_ops (stride, ostride, N);
169 test_complex_long_double_ops (stride, ostride, N);
169170 }
170171
171172 test_text (stride, N);
266266 TEST (status, "_setbasis" DESC " over range") ;
267267 }
268268
269 {
270 int status = 0;
271
272 for (i = 0; i < N; i++)
273 {
274 BASE x = ZERO;
275 GSL_REAL (x) = (ATOMIC)i;
276 GSL_IMAG (x) = (ATOMIC)(i + 1234);
277 FUNCTION (gsl_vector, set) (v, i, x);
278 }
279
280 {
281 BASE x = ZERO;
282 GSL_REAL(x) = 2.0;
283 GSL_IMAG(x) = 3.0;
284 FUNCTION (gsl_vector, scale) (v, x);
285 }
286
287 for (i = 0; i < N; i++)
288 {
289 BASE r = FUNCTION(gsl_vector,get) (v,i);
290 ATOMIC real = -(ATOMIC)i-(ATOMIC)3702;
291 ATOMIC imag = 5*(ATOMIC)i+(ATOMIC)2468;
292 if (GSL_REAL(r) != real || GSL_IMAG(r) != imag)
293 status = 1;
294 };
295
296 TEST (status, "_scale" DESC " by 2") ;
297 }
298
299 {
300 int status = 0;
301
302 {
303 BASE x = ZERO;
304 GSL_REAL(x) = 7.0;
305 GSL_IMAG(x) = 13.0;
306 FUNCTION (gsl_vector, add_constant) (v, x);
307 }
308
309
310 for (i = 0; i < N; i++)
311 {
312 BASE r = FUNCTION(gsl_vector,get) (v,i);
313 ATOMIC real = -(ATOMIC)i-(ATOMIC)3695;
314 ATOMIC imag = 5*(ATOMIC)i+(ATOMIC)2481;
315
316 if (GSL_REAL(r) != real || GSL_IMAG(r) != imag)
317 status = 1;
318 };
319
320 TEST (status, "_add_constant" DESC) ;
321 }
322
269323 for (i = 0; i < N; i++)
270324 {
271325 BASE x = ZERO;
424478
425479
426480 FUNCTION (gsl_vector, free) (v0); /* free whatever is in v */
481 }
482
483 void
484 FUNCTION (test, ops) (size_t stride1, size_t stride2, size_t N)
485 {
486 size_t i;
487 TYPE (gsl_vector) * a = FUNCTION (create, vector) (stride1, N);
488 TYPE (gsl_vector) * b = FUNCTION (create, vector) (stride2, N);
489 TYPE (gsl_vector) * v = FUNCTION (create, vector) (stride1, N);
490
491 for (i = 0; i < N; i++)
492 {
493 BASE z, z1;
494 GSL_REAL (z) = (ATOMIC) 3+i;
495 GSL_IMAG (z) = (ATOMIC) (3+i + 10);
496 GSL_REAL (z1) = (ATOMIC) (3 + 2*i + 5);
497 GSL_IMAG (z1) = (ATOMIC) (3 + 2*i + 20);
498
499 FUNCTION (gsl_vector, set) (a, i, z);
500 FUNCTION (gsl_vector, set) (b, i, z1);
501 }
502
503 FUNCTION(gsl_vector, memcpy) (v, a);
504 FUNCTION(gsl_vector, add) (v, b);
505
506 {
507 int status = 0;
508
509 for (i = 0; i < N; i++)
510 {
511 BASE r = FUNCTION(gsl_vector,get) (v,i);
512 if (GSL_REAL(r) != (ATOMIC) (3*i+11)
513 || GSL_IMAG(r) != (ATOMIC) (3*i+36))
514 status = 1;
515 }
516 TEST2 (status, "_add vector addition");
517 }
518
519 {
520 int status = 0;
521
522 FUNCTION(gsl_vector, swap) (a, b);
523
524 for (i = 0; i < N; i++)
525 {
526 BASE z, z1;
527
528 BASE x = FUNCTION (gsl_vector, get) (a, i);
529 BASE y = FUNCTION (gsl_vector, get) (b, i);
530
531 GSL_REAL (z) = (ATOMIC) 3+i;
532 GSL_IMAG (z) = (ATOMIC) (3+i + 10);
533 GSL_REAL (z1) = (ATOMIC) (3 + 2*i + 5);
534 GSL_IMAG (z1) = (ATOMIC) (3 + 2*i + 20);
535
536 status |= !GSL_COMPLEX_EQ(z,y);
537 status |= !GSL_COMPLEX_EQ(z1,x);
538 }
539
540 FUNCTION(gsl_vector, swap) (a, b);
541
542 for (i = 0; i < N; i++)
543 {
544 BASE z, z1;
545
546 BASE x = FUNCTION (gsl_vector, get) (a, i);
547 BASE y = FUNCTION (gsl_vector, get) (b, i);
548
549 GSL_REAL (z) = (ATOMIC) 3+i;
550 GSL_IMAG (z) = (ATOMIC) (3+i + 10);
551 GSL_REAL (z1) = (ATOMIC) (3 + 2*i + 5);
552 GSL_IMAG (z1) = (ATOMIC) (3 + 2*i + 20);
553
554 status |= !GSL_COMPLEX_EQ(z,x);
555 status |= !GSL_COMPLEX_EQ(z1,y);
556 }
557
558 TEST2 (status, "_swap exchange vectors");
559 }
560
561 FUNCTION(gsl_vector, memcpy) (v, a);
562 FUNCTION(gsl_vector, sub) (v, b);
563
564 {
565 int status = 0;
566
567 for (i = 0; i < N; i++)
568 {
569 BASE r = FUNCTION(gsl_vector,get) (v,i);
570 if (GSL_REAL(r) != (-(ATOMIC)i-(ATOMIC)5) || GSL_IMAG(r) != (-(ATOMIC)i-(ATOMIC)10))
571 status = 1;
572 }
573
574 TEST2 (status, "_sub vector subtraction");
575 }
576
577 FUNCTION(gsl_vector, memcpy) (v, a);
578 FUNCTION(gsl_vector, mul) (v, b);
579
580 {
581 int status = 0;
582
583 for (i = 0; i < N; i++)
584 {
585 BASE r = FUNCTION(gsl_vector,get) (v,i);
586 ATOMIC real = (-35*(ATOMIC)i-275);
587 ATOMIC imag = (173+((ATOMIC)i)*(63+4*(ATOMIC)i));
588 if (fabs(GSL_REAL(r) - real) > 100 * BASE_EPSILON ||
589 fabs(GSL_IMAG(r) - imag) > 100 * BASE_EPSILON)
590 status = 1;
591 }
592
593 TEST2 (status, "_mul multiplication");
594 }
595
596 FUNCTION(gsl_vector, memcpy) (v, a);
597 FUNCTION(gsl_vector, div) (v, b);
598
599 {
600 int status = 0;
601
602 for (i = 0; i < N; i++)
603 {
604 BASE r = FUNCTION(gsl_vector,get) (v,i);
605 ATOMIC denom = 593 + ((ATOMIC)i)*(124+((ATOMIC)i)*8);
606 ATOMIC real = (323+((ATOMIC)i)*(63+4*((ATOMIC)i))) / denom;
607 ATOMIC imag = (35 +((ATOMIC)i)*5) / denom;
608 if (fabs(GSL_REAL(r) - real) > 100 * BASE_EPSILON)
609 status = 1;
610 if (fabs(GSL_IMAG(r) - imag) > 100 * BASE_EPSILON)
611 status = 1;
612 }
613 TEST2 (status, "_div division");
614 }
615
616 FUNCTION(gsl_vector, free) (a);
617 FUNCTION(gsl_vector, free) (b);
618 FUNCTION(gsl_vector, free) (v);
427619 }
428620
429621 void
1818
1919 #include <config.h>
2020 #include <gsl/gsl_errno.h>
21
22 /* Compile all the inline functions */
23
24 #define COMPILE_INLINE_STATIC
25 #include "build.h"
2126 #include <gsl/gsl_vector.h>
2227
23 /* turn off range checking at runtime if zero */
28 /* turn on range checking at runtime (disabled if zero) */
2429 int gsl_check_range = 1;
2530
26 #define BASE_GSL_COMPLEX_LONG
27 #include "templates_on.h"
28 #include "vector_source.c"
29 #include "templates_off.h"
30 #undef BASE_GSL_COMPLEX_LONG
31
32 #define BASE_GSL_COMPLEX
33 #include "templates_on.h"
34 #include "vector_source.c"
35 #include "templates_off.h"
36 #undef BASE_GSL_COMPLEX
37
38 #define BASE_GSL_COMPLEX_FLOAT
39 #include "templates_on.h"
40 #include "vector_source.c"
41 #include "templates_off.h"
42 #undef BASE_GSL_COMPLEX_FLOAT
43
44 #define BASE_LONG_DOUBLE
45 #include "templates_on.h"
46 #include "vector_source.c"
47 #include "templates_off.h"
48 #undef BASE_LONG_DOUBLE
49
50 #define BASE_DOUBLE
51 #include "templates_on.h"
52 #include "vector_source.c"
53 #include "templates_off.h"
54 #undef BASE_DOUBLE
55
56 #define BASE_FLOAT
57 #include "templates_on.h"
58 #include "vector_source.c"
59 #include "templates_off.h"
60 #undef BASE_FLOAT
61
62 #define BASE_ULONG
63 #include "templates_on.h"
64 #include "vector_source.c"
65 #include "templates_off.h"
66 #undef BASE_ULONG
67
68 #define BASE_LONG
69 #include "templates_on.h"
70 #include "vector_source.c"
71 #include "templates_off.h"
72 #undef BASE_LONG
73
74 #define BASE_UINT
75 #include "templates_on.h"
76 #include "vector_source.c"
77 #include "templates_off.h"
78 #undef BASE_UINT
79
80 #define BASE_INT
81 #include "templates_on.h"
82 #include "vector_source.c"
83 #include "templates_off.h"
84 #undef BASE_INT
85
86 #define BASE_USHORT
87 #include "templates_on.h"
88 #include "vector_source.c"
89 #include "templates_off.h"
90 #undef BASE_USHORT
91
92 #define BASE_SHORT
93 #include "templates_on.h"
94 #include "vector_source.c"
95 #include "templates_off.h"
96 #undef BASE_SHORT
97
98 #define BASE_UCHAR
99 #include "templates_on.h"
100 #include "vector_source.c"
101 #include "templates_off.h"
102 #undef BASE_UCHAR
103
104 #define BASE_CHAR
105 #include "templates_on.h"
106 #include "vector_source.c"
107 #include "templates_off.h"
108 #undef BASE_CHAR
+0
-83
vector/vector_source.c less more
0 /* vector/vector_source.c
1 *
2 * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 3 of the License, or (at
7 * your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18
19 #ifndef HIDE_INLINE_STATIC
20 BASE
21 FUNCTION (gsl_vector, get) (const TYPE (gsl_vector) * v, const size_t i)
22 {
23 if (gsl_check_range)
24 {
25 if (i >= v->size) /* size_t is unsigned, can't be negative */
26 {
27 BASE zero = ZERO;
28 GSL_ERROR_VAL ("index out of range", GSL_EINVAL, zero);
29 }
30 }
31
32 /* The following line is a generalization of return v->data[i] */
33
34 return *(BASE *) (v->data + MULTIPLICITY * i * v->stride);
35 }
36
37 void
38 FUNCTION (gsl_vector, set) (TYPE (gsl_vector) * v, const size_t i, BASE x)
39 {
40 if (gsl_check_range)
41 {
42 if (i >= v->size) /* size_t is unsigned, can't be negative */
43 {
44 GSL_ERROR_VOID ("index out of range", GSL_EINVAL);
45 }
46 }
47
48 /* The following line is a generalization of v->data[i] = x */
49
50 *(BASE *) (v->data + MULTIPLICITY * i * v->stride) = x;
51 }
52
53 BASE *
54 FUNCTION (gsl_vector, ptr) (TYPE (gsl_vector) * v, const size_t i)
55 {
56 if (gsl_check_range)
57 {
58 if (i >= v->size) /* size_t is unsigned, can't be negative */
59 {
60 GSL_ERROR_NULL ("index out of range", GSL_EINVAL);
61 }
62 }
63
64 return (BASE *) (v->data + MULTIPLICITY * i * v->stride);
65 }
66
67 const BASE *
68 FUNCTION (gsl_vector, const_ptr) (const TYPE (gsl_vector) * v, const size_t i)
69 {
70 if (gsl_check_range)
71 {
72 if (i >= v->size) /* size_t is unsigned, can't be negative */
73 {
74 GSL_ERROR_NULL ("index out of range", GSL_EINVAL);
75 }
76 }
77
78 /* The following line is a generalization of return v->data[i] */
79
80 return (const BASE *) (v->data + MULTIPLICITY * i * v->stride);
81 }
82 #endif
0 2008-10-13 Brian Gough <bjg@network-theory.co.uk>
1
2 * test.c (test_2d): change typename variable to name to avoid
3 conflict with C++ typename keyword
4
5 2008-07-03 Brian Gough <bjg@hp2.network-theory.co.uk>
6
7 * Makefile.am (INCLUDES): use top_srcdir instead of top_builddir
8
09 2008-01-03 Brian Gough <bjg@network-theory.co.uk>
110
211 * dwt.c (dwt_step): move pointer dereference out of loop
11
22 pkginclude_HEADERS = gsl_wavelet.h gsl_wavelet2d.h
33
4 INCLUDES= -I$(top_builddir)
4 INCLUDES = -I$(top_srcdir)
55
66 libgslwavelet_la_SOURCES = dwt.c wavelet.c bspline.c daubechies.c haar.c
77
134134 LIBOBJS = @LIBOBJS@
135135 LIBS = @LIBS@
136136 LIBTOOL = @LIBTOOL@
137 LIPO = @LIPO@
137138 LN_S = @LN_S@
138139 LTLIBOBJS = @LTLIBOBJS@
139140 MAINT = @MAINT@
141142 MKDIR_P = @MKDIR_P@
142143 NM = @NM@
143144 NMEDIT = @NMEDIT@
145 OBJDUMP = @OBJDUMP@
144146 OBJEXT = @OBJEXT@
147 OTOOL = @OTOOL@
148 OTOOL64 = @OTOOL64@
145149 PACKAGE = @PACKAGE@
146150 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
147151 PACKAGE_NAME = @PACKAGE_NAME@
206210 top_srcdir = @top_srcdir@
207211 noinst_LTLIBRARIES = libgslwavelet.la
208212 pkginclude_HEADERS = gsl_wavelet.h gsl_wavelet2d.h
209 INCLUDES = -I$(top_builddir)
213 INCLUDES = -I$(top_srcdir)
210214 libgslwavelet_la_SOURCES = dwt.c wavelet.c bspline.c daubechies.c haar.c
211215 TESTS = $(check_PROGRAMS)
212216 test_LDADD = libgslwavelet.la ../blas/libgslblas.la ../cblas/libgslcblas.la ../matrix/libgslmatrix.la ../vector/libgslvector.la ../block/libgslblock.la ../ieee-utils/libgslieeeutils.la ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la ../utils/libutils.la
104104 gsl_wavelet *w;
105105
106106 size_t i;
107 double *data = malloc (N * stride * sizeof (double));
107 double *data = (double *)malloc (N * stride * sizeof (double));
108108
109109 for (i = 0; i < N * stride; i++)
110110 data[i] = 12345.0 + i;
183183 size_t i;
184184 size_t j;
185185
186 double *data = malloc (N * tda * sizeof (double));
187
188 const char * typename;
189
190 typename = (type == 1) ? "standard" : "nonstd" ;
186 double *data = (double *)malloc (N * tda * sizeof (double));
187
188 const char * name;
189
190 name = (type == 1) ? "standard" : "nonstd" ;
191191
192192 for (i = 0; i < N * tda; i++)
193193 data[i] = 12345.0 + i;
242242
243243 gsl_test (fabs (x2 - x1) > N * 1e-15,
244244 "%s(%d)-2d %s, n = %d, tda = %d, maxerr = %g",
245 gsl_wavelet_name (w), member, typename, N, tda, fabs (x2 - x1));
245 gsl_wavelet_name (w), member, name, N, tda, fabs (x2 - x1));
246246 }
247247
248248 if (tda > N)
258258 }
259259
260260 gsl_test (status, "%s(%d)-2d %s other data untouched, n = %d, tda = %d",
261 gsl_wavelet_name (w), member, typename, N, tda);
261 gsl_wavelet_name (w), member, name, N, tda);
262262 }
263263
264264 free (data);