25 #ifndef PAGMO_UTIL_DISCREPANCY_H
26 #define PAGMO_UTIL_DISCREPANCY_H
32 #include <boost/shared_ptr.hpp>
34 #include "../config.h"
35 #include "../exceptions.h"
38 namespace pagmo{
namespace util {
47 namespace discrepancy {
51 unsigned int prime (
int n );
52 unsigned int prime_ge (
unsigned int n );
53 class __PAGMO_VISIBLE project_2_simplex
56 project_2_simplex(
unsigned int dim) : m_dim(dim) {}
57 std::vector<double> operator()(std::vector<double> retval)
const;
65 typedef boost::shared_ptr<base>
base_ptr;
86 base(
unsigned int dim,
unsigned int count = 1) : m_dim(dim), m_count(count) {}
93 virtual std::vector<double> operator()() = 0;
101 virtual std::vector<double> operator()(
unsigned int n) = 0;
103 virtual base_ptr clone()
const = 0;
128 halton(
unsigned int dim,
unsigned int count = 1);
129 base_ptr clone()
const;
130 std::vector<double> operator()();
131 std::vector<double> operator()(
unsigned int n);
133 std::vector<unsigned int> m_primes;
148 faure(
unsigned int dim,
unsigned int count = 1);
149 base_ptr clone()
const;
150 std::vector<double> operator()();
151 std::vector<double> operator()(
unsigned int n);
153 int *binomial_table (
int qs,
int m,
int n );
154 void faure_orig (
unsigned int dim_num,
unsigned int *seed,
double quasi[] );
155 double *faure_generate (
int dim_num,
int n,
int skip );
156 int i4_log_i4 (
int i4,
int j4 );
157 int i4_min (
int i1,
int i2 );
158 int i4_power (
int i,
int j );
179 simplex(
unsigned int dim,
unsigned int count);
180 base_ptr clone()
const;
181 std::vector<double> operator()();
182 std::vector<double> operator()(
unsigned int n);
185 project_2_simplex m_projector;
201 sobol(
unsigned int dim,
unsigned int count);
202 base_ptr clone()
const;
203 std::vector<double> operator()();
204 std::vector<double> operator()(
unsigned int n);
206 int i8_bit_lo0 (
long long int n );
207 void i8_sobol (
unsigned int dim_num,
long long int *seed,
double quasi[ ] );
209 unsigned int m_dim_num_save;
211 long long int m_maxcol;
212 long long int m_seed_save;
214 long long int lastq[1111];
215 long long int poly[1111];
216 long long int v[1111][62];
233 lhs(
unsigned int dim,
unsigned int count);
234 base_ptr clone()
const;
235 std::vector<double> operator()();
236 std::vector<double> operator()(
unsigned int n);
238 std::vector<double> latin_random (
unsigned int dim_num,
unsigned int point_num);
239 unsigned int *perm_uniform (
unsigned int n);
242 std::vector<double> m_set;
Halton sequence projected on a simplex.
boost::shared_ptr< base > base_ptr
Smart pointer to the base discrepancy class.
Faure quasi-random point sequence.
base(unsigned int dim, unsigned int count=1)
Constructor.
unsigned int prime(int n)
Returns a prime number.
double van_der_corput(unsigned int n, unsigned int base)
Van Der Corput sequence.
Latin Hypercube Sampling.
unsigned int prime_ge(unsigned int n)
Returns the smallest prime greater than or equal to n.
unsigned int m_count
Starting point of the sequence (can be used to skip initial values)
Halton quasi-random point sequence.
Base low-discrepancy sequence class.
Sobol quasi-random point sequence.
unsigned int m_dim
Hypercube dimension where sampling with low-discrepancy.