5 releases

new 0.1.4 Oct 27, 2024
0.1.3 Sep 29, 2024
0.1.2 Jun 26, 2024
0.1.1 Dec 14, 2023
0.1.0 Aug 3, 2023

#740 in Algorithms

Download history 31/week @ 2024-07-01 20/week @ 2024-07-08 8/week @ 2024-07-15 10/week @ 2024-07-22 49/week @ 2024-07-29 18/week @ 2024-08-05 3/week @ 2024-08-12 15/week @ 2024-08-19 21/week @ 2024-09-16 150/week @ 2024-09-23 124/week @ 2024-09-30 27/week @ 2024-10-07 22/week @ 2024-10-14

329 downloads per month
Used in 2 crates

MIT/Apache

200KB
427 lines

lds-rs

Crates.io Docs.rs CI codecov

Low Discrepancy Sequence Generation in Rust

This library implements a set of low-discrepancy sequence generators, which are used to create sequences of numbers that exhibit a greater degree of uniformity than random numbers. The utility of these sequences is evident in a number of fields, including computer graphics, numerical integration, and Monte Carlo simulations.

The library defines a number of classes, each of which represents a distinct type of low-discrepancy sequence generator. The primary sequence types that are implemented are as follows:

  1. Van der Corput sequence
  2. Halton sequence
  3. Circle sequence
  4. Sphere sequence
  5. 3-Sphere Hopf sequence
  6. N-dimensional Halton sequence

Each generator is designed to accept specific inputs, which are typically presented in the form of base numbers or sequences of base numbers. The selection of bases serves to determine the manner in which the sequences are generated. The generators produce outputs in the form of floating-point numbers or lists of floating-point numbers, contingent upon the dimensionality of the sequence.

The fundamental algorithm utilized in the majority of these generators is the Van der Corput sequence. The Van der Corput sequence is generated by expressing integers in a specified base, reversing the digits, and inserting them after a decimal point. To illustrate, in base 2, the sequence would commence as follows: The sequence then progresses as follows: 1/2, 1/4, 3/4, 1/8, 5/8, and so on.

The Halton sequence extends this concept to multiple dimensions by employing a distinct base for each dimension. The Circle and Sphere sequences employ trigonometric functions to map the low-discrepancy sequences onto circular or spherical surfaces.

Furthermore, the library incorporates a set of utility functions and classes that facilitate the operation of these generators. To illustrate, a list of prime numbers may be employed as bases for the sequences.

Each generator class has methods for producing the next value in the sequence (pop()) and for resetting the sequence to a specific starting point (reseed()). This enables the generators to be employed in a variety of contexts in a flexible manner. The objective of this library is to provide a toolkit for the generation of sequences of numbers that are distributed in a well-balanced manner. These can be used in place of random numbers in many applications to achieve a more uniform coverage of a given space or surface. This can result in more efficient and accurate outcomes in tasks such as sampling, integration, and optimization.

🛠️ Installation

📦 Cargo

  • Install the rust toolchain in order to have cargo installed by following this guide.
  • run cargo install lds-rs

📜 License

Licensed under either of

at your option.

🤝 Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

See CONTRIBUTING.md.

No runtime deps