aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt24
-rw-r--r--guix.scm6
-rw-r--r--scm/nsmc/load-libs.scm.in (renamed from scm/extent-sampling/load-libs.scm.in)6
-rw-r--r--scm/nsmc/wrap.scm (renamed from scm/extent-sampling/wrap.scm)52
4 files changed, 44 insertions, 44 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 076a92b..ce1be04 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.10)
-project(extent-sampling VERSION 0.1.0)
+project(nsmc VERSION 0.1.0)
find_package(GSL REQUIRED)
find_program(SC NAMES sc REQUIRED)
@@ -42,17 +42,17 @@ endforeach()
include_directories("include")
# Build and install shared library with headers.
-add_library(extentsampling SHARED ${C_SOURCES})
-target_link_libraries(extentsampling -lgsl -lgslcblas)
-set_target_properties(extentsampling PROPERTIES
+add_library(nsmc SHARED ${C_SOURCES})
+target_link_libraries(nsmc -lgsl -lgslcblas)
+set_target_properties(nsmc PROPERTIES
PUBLIC_HEADER "include/extent-sampling.h;include/gaussian-nd-random.h;include/nd-random.h;include/oracles.h")
-install(TARGETS extentsampling LIBRARY
- PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/extent-sampling)
+install(TARGETS nsmc LIBRARY
+ PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/nsmc)
# Build and install scheme wrapper.
if(${GUILE_FOUND})
- configure_file(scm/extent-sampling/load-libs.scm.in scm/extent-sampling/load-libs.scm)
- set(SCM_WRAPPER_PATH scm/extent-sampling/wrap.scm)
+ configure_file(scm/nsmc/load-libs.scm.in scm/nsmc/load-libs.scm)
+ set(SCM_WRAPPER_PATH scm/nsmc/wrap.scm)
change_extension(SCM_WRAPPER_GO_PATH ${SCM_WRAPPER_PATH} go)
add_custom_command(
OUTPUT ${SCM_WRAPPER_GO_PATH}
@@ -64,12 +64,12 @@ if(${GUILE_FOUND})
string(REPLACE "." ";" GUILE_VERSION_LIST ${GUILE_VERSION})
list(GET GUILE_VERSION_LIST 0 GUILE_MAJOR_VERSION)
list(GET GUILE_VERSION_LIST 1 GUILE_MINOR_VERSION)
- install(FILES ${CMAKE_BINARY_DIR}/scm/extent-sampling/load-libs.scm
- DESTINATION ${CMAKE_INSTALL_DATADIR}/guile/site/${GUILE_MAJOR_VERSION}.${GUILE_MINOR_VERSION}/extent-sampling)
+ install(FILES ${CMAKE_BINARY_DIR}/scm/nsmc/load-libs.scm
+ DESTINATION ${CMAKE_INSTALL_DATADIR}/guile/site/${GUILE_MAJOR_VERSION}.${GUILE_MINOR_VERSION}/nsmc)
install(FILES ${CMAKE_BINARY_DIR}/${SCM_WRAPPER_PATH}
- DESTINATION ${CMAKE_INSTALL_DATADIR}/guile/site/${GUILE_MAJOR_VERSION}.${GUILE_MINOR_VERSION}/extent-sampling)
+ DESTINATION ${CMAKE_INSTALL_DATADIR}/guile/site/${GUILE_MAJOR_VERSION}.${GUILE_MINOR_VERSION}/nsmc)
install(FILES ${CMAKE_BINARY_DIR}/${SCM_WRAPPER_GO_PATH}
- DESTINATION ${CMAKE_INSTALL_LIBDIR}/guile/site/${GUILE_MAJOR_VERSION}.${GUILE_MINOR_VERSION}/site-ccache/extent-sampling)
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/guile/site/${GUILE_MAJOR_VERSION}.${GUILE_MINOR_VERSION}/site-ccache/nsmc)
endif()
# Configure environment wrapper script.
diff --git a/guix.scm b/guix.scm
index f82aa5c..ec77f47 100644
--- a/guix.scm
+++ b/guix.scm
@@ -125,7 +125,7 @@
(license license:gpl3+)))
(package
- (name "extent-sampling")
+ (name "nsmc")
(version "0.1.0")
(home-page "https://git.systemreboot.net/nsmc")
(source (local-file %source-dir
@@ -144,6 +144,6 @@
; readable. That can be useful.
("pkg-config" ,pkg-config)
("sph-sc" ,sph-sc)))
- (synopsis "Extent sampling library")
- (description "Extent sampling library")
+ (synopsis "n-sphere Monte Carlo library")
+ (description "n-sphere Monte Carlo library")
(license license:gpl3+))
diff --git a/scm/extent-sampling/load-libs.scm.in b/scm/nsmc/load-libs.scm.in
index 1b99e53..cd2fbe3 100644
--- a/scm/extent-sampling/load-libs.scm.in
+++ b/scm/nsmc/load-libs.scm.in
@@ -1,9 +1,9 @@
-(define lib-extentsampling
+(define lib-nsmc
(catch #t
(lambda ()
- (dynamic-link "@CMAKE_INSTALL_FULL_LIBDIR@/libextentsampling"))
+ (dynamic-link "@CMAKE_INSTALL_FULL_LIBDIR@/libnsmc"))
(lambda _
- (dynamic-link "libextentsampling"))))
+ (dynamic-link "libnsmc"))))
(define lib-gsl
(catch #t
diff --git a/scm/extent-sampling/wrap.scm b/scm/nsmc/wrap.scm
index 306caa4..e6d9a47 100644
--- a/scm/extent-sampling/wrap.scm
+++ b/scm/nsmc/wrap.scm
@@ -1,4 +1,4 @@
-(define-module (extent-sampling wrap)
+(define-module (nsmc wrap)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-26)
#:use-module (ice-9 match)
@@ -17,17 +17,17 @@
(define-public pi
((pointer->procedure double
- (dynamic-func "pi" lib-extentsampling)
+ (dynamic-func "pi" lib-nsmc)
(list))))
(define-public volume-of-ball
(pointer->procedure double
- (dynamic-func "volume_of_ball" lib-extentsampling)
+ (dynamic-func "volume_of_ball" lib-nsmc)
(list int)))
(define-public surface-area-of-ball
(pointer->procedure double
- (dynamic-func "surface_area_of_ball" lib-extentsampling)
+ (dynamic-func "surface_area_of_ball" lib-nsmc)
(list int)))
(define-public (lower-incomplete-gamma s x)
@@ -42,12 +42,12 @@
(define-public angle-between-vectors
(pointer->procedure double
- (dynamic-func "angle_between_vectors" lib-extentsampling)
+ (dynamic-func "angle_between_vectors" lib-nsmc)
(list '* '*)))
(define-public planar-angle->solid-angle
(pointer->procedure double
- (dynamic-func "planar_angle_to_solid_angle" lib-extentsampling)
+ (dynamic-func "planar_angle_to_solid_angle" lib-nsmc)
(list double int)))
;; Random state
@@ -138,7 +138,7 @@
((n range bin)
(let ((range (pointer->bytevector range (1+ n) 0 'f64)))
((pointer->procedure int
- (dynamic-func "gsl_histogram_scale" lib-extentsampling)
+ (dynamic-func "gsl_histogram_scale" lib-nsmc)
(list '* double))
histogram
(/ n
@@ -153,7 +153,7 @@
((histogram) histogram)
((histogram input)
((pointer->procedure int
- (dynamic-func "gsl_histogram_increment" lib-extentsampling)
+ (dynamic-func "gsl_histogram_increment" lib-nsmc)
(list '* double))
histogram input)
histogram)))
@@ -165,7 +165,7 @@
(define-public rstat-n
(pointer->procedure size_t
- (dynamic-func "gsl_rstat_n" lib-extentsampling)
+ (dynamic-func "gsl_rstat_n" lib-nsmc)
(list '*)))
;; Polynomial functions
@@ -183,7 +183,7 @@
(define-public (random-direction-vector dimension)
(let ((vector (vector-alloc dimension)))
((pointer->procedure void
- (dynamic-func "random_direction_vector" lib-extentsampling)
+ (dynamic-func "random_direction_vector" lib-nsmc)
(list '* '*))
%gsl-random-state vector)
vector))
@@ -191,7 +191,7 @@
(define-public (subsampling-random-vector mean max-theta)
(let ((vector (vector-alloc (vector-size mean))))
((pointer->procedure void
- (dynamic-func "subsampling_random_vector" lib-extentsampling)
+ (dynamic-func "subsampling_random_vector" lib-nsmc)
(list '* '* double '*))
%gsl-random-state mean max-theta vector)
vector))
@@ -200,14 +200,14 @@
(let* ((vector (vector-alloc (vector-size mean)))
(cost
((pointer->procedure int
- (dynamic-func "shifted_gaussian_random_vector" lib-extentsampling)
+ (dynamic-func "shifted_gaussian_random_vector" lib-nsmc)
(list '* '* double double '*))
%gsl-random-state mean max-theta standard-deviation vector)))
vector))
(define-public (shifted-gaussian-random-vector-cost mean max-theta standard-deviation)
((pointer->procedure int
- (dynamic-func "shifted_gaussian_random_vector" lib-extentsampling)
+ (dynamic-func "shifted_gaussian_random_vector" lib-nsmc)
(list '* '* double double '*))
%gsl-random-state mean max-theta standard-deviation (vector-alloc (vector-size mean))))
@@ -217,7 +217,7 @@
(define-public (shifted-gaussian-pdf theta mean max-theta standard-deviation)
((pointer->procedure double
- (dynamic-func "shifted_gaussian_pdf" lib-extentsampling)
+ (dynamic-func "shifted_gaussian_pdf" lib-nsmc)
(list double double double double unsigned-int '*))
theta (vector-norm2 mean) max-theta standard-deviation (vector-size mean) %integration-workspace))
@@ -232,12 +232,12 @@
(list p r0 r1)))
(define-public (make-bernoulli-oracle p r0 r1)
- (make-extent-oracle (dynamic-func "bernoulli_extent_oracle" lib-extentsampling)
+ (make-extent-oracle (dynamic-func "bernoulli_extent_oracle" lib-nsmc)
(make-bernoulli-params p r0 r1)))
(define (true-volume-procedure name)
(pointer->procedure double
- (dynamic-func name lib-extentsampling)
+ (dynamic-func name lib-nsmc)
(list unsigned-int '*)))
(define-public (bernoulli-true-volume p r0 r1 dimension)
@@ -249,7 +249,7 @@
(list a b)))
(define-public (make-uniform-oracle a b)
- (make-extent-oracle (dynamic-func "uniform_extent_oracle" lib-extentsampling)
+ (make-extent-oracle (dynamic-func "uniform_extent_oracle" lib-nsmc)
(make-uniform-params a b)))
(define-public (uniform-true-volume a b dimension)
@@ -261,7 +261,7 @@
(list alpha beta)))
(define-public (make-beta-oracle alpha beta)
- (make-extent-oracle (dynamic-func "beta_extent_oracle" lib-extentsampling)
+ (make-extent-oracle (dynamic-func "beta_extent_oracle" lib-nsmc)
(make-beta-params alpha beta)))
(define-public (beta-true-volume alpha beta dimension)
@@ -272,7 +272,7 @@
(make-c-struct (list double) (list edge)))
(define-public (make-cube-oracle edge)
- (make-extent-oracle (dynamic-func "cube_extent_oracle" lib-extentsampling)
+ (make-extent-oracle (dynamic-func "cube_extent_oracle" lib-nsmc)
(make-cube-params edge)))
(define-public (cube-true-volume edge dimension)
@@ -283,7 +283,7 @@
(make-c-struct (list double) (list eccentricity)))
(define-public (make-spheroid-oracle eccentricity)
- (make-extent-oracle (dynamic-func "spheroid_extent_oracle" lib-extentsampling)
+ (make-extent-oracle (dynamic-func "spheroid_extent_oracle" lib-nsmc)
(make-spheroid-params eccentricity)))
(define-public (spheroid-true-volume eccentricity dimension)
@@ -297,18 +297,18 @@
(list integrand params)))
(define-public (make-polynomial-integrand polynomial)
- (make-integrand (dynamic-func "polynomial_integrand" lib-extentsampling)
+ (make-integrand (dynamic-func "polynomial_integrand" lib-nsmc)
(make-c-struct (list '* int)
(list (bytevector->pointer
(list->typed-array 'f64 1 polynomial))
(1- (length polynomial))))))
(define-public gaussian-integrand
- (make-integrand (dynamic-func "gaussian_integrand" lib-extentsampling)
+ (make-integrand (dynamic-func "gaussian_integrand" lib-nsmc)
%null-pointer))
(define-public x-coordinate-integrand
- (make-integrand (dynamic-func "x_coordinate_integrand" lib-extentsampling)
+ (make-integrand (dynamic-func "x_coordinate_integrand" lib-nsmc)
%null-pointer))
;; extent-sampling
@@ -338,7 +338,7 @@
(define-public (volume extent-oracle true-volume dimension rtol)
(let ((stats (rstat-alloc)))
((pointer->procedure double
- (dynamic-func "volume" lib-extentsampling)
+ (dynamic-func "volume" lib-nsmc)
(list '* double '* unsigned-int double '*))
(maybe-procedure->extent-oracle extent-oracle)
true-volume %gsl-random-state dimension rtol stats)
@@ -347,7 +347,7 @@
(define-public (volume-window extent-oracle true-volume dimension rtol)
(let ((samples (make-c-struct (list unsigned-int) (list 0))))
((pointer->procedure double
- (dynamic-func "volume_window" lib-extentsampling)
+ (dynamic-func "volume_window" lib-nsmc)
(list '* double '* unsigned-int double '*))
(maybe-procedure->extent-oracle extent-oracle)
true-volume %gsl-random-state dimension rtol samples)
@@ -357,7 +357,7 @@
(define-public (integral integrand extent-oracle true-integral dimension rtol)
(let ((stats (rstat-alloc)))
((pointer->procedure double
- (dynamic-func "integral" lib-extentsampling)
+ (dynamic-func "integral" lib-nsmc)
(list '* '* double '* unsigned-int double '*))
(maybe-procedure->integrand integrand)
(maybe-procedure->extent-oracle extent-oracle)