pax_global_header00006660000000000000000000000064123353704260014517gustar00rootroot0000000000000052 comment=8febe1bf858f56688942f169d21066f7de2ea950 ygsl-1.2.0/000077500000000000000000000000001233537042600124755ustar00rootroot00000000000000ygsl-1.2.0/.gitattributes000066400000000000000000000004031233537042600153650ustar00rootroot00000000000000*.[hc] filter=cleanup-code *.i filter=cleanup-text README filter=cleanup-text TODO filter=cleanup-text AUTHORS filter=cleanup-text NEWS filter=cleanup-text configure filter=cleanup-text Makefile filter=cleanup-yorick-makefile ygsl-1.2.0/.gitignore000066400000000000000000000011451233537042600144660ustar00rootroot00000000000000# Specific files # ################## ywrap.c build/ # Automatic backups # ##################### *~ # Compiled sources and libraries # ################################## *.com *.class *.dll *.exe *.o *.so lib*.a # Packages # ############ # it's better to unpack these files and commit the raw source # git has its own built in compression methods *.7z *.bz2 *.dmg *.gz *.iso *.jar *.rar *.tar *.tar.bz2 *.tar.gz *.tar.xz *.tgz *.txz *.xz *.zip # Logs and databases # ###################### *.log *.sql *.sqlite # OS generated files # ###################### .DS_Store* ehthumbs.db Icon? Thumbs.db .directory ygsl-1.2.0/AUTHORS000066400000000000000000000000561233537042600135460ustar00rootroot00000000000000Éric Thiébaut ygsl-1.2.0/LICENSE000066400000000000000000000525471233537042600135170ustar00rootroot00000000000000 CeCILL-C FREE SOFTWARE LICENSE AGREEMENT Notice This Agreement is a Free Software license agreement that is the result of discussions between its authors in order to ensure compliance with the two main principles guiding its drafting: * firstly, compliance with the principles governing the distribution of Free Software: access to source code, broad rights granted to users, * secondly, the election of a governing law, French law, with which it is conformant, both as regards the law of torts and intellectual property law, and the protection that it offers to both authors and holders of the economic rights over software. The authors of the CeCILL-C (for Ce[a] C[nrs] I[nria] L[ogiciel] L[ibre]) license are: Commissariat à l'Energie Atomique - CEA, a public scientific, technical and industrial research establishment, having its principal place of business at 25 rue Leblanc, immeuble Le Ponant D, 75015 Paris, France. Centre National de la Recherche Scientifique - CNRS, a public scientific and technological establishment, having its principal place of business at 3 rue Michel-Ange, 75794 Paris cedex 16, France. Institut National de Recherche en Informatique et en Automatique - INRIA, a public scientific and technological establishment, having its principal place of business at Domaine de Voluceau, Rocquencourt, BP 105, 78153 Le Chesnay cedex, France. Preamble The purpose of this Free Software license agreement is to grant users the right to modify and re-use the software governed by this license. The exercising of this right is conditional upon the obligation to make available to the community the modifications made to the source code of the software so as to contribute to its evolution. In consideration of access to the source code and the rights to copy, modify and redistribute granted by the license, users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the successive licensors only have limited liability. In this respect, the risks associated with loading, using, modifying and/or developing or reproducing the software by the user are brought to the user's attention, given its Free Software status, which may make it complicated to use, with the result that its use is reserved for developers and experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the suitability of the software as regards their requirements in conditions enabling the security of their systems and/or data to be ensured and, more generally, to use and operate it in the same conditions of security. This Agreement may be freely reproduced and published, provided it is not altered, and that no provisions are either added or removed herefrom. This Agreement may apply to any or all software for which the holder of the economic rights decides to submit the use thereof to its provisions. Article 1 - DEFINITIONS For the purpose of this Agreement, when the following expressions commence with a capital letter, they shall have the following meaning: Agreement: means this license agreement, and its possible subsequent versions and annexes. Software: means the software in its Object Code and/or Source Code form and, where applicable, its documentation, "as is" when the Licensee accepts the Agreement. Initial Software: means the Software in its Source Code and possibly its Object Code form and, where applicable, its documentation, "as is" when it is first distributed under the terms and conditions of the Agreement. Modified Software: means the Software modified by at least one Integrated Contribution. Source Code: means all the Software's instructions and program lines to which access is required so as to modify the Software. Object Code: means the binary files originating from the compilation of the Source Code. Holder: means the holder(s) of the economic rights over the Initial Software. Licensee: means the Software user(s) having accepted the Agreement. Contributor: means a Licensee having made at least one Integrated Contribution. Licensor: means the Holder, or any other individual or legal entity, who distributes the Software under the Agreement. Integrated Contribution: means any or all modifications, corrections, translations, adaptations and/or new functions integrated into the Source Code by any or all Contributors. Related Module: means a set of sources files including their documentation that, without modification to the Source Code, enables supplementary functions or services in addition to those offered by the Software. Derivative Software: means any combination of the Software, modified or not, and of a Related Module. Parties: mean both the Licensee and the Licensor. These expressions may be used both in singular and plural form. Article 2 - PURPOSE The purpose of the Agreement is the grant by the Licensor to the Licensee of a non-exclusive, transferable and worldwide license for the Software as set forth in Article 5 hereinafter for the whole term of the protection granted by the rights over said Software. Article 3 - ACCEPTANCE 3.1 The Licensee shall be deemed as having accepted the terms and conditions of this Agreement upon the occurrence of the first of the following events: * (i) loading the Software by any or all means, notably, by downloading from a remote server, or by loading from a physical medium; * (ii) the first time the Licensee exercises any of the rights granted hereunder. 3.2 One copy of the Agreement, containing a notice relating to the characteristics of the Software, to the limited warranty, and to the fact that its use is restricted to experienced users has been provided to the Licensee prior to its acceptance as set forth in Article 3.1 hereinabove, and the Licensee hereby acknowledges that it has read and understood it. Article 4 - EFFECTIVE DATE AND TERM 4.1 EFFECTIVE DATE The Agreement shall become effective on the date when it is accepted by the Licensee as set forth in Article 3.1. 4.2 TERM The Agreement shall remain in force for the entire legal term of protection of the economic rights over the Software. Article 5 - SCOPE OF RIGHTS GRANTED The Licensor hereby grants to the Licensee, who accepts, the following rights over the Software for any or all use, and for the term of the Agreement, on the basis of the terms and conditions set forth hereinafter. Besides, if the Licensor owns or comes to own one or more patents protecting all or part of the functions of the Software or of its components, the Licensor undertakes not to enforce the rights granted by these patents against successive Licensees using, exploiting or modifying the Software. If these patents are transferred, the Licensor undertakes to have the transferees subscribe to the obligations set forth in this paragraph. 5.1 RIGHT OF USE The Licensee is authorized to use the Software, without any limitation as to its fields of application, with it being hereinafter specified that this comprises: 1. permanent or temporary reproduction of all or part of the Software by any or all means and in any or all form. 2. loading, displaying, running, or storing the Software on any or all medium. 3. entitlement to observe, study or test its operation so as to determine the ideas and principles behind any or all constituent elements of said Software. This shall apply when the Licensee carries out any or all loading, displaying, running, transmission or storage operation as regards the Software, that it is entitled to carry out hereunder. 5.2 RIGHT OF MODIFICATION The right of modification includes the right to translate, adapt, arrange, or make any or all modifications to the Software, and the right to reproduce the resulting software. It includes, in particular, the right to create a Derivative Software. The Licensee is authorized to make any or all modification to the Software provided that it includes an explicit notice that it is the author of said modification and indicates the date of the creation thereof. 5.3 RIGHT OF DISTRIBUTION In particular, the right of distribution includes the right to publish, transmit and communicate the Software to the general public on any or all medium, and by any or all means, and the right to market, either in consideration of a fee, or free of charge, one or more copies of the Software by any means. The Licensee is further authorized to distribute copies of the modified or unmodified Software to third parties according to the terms and conditions set forth hereinafter. 5.3.1 DISTRIBUTION OF SOFTWARE WITHOUT MODIFICATION The Licensee is authorized to distribute true copies of the Software in Source Code or Object Code form, provided that said distribution complies with all the provisions of the Agreement and is accompanied by: 1. a copy of the Agreement, 2. a notice relating to the limitation of both the Licensor's warranty and liability as set forth in Articles 8 and 9, and that, in the event that only the Object Code of the Software is redistributed, the Licensee allows effective access to the full Source Code of the Software at a minimum during the entire period of its distribution of the Software, it being understood that the additional cost of acquiring the Source Code shall not exceed the cost of transferring the data. 5.3.2 DISTRIBUTION OF MODIFIED SOFTWARE When the Licensee makes an Integrated Contribution to the Software, the terms and conditions for the distribution of the resulting Modified Software become subject to all the provisions of this Agreement. The Licensee is authorized to distribute the Modified Software, in source code or object code form, provided that said distribution complies with all the provisions of the Agreement and is accompanied by: 1. a copy of the Agreement, 2. a notice relating to the limitation of both the Licensor's warranty and liability as set forth in Articles 8 and 9, and that, in the event that only the object code of the Modified Software is redistributed, the Licensee allows effective access to the full source code of the Modified Software at a minimum during the entire period of its distribution of the Modified Software, it being understood that the additional cost of acquiring the source code shall not exceed the cost of transferring the data. 5.3.3 DISTRIBUTION OF DERIVATIVE SOFTWARE When the Licensee creates Derivative Software, this Derivative Software may be distributed under a license agreement other than this Agreement, subject to compliance with the requirement to include a notice concerning the rights over the Software as defined in Article 6.4. In the event the creation of the Derivative Software required modification of the Source Code, the Licensee undertakes that: 1. the resulting Modified Software will be governed by this Agreement, 2. the Integrated Contributions in the resulting Modified Software will be clearly identified and documented, 3. the Licensee will allow effective access to the source code of the Modified Software, at a minimum during the entire period of distribution of the Derivative Software, such that such modifications may be carried over in a subsequent version of the Software; it being understood that the additional cost of purchasing the source code of the Modified Software shall not exceed the cost of transferring the data. 5.3.4 COMPATIBILITY WITH THE CeCILL LICENSE When a Modified Software contains an Integrated Contribution subject to the CeCILL license agreement, or when a Derivative Software contains a Related Module subject to the CeCILL license agreement, the provisions set forth in the third item of Article 6.4 are optional. Article 6 - INTELLECTUAL PROPERTY 6.1 OVER THE INITIAL SOFTWARE The Holder owns the economic rights over the Initial Software. Any or all use of the Initial Software is subject to compliance with the terms and conditions under which the Holder has elected to distribute its work and no one shall be entitled to modify the terms and conditions for the distribution of said Initial Software. The Holder undertakes that the Initial Software will remain ruled at least by this Agreement, for the duration set forth in Article 4.2. 6.2 OVER THE INTEGRATED CONTRIBUTIONS The Licensee who develops an Integrated Contribution is the owner of the intellectual property rights over this Contribution as defined by applicable law. 6.3 OVER THE RELATED MODULES The Licensee who develops a Related Module is the owner of the intellectual property rights over this Related Module as defined by applicable law and is free to choose the type of agreement that shall govern its distribution under the conditions defined in Article 5.3.3. 6.4 NOTICE OF RIGHTS The Licensee expressly undertakes: 1. not to remove, or modify, in any manner, the intellectual property notices attached to the Software; 2. to reproduce said notices, in an identical manner, in the copies of the Software modified or not; 3. to ensure that use of the Software, its intellectual property notices and the fact that it is governed by the Agreement is indicated in a text that is easily accessible, specifically from the interface of any Derivative Software. The Licensee undertakes not to directly or indirectly infringe the intellectual property rights of the Holder and/or Contributors on the Software and to take, where applicable, vis-à-vis its staff, any and all measures required to ensure respect of said intellectual property rights of the Holder and/or Contributors. Article 7 - RELATED SERVICES 7.1 Under no circumstances shall the Agreement oblige the Licensor to provide technical assistance or maintenance services for the Software. However, the Licensor is entitled to offer this type of services. The terms and conditions of such technical assistance, and/or such maintenance, shall be set forth in a separate instrument. Only the Licensor offering said maintenance and/or technical assistance services shall incur liability therefor. 7.2 Similarly, any Licensor is entitled to offer to its licensees, under its sole responsibility, a warranty, that shall only be binding upon itself, for the redistribution of the Software and/or the Modified Software, under terms and conditions that it is free to decide. Said warranty, and the financial terms and conditions of its application, shall be subject of a separate instrument executed between the Licensor and the Licensee. Article 8 - LIABILITY 8.1 Subject to the provisions of Article 8.2, the Licensee shall be entitled to claim compensation for any direct loss it may have suffered from the Software as a result of a fault on the part of the relevant Licensor, subject to providing evidence thereof. 8.2 The Licensor's liability is limited to the commitments made under this Agreement and shall not be incurred as a result of in particular: (i) loss due the Licensee's total or partial failure to fulfill its obligations, (ii) direct or consequential loss that is suffered by the Licensee due to the use or performance of the Software, and (iii) more generally, any consequential loss. In particular the Parties expressly agree that any or all pecuniary or business loss (i.e. loss of data, loss of profits, operating loss, loss of customers or orders, opportunity cost, any disturbance to business activities) or any or all legal proceedings instituted against the Licensee by a third party, shall constitute consequential loss and shall not provide entitlement to any or all compensation from the Licensor. Article 9 - WARRANTY 9.1 The Licensee acknowledges that the scientific and technical state-of-the-art when the Software was distributed did not enable all possible uses to be tested and verified, nor for the presence of possible defects to be detected. In this respect, the Licensee's attention has been drawn to the risks associated with loading, using, modifying and/or developing and reproducing the Software which are reserved for experienced users. The Licensee shall be responsible for verifying, by any or all means, the suitability of the product for its requirements, its good working order, and for ensuring that it shall not cause damage to either persons or properties. 9.2 The Licensor hereby represents, in good faith, that it is entitled to grant all the rights over the Software (including in particular the rights set forth in Article 5). 9.3 The Licensee acknowledges that the Software is supplied "as is" by the Licensor without any other express or tacit warranty, other than that provided for in Article 9.2 and, in particular, without any warranty as to its commercial value, its secured, safe, innovative or relevant nature. Specifically, the Licensor does not warrant that the Software is free from any error, that it will operate without interruption, that it will be compatible with the Licensee's own equipment and software configuration, nor that it will meet the Licensee's requirements. 9.4 The Licensor does not either expressly or tacitly warrant that the Software does not infringe any third party intellectual property right relating to a patent, software or any other property right. Therefore, the Licensor disclaims any and all liability towards the Licensee arising out of any or all proceedings for infringement that may be instituted in respect of the use, modification and redistribution of the Software. Nevertheless, should such proceedings be instituted against the Licensee, the Licensor shall provide it with technical and legal assistance for its defense. Such technical and legal assistance shall be decided on a case-by-case basis between the relevant Licensor and the Licensee pursuant to a memorandum of understanding. The Licensor disclaims any and all liability as regards the Licensee's use of the name of the Software. No warranty is given as regards the existence of prior rights over the name of the Software or as regards the existence of a trademark. Article 10 - TERMINATION 10.1 In the event of a breach by the Licensee of its obligations hereunder, the Licensor may automatically terminate this Agreement thirty (30) days after notice has been sent to the Licensee and has remained ineffective. 10.2 A Licensee whose Agreement is terminated shall no longer be authorized to use, modify or distribute the Software. However, any licenses that it may have granted prior to termination of the Agreement shall remain valid subject to their having been granted in compliance with the terms and conditions hereof. Article 11 - MISCELLANEOUS 11.1 EXCUSABLE EVENTS Neither Party shall be liable for any or all delay, or failure to perform the Agreement, that may be attributable to an event of force majeure, an act of God or an outside cause, such as defective functioning or interruptions of the electricity or telecommunications networks, network paralysis following a virus attack, intervention by government authorities, natural disasters, water damage, earthquakes, fire, explosions, strikes and labor unrest, war, etc. 11.2 Any failure by either Party, on one or more occasions, to invoke one or more of the provisions hereof, shall under no circumstances be interpreted as being a waiver by the interested Party of its right to invoke said provision(s) subsequently. 11.3 The Agreement cancels and replaces any or all previous agreements, whether written or oral, between the Parties and having the same purpose, and constitutes the entirety of the agreement between said Parties concerning said purpose. No supplement or modification to the terms and conditions hereof shall be effective as between the Parties unless it is made in writing and signed by their duly authorized representatives. 11.4 In the event that one or more of the provisions hereof were to conflict with a current or future applicable act or legislative text, said act or legislative text shall prevail, and the Parties shall make the necessary amendments so as to comply with said act or legislative text. All other provisions shall remain effective. Similarly, invalidity of a provision of the Agreement, for any reason whatsoever, shall not cause the Agreement as a whole to be invalid. 11.5 LANGUAGE The Agreement is drafted in both French and English and both versions are deemed authentic. Article 12 - NEW VERSIONS OF THE AGREEMENT 12.1 Any person is authorized to duplicate and distribute copies of this Agreement. 12.2 So as to ensure coherence, the wording of this Agreement is protected and may only be modified by the authors of the License, who reserve the right to periodically publish updates or new versions of the Agreement, each with a separate number. These subsequent versions may address new issues encountered by Free Software. 12.3 Any Software distributed under a given version of the Agreement may only be subsequently distributed under the same version of the Agreement or a subsequent version. Article 13 - GOVERNING LAW AND JURISDICTION 13.1 The Agreement is governed by French law. The Parties agree to endeavor to seek an amicable solution to any disagreements or disputes that may arise during the performance of the Agreement. 13.2 Failing an amicable solution within two (2) months as from their occurrence, and unless emergency proceedings are necessary, the disagreements or disputes shall be referred to the Paris Courts having jurisdiction, by the more diligent Party. Version 1.0 dated 2006-09-05. ygsl-1.2.0/Makefile000066400000000000000000000102071233537042600141350ustar00rootroot00000000000000# where are the sources? (automatically filled in by configure script) srcdir=. # these values filled in by "yorick -batch make.i" or configure script Y_MAKEDIR= Y_EXE= Y_EXE_PKGS= Y_EXE_HOME= Y_EXE_SITE= Y_HOME_PKG= # ----------------------------------------------------- optimization flags # options for make command line, e.g.- make COPT=-g TGT=exe COPT=$(COPT_DEFAULT) TGT=$(DEFAULT_TGT) # ------------------------------------------------ macros for this package PKG_NAME=ygsl PKG_I=${srcdir}/gsl.i OBJS=ygsl.o # change to give the executable a name other than yorick PKG_EXENAME=yorick PREFIX=/usr/local # PKG_DEPLIBS=-Lsomedir -lsomelib for dependencies of this package PKG_DEPLIBS= -L$(PREFIX)/lib -lgsl -lgslcblas # set compiler (or rarely loader) flags specific to this package PKG_CFLAGS= -I$(PREFIX)/include PKG_LDFLAGS= # list of additional package names you want in PKG_EXENAME # (typically $(Y_EXE_PKGS) should be first here) EXTRA_PKGS=$(Y_EXE_PKGS) # list of additional files for clean PKG_CLEAN= cmp.tmp1 cmp.tmp2 # autoload file for this package, if any PKG_I_START= # non-pkg.i include files for this package, if any PKG_I_EXTRA= RELEASE_FILES = AUTHORS LICENSE Makefile NEWS README.md TODO \ configure gsl.i ygsl.c RELEASE_NAME = $(PKG_NAME)-$(RELEASE_VERSION).tar.bz2 # -------------------------------- standard targets and rules (in Makepkg) # set macros Makepkg uses in target and dependency names # DLL_TARGETS, LIB_TARGETS, EXE_TARGETS # are any additional targets (defined below) prerequisite to # the plugin library, archive library, and executable, respectively PKG_I_DEPS=$(PKG_I) Y_DISTMAKE=distmake ifeq (,$(strip $(Y_MAKEDIR))) $(info *** WARNING: Y_MAKEDIR not defined, you may run 'yorick -batch make.i' first) else include $(Y_MAKEDIR)/Make.cfg include $(Y_MAKEDIR)/Makepkg include $(Y_MAKEDIR)/Make$(TGT) endif # override macros Makepkg sets for rules and other macros # see comments in Y_HOME/Makepkg for a list of possibilities # if this package built with mpy: 1. be sure mpy appears in EXTRA_PKGS, # 2. set TGT=exe, and 3. uncomment following two lines # Y_MAIN_O=$(Y_LIBEXE)/mpymain.o # include $(Y_MAKEDIR)/Makempy # configure script for this package may produce make macros: # include output-makefile-from-package-configure # reduce chance of yorick-1.5 corrupting this Makefile MAKE_TEMPLATE = protect-against-1.5 # ------------------------------------- targets and rules for this package # Dummy default target in case Y_MAKEDIR was not defined: dummy-default: @echo >&2 "*** ERROR: Y_MAKEDIR not defined, aborting..."; false %.o: ${srcdir}/%.c $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $< # simple example: #myfunc.o: myapi.h # more complex example (also consider using PKG_CFLAGS above): #myfunc.o: myapi.h myfunc.c # $(CC) $(CPPFLAGS) $(CFLAGS) -DMY_SWITCH -o $@ -c myfunc.c cmp-sf: grep 'FN.gsl_sf' <${srcdir}/ygsl.c \ | sed 's/FN//g;s/[^0-9A-Za-z_]/ /g;s/ */\n/g;' \ | sort -u >cmp.tmp1 grep '^[ ]*extern[ ]' <${srcdir}/gsl.i \ | sed 's/extern//g;s/[^0-9A-Za-z_]/ /g;s/ */\n/g;' \ | grep 'gsl_sf_' \ | sort -u >cmp.tmp2 diff -B cmp.tmp1 cmp.tmp2 release: $(RELEASE_NAME) $(RELEASE_NAME): @if test "x$(RELEASE_VERSION)" = "x"; then \ echo >&2 "set package version: make RELEASE_VERSION=... release"; \ else \ dir=`basename "$(RELEASE_NAME)" .tar.bz2`; \ if test "x$$dir" = "x" -o "x$$dir" = "x."; then \ echo >&2 "bad directory name for archive"; \ elif test -d "$$dir"; then \ echo >&2 "directory $$dir already exists"; \ else \ mkdir -p "$$dir"; \ for src in $(RELEASE_FILES); do \ dst="$$dir/$$src"; \ if test "$$src" = "Makefile"; then \ sed <"$$src" >"$$dst" -e 's/^\( *Y_\(MAKEDIR\|EXE\(\|_PKGS\|_HOME\|_SITE\)\|HOME_PKG\) *=\).*/\1/'; \ touch -r "$$src" "$$dst"; \ else \ cp -p "$$src" "$$dst"; \ fi; \ done; \ rm -f "$$dir"/*~ "$$dir"/*/*~; \ echo "$(RELEASE_VERSION)" > "$$dir/VERSION"; \ tar jcf "$(RELEASE_NAME)" "$$dir"; \ rm -rf "$$dir"; \ echo "$(RELEASE_NAME) created"; \ fi; \ fi; .PHONY: clean release # -------------------------------------------------------- end of Makefile ygsl-1.2.0/NEWS000066400000000000000000000007201233537042600131730ustar00rootroot00000000000000 * 2014-05-16: Release 1.1.1 New functions gsl_poly_solve_quadratic and gsl_poly_solve_cubic to find the roots of quadratic and cubic polynomials. * 2013-07-09: Release 1.1.1 README.md used in place of README. * 2013-07-09: Release 1.1.0 Created repository on GitHub: * 2013-01-27: Add digamma, trigamma and polygamma functions. * 2013-01-17: Release 1.0.0 YGSL plugin created from a component of Yeti. ygsl-1.2.0/README.md000066400000000000000000000041111233537042600137510ustar00rootroot00000000000000YGSL ==== YGSL is a Yorick plug-in to bring some special functions of the GSL (GNU Scientific Library) into Yorick. Installation ------------ In short, building and installing the plug-in can be as quick as: ```` $ cd $BUILD_DIR $ $SRC_DIR/configure $ make $ make install ```` where `$BUILD_DIR` is the build directory (at your convenience) and `$SRC\_DIR` is the source directory of the plug-in code. The build and source directories can be the same in which case, call `./configure` to configure for building. Then, to use the plug-in in Yorick: ```` $ yorick > include "gsl.i" ```` More detailled explanations are given below. 1. You must have Yorick and the GSL (GNU Scientific Library) installed on your machine. (See the *"Links"* section below.) 2. Unpack the plug-in code somewhere. 3. Configure for compilation. The are two possibilities: For an **in-place build**, go to the source directory of the plug-in code and run the configuration script: ```` $ cd SRC_DIR $ ./configure ```` To see the configuration options, call: ```` $ ./configure --help ```` To compile in a **different build directory**, say BUILD_DIR, create the build directory, go to the build directory, and run the configuration script: ```` $ mkdir -p $BUILD_DIR $ cd $BUILD_DIR $ $SRC_DIR/configure ```` where `$SRC_DIR` is the path to the source directory of the plug-in code. To see the configuration options, call: ```` $ $SRC_DIR/configure --help ```` 4. Compile the code: ```` $ make ```` 4. Install the plug-in in Yorick directories: ```` $ make install ```` License ------- YGSL is open source sofware released under the CeCILL-C license . History ------- YGSL was a component of Yeti (a group of Yorick plugins), it is now a standalone plug-in. You can find more informations about Yeti at . Links ----- * Yorick: ; * GSL (GNU Scientific Library): ; ygsl-1.2.0/TODO000066400000000000000000000002071233537042600131640ustar00rootroot00000000000000 - make a portable configure-like script able to build a plugin in a remote directory - change Yorick Make(file)s to use ${srcdir} ygsl-1.2.0/configure000077500000000000000000000143571233537042600144160ustar00rootroot00000000000000#! /bin/sh # # Configuration script for a Yorick plugin. # #------------------------------------------------------------------------------ # # Copyright (C) 2012 Éric Thiébaut # # This software is governed by the CeCILL-C license under French law and # abiding by the rules of distribution of free software. You can use, modify # and/or redistribute the software under the terms of the CeCILL-C license as # circulated by CEA, CNRS and INRIA at the following URL # "http://www.cecill.info". # # As a counterpart to the access to the source code and rights to copy, # modify and redistribute granted by the license, users are provided only # with a limited warranty and the software's author, the holder of the # economic rights, and the successive licensors have only limited liability. # # In this respect, the user's attention is drawn to the risks associated with # loading, using, modifying and/or developing or reproducing the software by # the user in light of its specific status of free software, that may mean # that it is complicated to manipulate, and that also therefore means that it # is reserved for developers and experienced professionals having in-depth # computer knowledge. Users are therefore encouraged to load and test the # software's suitability as regards their requirements in conditions enabling # the security of their systems and/or data to be ensured and, more # generally, to use and operate it in the same conditions as regards # security. # # The fact that you are presently reading this means that you have had # knowledge of the CeCILL-C license and that you accept its terms. # #------------------------------------------------------------------------------ # The following default values are specific to the package. They can be # overwritten by options on the command line. cfg_cflags= cfg_deplibs='-lgsl -lgslcblas' cfg_ldflags= # The other values are pretty general. cfg_tmpdir=. cfg_tmpfile="$cfg_tmpdir/cfg-$$" cfg_debug=no cfg_on_exit () { if test "$cfg_debug" = "no"; then rm -f "$cfg_tmpfile" "$cfg_tmpfile.i" fi } trap cfg_on_exit 0 cfg_progname=$0 cfg_srcdir=$(dirname "$0") #cfg_path=$(readlink -fn "$@") #cfg_srcdir=$(dirname "$cfg_path") cfg_die () { echo >&2 "$cfg_progname: $*"; exit 1; } cfg_opt_value () { echo "$*" | sed 's/^--[^=]*=//'; } cfg_despace () { echo "$*" | sed 's/ /\\ /g'; } cfg_subst_macro () { local s local t s=$* for t in "/" "%" "@" "," "-"; do case "$s" in *$t* ) ;; * ) break esac done if test "$t" = "-"; then cfg_die "No valid separator found" fi s='[ ]*' echo "s${t}^${s}${1}${s}=.*${t}${1}=${2}${t}" } cfg_help () { cat <&2 "Yorick excutable not found." echo >&2 "Try to specify the path with option --yorick=..." exit 1 fi echo >&2 "Yorick executable --------> $cfg_yorick" # Get the Y_HOME and Y_SITE variables. cat >"$cfg_tmpfile.i" < "$cfg_tmpfile" cfg_yhome=$(sed < "$cfg_tmpfile" -e '/^Y_HOME=/!d;s/^Y_HOME=//') cfg_ysite=$(sed < "$cfg_tmpfile" -e '/^Y_SITE=/!d;s/^Y_SITE=//') cfg_ymkdir=$cfg_yhome echo >&2 "Yorick home directory ----> $cfg_yhome" echo >&2 "Yorick site directory ----> $cfg_ysite" # Create the Makefile. cfg_dst="./Makefile" if test "$cfg_inplace" = "yes"; then cfg_src="$cfg_dst.bak" mv -f "$cfg_dst" "$cfg_src" else cfg_src="$cfg_srcdir/Makefile" fi cfg_s0=$(cfg_subst_macro "Y_EXE" "$cfg_yorick") cfg_s1=$(cfg_subst_macro "Y_MAKEDIR" "$cfg_ymkdir") cfg_s2=$(cfg_subst_macro "Y_EXE_HOME" "$cfg_yhome") cfg_s3=$(cfg_subst_macro "Y_EXE_SITE" "$cfg_ysite") cfg_s4=$(cfg_subst_macro "PKG_CFLAGS" "$cfg_cflags") cfg_s5=$(cfg_subst_macro "PKG_DEPLIBS" "$cfg_deplibs") cfg_s6=$(cfg_subst_macro "PKG_LFLAGS" "$cfg_ldflags") cfg_s7=$(cfg_subst_macro "srcdir" "$cfg_srcdir") sed < "$cfg_src" > "$cfg_dst" \ -e "$cfg_s0;$cfg_s1;$cfg_s2;$cfg_s3;$cfg_s4;$cfg_s5;$cfg_s6;$cfg_s7" if test "$cfg_inplace" = "yes"; then rm -f "$cfg_src" fi echo "Makefile has been updated." echo "You can run 'make' and 'make install' now." # Local Variables: # mode: sh # tab-width: 8 # indent-tabs-mode: nil # fill-column: 78 # coding: utf-8 # End: ygsl-1.2.0/gsl.i000066400000000000000000000747441233537042600134540ustar00rootroot00000000000000/* * gsl.i -- * * Support for GSL (GNU Scientific Library) in Yorick. * *----------------------------------------------------------------------------- * * Copyright (C) 2012 Éric Thiébaut * * This software is governed by the CeCILL-C license under French law and * abiding by the rules of distribution of free software. You can use, modify * and/or redistribute the software under the terms of the CeCILL-C license as * circulated by CEA, CNRS and INRIA at the following URL * "http://www.cecill.info". * * As a counterpart to the access to the source code and rights to copy, * modify and redistribute granted by the license, users are provided only * with a limited warranty and the software's author, the holder of the * economic rights, and the successive licensors have only limited liability. * * In this respect, the user's attention is drawn to the risks associated with * loading, using, modifying and/or developing or reproducing the software by * the user in light of its specific status of free software, that may mean * that it is complicated to manipulate, and that also therefore means that it * is reserved for developers and experienced professionals having in-depth * computer knowledge. Users are therefore encouraged to load and test the * software's suitability as regards their requirements in conditions enabling * the security of their systems and/or data to be ensured and, more * generally, to use and operate it in the same conditions as regards * security. * * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. * *----------------------------------------------------------------------------- */ if (is_func(plug_in)) plug_in, "ygsl"; local gsl_sf; /* DOCUMENT gsl_sf_* * * Special functions from GSL (GNU Scientific Library) are prefixed with * "gsl_sf_"; to obtain more information, see the following documentation * entries: * * gsl_sf_airy_Ai - Airy functions * gsl_sf_bessel_J0 - regular cylindrical Bessel functions * gsl_sf_bessel_Y0 - irregular cylindrical Bessel functions * gsl_sf_bessel_I0 - regular modified cylindrical Bessel functions * gsl_sf_bessel_K0 - irregular modified cylindrical Bessel functions * gsl_sf_bessel_j0 - regular spherical Bessel functions * gsl_sf_bessel_y0 - irregular spherical Bessel functions * gsl_sf_bessel_i0_scaled - regular modified spherical Bessel functions * gsl_sf_bessel_k0_scaled - irregular modified spherical Bessel functions * gsl_sf_clausen - Clausen function * gsl_sf_dawson - Dawson integral * gsl_sf_debye - Debye functions * gsl_sf_dilog - dilogarithm * gsl_sf_ellint_Kcomp - Legendre form of complete elliptic integrals * gsl_sf_erf - error functions * gsl_sf_exp - exponential and logarithm functions * gsl_sf_expint - exponential, hyperbolic and trigonometric integrals * gsl_sf_fermi_dirac - Fermi-Dirac integrals * gsl_sf_gamma - Gamma functions * gsl_sf_psi - Digamma, trigamma and polygamma functions * gsl_sf_lamber - Lambert's functions * gsl_sf_legendre - Legendre polynomials * gsl_sf_synchrotron - synchrotron functions * gsl_sf_transport - transport functions * gsl_sf_sin - trigonometric functions * gsl_sf_zeta - Zeta functions */ extern gsl_sf_airy_Ai; extern gsl_sf_airy_Bi; extern gsl_sf_airy_Ai_scaled; extern gsl_sf_airy_Bi_scaled; extern gsl_sf_airy_Ai_deriv; extern gsl_sf_airy_Bi_deriv; extern gsl_sf_airy_Ai_deriv_scaled; extern gsl_sf_airy_Bi_deriv_scaled; /* DOCUMENT gsl_sf_airy_Ai(x [,flags]) * gsl_sf_airy_Bi(x [,flags]) * gsl_sf_airy_Ai_deriv(x [,flags]) * gsl_sf_airy_Bi_deriv(x [,flags]) * gsl_sf_airy_Ai_scaled(x [,flags]) * gsl_sf_airy_Bi_scaled(x [,flags]) * gsl_sf_airy_Ai_deriv_scaled(x [,flags]) * gsl_sf_airy_Bi_deriv_scaled(x [,flags]) * * These routines compute the Airy functions and derivatives for the * argument X (a non-complex numerical array). * * The routines gsl_sf_airy_Ai and gsl_sf_airy_Bi compute Airy functions * Ai(x) and Bi(x) which are defined by the integral representations: * * Ai(x) = (1/PI) \int_0^\infty cos((1/3)*t^3 + x*t) dt * Bi(x) = (1/PI) \int_0^\infty (exp(-(1/3)*t^3) * + sin((1/3)*t^3 + x*t)) dt * * The routines gsl_sf_airy_Ai_deriv and gsl_sf_airy_Bi_deriv compute * the derivatives of the Airy functions. * * The routines gsl_sf_airy_Ai_scaled and gsl_sf_airy_Bi_scaled compute * a scaled version of the Airy functions S_A(x) Ai(x) and S_B(x) Bi(x). * The scaling factors are: * S_A(x) = exp(+(2/3)*x^(3/2)), for x>0 * 1, for x<0; * S_B(x) = exp(-(2/3)*x^(3/2)), for x>0 * 1, for x<0. * * The routines gsl_sf_airy_Ai_deriv_scaled and * gsl_sf_airy_Bi_deriv_scaled compute the derivatives of the scaled Airy * functions. * * The optional FLAGS argument is a bitwise combination which specifies * the relative accuracy of the result and if an estimate of the error * is required: * * (FLAGS & 1) is non-zero to compute an estimate of the error, the * result, says Y, has an additional dimension of length 2 * prepended to the dimension list of X: * Y(1,..) = value of F(X) * Y(2,..) = error estimate for the value of F(X) * * (FLAGS & 6) is the accuracy mode: * 6 - Double-precision (GSL_PREC_DOUBLE), a relative accuracy of * approximately 2e-16. * 4 - Single-precision (GSL_PREC_SINGLE), a relative accuracy of * approximately 1e-7. * 2 - Approximate values (GSL_PREC_APPROX), a relative accuracy * of approximately 5e-4. * 0 - Default accuracy (GSL_PREC_DOUBLE). * * For instance, with FLAGS=1, function values are computed with relative * accuracy of 2e-16 and an estimate of the error is returned; with * FLAGS=2, approximate values with relative accuracy of 5e-4 are * returned without error estimate * * * SEE ALSO: gsl_sf. */ extern gsl_sf_bessel_J0; extern gsl_sf_bessel_J1; extern gsl_sf_bessel_Jn; extern gsl_sf_bessel_Jnu; /* DOCUMENT gsl_sf_bessel_J0(x [,err]) * gsl_sf_bessel_J1(x [,err]) * gsl_sf_bessel_Jn(n, x [,err]) * gsl_sf_bessel_Jnu(nu, x [,err]) * * These functions compute the regular cylindrical Bessel functions for * argument X (a non-complex numerical array or scalar) and of various * order: zeroth order, J_0(x); first order, J_1(x), integer order order * N, J_n(x), and fractional order NU, J_nu(x). N must be a scalar * integer and NU a scalar real. * * If optional argument ERR is true, these functions also compute an * estimate of the error, the result, says Y, has an additional dimension * of length 2 prepended to the dimension list of X: * Y(1,..) = value of F(X) * Y(2,..) = error estimate for the value of F(X) * * * SEE ALSO: gsl_sf, gsl_sf_bessel_Y0, gsl_sf_bessel_I0, gsl_sf_bessel_K0, * gsl_sf_bessel_j0, gsl_sf_bessel_y0, gsl_sf_bessel_i0, * gsl_sf_bessel_k0. */ extern gsl_sf_bessel_Y0; extern gsl_sf_bessel_Y1; extern gsl_sf_bessel_Yn; extern gsl_sf_bessel_Ynu; /* DOCUMENT gsl_sf_bessel_Y0(x [,err]) * gsl_sf_bessel_Y1(x [,err]) * gsl_sf_bessel_Yn(n, x [,err]) * gsl_sf_bessel_Ynu(nu, x [,err]) * * These functions compute the irregular cylindrical Bessel functions for * X>0. See gsl_sf_bessel_J0 for a more detailled description of the * arguments. * * * SEE ALSO: gsl_sf, gsl_sf_bessel_J0. */ extern gsl_sf_bessel_I0; extern gsl_sf_bessel_I1; extern gsl_sf_bessel_In; extern gsl_sf_bessel_Inu; extern gsl_sf_bessel_I0_scaled; extern gsl_sf_bessel_I1_scaled; extern gsl_sf_bessel_In_scaled; extern gsl_sf_bessel_Inu_scaled; /* DOCUMENT gsl_sf_bessel_I0(x [,err]) * gsl_sf_bessel_I1(x [,err]) * gsl_sf_bessel_In(n, x [,err]) * gsl_sf_bessel_Inu(nu, x [,err]) * gsl_sf_bessel_I0_scaled(x [,err]) * gsl_sf_bessel_I1_scaled(x [,err]) * gsl_sf_bessel_In_scaled(n, x [,err]) * gsl_sf_bessel_Inu_scaled(nu, x [,err]) * * These routines compute the regular modified cylindrical Bessel * functions and their scaled counterparts. The scaling factor is * exp(-abs(X)); for instance: I0_scaled(X) = exp(-abs(X))*I0(X). See * gsl_sf_bessel_J0 for a more detailled description of the arguments. * * * SEE ALSO: gsl_sf, gsl_sf_bessel_J0. */ extern gsl_sf_bessel_K0; extern gsl_sf_bessel_K1; extern gsl_sf_bessel_Kn; extern gsl_sf_bessel_Knu; extern gsl_sf_bessel_lnKnu; extern gsl_sf_bessel_K0_scaled; extern gsl_sf_bessel_K1_scaled; extern gsl_sf_bessel_Kn_scaled; extern gsl_sf_bessel_Knu_scaled; /* DOCUMENT gsl_sf_bessel_K0(x [,err]) * gsl_sf_bessel_K1(x [,err]) * gsl_sf_bessel_Kn(n, x [,err]) * gsl_sf_bessel_Knu(nu, x [,err]) * gsl_sf_bessel_lnKnu(nu, x [,err]) * gsl_sf_bessel_K0_scaled(x [,err]) * gsl_sf_bessel_K1_scaled(x [,err]) * gsl_sf_bessel_Kn_scaled(n, x [,err]) * gsl_sf_bessel_Knu_scaled(nu, x [,err]) * * These routines compute the irregular modified cylindrical Bessel * functions and their scaled counterparts. The scaling factor is exp(X) * for X>0; for instance: K0_scaled(X) = exp(X)*K0(X). The function * gsl_sf_bessel_lnKnu computes the logarithm of the irregular modified * Bessel function of fractional order NU. See gsl_sf_bessel_J0 for a * more detailled description of the arguments. * * * SEE ALSO: gsl_sf, gsl_sf_bessel_J0. */ extern gsl_sf_bessel_j0; extern gsl_sf_bessel_j1; extern gsl_sf_bessel_j2; extern gsl_sf_bessel_jl; /* DOCUMENT gsl_sf_bessel_j0(x [,err]) * gsl_sf_bessel_j1(x [,err]) * gsl_sf_bessel_j2(x [,err]) * gsl_sf_bessel_jl(l, x [,err]) * * These routines compute the regular spherical Bessel functions of * zeroth order (j0), first order (j1), second order (j2) and l-th order * (jl, for X>=0 and L>=0). See gsl_sf_bessel_J0 for a more detailled * description of the arguments. * * * SEE ALSO: gsl_sf, gsl_sf_bessel_J0. */ extern gsl_sf_bessel_y0; extern gsl_sf_bessel_y1; extern gsl_sf_bessel_y2; extern gsl_sf_bessel_yl; /* DOCUMENT gsl_sf_bessel_y0(x [,err]) * gsl_sf_bessel_y1(x [,err]) * gsl_sf_bessel_y2(x [,err]) * gsl_sf_bessel_yl(l, x [,err]) * * These routines compute the irregular spherical Bessel functions of * zeroth order (y0), first order (y1), second order (y2) and l-th order * (yl, for L>=0): * * y0(x) = -cos(x)/x * y1(x) = -(cos(x)/x + sin(x))/x * y2(x) = (-3/x^3 + 1/x)*cos(x) - (3/x^2)*sin(x) * * See gsl_sf_bessel_J0 for a more detailled description of the * arguments. * * * SEE ALSO: gsl_sf, gsl_sf_bessel_J0. */ extern gsl_sf_bessel_i0_scaled; extern gsl_sf_bessel_i1_scaled; extern gsl_sf_bessel_i2_scaled; extern gsl_sf_bessel_il_scaled; /* DOCUMENT gsl_sf_bessel_i0_scaled(x [,err]) * gsl_sf_bessel_i1_scaled(x [,err]) * gsl_sf_bessel_i2_scaled(x [,err]) * gsl_sf_bessel_il_scaled(l, x [,err]) * * These routines compute the regular modified spherical Bessel functions * of zeroth order (i0), first order (i1), second order (i2) and l-th * order (il): * * il_scaled(x) = exp(-abs(x))*il(x) * * The regular modified spherical Bessel functions i_l(x) are related to * the modified Bessel functions of fractional order by: * * i_l(x) = sqrt(PI/(2*x))*I_{l + 1/2}(x) * * See gsl_sf_bessel_J0 for a more detailled description of the * arguments. * * * SEE ALSO: gsl_sf, gsl_sf_bessel_J0. */ extern gsl_sf_bessel_k0_scaled; extern gsl_sf_bessel_k1_scaled; extern gsl_sf_bessel_k2_scaled; extern gsl_sf_bessel_kl_scaled; /* DOCUMENT gsl_sf_bessel_k0_scaled(x [,err]) * gsl_sf_bessel_k1_scaled(x [,err]) * gsl_sf_bessel_k2_scaled(x [,err]) * gsl_sf_bessel_kl_scaled(l, x [,err]) * * These routines compute the irregular modified spherical Bessel * functions of zeroth order (k0), first order (k1), second order (k2) * and l-th order (kl), for X>0: * * kl_scaled(x) = exp(x)*kl(x) * * The irregular modified spherical Bessel functions i_l(x) are related to * the modified Bessel functions of fractional order by: * * k_l(x) = sqrt(PI/(2*x))*K_{l + 1/2}(x) * * If optional argument ERR is true, the result, says Y, has an * additional dimension of length 2 prepended to the dimension list of X * which is used to provide an estimate of the error: * Y(1,..) = value of F(X) * Y(2,..) = error estimate for the value of F(X) * * * SEE ALSO: gsl_sf, gsl_sf_bessel_J0. */ extern gsl_sf_clausen; /* DOCUMENT gsl_sf_clausen(x [,err]) * * Returns the Clausen function Cl_2 of its argument X. * * If optional argument ERR is true, the result, says Y, has an * additional dimension of length 2 prepended to the dimension list of X * which is used to provide an estimate of the error: * Y(1,..) = value of F(X) * Y(2,..) = error estimate for the value of F(X) * * * SEE ALSO: gsl_sf */ extern gsl_sf_dawson; /* DOCUMENT gsl_sf_dawson(x [,err]) * * Returns the Dawson integral of its argument X defined by: * * exp(-x^2) \int_0^x exp(t^2) dt * * If optional argument ERR is true, the result, says Y, has an * additional dimension of length 2 prepended to the dimension list of X * which is used to provide an estimate of the error: * Y(1,..) = value of F(X) * Y(2,..) = error estimate for the value of F(X) * * * SEE ALSO: gsl_sf */ extern gsl_sf_debye_1; extern gsl_sf_debye_2; extern gsl_sf_debye_3; extern gsl_sf_debye_4; extern gsl_sf_debye_5; extern gsl_sf_debye_6; local gsl_sf_debye; /* DOCUMENT gsl_sf_debye_1(x [,err]) * gsl_sf_debye_2(x [,err]) * gsl_sf_debye_3(x [,err]) * gsl_sf_debye_4(x [,err]) * gsl_sf_debye_5(x [,err]) * gsl_sf_debye_6(x [,err]) * * Return the Debye function D_n(x) of argument X defined by the * following integral: * * D_n(x) = n/x^n \int_0^x (t^n/(e^t - 1)) dt * * If optional argument ERR is true, the result, says Y, has an * additional dimension of length 2 prepended to the dimension list of X * which is used to provide an estimate of the error: * Y(1,..) = value of F(X) * Y(2,..) = error estimate for the value of F(X) * * * SEE ALSO: gsl_sf */ extern gsl_sf_dilog; /* DOCUMENT gsl_sf_dilog(x [,err]) * * Return the dilogarithm for a real argument X. If optional argument * ERR is true, the result, says Y, has an additional dimension of length * 2 prepended to the dimension list of X which is used to provide an * estimate of the error: * Y(1,..) = value of F(X) * Y(2,..) = error estimate for the value of F(X) * * * SEE ALSO: gsl_sf */ extern gsl_sf_ellint_Kcomp; extern gsl_sf_ellint_Ecomp; /* DOCUMENT gsl_sf_ellint_Kcomp(k [,flags]) * gsl_sf_ellint_Ecomp(k [,flags]) * Return the complete elliptic integral K(k) or E(k). See * gsl_sf_airy_Ai for the meaning of optional argument FLAGS. * * SEE ALSO: gsl_sf, gsl_sf_airy_Ai. */ extern gsl_sf_erf; extern gsl_sf_erfc; extern gsl_sf_log_erfc; extern gsl_sf_erf_Z; extern gsl_sf_erf_Q; extern gsl_sf_hazard; /* DOCUMENT gsl_sf_erf(x [,err]) * gsl_sf_erfc(x [,err]) * gsl_sf_log_erfc(x [,err]) * gsl_sf_erf_Q(x [,err]) * gsl_sf_erf_Z(x [,err]) * gsl_sf_hazard(x [,err]) * * gsl_sf_erf(x) computes the error function: * * erf(x) = (2/sqrt(pi)) \int_0^x exp(-t^2) dt * * gsl_sf_erfc(x) computes the complementary error function: * * erfc(x) = 1 - erf(x) * = (2/sqrt(pi)) \int_x^\infty exp(-t^2) dt * * gsl_sf_log_erfc(x) computes the logarithm of the complementary error function. * * gsl_sf_erf_Z(x) computes the Gaussian probability density function: * * Z(x) = (1/sqrt(2 pi)) \exp(-x^2/2). * * gsl_sf_erf_Q(x) computes the upper tail of the Gaussian probability * density function: * * Q(x) = (1/sqrt(2 pi)) \int_x^\infty \exp(-t^2/2) dt. * * gsl_sf_hazard(x) computes the hazard function for the normal * distribution, also known as the inverse Mill's ratio: * * h(x) = Z(x)/Q(x) * = sqrt(2/pi) exp(-x^2/2)/erfc(x/sqrt(2)). * * If optional argument ERR is true, the result, says Y, has an * additional dimension of length 2 prepended to the dimension list of X * which is used to provide an estimate of the error: * Y(1,..) = value of F(X) * Y(2,..) = error estimate for the value of F(X) * * * SEE ALSO: gsl_sf */ extern gsl_sf_exp; extern gsl_sf_expm1; extern gsl_sf_exprel; extern gsl_sf_exprel_2; extern gsl_sf_exprel_n; extern gsl_sf_log; extern gsl_sf_log_abs; extern gsl_sf_log_1plusx; extern gsl_sf_log_1plusx_mx; /* DOCUMENT gsl_sf_exp(x [,err]) * gsl_sf_expm1(x [,err]) * gsl_sf_exprel(x [,err]) * gsl_sf_exprel_2(x [,err]) * gsl_sf_exprel_n(n, x [,err]) * gsl_sf_log(x [,err]) * gsl_sf_log_abs(x [,err]) * gsl_sf_log_1plusx(x [,err]) * gsl_sf_log_1plusx_mx(x [,err]) * * gsl_sf_exp(X) computes the exponential of X. * * gsl_sf_expm1(X) computes the quantity exp(X) - 1 using an algorithm * that is accurate for small X. * * gsl_sf_exprel(X) computes the quantity (exp(X) - 1)/X using an * algorithm that is accurate for small X and which is based on the * expansion: * * (exp(x) - 1)/x = 1 + x/2 + x^2/(2*3) + x^3/(2*3*4) + ... * * gsl_sf_exprel_2(X) computes the quantity 2*(exp(X) - 1)/X^2 using an * algorithm that is accurate for small X and which is based on the * expansion: * * 2*(exp(x) - 1 - x)/x^2 = 1 + x/3 + x^2/(3*4) + x^3/(3*4*5) + ... * * gsl_sf_exprel_n(N,X) computes the N-relative exponential (N must be a * scalar integer): * * expre_n(x) = n! / x^n ( exp(x) - \sum_{k=0}^{n-1} x^k / k! ) * * gsl_sf_log(X) computes the logarithm of X, for X > 0. * * gsl_sf_log_abs(X) computes the logarithm of |X|, for X != 0. * * gsl_sf_log_1plusx(x) computes log(1 + X) for X > -1 using an algorithm * that is accurate for small X. * * gsl_sf_log_1plusx_mx(x) computes log(1 + X) - X for X > -1 using an * algorithm that is accurate for small X. * * If optional argument ERR is true, the result, says Y, has an * additional dimension of length 2 prepended to the dimension list of X * which is used to provide an estimate of the error: * Y(1,..) = value of F(X) * Y(2,..) = error estimate for the value of F(X) * * * SEE ALSO: gsl_sf */ local gsl_sf_expint; extern gsl_sf_expint_E1; extern gsl_sf_expint_E2; extern gsl_sf_expint_Ei; extern gsl_sf_expint_3; extern gsl_sf_Shi; extern gsl_sf_Chi; extern gsl_sf_Si; extern gsl_sf_Ci; extern gsl_sf_atanint; /* DOCUMENT gsl_sf_expint_E1(x [, err]) * gsl_sf_expint_E2(x [, err]) * gsl_sf_expint_Ei(x [, err]) * gsl_sf_expint_3(x [, err]) * gsl_sf_Shi(x [, err]) * gsl_sf_Chi(x [, err]) * gsl_sf_Si(x [, err]) * gsl_sf_Ci(x [, err]) * gsl_sf_atanint(x [, err]) * * gsl_sf_expint_E1(X) computes the exponential integral: * E1(x) = \int_1^\infty exp(-x t)/t dt * * gsl_sf_expint_E2(X) computes the second-order exponential integral: * E2(x) = \int_1^\infty exp(-x t)/t^2 dt * * gsl_sf_expint_E2(X) computes the exponetial integral: * Ei(x) = -PV( \int_{-x}^\infty exp(-t)/t dt ) * where PV() denotes the principal value. * * gsl_sf_expint_3(X) computes the third-order exponential integral: * Ei_3(x) = \int_0^x \exp(-t^3) dt for x >= 0. * * gsl_sf_Shi(X) computes the integral: * Shi(x) = \int_0^x sinh(t)/t dt. * * gsl_sf_Chi(X) computes the integral: * Chi(x) = Re[ gamma_E + log(x) + \int_0^x (cosh(t) - 1)/t dt ] * where gamma_E is the Euler constant. * * gsl_sf_Si(X) computes the Sine integral: * Si(x) = \int_0^x sin(t)/t dt. * * gsl_sf_Ci(X) computes the Cosine integral: * Ci(x) = -\int_x^\int_x cos(t)/t dt for x > 0. * * gsl_sf_atanint(X) computes the arc-tangent integral: * AtanInt(x) = \int_0^x arctan(t)/t dt. * * If optional argument ERR is true, the result, says Y, has an * additional dimension of length 2 prepended to the dimension list of X * which is used to provide an estimate of the error: * Y(1,..) = value of F(X) * Y(2,..) = error estimate for the value of F(X) * * * SEE ALSO: gsl_sf */ local gsl_sf_fermi_dirac; extern gsl_sf_fermi_dirac_m1; extern gsl_sf_fermi_dirac_0; extern gsl_sf_fermi_dirac_1; extern gsl_sf_fermi_dirac_2; extern gsl_sf_fermi_dirac_mhalf; extern gsl_sf_fermi_dirac_half; extern gsl_sf_fermi_dirac_3half; extern gsl_sf_fermi_dirac_int; /* DOCUMENT gsl_sf_fermi_dirac_int(j, x [, err]) * gsl_sf_fermi_dirac_m1(x [, err]) * gsl_sf_fermi_dirac_0(x [, err]) * gsl_sf_fermi_dirac_1(x [, err]) * gsl_sf_fermi_dirac_2(x [, err]) * gsl_sf_fermi_dirac_mhalf(x [, err]) * gsl_sf_fermi_dirac_half(x [, err]) * gsl_sf_fermi_dirac_3half(x [, err]) * * gsl_sf_fermi_dirac_int(J,X) computes the complete Fermi-Dirac integral * with an index of J: * F_j(x) = 1/Gamma(j + 1) \int_0^\infty t^j/(exp(t - x) + 1) dt * where J is a scalar integer and Gamma() is the Gamma function: * Gamma(n) = (n - 1)! * for integer n. * * gsl_sf_fermi_dirac_m1(X) computes the complete Fermi-Dirac integral * with an index of -1: * F_{-1}(x) = exp(x)/(1 + exp(x)) * * gsl_sf_fermi_dirac_0(X) computes the complete Fermi-Dirac integral * with an index of 0: * F_0(x) = log(1 + exp(x)) * * gsl_sf_fermi_dirac_1(X) computes the complete Fermi-Dirac integral * with an index of 1: * F_1(x) = \int_0^\infty t/(exp(t - x) + 1) dt * * gsl_sf_fermi_dirac_2(X) computes the complete Fermi-Dirac integral * with an index of 2: * F_2(x) = (1/2) \int_0^\infty t^2/(exp(t - x) + 1) dt * * gsl_sf_fermi_dirac_mhalf(X) computes the complete Fermi-Dirac integral * with an index of -1/2. * * gsl_sf_fermi_dirac_half(X) computes the complete Fermi-Dirac integral * with an index of +1/2. * * gsl_sf_fermi_dirac_3half(X) computes the complete Fermi-Dirac integral * with an index of +3/2. * * If optional argument ERR is true, the result, says Y, has an * additional dimension of length 2 prepended to the dimension list of X * which is used to provide an estimate of the error: * Y(1,..) = value of F(X) * Y(2,..) = error estimate for the value of F(X) * * * SEE ALSO: gsl_sf, gsl_sf_gamma. */ extern gsl_sf_gamma; extern gsl_sf_lngamma; extern gsl_sf_gammastar; extern gsl_sf_gammainv; extern gsl_sf_taylorcoeff; /* DOCUMENT gsl_sf_gamma(x [, err]) * gsl_sf_lngamma(x [, err]) * gsl_sf_gammastar(x [, err]) * gsl_sf_gammainv(x [, err]) * gsl_sf_taylorcoeff(n, x [, err]) * * gsl_sf_gamma(X) computes the Gamma function: * Gammma(x) = \int_0^\infty t^(x - 1) exp(-t) dt for x >= 0 * for a positive integer argument, Gamma(n) = (n - 1)!. * * gsl_sf_lngamma(X) computes the logarithm of the Gamma function. * * gsl_sf_gammastar(X) computes the regulated Gamma function: * GammaStar(x) = Gamma(x) / ( sqrt(2 pi) x^(x - 1/2) exp(x) ) * = 1 + 1/12x + ... for large x * * gsl_sf_gammainv(X) computes the reciprocal of the Gamma function * 1/Gamma(x) using the real Lanczos method. * * gsl_sf_taylorcoeff(N,X) computes the Taylor coefficient X^N/N! * for X >= 0 and N >= 0 -- N must be a scalar integer. * * If optional argument ERR is true, the result, says Y, has an * additional dimension of length 2 prepended to the dimension list of X * which is used to provide an estimate of the error: * Y(1,..) = value of F(X) * Y(2,..) = error estimate for the value of F(X) * * * SEE ALSO: gsl_sf. */ extern gsl_sf_psi; extern gsl_sf_psi_1piy; extern gsl_sf_psi_1; extern gsl_sf_psi_n; /* DOCUMENT gsl_sf_psi(x [, err]) * gsl_sf_psi_1(x [, err]) * gsl_sf_psi_n(n, x [, err]) * gsl_sf_psi_1piy(x [, err]) * * gsl_sf_psi(X) computes the digamma function \psi(x) for X != 0. * * gsl_sf_psi_1piy(Y) computes the real part of the digamma function on the * line 1+i y, \Re[\psi(1 + i y)]. * * gsl_sf_psi_1(X) computes the trigamma function \psi'(x) for X. * * gsl_sf_psi_n(N, X) computes the polygamma function \psi^{(n)}(x) * for N >= 0, X > 0. * * SEE ALSO: gsl_sf. */ local gsl_sf_lambert; extern gsl_sf_lambert_W0; extern gsl_sf_lambert_Wm1; /* DOCUMENT gsl_sf_lambert_W0(x [, err]) * gsl_sf_lambert_Wm1(x [, err]) * Lambert's W functions, W(x), are defined to be solutions of the * equation W(x) exp(W(x)) = x. This function has multiple branches for * x < 0; however, it has only two real-valued branches. We define W0(x) * to be the principal branch, where W > -1 for x < 0, and Wm1(x) to * be the other real branch, where W < -1 for x < 0. * * If optional argument ERR is true, the result, says Y, has an * additional dimension of length 2 prepended to the dimension list of X * which is used to provide an estimate of the error: * Y(1,..) = value of F(X) * Y(2,..) = error estimate for the value of F(X) * * * SEE ALSO: gsl_sf. */ local gsl_sf_legendre; extern gsl_sf_legendre_P1; extern gsl_sf_legendre_P2; extern gsl_sf_legendre_P3; extern gsl_sf_legendre_Pl; extern gsl_sf_legendre_Q0; extern gsl_sf_legendre_Q1; extern gsl_sf_legendre_Ql; /* DOCUMENT gsl_sf_legendre_P1(x [, err]) * gsl_sf_legendre_P2(x [, err]) * gsl_sf_legendre_P3(x [, err]) * gsl_sf_legendre_Pl(l, x [, err]) * gsl_sf_legendre_Q0(x [, err]) * gsl_sf_legendre_Q1(x [, err]) * gsl_sf_legendre_Ql(l, x [, err]) * * The functions gsl_sf_legendre_P# evaluate the Legendre polynomials * P_l(x) for specific values of l = 1, 2, 3 or for a scalar integer l. * * The functions gsl_sf_legendre_Q# evaluate the Legendre function * Q_l(x) for specific values of l = 0, 1 or for a scalar integer l. * * If optional argument ERR is true, the result, says Y, has an * additional dimension of length 2 prepended to the dimension list of X * which is used to provide an estimate of the error: * Y(1,..) = value of F(X) * Y(2,..) = error estimate for the value of F(X) * * * SEE ALSO: gsl_sf. */ local gsl_sf_synchrotron; extern gsl_sf_synchrotron_1; extern gsl_sf_synchrotron_2; local gsl_sf_transport; extern gsl_sf_transport_2; extern gsl_sf_transport_3; extern gsl_sf_transport_4; extern gsl_sf_transport_5; /* DOCUMENT gsl_sf_synchrotron_1(x [, err]) * gsl_sf_synchrotron_2(x [, err]) * gsl_sf_transport_2(x [, err]) * gsl_sf_transport_3(x [, err]) * gsl_sf_transport_4(x [, err]) * gsl_sf_transport_5(x [, err]) * * gsl_sf_synchrotron_1(x) computes the first synchrotron function: * x \int_x^\infty K_{5/3}(t) dt for x >= 0. * * gsl_sf_synchrotron_2(x) computes the second synchrotron function: * x K_{2/3}(x) for x >= 0. * * The transport functions J(n,x) are defined by the integral representations: * J(n,x) = \int_0^x t^n e^t /(e^t - 1)^2 dt. * * If optional argument ERR is true, the result, says Y, has an * additional dimension of length 2 prepended to the dimension list of X * which is used to provide an estimate of the error: * Y(1,..) = value of F(X) * Y(2,..) = error estimate for the value of F(X) * * * SEE ALSO: gsl_sf. */ extern gsl_sf_sin; extern gsl_sf_cos; extern gsl_sf_sinc; extern gsl_sf_lnsinh; extern gsl_sf_lncosh; /* DOCUMENT gsl_sf_sin(x [, err]) * gsl_sf_cos(x [, err]) * gsl_sf_sinc(x [, err]) * gsl_sf_lnsinh(x [, err]) * gsl_sf_lncosh(x [, err]) * * gsl_sf_sin(X) computes the sine function of X. * * gsl_sf_cos(X) computes the cosine function of X. * * gsl_sf_sinc(X) computes sinc(x) = sin(pi x)/(pi x) for any value of X. * * gsl_sf_lnsinh(X) computes log(sinh(X)) for X > 0. * * gsl_sf_lncosh(X) computes log(cosh(X)) for any value of X. * * If optional argument ERR is true, the result, says Y, has an * additional dimension of length 2 prepended to the dimension list of X * which is used to provide an estimate of the error: * Y(1,..) = value of F(X) * Y(2,..) = error estimate for the value of F(X) * * * SEE ALSO: gsl_sf. */ extern gsl_sf_zeta; extern gsl_sf_zetam1; extern gsl_sf_eta; /* DOCUMENT gsl_sf_zeta(x [, err]) * gsl_sf_zetam1(x [, err]) * gsl_sf_eta(x [, err]) * * gsl_sf_zeta(x) computes the Riemann zeta function: * zeta(x) = \sum_{k=1}^\infty k^{-x} for X != 1. * * gsl_sf_zetam1(x) computes zeta(X) - 1 for X != 1. * * gsl_sf_eta(x) computes the eta function: * eta(x) = (1 - 2^(1-x)) zeta(x). * * If optional argument ERR is true, the result, says Y, has an * additional dimension of length 2 prepended to the dimension list of X * which is used to provide an estimate of the error: * Y(1,..) = value of F(X) * Y(2,..) = error estimate for the value of F(X) * * * SEE ALSO: gsl_sf. */ extern gsl_poly_solve_quadratic; extern gsl_poly_solve_cubic; /* DOCUMENT x = gsl_poly_solve_quadratic(a, b, c); or x = gsl_poly_solve_quadratic(v); or x = gsl_poly_solve_cubic(a, b, c); or x = gsl_poly_solve_cubic(v); These functions return the real roots of a quadratic or cubic polynomials with real coefficients A, B and C. When called with a single argument, it must be a vector of coefficients: V = [A,B,C]. If there are no roots, an empty result is returned otherwise a vector of 1, 2, or 3 roots is returned. The roots are sorted in ascending order. The case of coincident roots is not considered special. Therefore, either 0 or 1 or 2 roots are returned for a quadratic polynomial (a single root only occurs if A=0) and either 0 or 1 or 3 roots are returned for a cubic polynomial. The roots X are such that: A*X^2 + B*X + C = 0 X^3 + A*X^2 + B*X + C = 0 for a quadratic and a cubic polynomial respectively. */ /* * Local Variables: * mode: Yorick * tab-width: 8 * c-basic-offset: 2 * indent-tabs-mode: nil * fill-column: 78 * coding: utf-8 * End: */ ygsl-1.2.0/tools/000077500000000000000000000000001233537042600136355ustar00rootroot00000000000000ygsl-1.2.0/tools/c_cleanup000077500000000000000000000041301233537042600155120ustar00rootroot00000000000000#! /bin/sh # # This script is a filter to cleanup C/C++ files. The following # operations are performed: # - Trailing spaces are removed. # - Unix-like end of line markers are used (LF). # - Code is re-indented by AStyle. # # Note that the filter is called for every 'git-add', 'git-status', etc. # So it is better if it is fast... debug=no bypass=no if test "$debug" = "yes"; then echo >&2 "command -----> $0 $@" fi # Simply execute "cat" to bypass the filter: test "$bypass" = "yes" && exec cat ## AStyle options: astyle=/usr/bin/astyle options="--options=none --mode=c --quiet --preserve-date \ --style=stroustrup --indent=spaces=2 \ --pad-header --indent-labels --lineend=linux \ --min-conditional-indent=0 --max-instatement-indent=80 \ --keep-one-line-blocks --keep-one-line-statements \ --align-pointer=name" # --suffix=none ## Option --align-reference=... is only available after version 2.02. version=$($astyle --version 2>&1 \ | sed 's/^[^0-9]*\([.0-9]*\).*/\1/;s/0*\([1-9][0-9]*\|0\)/\1/g') if test "$debug" = "yes"; then echo >&2 "version -----> $version" fi major=$(echo "$version" | cut -d. -f1) minor=$(echo "$version" | cut -d. -f2) if test "$major" -gt 2 -o \( $major -eq 2 -a $minor -ge 2 \); then options="$options --align-reference=name" fi if test "$debug" = "yes"; then echo >&2 "major -------> $major" echo >&2 "minor -------> $minor" fi # This script can be as a filter (with no arguments) or not. if [ $# -gt 0 ]; then $astyle $options "$@" code=$? else # For some reasons, AStyle cannot work as a filter with GIT. So I first # save the input in a temporary file and run AStyle on it to generate the # output. tmp=$(mktemp "/tmp/c_cleanup-XXXXXXXXXX") cat >"$tmp" $astyle $options <"$tmp" code=$? if test "$debug" = "yes"; then echo >&2 "input -------> $tmp" echo >&2 "status ------> $code" else rm -f "$tmp" fi fi return $code ## No needs to remove spaces, astyle takes care of that; otherwise add: ## | sed -e 's/[ ][ ]*$//' # Local Variables: # mode: sh # tab-width: 8 # indent-tabs-mode: nil # fill-column: 78 # coding: utf-8 # End: ygsl-1.2.0/tools/code_cleanup000077500000000000000000000011461233537042600162060ustar00rootroot00000000000000#! /bin/sh # # This script is a filter to cleanup text or code files. The following # operations are performed: # - Trailing spaces are removed. # - Unix-like end of line markers are used (LF). # - Leading tabulations are replaced by spaces. # debug=no bypass=no if test "$debug" = "yes"; then echo >&2 "command -----> $0 $@" fi # Simply execute "cat" to bypass the filter: test "$bypass" = "yes" && exec cat expand --initial --tabs=8 \ | sed -e 's/\x0d$//;s/[ ]*$//;s/[ ]*\x0d/\x0a/g' # Local Variables: # mode: sh # tab-width: 8 # indent-tabs-mode: nil # fill-column: 78 # coding: utf-8 # End: ygsl-1.2.0/tools/ymk_cleanup000077500000000000000000000007251233537042600160760ustar00rootroot00000000000000#! /bin/sed -f # # This SED script is a filter to Yorick Makefile. The following # operations are performed: # - Trailing spaces are removed. # - Tabulations are left unchanged (this is intended for Makefiles). # - Unix-like end of line markers are used (LF). # - Macros like Y_HOME which are overwritten by 'yorick -batch make.i' are # cleared. # s/\x0d$// s/ *$// s/ *\x0d/\x0a/g s/^\( *Y_\(MAKEDIR\|EXE\(\|_PKGS\|_HOME\|_SITE\)\|HOME_PKG\) *=\).*/\1/ # ygsl-1.2.0/ygsl.c000066400000000000000000000351431233537042600136250ustar00rootroot00000000000000/* * ygsl.c -- * * Implements Yorick interface to GSL (GNU Scientific Library). * *----------------------------------------------------------------------------- * * Copyright (C) 2012 Éric Thiébaut * * This software is governed by the CeCILL-C license under French law and * abiding by the rules of distribution of free software. You can use, modify * and/or redistribute the software under the terms of the CeCILL-C license as * circulated by CEA, CNRS and INRIA at the following URL * "http://www.cecill.info". * * As a counterpart to the access to the source code and rights to copy, * modify and redistribute granted by the license, users are provided only * with a limited warranty and the software's author, the holder of the * economic rights, and the successive licensors have only limited liability. * * In this respect, the user's attention is drawn to the risks associated with * loading, using, modifying and/or developing or reproducing the software by * the user in light of its specific status of free software, that may mean * that it is complicated to manipulate, and that also therefore means that it * is reserved for developers and experienced professionals having in-depth * computer knowledge. Users are therefore encouraged to load and test the * software's suitability as regards their requirements in conditions enabling * the security of their systems and/or data to be ensured and, more * generally, to use and operate it in the same conditions as regards * security. * * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. * *----------------------------------------------------------------------------- * * TO DO: * - gsl_sf_complex_dilog_e fo complex argument * - use gsl_sf_zeta_int, gsl_sf_zetam1_int and * gsl_sf_eta_int for integer argument * * MISSING: * Dilogarithm with complex argument. * Zeros of Airy Functions. * Zeros of Bessel Functions. * Coulomb Functions. * Legendre Forms of Incomplete Elliptic Integrals. * Carlson Forms of Elliptic Integrals. * Elliptic Functions (Jacobi). * Exponential Functions (some) * Incomplete Fermi-Dirac Integrals * Gamma Function: * - gsl_sf_lngamma_sgn_e, gsl_sf_lngamma_complex_e, * - gsl_sf_fact, gsl_sf_fact_e * - gsl_sf_doublefact, gsl_sf_doublefact_e * - gsl_sf_lnfact, gsl_sf_lnfact_e * - gsl_sf_lndoublefact, gsl_sf_lndoublefact_e * - gsl_sf_choose, gsl_sf_choose_e * - gsl_sf_lnchoose, gsl_sf_lnchoose_e * - gsl_sf_poch, gsl_sf_poch_e * - gsl_sf_lnpoch, gsl_sf_lnpoch_e * - gsl_sf_lnpoch_sgn_e * - gsl_sf_pochrel, gsl_sf_pochrel_e * - gsl_sf_gamma_inc_Q, gsl_sf_gamma_inc_Q_e * - gsl_sf_gamma_inc_P, gsl_sf_gamma_inc_P_e * - gsl_sf_gamma_inc, gsl_sf_gamma_inc_e * - gsl_sf_beta, gsl_sf_beta_e * - gsl_sf_lnbeta, gsl_sf_lnbeta_e * - gsl_sf_beta_inc, gsl_sf_beta_inc_e * Gegenbauer Functions * Hypergeometric Functions * Laguerre Functions * Legendre Functions * - Associated Legendre Polynomials and Spherical Harmonics * - Conical Functions * - Radial Functions for Hyperbolic Space * Logarithmic Functions: gsl_sf_complex_log_e * Power Functions: gsl_sf_pow_int, gsl_sf_pow_int_e * Digamma Functions * Trigonometric Functions: gsl_sf_hypot, ... for complex arguments, * Conversion Functions, Trigonometric Functions With Error Estimates, * Restriction Functions * Zeta Functions: * - gsl_sf_zeta, gsl_sf_zeta_e * - gsl_sf_zetam1_int, gsl_sf_zetam1_int_e * - gsl_sf_hzeta, gsl_sf_hzeta_e * - gsl_sf_eta_int, gsl_sf_eta_int_e */ #include #include #include #include #include #include #include #include /* Define some macros to get rid of some GNU extensions when not compiling with GCC. */ #if ! (defined(__GNUC__) && __GNUC__ > 1) # define __attribute__(x) # define __inline__ # define __FUNCTION__ "" # define __PRETTY_FUNCTION__ "" #endif PLUG_API void y_error(const char *) __attribute__ ((noreturn)); static void fnerr(const char *name, char *msg) __attribute__ ((noreturn)); static void setup(void); static void error_handler(const char *reason, const char *file, int line, int gsl_errno); static int first_time = 1; static void setup(void) { gsl_set_error_handler(error_handler); first_time = 0; } static void error_handler(const char *reason, const char *file, int line, int status) { if (reason == NULL || reason[0] == '\0') { reason = gsl_strerror(status); } y_error(reason); } /* Same as ypush_d(DIMS) but with an additional dimension of length 2 prepended to the dimension list DIMS. Beware that the contents of DIMS is modified. */ static double *push_d2(long dims[]) { long i; if (dims[0] >= (Y_DIMSIZE - 1)) y_error("too many dimensions"); for (i=dims[0] ; i>=1 ; --i) { dims[i + 1] = dims[i]; } dims[1] = 2; ++dims[0]; return ypush_d(dims); } static double *get_array_d(int iarg, long *ntot, long dims[]) { switch (yarg_typeid(iarg)) { case Y_CHAR: case Y_SHORT: case Y_INT: case Y_LONG: case Y_FLOAT: case Y_DOUBLE: return ygeta_d(iarg, ntot, dims); break; } y_error("expecting a non-complex numerical array"); return NULL; /* avoids compiler warnings */ } /* 3 - `GSL_PREC_DOUBLE' Double-precision, a relative accuracy of approximately 2 * 10^-16. 2 - `GSL_PREC_SINGLE' Single-precision, a relative accuracy of approximately 10^-7. 1 - `GSL_PREC_APPROX' Approximate values, a relative accuracy of approximately 5 * 10^-4. */ static void fnerr(const char *name, char *msg) { const size_t bufsiz = 128; char buf[bufsiz]; if (name && name[0]) { snprintf(buf, bufsiz, "%s: %s", name, msg); buf[bufsiz - 1] = '\0'; msg = buf; } y_error(msg); } static long get_flags(int iarg, long default_value) { switch (yarg_typeid(iarg)) { case Y_VOID: return default_value; case Y_CHAR: case Y_SHORT: case Y_INT: case Y_LONG: return ygets_l(iarg); } y_error("expecting nil or integer scalar"); } /*---------------------------------------------------------------------------*/ static void sf_driver_1(int argc, const char *name, double (*fn)(double x, gsl_mode_t mode), int (*fn_e)(double x, gsl_mode_t mode, gsl_sf_result *result)) { gsl_sf_result r; gsl_mode_t mode; long i, ntot, flags, dims[Y_DIMSIZE]; double *x, *y; if (first_time) setup(); if (argc == 2) { flags = get_flags(0, 0L); yarg_drop(1); } else { if (argc != 1) fnerr(name, "takes one or two arguments"); flags = 0L; } switch (flags & 0x6) { case 2: mode = GSL_PREC_APPROX; break; case 4: mode = GSL_PREC_SINGLE; break; default: mode = GSL_PREC_DOUBLE; break; } x = get_array_d(0, &ntot, dims); if (flags & 0x1) { y = push_d2(dims); for (i = 0; i < ntot; ++i) { fn_e(x[i], mode, &r); y[2*i] = r.val; y[2*i + 1] = r.err; } } else { y = (yarg_scratch(0) ? x : ypush_d(dims)); for (i = 0; i < ntot; ++i) { y[i] = fn(x[i], mode); } } } #undef FN #define FN(fn) \ extern void Y_##fn(int argc); \ void Y_##fn(int argc) { sf_driver_1(argc, #fn, fn, fn##_e); } FN(gsl_sf_airy_Ai) FN(gsl_sf_airy_Bi) FN(gsl_sf_airy_Ai_scaled) FN(gsl_sf_airy_Bi_scaled) FN(gsl_sf_airy_Ai_deriv) FN(gsl_sf_airy_Bi_deriv) FN(gsl_sf_airy_Ai_deriv_scaled) FN(gsl_sf_airy_Bi_deriv_scaled) FN(gsl_sf_ellint_Kcomp) FN(gsl_sf_ellint_Ecomp) #undef FN /*---------------------------------------------------------------------------*/ static void sf_driver_2(int argc, const char *name, double (*fn)(double x), int (*fn_e)(double x, gsl_sf_result *result)) { gsl_sf_result r; long i, ntot, flags, dims[Y_DIMSIZE]; double *x, *y; if (first_time) setup(); if (argc == 2) { flags = get_flags(0, 0L); yarg_drop(1); } else { if (argc != 1) fnerr(name, "takes one or two arguments"); flags = 0; } x = get_array_d(0, &ntot, dims); if (flags) { y = push_d2(dims); for (i = 0; i < ntot; ++i) { fn_e(x[i], &r); y[2*i] = r.val; y[2*i+1] = r.err; } } else { y = (yarg_scratch(0) ? x : ypush_d(dims)); for (i = 0; i < ntot; ++i) { y[i] = fn(x[i]); } } } #undef FN #define FN(fn) \ extern void Y_##fn(int argc); \ void Y_##fn(int argc) { sf_driver_2(argc, #fn, fn, fn##_e); } FN(gsl_sf_bessel_J0) FN(gsl_sf_bessel_J1) FN(gsl_sf_bessel_Y0) FN(gsl_sf_bessel_Y1) FN(gsl_sf_bessel_I0) FN(gsl_sf_bessel_I1) FN(gsl_sf_bessel_I0_scaled) FN(gsl_sf_bessel_I1_scaled) FN(gsl_sf_bessel_K0) FN(gsl_sf_bessel_K1) FN(gsl_sf_bessel_K0_scaled) FN(gsl_sf_bessel_K1_scaled) FN(gsl_sf_bessel_j0) FN(gsl_sf_bessel_j1) FN(gsl_sf_bessel_j2) FN(gsl_sf_bessel_y0) FN(gsl_sf_bessel_y1) FN(gsl_sf_bessel_y2) FN(gsl_sf_bessel_i0_scaled) FN(gsl_sf_bessel_i1_scaled) FN(gsl_sf_bessel_i2_scaled) FN(gsl_sf_bessel_k0_scaled) FN(gsl_sf_bessel_k1_scaled) FN(gsl_sf_bessel_k2_scaled) FN(gsl_sf_clausen) FN(gsl_sf_dawson) FN(gsl_sf_debye_1) FN(gsl_sf_debye_2) FN(gsl_sf_debye_3) FN(gsl_sf_debye_4) FN(gsl_sf_debye_5) FN(gsl_sf_debye_6) FN(gsl_sf_dilog) FN(gsl_sf_erf) FN(gsl_sf_erfc) FN(gsl_sf_log_erfc) FN(gsl_sf_erf_Z) FN(gsl_sf_erf_Q) FN(gsl_sf_hazard) FN(gsl_sf_exp) FN(gsl_sf_expm1) FN(gsl_sf_exprel) FN(gsl_sf_exprel_2) FN(gsl_sf_expint_E1) FN(gsl_sf_expint_E2) FN(gsl_sf_expint_Ei) FN(gsl_sf_expint_3) FN(gsl_sf_Shi) FN(gsl_sf_Chi) FN(gsl_sf_Si) FN(gsl_sf_Ci) FN(gsl_sf_atanint) FN(gsl_sf_fermi_dirac_m1) FN(gsl_sf_fermi_dirac_0) FN(gsl_sf_fermi_dirac_1) FN(gsl_sf_fermi_dirac_2) FN(gsl_sf_fermi_dirac_mhalf) FN(gsl_sf_fermi_dirac_half) FN(gsl_sf_fermi_dirac_3half) FN(gsl_sf_gamma) FN(gsl_sf_lngamma) FN(gsl_sf_gammastar) FN(gsl_sf_gammainv) FN(gsl_sf_lambert_W0) FN(gsl_sf_lambert_Wm1) FN(gsl_sf_legendre_P1) FN(gsl_sf_legendre_P2) FN(gsl_sf_legendre_P3) FN(gsl_sf_legendre_Q0) FN(gsl_sf_legendre_Q1) FN(gsl_sf_log) FN(gsl_sf_log_abs) FN(gsl_sf_log_1plusx) FN(gsl_sf_log_1plusx_mx) FN(gsl_sf_synchrotron_1) FN(gsl_sf_synchrotron_2) FN(gsl_sf_transport_2) FN(gsl_sf_transport_3) FN(gsl_sf_transport_4) FN(gsl_sf_transport_5) FN(gsl_sf_sin) FN(gsl_sf_cos) FN(gsl_sf_sinc) FN(gsl_sf_lnsinh) FN(gsl_sf_lncosh) FN(gsl_sf_zeta) FN(gsl_sf_zetam1) FN(gsl_sf_eta) FN(gsl_sf_psi) FN(gsl_sf_psi_1piy) FN(gsl_sf_psi_1) #undef FN static void sf_driver_3(int argc, const char *name, double (*fn)(int l, double x), int (*fn_e)(int l, double x, gsl_sf_result *result)) { gsl_sf_result r; long i, ntot, flags, dims[Y_DIMSIZE]; double *x, *y; int l; if (first_time) setup(); if (argc == 3) { flags = get_flags(0, 0L); yarg_drop(1); } else { if (argc != 2) fnerr(name, "takes two or three arguments"); flags = 0; } l = ygets_l(1); x = get_array_d(0, &ntot, dims); if (flags) { y = push_d2(dims); for (i = 0; i < ntot; ++i) { fn_e(l, x[i], &r); y[2*i] = r.val; y[2*i+1] = r.err; } } else { y = (yarg_scratch(0) ? x : ypush_d(dims)); for (i = 0; i < ntot; ++i) { y[i] = fn(l, x[i]); } } } #undef FN #define FN(fn) \ extern void Y_##fn(int argc); \ void Y_##fn(int argc) { sf_driver_3(argc, #fn, fn, fn##_e); } FN(gsl_sf_bessel_Jn) FN(gsl_sf_bessel_Yn) FN(gsl_sf_bessel_In) FN(gsl_sf_bessel_In_scaled) FN(gsl_sf_bessel_Kn) FN(gsl_sf_bessel_Kn_scaled) FN(gsl_sf_bessel_jl) FN(gsl_sf_bessel_yl) FN(gsl_sf_bessel_il_scaled) FN(gsl_sf_bessel_kl_scaled) FN(gsl_sf_exprel_n) FN(gsl_sf_fermi_dirac_int) FN(gsl_sf_taylorcoeff) FN(gsl_sf_legendre_Pl) FN(gsl_sf_legendre_Ql) FN(gsl_sf_psi_n) #undef FN static void sf_driver_4(int argc, const char *name, double (*fn)(double nu, double x), int (*fn_e)(double nu, double x, gsl_sf_result *result)) { double nu; gsl_sf_result r; long i, ntot, flags, dims[Y_DIMSIZE]; double *x, *y; if (first_time) setup(); if (argc == 3) { flags = get_flags(0, 0L); yarg_drop(1); } else { if (argc != 2) fnerr(name, "takes one or two arguments"); flags = 0; } nu = ygets_d(1); x = get_array_d(0, &ntot, dims); if (flags) { y = push_d2(dims); for (i = 0; i < ntot; ++i) { fn_e(nu, x[i], &r); y[2*i] = r.val; y[2*i+1] = r.err; } } else { y = (yarg_scratch(0) ? x : ypush_d(dims)); for (i = 0; i < ntot; ++i) { y[i] = fn(nu, x[i]); } } } #undef FN #define FN(fn) \ extern void Y_##fn(int argc); \ void Y_##fn(int argc) { sf_driver_4(argc, #fn, fn, fn##_e); } FN(gsl_sf_bessel_Jnu) FN(gsl_sf_bessel_Ynu) FN(gsl_sf_bessel_Inu) FN(gsl_sf_bessel_Inu_scaled) FN(gsl_sf_bessel_Knu) FN(gsl_sf_bessel_lnKnu) FN(gsl_sf_bessel_Knu_scaled) #undef FN /*---------------------------------------------------------------------------*/ /* POLYNOMIAL ROOTS */ static void push_vector_d(long n, const double inp[]) { long dims[2]; double* out; long j; if (n > 0) { dims[0] = 1; dims[1] = n; out = ypush_d(dims); for (j = 0; j < n; ++j) { out[j] = inp[j]; } } else { ypush_nil(); } } void Y_gsl_poly_solve_quadratic(int argc) { double a, b, c; long dims[Y_DIMSIZE]; double x[2]; const double* coef; long n; if (argc == 1) { coef = ygeta_d(0, &n, dims); if (dims[0] == 1 && dims[1] == 3) { a = coef[0]; b = coef[1]; c = coef[2]; } else { goto bad_args; } } else if (argc == 3) { a = ygets_d(2); b = ygets_d(1); c = ygets_d(0); } else { bad_args: y_error("expecting a 3-element vector or 3 arguments"); return; } n = gsl_poly_solve_quadratic(a, b, c, &x[0], &x[1]); push_vector_d(n, x); } void Y_gsl_poly_solve_cubic(int argc) { double a, b, c; long dims[Y_DIMSIZE]; double x[3]; const double* coef; long n; if (argc == 1) { coef = ygeta_d(0, &n, dims); if (dims[0] == 1 && dims[1] == 3) { a = coef[0]; b = coef[1]; c = coef[2]; } else { goto bad_args; } } else if (argc == 3) { a = ygets_d(2); b = ygets_d(1); c = ygets_d(0); } else { bad_args: y_error("expecting a 3-element vector or 3 arguments"); return; } n = gsl_poly_solve_cubic(a, b, c, &x[0], &x[1], &x[2]); push_vector_d(n, x); } /* * Local Variables: * mode: C * c-basic-offset: 2 * tab-width: 8 * indent-tabs-mode: nil * fill-column: 78 * coding: utf-8 * ispell-local-dictionary: "american" * End: */