Changeset 33028 in project


Ignore:
Timestamp:
12/25/15 00:20:48 (6 years ago)
Author:
Ivan Raikov
Message:

statistics: added gsl bindings for lambert's w function; added maintainer to meta file

Location:
release/4/statistics/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • release/4/statistics/trunk/statistics.meta

    r23255 r33028  
    11((author "Peter Lane")
     2 (maintainer "Ivan Raikov")
    23 (synopsis "Statistics library")
    34 (license "GPL-3")
  • release/4/statistics/trunk/statistics.scm

    r32983 r33028  
    170170    ; (chi-square significance is calculated from chi-square-cdf
    171171    ;  in ways depending on the problem)
     172
     173    ;; The Lambert W function, also called the omega function or product logarithm.
     174    lambert-W0
     175    lambert-Wm1
    172176    )
    173177
     
    188192  #include <gsl/gsl_sf_erf.h>
    189193  #include <gsl/gsl_sf_gamma.h>
     194  #include <gsl/gsl_sf_lambert.h>
    190195  <#
     196
     197  ;; The principal branch of the Lambert W function
     198  (define lambert-W0
     199    (foreign-lambda double "gsl_sf_lambert_W0" double))
     200
     201  ;;The secondary real-valued branch of the Lambert W function
     202  (define lambert-Wm1
     203    (foreign-lambda double "gsl_sf_lambert_Wm1" double))
    191204
    192205  (define beta-incomplete
  • release/4/statistics/trunk/statistics.setup

    r32985 r33028  
    1 (compile -s -O3 -d1 "statistics.scm" -j statistics -lgsl -lgslcblas)
    2 (compile -c -O3 -d1 "statistics.scm" -unit statistics -lgsl -lgslcblas)
    3 (compile -s -O3 -d0 "statistics.import.scm" -lgsl -lgslcblas)
     1;; -*- Hen -*-
     2
     3(define (gsl-try-compile header ldflags)
     4  (and (try-compile
     5        (string-append "#include " header "\n"
     6                       "int main() { cblas_ddot(0, NULL, 0, NULL, 0); return 0; }\n")
     7        ldflags: ldflags)
     8       ldflags ))
     9
     10(define-syntax gsl-test
     11  (syntax-rules ()
     12    ((_ (flags ...))
     13     (condition-case (gsl-try-compile flags ...)
     14                     (t ()    #f)))))
     15
     16(define ld-options
     17  (or (gsl-test  ("<gsl/gsl_cblas.h>" "-lgsl -lgslcblas -lm"))
     18      (error "unable to figure out location of GSL library")))
     19
     20(compile -s -O3 -d1 "statistics.scm" -j statistics -L "\"" ,ld-options "\"" )
     21(compile -c -O3 -d1 "statistics.scm" -unit statistics -L "\"" ,ld-options "\"" )
     22(compile -s -O3 -d0 "statistics.import.scm"  -L "\"" ,ld-options "\"" )
     23
    424
    525(install-extension
    626 'statistics
    727 '("statistics.o" "statistics.so" "statistics.import.so")
    8  '((version 0.6)
    9    (static "statistics.o")))
     28 '((version 0.7)))
     29
  • release/4/statistics/trunk/tests/run.scm

    r32983 r33028  
    318318       (=> =5) 0.5066621427235114)
    319319
     320(check (lambert-W0 1.0)
     321       (=> =5) 0.567143290410)
     322
     323(check (lambert-Wm1 1.0)
     324       (=> =5) 0.567143290410)
     325
    320326;; -- summarise results of tests
    321327
Note: See TracChangeset for help on using the changeset viewer.