gsl.lisp (1082B)
1 (defpackage :gsl 2 (:use :common-lisp :sb-alien) 3 (:export :gsl-rng-type 4 :gsl-rng 5 :+gsl-rng-ranlxd2+ 6 :*gsl-rng-default* 7 :*gsl-rng-default-seed* 8 :gsl-rng-alloc 9 :gsl-rng-set 10 :gsl-rng-free 11 :gsl-rng-env-setup 12 :gsl-ran-binomial)) 13 14 (in-package :gsl) 15 16 (load-shared-object "libgslcblas.so.0") 17 (load-shared-object "libgsl.so.0") 18 19 (define-alien-type gsl-rng-type (struct nil)) 20 (define-alien-type gsl-rng (struct nil)) 21 22 (define-alien-variable ("gsl_rng_ranlxd2" +gsl-rng-ranlxd2+) 23 (* gsl-rng-type)) 24 25 (define-alien-variable ("gsl_rng_default" *gsl-rng-default*) 26 (* gsl-rng-type)) 27 28 (define-alien-variable ("gsl_rng_default_seed" *gsl-rng-default-seed*) 29 unsigned-long) 30 31 (define-alien-routine gsl-rng-alloc (* gsl-rng) 32 (type (* gsl-rng-type))) 33 34 (define-alien-routine gsl-rng-set void 35 (r (* gsl-rng)) 36 (s unsigned-long)) 37 38 (define-alien-routine gsl-rng-free void 39 (r (* gsl-rng))) 40 41 (define-alien-routine gsl-rng-env-setup (* gsl-rng-type)) 42 43 (define-alien-routine gsl-ran-binomial unsigned-int 44 (r (* gsl-rng)) 45 (p double) 46 (n unsigned-int))