This repository has been archived by the owner on Mar 7, 2018. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 1e49d64
Showing
6 changed files
with
1,299 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,3 @@ | |||
*.fasl | |||
*~ | |||
*.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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"))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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"; |
Oops, something went wrong.