SymEngine::Sieve Class Reference

Data Structures

class  iterator
 

Static Public Member Functions

static void generate_primes (std::vector< unsigned > &primes, unsigned limit)
 
static void clear ()
 
static void set_sieve_size (unsigned size)
 
static void set_clear (bool clear)
 

Static Private Member Functions

static void _extend (unsigned limit)
 

Static Private Attributes

static unsigned _sieve_size = 32 * 1024 * 8
 
static bool _clear = true
 

Detailed Description

Definition at line 19 of file prime_sieve.h.

Member Function Documentation

◆ generate_primes()

void SymEngine::Sieve::generate_primes ( std::vector< unsigned > &  primes,
unsigned  limit 
)
static
Parameters
primesholds all primes up to the limit (including).

Definition at line 91 of file prime_sieve.cpp.

92 {
93  _extend(limit);
94  std::vector<unsigned> &_primes = sieve_primes();
95  auto it = std::upper_bound(_primes.begin(), _primes.end(), limit);
96  // find the first position greater than limit and reserve space for the
97  // primes
98  primes.reserve(it - _primes.begin());
99  std::copy(_primes.begin(), it, std::back_inserter(primes));
100  if (_clear)
101  clear();
102 }
T back_inserter(T... args)
T begin(T... args)
T copy(T... args)
T end(T... args)
T reserve(T... args)
T upper_bound(T... args)

The documentation for this class was generated from the following files: