This repository is the source code accompanying the following papers.
- An O(n) algorithm for generating uniform random vectors in n-dimensional cones
- An algorithm for estimating volumes and other integrals in n dimensions
Most of the code has been ported to Python and is in the python directory. So, if you wish, you can ignore the rest of this document, and jump straight there.
Build
Build dependencies are
- cmake and make (for the build system)
- sph-sc (to generate C sources from SC sources)
- indent (optional; to indent the generated sources)
- GNU Scientific Library (for vector and scientific functions)
- GNU Guile (for the scheme wrappers)
The easiest way to install these dependencies is to use GNU Guix.
$ guix shell
To build, run the following commands.
$ cmake -B build $ make -C build
Usage
See examples in the examples directory. You can build and run them, for example, using the following commands. pre-inst-env is a shell wrapper that sets the necessary environment variables so that headers and dynamic libraries are found correctly.
$ ./build/pre-inst-env gcc -lgsl -lgslcblas -lnsmc examples/generate-cone-vector.c -o generate-cone-vector $ ./build/pre-inst-env ./generate-cone-vector
Citing
If you use this code for your research, please cite one or more of the following papers as relevant.
License
The source code is free software released under the terms of the GNU General Public License, either version 3 of the License, or (at your option) any later version.