From 1e49d64401b0e263d6f9d989280d96aff02f064d Mon Sep 17 00:00:00 2001 From: tpapp Date: Sun, 24 Jul 2011 14:26:11 +0200 Subject: [PATCH] Initial commit. --- .gitignore | 3 + Makefile | 14 + README.org | 19 + cl-rmath.asd | 10 + cl-rmath.i | 29 ++ cl-rmath.lisp | 1224 +++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 1299 insertions(+) create mode 100644 .gitignore create mode 100644 Makefile create mode 100644 README.org create mode 100644 cl-rmath.asd create mode 100644 cl-rmath.i create mode 100644 cl-rmath.lisp diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..eae810c --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +*.fasl +*~ +*.html diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..931050f --- /dev/null +++ b/Makefile @@ -0,0 +1,14 @@ +# Running this Makefile is only necessary when Rmath.h changes. + +RMATH_DIRECTORY=/usr/include/ +LISP_FILENAME=cl-rmath.lisp + +all: $(LISP_FILENAME) + +$(LISP_FILENAME): cl-rmath.i $(RMATH_DIRECTORY)/Rmath.h + swig2.0 -cffi -I$(RMATH_DIRECTORY) $< + +.PHONY: clean + +clean: + rm $(LISP_FILENAME) diff --git a/README.org b/README.org new file mode 100644 index 0000000..f3abd59 --- /dev/null +++ b/README.org @@ -0,0 +1,19 @@ +#+TITLE: A simple wrapper for libRmath + +This is a simple, autogenerated foreign interface for the standalone [[http://www.r-project.org][R]] API +[[ +http://cran.r-project.org/doc/manuals/R-exts.html#The-R-API][libRmath]]. There has been no effort to provide a high-level interface for the original library, instead, this library is meant to serve as a building block for such an interface. + +The =libRmath= shared library has to be installed for this library to work. For example, on Debian/Ubuntu/..., you just need to +#+BEGIN_EXAMPLE +apt-get install r-mathlib +#+END_EXAMPLE +as root. + +The function names are preserved as they are. Packages should not use the =cl-rmath= package, but refer to symbols using the =cl-rmath= or =rmath= package qualifiers (in fact, =fround= is in both =cl= and =cl-rmath=, so useing the package would require shadowing). + +Functions using random number generators are not expected to work out of the box. + +It is only necessary to run =make= when =Rmath.h= changes. + +Bugs and issues should be reported using the Github issue tracker. diff --git a/cl-rmath.asd b/cl-rmath.asd new file mode 100644 index 0000000..843d1f5 --- /dev/null +++ b/cl-rmath.asd @@ -0,0 +1,10 @@ +;;;; cl-rmath.asd + +(asdf:defsystem #:cl-rmath + :description "A Common Lisp wrapper for the Rmath library." + :version "0.0.1" + :author "Tamas K. Papp" + :license "Boost Software License - Version 1.0" + :serial t + :depends-on (#:cffi) + :components ((:file "cl-rmath"))) diff --git a/cl-rmath.i b/cl-rmath.i new file mode 100644 index 0000000..288f4c1 --- /dev/null +++ b/cl-rmath.i @@ -0,0 +1,29 @@ +%module "cl-rmath" + +/* Everything ends up in a single file, since the package definition + does not contain the export list and reloading the library would + give errors otherwise because of symbols exported previously. */ + +%insert("lisphead") %{ +(defpackage #:cl-rmath + (:use #:cl) + (:nicknames #:rmath) + (:shadow #:fround)) + +(in-package :cl-rmath) + +(cffi:define-foreign-library librmath + (:unix "libRmath.so") + (t (:default "libRmath"))) + +(cffi:use-foreign-library librmath) + +%} + +/* R_VERSION_STRING is ignored because SBCL's defconstant doesn't like + the redefinition of string constants. */ + +%feature("export"); +%ignore R_VERSION_STRING; +#define MATHLIB_STANDALONE +%include "Rmath.h"; diff --git a/cl-rmath.lisp b/cl-rmath.lisp new file mode 100644 index 0000000..6b5776c --- /dev/null +++ b/cl-rmath.lisp @@ -0,0 +1,1224 @@ +;;; This file was automatically generated by SWIG (http://www.swig.org). +;;; Version 2.0.4 +;;; +;;; Do not make changes to this file unless you know what you are doing--modify +;;; the SWIG interface file instead. + +(defpackage #:cl-rmath + (:use #:cl) + (:nicknames #:rmath) + (:shadow #:fround)) + +(in-package :cl-rmath) + +(cffi:define-foreign-library librmath + (:unix "libRmath.so") + (t (:default "libRmath"))) + +(cffi:use-foreign-library librmath) + + + + +;;;SWIG wrapper code starts here + +(cl:defmacro defanonenum (&body enums) + "Converts anonymous enums to defconstants." + `(cl:progn ,@(cl:loop for value in enums + for index = 0 then (cl:1+ index) + when (cl:listp value) do (cl:setf index (cl:second value) + value (cl:first value)) + collect `(cl:defconstant ,value ,index)))) + +(cl:eval-when (:compile-toplevel :load-toplevel) + (cl:unless (cl:fboundp 'swig-lispify) + (cl:defun swig-lispify (name flag cl:&optional (package cl:*package*)) + (cl:labels ((helper (lst last rest cl:&aux (c (cl:car lst))) + (cl:cond + ((cl:null lst) + rest) + ((cl:upper-case-p c) + (helper (cl:cdr lst) 'upper + (cl:case last + ((lower digit) (cl:list* c #\- rest)) + (cl:t (cl:cons c rest))))) + ((cl:lower-case-p c) + (helper (cl:cdr lst) 'lower (cl:cons (cl:char-upcase c) rest))) + ((cl:digit-char-p c) + (helper (cl:cdr lst) 'digit + (cl:case last + ((upper lower) (cl:list* c #\- rest)) + (cl:t (cl:cons c rest))))) + ((cl:char-equal c #\_) + (helper (cl:cdr lst) '_ (cl:cons #\- rest))) + (cl:t + (cl:error "Invalid character: ~A" c))))) + (cl:let ((fix (cl:case flag + ((constant enumvalue) "+") + (variable "*") + (cl:t "")))) + (cl:intern + (cl:concatenate + 'cl:string + fix + (cl:nreverse (helper (cl:concatenate 'cl:list name) cl:nil cl:nil)) + fix) + package)))))) + +;;;SWIG wrapper code ends here + + +(cl:defconstant HAVE_EXPM1 1) + +(cl:export 'HAVE_EXPM1) + +(cl:defconstant HAVE_HYPOT 1) + +(cl:export 'HAVE_HYPOT) + +(cl:defconstant HAVE_LOG1P 1) + +(cl:export 'HAVE_LOG1P) + +(cl:defconstant HAVE_WORKING_LOG1P 1) + +(cl:export 'HAVE_WORKING_LOG1P) + +(cl:defconstant M_E 2.718281828459045235360287471353d0) + +(cl:export 'M_E) + +(cl:defconstant M_LOG2E 1.442695040888963407359924681002d0) + +(cl:export 'M_LOG2E) + +(cl:defconstant M_LOG10E 0.434294481903251827651128918917d0) + +(cl:export 'M_LOG10E) + +(cl:defconstant M_LN2 0.693147180559945309417232121458d0) + +(cl:export 'M_LN2) + +(cl:defconstant M_LN10 2.302585092994045684017991454684d0) + +(cl:export 'M_LN10) + +(cl:defconstant M_PI 3.141592653589793238462643383280d0) + +(cl:export 'M_PI) + +(cl:defconstant M_2PI 6.283185307179586476925286766559d0) + +(cl:export 'M_2PI) + +(cl:defconstant M_PI_2 1.570796326794896619231321691640d0) + +(cl:export 'M_PI_2) + +(cl:defconstant M_PI_4 0.785398163397448309615660845820d0) + +(cl:export 'M_PI_4) + +(cl:defconstant M_1_PI 0.318309886183790671537767526745d0) + +(cl:export 'M_1_PI) + +(cl:defconstant M_2_PI 0.636619772367581343075535053490d0) + +(cl:export 'M_2_PI) + +(cl:defconstant M_2_SQRTPI 1.128379167095512573896158903122d0) + +(cl:export 'M_2_SQRTPI) + +(cl:defconstant M_SQRT2 1.414213562373095048801688724210d0) + +(cl:export 'M_SQRT2) + +(cl:defconstant M_SQRT1_2 0.707106781186547524400844362105d0) + +(cl:export 'M_SQRT1_2) + +(cl:defconstant M_SQRT_3 1.732050807568877293527446341506d0) + +(cl:export 'M_SQRT_3) + +(cl:defconstant M_SQRT_32 5.656854249492380195206754896838d0) + +(cl:export 'M_SQRT_32) + +(cl:defconstant M_LOG10_2 0.301029995663981195213738894724d0) + +(cl:export 'M_LOG10_2) + +(cl:defconstant M_SQRT_PI 1.772453850905516027298167483341d0) + +(cl:export 'M_SQRT_PI) + +(cl:defconstant M_1_SQRT_2PI 0.398942280401432677939946059934d0) + +(cl:export 'M_1_SQRT_2PI) + +(cl:defconstant M_SQRT_2dPI 0.797884560802865355879892119869d0) + +(cl:export 'M_SQRT_2dPI) + +(cl:defconstant M_LN_SQRT_PI 0.572364942924700087071713675677d0) + +(cl:export 'M_LN_SQRT_PI) + +(cl:defconstant M_LN_SQRT_2PI 0.918938533204672741780329736406d0) + +(cl:export 'M_LN_SQRT_2PI) + +(cl:defconstant M_LN_SQRT_PId2 0.225791352644727432363097614947d0) + +(cl:export 'M_LN_SQRT_PId2) + +(cffi:defcenum Rboolean + (:FALSE #.0) + :TRUE) + +(cl:export 'Rboolean) + +(cffi:defcfun ("R_pow" R_pow) :double + (x :double) + (y :double)) + +(cl:export 'R_pow) + +(cffi:defcfun ("R_pow_di" R_pow_di) :double + (arg0 :double) + (arg1 :int)) + +(cl:export 'R_pow_di) + +(cffi:defcfun ("norm_rand" norm_rand) :double) + +(cl:export 'norm_rand) + +(cffi:defcfun ("unif_rand" unif_rand) :double) + +(cl:export 'unif_rand) + +(cffi:defcfun ("exp_rand" exp_rand) :double) + +(cl:export 'exp_rand) + +(cffi:defcfun ("set_seed" set_seed) :void + (arg0 :unsigned-int) + (arg1 :unsigned-int)) + +(cl:export 'set_seed) + +(cffi:defcfun ("get_seed" get_seed) :void + (arg0 :pointer) + (arg1 :pointer)) + +(cl:export 'get_seed) + +(cffi:defcfun ("dnorm4" dnorm4) :double + (arg0 :double) + (arg1 :double) + (arg2 :double) + (arg3 :int)) + +(cl:export 'dnorm4) + +(cffi:defcfun ("pnorm5" pnorm5) :double + (arg0 :double) + (arg1 :double) + (arg2 :double) + (arg3 :int) + (arg4 :int)) + +(cl:export 'pnorm5) + +(cffi:defcfun ("qnorm5" qnorm5) :double + (arg0 :double) + (arg1 :double) + (arg2 :double) + (arg3 :int) + (arg4 :int)) + +(cl:export 'qnorm5) + +(cffi:defcfun ("rnorm" rnorm) :double + (arg0 :double) + (arg1 :double)) + +(cl:export 'rnorm) + +(cffi:defcfun ("pnorm_both" pnorm_both) :void + (arg0 :double) + (arg1 :pointer) + (arg2 :pointer) + (arg3 :int) + (arg4 :int)) + +(cl:export 'pnorm_both) + +(cffi:defcfun ("dunif" dunif) :double + (arg0 :double) + (arg1 :double) + (arg2 :double) + (arg3 :int)) + +(cl:export 'dunif) + +(cffi:defcfun ("punif" punif) :double + (arg0 :double) + (arg1 :double) + (arg2 :double) + (arg3 :int) + (arg4 :int)) + +(cl:export 'punif) + +(cffi:defcfun ("qunif" qunif) :double + (arg0 :double) + (arg1 :double) + (arg2 :double) + (arg3 :int) + (arg4 :int)) + +(cl:export 'qunif) + +(cffi:defcfun ("runif" runif) :double + (arg0 :double) + (arg1 :double)) + +(cl:export 'runif) + +(cffi:defcfun ("dgamma" dgamma) :double + (arg0 :double) + (arg1 :double) + (arg2 :double) + (arg3 :int)) + +(cl:export 'dgamma) + +(cffi:defcfun ("pgamma" pgamma) :double + (arg0 :double) + (arg1 :double) + (arg2 :double) + (arg3 :int) + (arg4 :int)) + +(cl:export 'pgamma) + +(cffi:defcfun ("qgamma" qgamma) :double + (arg0 :double) + (arg1 :double) + (arg2 :double) + (arg3 :int) + (arg4 :int)) + +(cl:export 'qgamma) + +(cffi:defcfun ("rgamma" rgamma) :double + (arg0 :double) + (arg1 :double)) + +(cl:export 'rgamma) + +(cffi:defcfun ("log1pmx" log1pmx) :double + (arg0 :double)) + +(cl:export 'log1pmx) + +(cffi:defcfun ("lgamma1p" lgamma1p) :double + (arg0 :double)) + +(cl:export 'lgamma1p) + +(cffi:defcfun ("logspace_add" logspace_add) :double + (arg0 :double) + (arg1 :double)) + +(cl:export 'logspace_add) + +(cffi:defcfun ("logspace_sub" logspace_sub) :double + (arg0 :double) + (arg1 :double)) + +(cl:export 'logspace_sub) + +(cffi:defcfun ("dbeta" dbeta) :double + (arg0 :double) + (arg1 :double) + (arg2 :double) + (arg3 :int)) + +(cl:export 'dbeta) + +(cffi:defcfun ("pbeta" pbeta) :double + (arg0 :double) + (arg1 :double) + (arg2 :double) + (arg3 :int) + (arg4 :int)) + +(cl:export 'pbeta) + +(cffi:defcfun ("qbeta" qbeta) :double + (arg0 :double) + (arg1 :double) + (arg2 :double) + (arg3 :int) + (arg4 :int)) + +(cl:export 'qbeta) + +(cffi:defcfun ("rbeta" rbeta) :double + (arg0 :double) + (arg1 :double)) + +(cl:export 'rbeta) + +(cffi:defcfun ("dlnorm" dlnorm) :double + (arg0 :double) + (arg1 :double) + (arg2 :double) + (arg3 :int)) + +(cl:export 'dlnorm) + +(cffi:defcfun ("plnorm" plnorm) :double + (arg0 :double) + (arg1 :double) + (arg2 :double) + (arg3 :int) + (arg4 :int)) + +(cl:export 'plnorm) + +(cffi:defcfun ("qlnorm" qlnorm) :double + (arg0 :double) + (arg1 :double) + (arg2 :double) + (arg3 :int) + (arg4 :int)) + +(cl:export 'qlnorm) + +(cffi:defcfun ("rlnorm" rlnorm) :double + (arg0 :double) + (arg1 :double)) + +(cl:export 'rlnorm) + +(cffi:defcfun ("dchisq" dchisq) :double + (arg0 :double) + (arg1 :double) + (arg2 :int)) + +(cl:export 'dchisq) + +(cffi:defcfun ("pchisq" pchisq) :double + (arg0 :double) + (arg1 :double) + (arg2 :int) + (arg3 :int)) + +(cl:export 'pchisq) + +(cffi:defcfun ("qchisq" qchisq) :double + (arg0 :double) + (arg1 :double) + (arg2 :int) + (arg3 :int)) + +(cl:export 'qchisq) + +(cffi:defcfun ("rchisq" rchisq) :double + (arg0 :double)) + +(cl:export 'rchisq) + +(cffi:defcfun ("dnchisq" dnchisq) :double + (arg0 :double) + (arg1 :double) + (arg2 :double) + (arg3 :int)) + +(cl:export 'dnchisq) + +(cffi:defcfun ("pnchisq" pnchisq) :double + (arg0 :double) + (arg1 :double) + (arg2 :double) + (arg3 :int) + (arg4 :int)) + +(cl:export 'pnchisq) + +(cffi:defcfun ("qnchisq" qnchisq) :double + (arg0 :double) + (arg1 :double) + (arg2 :double) + (arg3 :int) + (arg4 :int)) + +(cl:export 'qnchisq) + +(cffi:defcfun ("rnchisq" rnchisq) :double + (arg0 :double) + (arg1 :double)) + +(cl:export 'rnchisq) + +(cffi:defcfun ("df" df) :double + (arg0 :double) + (arg1 :double) + (arg2 :double) + (arg3 :int)) + +(cl:export 'df) + +(cffi:defcfun ("pf" pf) :double + (arg0 :double) + (arg1 :double) + (arg2 :double) + (arg3 :int) + (arg4 :int)) + +(cl:export 'pf) + +(cffi:defcfun ("qf" qf) :double + (arg0 :double) + (arg1 :double) + (arg2 :double) + (arg3 :int) + (arg4 :int)) + +(cl:export 'qf) + +(cffi:defcfun ("rf" rf) :double + (arg0 :double) + (arg1 :double)) + +(cl:export 'rf) + +(cffi:defcfun ("dt" dt) :double + (arg0 :double) + (arg1 :double) + (arg2 :int)) + +(cl:export 'dt) + +(cffi:defcfun ("pt" pt) :double + (arg0 :double) + (arg1 :double) + (arg2 :int) + (arg3 :int)) + +(cl:export 'pt) + +(cffi:defcfun ("qt" qt) :double + (arg0 :double) + (arg1 :double) + (arg2 :int) + (arg3 :int)) + +(cl:export 'qt) + +(cffi:defcfun ("rt" rt) :double + (arg0 :double)) + +(cl:export 'rt) + +(cffi:defcfun ("dbinom" dbinom) :double + (arg0 :double) + (arg1 :double) + (arg2 :double) + (arg3 :int)) + +(cl:export 'dbinom) + +(cffi:defcfun ("pbinom" pbinom) :double + (arg0 :double) + (arg1 :double) + (arg2 :double) + (arg3 :int) + (arg4 :int)) + +(cl:export 'pbinom) + +(cffi:defcfun ("qbinom" qbinom) :double + (arg0 :double) + (arg1 :double) + (arg2 :double) + (arg3 :int) + (arg4 :int)) + +(cl:export 'qbinom) + +(cffi:defcfun ("rbinom" rbinom) :double + (arg0 :double) + (arg1 :double)) + +(cl:export 'rbinom) + +(cffi:defcfun ("rmultinom" rmultinom) :void + (arg0 :int) + (arg1 :pointer) + (arg2 :int) + (arg3 :pointer)) + +(cl:export 'rmultinom) + +(cffi:defcfun ("dcauchy" dcauchy) :double + (arg0 :double) + (arg1 :double) + (arg2 :double) + (arg3 :int)) + +(cl:export 'dcauchy) + +(cffi:defcfun ("pcauchy" pcauchy) :double + (arg0 :double) + (arg1 :double) + (arg2 :double) + (arg3 :int) + (arg4 :int)) + +(cl:export 'pcauchy) + +(cffi:defcfun ("qcauchy" qcauchy) :double + (arg0 :double) + (arg1 :double) + (arg2 :double) + (arg3 :int) + (arg4 :int)) + +(cl:export 'qcauchy) + +(cffi:defcfun ("rcauchy" rcauchy) :double + (arg0 :double) + (arg1 :double)) + +(cl:export 'rcauchy) + +(cffi:defcfun ("dexp" dexp) :double + (arg0 :double) + (arg1 :double) + (arg2 :int)) + +(cl:export 'dexp) + +(cffi:defcfun ("pexp" pexp) :double + (arg0 :double) + (arg1 :double) + (arg2 :int) + (arg3 :int)) + +(cl:export 'pexp) + +(cffi:defcfun ("qexp" qexp) :double + (arg0 :double) + (arg1 :double) + (arg2 :int) + (arg3 :int)) + +(cl:export 'qexp) + +(cffi:defcfun ("rexp" rexp) :double + (arg0 :double)) + +(cl:export 'rexp) + +(cffi:defcfun ("dgeom" dgeom) :double + (arg0 :double) + (arg1 :double) + (arg2 :int)) + +(cl:export 'dgeom) + +(cffi:defcfun ("pgeom" pgeom) :double + (arg0 :double) + (arg1 :double) + (arg2 :int) + (arg3 :int)) + +(cl:export 'pgeom) + +(cffi:defcfun ("qgeom" qgeom) :double + (arg0 :double) + (arg1 :double) + (arg2 :int) + (arg3 :int)) + +(cl:export 'qgeom) + +(cffi:defcfun ("rgeom" rgeom) :double + (arg0 :double)) + +(cl:export 'rgeom) + +(cffi:defcfun ("dhyper" dhyper) :double + (arg0 :double) + (arg1 :double) + (arg2 :double) + (arg3 :double) + (arg4 :int)) + +(cl:export 'dhyper) + +(cffi:defcfun ("phyper" phyper) :double + (arg0 :double) + (arg1 :double) + (arg2 :double) + (arg3 :double) + (arg4 :int) + (arg5 :int)) + +(cl:export 'phyper) + +(cffi:defcfun ("qhyper" qhyper) :double + (arg0 :double) + (arg1 :double) + (arg2 :double) + (arg3 :double) + (arg4 :int) + (arg5 :int)) + +(cl:export 'qhyper) + +(cffi:defcfun ("rhyper" rhyper) :double + (arg0 :double) + (arg1 :double) + (arg2 :double)) + +(cl:export 'rhyper) + +(cffi:defcfun ("dnbinom" dnbinom) :double + (arg0 :double) + (arg1 :double) + (arg2 :double) + (arg3 :int)) + +(cl:export 'dnbinom) + +(cffi:defcfun ("pnbinom" pnbinom) :double + (arg0 :double) + (arg1 :double) + (arg2 :double) + (arg3 :int) + (arg4 :int)) + +(cl:export 'pnbinom) + +(cffi:defcfun ("qnbinom" qnbinom) :double + (arg0 :double) + (arg1 :double) + (arg2 :double) + (arg3 :int) + (arg4 :int)) + +(cl:export 'qnbinom) + +(cffi:defcfun ("rnbinom" rnbinom) :double + (arg0 :double) + (arg1 :double)) + +(cl:export 'rnbinom) + +(cffi:defcfun ("dnbinom_mu" dnbinom_mu) :double + (arg0 :double) + (arg1 :double) + (arg2 :double) + (arg3 :int)) + +(cl:export 'dnbinom_mu) + +(cffi:defcfun ("pnbinom_mu" pnbinom_mu) :double + (arg0 :double) + (arg1 :double) + (arg2 :double) + (arg3 :int) + (arg4 :int)) + +(cl:export 'pnbinom_mu) + +(cffi:defcfun ("qnbinom_mu" qnbinom_mu) :double + (arg0 :double) + (arg1 :double) + (arg2 :double) + (arg3 :int) + (arg4 :int)) + +(cl:export 'qnbinom_mu) + +(cffi:defcfun ("rnbinom_mu" rnbinom_mu) :double + (arg0 :double) + (arg1 :double)) + +(cl:export 'rnbinom_mu) + +(cffi:defcfun ("dpois" dpois) :double + (arg0 :double) + (arg1 :double) + (arg2 :int)) + +(cl:export 'dpois) + +(cffi:defcfun ("ppois" ppois) :double + (arg0 :double) + (arg1 :double) + (arg2 :int) + (arg3 :int)) + +(cl:export 'ppois) + +(cffi:defcfun ("qpois" qpois) :double + (arg0 :double) + (arg1 :double) + (arg2 :int) + (arg3 :int)) + +(cl:export 'qpois) + +(cffi:defcfun ("rpois" rpois) :double + (arg0 :double)) + +(cl:export 'rpois) + +(cffi:defcfun ("dweibull" dweibull) :double + (arg0 :double) + (arg1 :double) + (arg2 :double) + (arg3 :int)) + +(cl:export 'dweibull) + +(cffi:defcfun ("pweibull" pweibull) :double + (arg0 :double) + (arg1 :double) + (arg2 :double) + (arg3 :int) + (arg4 :int)) + +(cl:export 'pweibull) + +(cffi:defcfun ("qweibull" qweibull) :double + (arg0 :double) + (arg1 :double) + (arg2 :double) + (arg3 :int) + (arg4 :int)) + +(cl:export 'qweibull) + +(cffi:defcfun ("rweibull" rweibull) :double + (arg0 :double) + (arg1 :double)) + +(cl:export 'rweibull) + +(cffi:defcfun ("dlogis" dlogis) :double + (arg0 :double) + (arg1 :double) + (arg2 :double) + (arg3 :int)) + +(cl:export 'dlogis) + +(cffi:defcfun ("plogis" plogis) :double + (arg0 :double) + (arg1 :double) + (arg2 :double) + (arg3 :int) + (arg4 :int)) + +(cl:export 'plogis) + +(cffi:defcfun ("qlogis" qlogis) :double + (arg0 :double) + (arg1 :double) + (arg2 :double) + (arg3 :int) + (arg4 :int)) + +(cl:export 'qlogis) + +(cffi:defcfun ("rlogis" rlogis) :double + (arg0 :double) + (arg1 :double)) + +(cl:export 'rlogis) + +(cffi:defcfun ("dnbeta" dnbeta) :double + (arg0 :double) + (arg1 :double) + (arg2 :double) + (arg3 :double) + (arg4 :int)) + +(cl:export 'dnbeta) + +(cffi:defcfun ("pnbeta" pnbeta) :double + (arg0 :double) + (arg1 :double) + (arg2 :double) + (arg3 :double) + (arg4 :int) + (arg5 :int)) + +(cl:export 'pnbeta) + +(cffi:defcfun ("qnbeta" qnbeta) :double + (arg0 :double) + (arg1 :double) + (arg2 :double) + (arg3 :double) + (arg4 :int) + (arg5 :int)) + +(cl:export 'qnbeta) + +(cffi:defcfun ("rnbeta" rnbeta) :double + (arg0 :double) + (arg1 :double) + (arg2 :double)) + +(cl:export 'rnbeta) + +(cffi:defcfun ("dnf" dnf) :double + (arg0 :double) + (arg1 :double) + (arg2 :double) + (arg3 :double) + (arg4 :int)) + +(cl:export 'dnf) + +(cffi:defcfun ("pnf" pnf) :double + (arg0 :double) + (arg1 :double) + (arg2 :double) + (arg3 :double) + (arg4 :int) + (arg5 :int)) + +(cl:export 'pnf) + +(cffi:defcfun ("qnf" qnf) :double + (arg0 :double) + (arg1 :double) + (arg2 :double) + (arg3 :double) + (arg4 :int) + (arg5 :int)) + +(cl:export 'qnf) + +(cffi:defcfun ("dnt" dnt) :double + (arg0 :double) + (arg1 :double) + (arg2 :double) + (arg3 :int)) + +(cl:export 'dnt) + +(cffi:defcfun ("pnt" pnt) :double + (arg0 :double) + (arg1 :double) + (arg2 :double) + (arg3 :int) + (arg4 :int)) + +(cl:export 'pnt) + +(cffi:defcfun ("qnt" qnt) :double + (arg0 :double) + (arg1 :double) + (arg2 :double) + (arg3 :int) + (arg4 :int)) + +(cl:export 'qnt) + +(cffi:defcfun ("ptukey" ptukey) :double + (arg0 :double) + (arg1 :double) + (arg2 :double) + (arg3 :double) + (arg4 :int) + (arg5 :int)) + +(cl:export 'ptukey) + +(cffi:defcfun ("qtukey" qtukey) :double + (arg0 :double) + (arg1 :double) + (arg2 :double) + (arg3 :double) + (arg4 :int) + (arg5 :int)) + +(cl:export 'qtukey) + +(cffi:defcfun ("dwilcox" dwilcox) :double + (arg0 :double) + (arg1 :double) + (arg2 :double) + (arg3 :int)) + +(cl:export 'dwilcox) + +(cffi:defcfun ("pwilcox" pwilcox) :double + (arg0 :double) + (arg1 :double) + (arg2 :double) + (arg3 :int) + (arg4 :int)) + +(cl:export 'pwilcox) + +(cffi:defcfun ("qwilcox" qwilcox) :double + (arg0 :double) + (arg1 :double) + (arg2 :double) + (arg3 :int) + (arg4 :int)) + +(cl:export 'qwilcox) + +(cffi:defcfun ("rwilcox" rwilcox) :double + (arg0 :double) + (arg1 :double)) + +(cl:export 'rwilcox) + +(cffi:defcfun ("dsignrank" dsignrank) :double + (arg0 :double) + (arg1 :double) + (arg2 :int)) + +(cl:export 'dsignrank) + +(cffi:defcfun ("psignrank" psignrank) :double + (arg0 :double) + (arg1 :double) + (arg2 :int) + (arg3 :int)) + +(cl:export 'psignrank) + +(cffi:defcfun ("qsignrank" qsignrank) :double + (arg0 :double) + (arg1 :double) + (arg2 :int) + (arg3 :int)) + +(cl:export 'qsignrank) + +(cffi:defcfun ("rsignrank" rsignrank) :double + (arg0 :double)) + +(cl:export 'rsignrank) + +(cffi:defcfun ("gammafn" gammafn) :double + (arg0 :double)) + +(cl:export 'gammafn) + +(cffi:defcfun ("lgammafn" lgammafn) :double + (arg0 :double)) + +(cl:export 'lgammafn) + +(cffi:defcfun ("lgammafn_sign" lgammafn_sign) :double + (arg0 :double) + (arg1 :pointer)) + +(cl:export 'lgammafn_sign) + +(cffi:defcfun ("dpsifn" dpsifn) :void + (arg0 :double) + (arg1 :int) + (arg2 :int) + (arg3 :int) + (arg4 :pointer) + (arg5 :pointer) + (arg6 :pointer)) + +(cl:export 'dpsifn) + +(cffi:defcfun ("psigamma" psigamma) :double + (arg0 :double) + (arg1 :double)) + +(cl:export 'psigamma) + +(cffi:defcfun ("digamma" digamma) :double + (arg0 :double)) + +(cl:export 'digamma) + +(cffi:defcfun ("trigamma" trigamma) :double + (arg0 :double)) + +(cl:export 'trigamma) + +(cffi:defcfun ("tetragamma" tetragamma) :double + (arg0 :double)) + +(cl:export 'tetragamma) + +(cffi:defcfun ("pentagamma" pentagamma) :double + (arg0 :double)) + +(cl:export 'pentagamma) + +(cffi:defcfun ("beta" beta) :double + (arg0 :double) + (arg1 :double)) + +(cl:export 'beta) + +(cffi:defcfun ("lbeta" lbeta) :double + (arg0 :double) + (arg1 :double)) + +(cl:export 'lbeta) + +(cffi:defcfun ("choose" choose) :double + (arg0 :double) + (arg1 :double)) + +(cl:export 'choose) + +(cffi:defcfun ("lchoose" lchoose) :double + (arg0 :double) + (arg1 :double)) + +(cl:export 'lchoose) + +(cffi:defcfun ("bessel_i" bessel_i) :double + (arg0 :double) + (arg1 :double) + (arg2 :double)) + +(cl:export 'bessel_i) + +(cffi:defcfun ("bessel_j" bessel_j) :double + (arg0 :double) + (arg1 :double)) + +(cl:export 'bessel_j) + +(cffi:defcfun ("bessel_k" bessel_k) :double + (arg0 :double) + (arg1 :double) + (arg2 :double)) + +(cl:export 'bessel_k) + +(cffi:defcfun ("bessel_y" bessel_y) :double + (arg0 :double) + (arg1 :double)) + +(cl:export 'bessel_y) + +(cffi:defcfun ("bessel_i_ex" bessel_i_ex) :double + (arg0 :double) + (arg1 :double) + (arg2 :double) + (arg3 :pointer)) + +(cl:export 'bessel_i_ex) + +(cffi:defcfun ("bessel_j_ex" bessel_j_ex) :double + (arg0 :double) + (arg1 :double) + (arg2 :pointer)) + +(cl:export 'bessel_j_ex) + +(cffi:defcfun ("bessel_k_ex" bessel_k_ex) :double + (arg0 :double) + (arg1 :double) + (arg2 :double) + (arg3 :pointer)) + +(cl:export 'bessel_k_ex) + +(cffi:defcfun ("bessel_y_ex" bessel_y_ex) :double + (arg0 :double) + (arg1 :double) + (arg2 :pointer)) + +(cl:export 'bessel_y_ex) + +(cffi:defcfun ("pythag" pythag) :double + (arg0 :double) + (arg1 :double)) + +(cl:export 'pythag) + +(cffi:defcfun ("imax2" imax2) :int + (arg0 :int) + (arg1 :int)) + +(cl:export 'imax2) + +(cffi:defcfun ("imin2" imin2) :int + (arg0 :int) + (arg1 :int)) + +(cl:export 'imin2) + +(cffi:defcfun ("fmax2" fmax2) :double + (arg0 :double) + (arg1 :double)) + +(cl:export 'fmax2) + +(cffi:defcfun ("fmin2" fmin2) :double + (arg0 :double) + (arg1 :double)) + +(cl:export 'fmin2) + +(cffi:defcfun ("sign" sign) :double + (arg0 :double)) + +(cl:export 'sign) + +(cffi:defcfun ("fprec" fprec) :double + (arg0 :double) + (arg1 :double)) + +(cl:export 'fprec) + +(cffi:defcfun ("fround" fround) :double + (arg0 :double) + (arg1 :double)) + +(cl:export 'fround) + +(cffi:defcfun ("fsign" fsign) :double + (arg0 :double) + (arg1 :double)) + +(cl:export 'fsign) + +(cffi:defcfun ("ftrunc" ftrunc) :double + (arg0 :double)) + +(cl:export 'ftrunc) + +(cffi:defcfun ("R_finite" R_finite) :int + (arg0 :double)) + +(cl:export 'R_finite) + +(cffi:defcvar ("N01_kind" N01_kind) + :int) + +(cl:export 'N01_kind) + +