aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2021-03-19Demonstrate cone sampling with rejection sampling too.Arun Isaac
* contrib/cone-vector.py (sample_code): Demonstrate cone sampling with rejection sampling too.
2021-03-19Implement rejection sampling based cone sampling.Arun Isaac
* contrib/cone-vector.py: Import log. (random_planar_angle_pdf, random_vector_on_spherical_cap_pdf): New functions.
2021-03-19Factor out random planar angle generation.Arun Isaac
* contrib/cone-vector.py (random_planar_angle_cdf, random_vector_on_disk): New functions. (random_vector_on_spherical_cap): Rename to random_vector_on_spherical_cap_cdf. Call random_planar_angle_cdf and random_vector_on_disk. (sample_code): Call random_vector_on_spherical_cap_cdf instead of random_vector_on_spherical_cap.
2021-03-16Deal in solid angle fractions, not absolute solid angles.Arun Isaac
* src/extent-sampling.sc (volume-cone): Use solid-angle-fraction->planar-angle instead of solid-angle->planar-angle. * src/nd-random.sc (planar-angle->solid-angle): Rename to planar-angle->solid-angle-fraction and return a solid angle fraction. (solid-angle->planar-angle): Rename to solid-angle-fraction->planar-angle and accept a solid angle fraction. (hollow-cone-random-vector): Use planar-angle->solid-angle-fraction instead of planar-angle->solid-angle. (beta-inc-unnormalized, incomplete-wallis-integral): Delete functions. * include/nd-random.h (planar_angle_to_solid_angle): Rename to planar_angle_to_solid_angle_fraction. (solid_angle_to_planar_angle): Rename to solid_angle_fraction_to_planar_angle. * scm/nsmc/wrap.scm (planar-angle->solid-angle): Rename to planar-angle->solid-angle-fraction.
2021-03-16Fix edge case when vectors around the nth canonical axis are required.Arun Isaac
* src/nd-random.sc (rotate-from-nth-canonical): Do nothing when vectors around the nth canonical axis are required.
2021-03-16Implement simplified cone sampling algorithm.Arun Isaac
* src/nd-random.sc (hollow-cone-random-vector): Implement simplified algorithm that directly samples the surface of the sphere instead of sampling a disk and projecting it onto the surface.
2021-03-15Put sample code in separate function.Arun Isaac
* contrib/cone-vector.py: Call sample_code when run as a script. (sample_code): New function.
2021-03-15Remove unused imports.Arun Isaac
* contrib/cone-vector.py: Don't import zeros from numpy and gamma from scipy.special.
2021-03-15Add function docstrings.Arun Isaac
* contrib/cone-vector.py (random_vector_on_sphere, planar_angle2solid_angle_fraction, solid_angle_fraction2planar_angle, rotate_from_nth_canonical, random_vector_on_spherical_cap): Add docstrings.
2021-03-15Remove space between function name and bracket.Arun Isaac
* contrib/cone-vector.py (random_vector_on_sphere, planar_angle2solid_angle_fraction, solid_angle_fraction2planar_angle, rotate_from_nth_canonical, random_vector_on_spherical_cap): Remove space between function name and bracket.
2021-03-15Implement simplified cone sampling algorithm.Arun Isaac
* contrib/cone-vector.py: Don't import tan. (random_vector_on_spherical_cap): Implement simplified algorithm that directly samples the surface of the sphere instead of sampling a disk and projecting it onto the surface.
2021-03-15Vectorize functions.Arun Isaac
* contrib/cone-vector.py: Import where. (planar_angle2solid_angle_fraction, solid_angle_fraction2planar_angle): Vectorize functions.
2021-03-15Fix solid_angle_fraction2planar_angle for solid_angle_fraction > 1/2.Arun Isaac
* contrib/cone-vector.py (solid_angle_fraction2planar_angle): Fix for solid_angle_fraction > 1/2.
2021-03-10Do not concatenate numpy arrays.Arun Isaac
* contrib/cone-vector.py: Import empty. Don't import concatenate. (random_vector_on_spherical_cap): Build random vector without concatenation.
2021-03-10Remove surface area computation.Arun Isaac
Now that we are computing solid angle fractions, there is no need to compute the total surface area of the sphere. * contrib/cone-vector.py (surface_area_of_ball): Delete function. (solid_angle_fraction2planar_angle): Remove surface area computation.
2021-03-10Add Python implementation of cone sampling.Arun Isaac
* contrib/cone-vector.py: New file.
2021-02-26Add copyright and license headers.Arun Isaac
* scm/nsmc/load-libs.scm.in, scm/nsmc/wrap.scm: Add copyright and license headers.
2021-02-26List papers as a bulleted list.Arun Isaac
* README.org: List papers as a bulleted list.
2021-02-26Add guix environment instructions to guix.scm.Arun Isaac
* guix.scm: Add guix environment instructions.
2021-02-26Add copyright and license headers for all files.Arun Isaac
* include/extent-sampling.h, include/gaussian-nd-random.h, include/integrands.h, include/nd-random.h, include/oracles.h, include/utils.h, src/extent-sampling.sc, src/gaussian-nd-random.sc, src/integrands.sc, src/macros/macros.sc, src/nd-random.sc, src/oracles.sc, src/utils.sc, CMakeLists.txt, pre-inst-env.in: Add copyright and license headers.
2021-02-26Add a copy of the GPLv3.Arun Isaac
* COPYING: New file.
2021-02-26Add explicit citation information in README.Arun Isaac
* README.org (Citing): New section.
2021-02-26Refer to papers in the opening of the README.Arun Isaac
* README.org: Refer to papers at the opening.
2021-02-26Change title of README.Arun Isaac
* README.org (TITLE): Set to "n-sphere Monte Carlo Method".
2021-02-26Document running of examples in README.Arun Isaac
* README.org (Usage): New section.
2021-02-26Add hollow cone vector generation example.Arun Isaac
* examples/generate-hollow-cone-vector.c: New file.
2021-02-26Add cone vector generation example.Arun Isaac
* examples/generate-cone-vector.c: New file.
2021-02-26Set CPATH and LIBRARY_PATH in pre-inst-env wrapper.Arun Isaac
This is so that someone compiling and running C programs against libnsmc can do so easily. * pre-inst-env.in: Set CPATH and LIBRARY_PATH.
2021-02-26Rename subsampling-random-vector to cone-random-vector.Arun Isaac
* scm/nsmc/wrap.scm: (subsampling-random-vector): Rename to cone-random-vector. * src/nd-random.sc (subsampling-random-vector): Rename to cone-random-vector. * include/nd-random.h (subsampling_random_vector): Rename to cone_random_vector.
2021-02-26Rename project to nsmc.Arun Isaac
2021-02-26Advertise guix environment in README.Arun Isaac
* README.org (Build): Advertise guix environment.
2021-02-26Link to dependencies in README.Arun Isaac
* README.org (Build): Link to dependencies.
2021-02-26Specify GSL as a dependency in README.Arun Isaac
* README.org (Build): Specify GSL as a dependency.
2021-02-26Add indent to build dependencies.Arun Isaac
* guix.scm (extent-sampling): Add indent to native-inputs.
2021-02-26Fix home-page in guix.scm.Arun Isaac
* guix.scm (extent-sampling): Fix home-page.
2021-02-26Add README.Arun Isaac
* README.org: New file.
2021-02-26Comment about building and installing shared library.Arun Isaac
* CMakeLists.txt: Comment about building and installing shared library.
2021-02-26Include GNUInstallDirs earlier in CMakeLists.Arun Isaac
* CMakeLists.txt: Include GNUInstallDirs earlier.
2021-02-26Wrap volume-window function.Arun Isaac
* scm/extent-sampling/wrap.scm (volume-window): New function.
2021-02-26Remove unused neval variable.Arun Isaac
* src/extent-sampling.sc (integral-per-direction): Remove neval from function arguments. (integral): Adjust integral-per-direction function call.
2021-02-24Remove workaround for sph-sc negation bug.Arun Isaac
The bug has been fixed upstream. * src/integrands.sc (gaussian-integrand): Remove workaround for sph-sc negation bug.
2021-02-23Wrap integral function.Arun Isaac
* scm/extent-sampling/wrap.scm (maybe-procedure->integrand, integral): New functions.
2021-02-23Wrap volume function.Arun Isaac
* scm/extent-sampling/wrap.scm (maybe-procedure->extent-oracle, maybe-procedure->integrand): New functions.
2021-02-23Wrap integrands.Arun Isaac
* scm/extent-sampling/wrap.scm (make-integrand, make-polynomial-integrand, gaussian-integrand, x-coordinate-integrand): New functions.
2021-02-23Wrap extent oracles.Arun Isaac
* scm/extent-sampling/wrap.scm (make-extent-oracle, make-bernoulli-params, make-bernoulli-oracle, true-volume-procedure, bernoulli-true-volume, make-uniform-params, make-uniform-oracle, uniform-true-volume, make-beta-params, make-beta-oracle, beta-true-volume, make-cube-params, make-cube-oracle, cube-true-volume, make-spheroid-params, make-spheroid-oracle, spheroid-true-volume): New functions.
2021-02-23Implement the lower incomplete gamma function as a scheme wrapper.Arun Isaac
With this change, the wrapper around the gsl lower incomplete gamma function is directly in scheme. Earlier, there was one layer of wrapping in C which needed to be wrapped again in scheme. * include/utils.h (lower_incomplete_gamma): Delete function. * src/utils.sc (lower-incomplete-gamma): Delete function. * scm/extent-sampling/wrap.scm (lower-incomplete-gamma): New function.
2021-02-23Provide test integrals.Arun Isaac
* include/integrands.h, src/integrands.sc: New files.
2021-02-23Redefine integrand_t as a struct.Arun Isaac
This change will make it easier for the scheme wrapper to curry integrands. * include/extent-sampling.h (integrand_t): Redefine type as struct. (integral): Pass pointer to integrand_t. * src/extent-sampling.sc (integral-per-direction, integral): Handle new integrand-t type. (invoke-integrand): New sc macro.
2021-02-23Implement uniform-true-volume without log.Arun Isaac
Logarithmic functions trip up when their parameter is 0. * src/oracles.sc (uniform-true-volume): Implement without log.
2021-02-23Rename function scope params argument to avoid name conflict.Arun Isaac
* src/oracles.sc (bernoulli-extent-oracle, bernoulli-true-volume, uniform-extent-oracle, uniform-true-volume, beta-extent-oracle, beta-true-volume, cube-extent-oracle, cube-extent-oracle-with-center, cube-true-volume, ellipsoid-extent-oracle, ellipsoid-true-volume, spheroid-extent-oracle, spheroid-true-volume): Rename params argument to -params.