54 return Min(bs->
n, bs->
N);
60 return (bs->
t < bs->
N) && (bs->
m < bs->
n);
67 int k = bs->
n - bs->
m;
102 p = 1.0 - (double) k / (
double)
K;
110 p *= 1.0 - (double) k / (
double)
K;
162 quot = (t - (double) n) / t;
168 quot *= (t - (double) n) / t;
175 double term = t - (double) n + 1;
194 tmp = (t + 1) / term;
195 lhs = exp(log(((U * tmp * tmp) * (term +
S)) / (t + X)) / n);
196 rhs = (((t + X) / (term +
S)) * term) / t;
203 y = (((U * (t + 1)) / term) * (t +
S + 1)) / (t + X);
207 numer_lim = term +
S;
211 denom = t - (double) n +
S;
214 for (numer = t +
S; numer >= numer_lim; numer -= 1)
220 if (exp(log(
y) / n) <= (t + X) / t)
#define Assert(condition)
static void PGresult * res
double pg_prng_double(pg_prng_state *state)
uint32 pg_prng_uint32(pg_prng_state *state)
void pg_prng_seed(pg_prng_state *state, uint64 seed)
pg_prng_state pg_global_prng_state
static ReservoirStateData oldrs
static bool oldrs_initialized
BlockNumber BlockSampler_Init(BlockSampler bs, BlockNumber nblocks, int samplesize, uint32 randseed)
void reservoir_init_selection_state(ReservoirState rs, int n)
double anl_get_next_S(double t, int n, double *stateptr)
double sampler_random_fract(pg_prng_state *randstate)
bool BlockSampler_HasMore(BlockSampler bs)
BlockNumber BlockSampler_Next(BlockSampler bs)
double anl_init_selection_state(int n)
void sampler_random_init_state(uint32 seed, pg_prng_state *randstate)
double anl_random_fract(void)
double reservoir_get_next_S(ReservoirState rs, double t, int n)