concurrent_prime_sieve (v 0.2.2)
Tools for generating filters and collections with primes concurrently.
Rust implementation of the Sieve of Atkin.
This implementation runs in O(sqrt(max_num) + max_num - min_num), thus it is asymptotically faster than the Sieve of Eratosthenes for finding primes in fixed-sized sections. (fixed-sized section runtime = O(sqrt(max_num))
Therefore, this implementation will run faster than any implementation of the Sieve of Eratosthenes with the same number of cores for a large enough number of cores, making it ideal for parallel processing.
concurrent_prime_sieve::filter
Generates a vector of bools of size max_num, with
true
at each prime index, andfalse
otherwise.The number of threads is based on the number of virtual cores detected.
Similar to
fn prime_filter
, but allows for a custom number of threads.
Similar to
fn prime_filter
, but does not spawn any new threads.
Similar to
fn prime_filter
, but just for numbers between min and max, returned in a vector of length max-min.
Similar to
fn prime_filter_section
, but allows for a custom number of threads.
Similar to
fn prime_filter_section
, but does not spawn any new threads.
concurrent_prime_sieve::collection
Generates a vector collection of primes strictly less than max_num.
The number of threads is based on the number of virtual cores detected.
Similar to
fn primes
, but allows for a custom number of threads.
Similar to
fn primes
, but does not spawn any new threads.
Generates a vector collection of primes between min_num and max_num.
The number of threads is based on the number of virtual cores detected.
Similar to
fn primes_section
, but allows for a custom number of threads.
Similar to
fn primes_section
, but does not spawn any new threads.