Computation


Data Structures

struct  output_t
 Output. More...
struct  bounds_t
 Bounds for values. More...

Defines

#define DEF_CALCULATE_STATISTICS(suffix, representation)
 A macro for constructing calculate_statistics_normal and calculate_statistics_hapax.

Functions

static void prepare_slots (input_t *restrict pinput, output_t *restrict poutput)
 Prepare output_t::slot_threshold.
static void next_permutation (builtin_rng_state_t *restrict rng_state, const input_t *pinput, unsigned *restrict sample_order)
 Construct the next permutation in sample_order, based on the user's choice on how to compute the permutations.
static void calculate_bounds_normal (const input_t *pinput, unsigned sample, word_t *restrict accum, unsigned *restrict p_accum_types, bounds_t *restrict pb_sample)
 Process the sample number sample. Update type accumulation vector accum and type accumulation count in p_accum_types. Calculate type accumulation bounds for this sample and store the result in pb_sample.
static void calculate_bounds_hapax (const input_t *pinput, unsigned sample, zom_t *restrict accum, unsigned *restrict p_accum_hapaxes, bounds_t *restrict pb_sample)
 Process the sample number sample. Update hapax accumulation vector accum and hapax accumulation count in p_accum_hapaxes. Calculate hapax accumulation bounds for this sample and store the result in pb_sample.
static void update_bounds_normal (bounds_t *restrict pb_this_gap, const bounds_t *pb_sample)
 Use the bounds for this sample in pb_sample and use it to update the bounds for this gap in pg_this_gap.
static void update_bounds_hapax (bounds_t *restrict pb_this_gap, const bounds_t *pb_sample)
 Use the bounds for this sample in pb_sample and use it to update the bounds for this gap in pg_this_gap.
static void record (unsigned slots, const output_t *poutput, bounds_t b_slot, unsigned current_slot)
 Store new per-slot bounds.
static void record_normal (unsigned slots, const output_t *poutput, bounds_t b_prev_gap, bounds_t b_this_gap, unsigned current_slot)
 Store new per-slot bounds based on per-gap bounds.
static void record_hapax (unsigned slots, const output_t *poutput, bounds_t b_prev_gap, bounds_t b_this_gap, unsigned current_slot)
 Store new per-slot bounds based on per-gap bounds.
static void calculate_statistics_normal (const input_t *restrict pinput, const output_t *poutput)
 Calculate the bounds for type accumulation.
static void calculate_statistics_hapax (const input_t *restrict pinput, const output_t *poutput)
 Calculate the bounds for hapax accumulation.
static void calculate_statistics (const input_t *pinput, output_t *restrict poutput)
 Calculate the bounds for type or hapax accumulation.
static void free_output (const output_t *poutput)
 Frees the memory allocated for the fields of output_t.


Define Documentation

#define DEF_CALCULATE_STATISTICS ( suffix,
representation   ) 

A macro for constructing calculate_statistics_normal and calculate_statistics_hapax.

Definition at line 922 of file types.c.


Function Documentation

static void calculate_bounds_hapax ( const input_t pinput,
unsigned  sample,
zom_t *restrict  accum,
unsigned *restrict  p_accum_hapaxes,
bounds_t *restrict  pb_sample 
) [inline, static]

Process the sample number sample. Update hapax accumulation vector accum and hapax accumulation count in p_accum_hapaxes. Calculate hapax accumulation bounds for this sample and store the result in pb_sample.

Definition at line 833 of file types.c.

References zom_t::at_least_1, bitcount(), input_t::incidencezom, input_t::type_words, zom_add(), and zom_exactly_1().

static void calculate_bounds_normal ( const input_t pinput,
unsigned  sample,
word_t *restrict  accum,
unsigned *restrict  p_accum_types,
bounds_t *restrict  pb_sample 
) [inline, static]

Process the sample number sample. Update type accumulation vector accum and type accumulation count in p_accum_types. Calculate type accumulation bounds for this sample and store the result in pb_sample.

Definition at line 814 of file types.c.

References bitcount(), input_t::incidenceb, and input_t::type_words.

static void calculate_statistics ( const input_t pinput,
output_t *restrict  poutput 
) [static]

Calculate the bounds for type or hapax accumulation.

Definition at line 976 of file types.c.

References calculate_statistics_hapax(), calculate_statistics_normal(), and MYMALLOC2Z.

Referenced by main().

static void calculate_statistics_hapax ( const input_t *restrict  pinput,
const output_t poutput 
) [static]

Calculate the bounds for hapax accumulation.

Definition at line 972 of file types.c.

Referenced by calculate_statistics().

static void calculate_statistics_normal ( const input_t *restrict  pinput,
const output_t poutput 
) [static]

Calculate the bounds for type accumulation.

Definition at line 969 of file types.c.

Referenced by calculate_statistics().

static void free_output ( const output_t poutput  )  [static]

Frees the memory allocated for the fields of output_t.

Definition at line 990 of file types.c.

References output_t::lower_bound, output_t::slot_threshold, and output_t::upper_bound.

Referenced by main().

static void next_permutation ( builtin_rng_state_t *restrict  rng_state,
const input_t pinput,
unsigned *restrict  sample_order 
) [inline, static]

Construct the next permutation in sample_order, based on the user's choice on how to compute the permutations.

Definition at line 801 of file types.c.

References input_t::builtin_rng, builtin_rng_permutation(), identity_permutation(), input_t::nonrandom, input_t::nsample, and rand_permutation().

static void prepare_slots ( input_t *restrict  pinput,
output_t *restrict  poutput 
) [static]

Prepare output_t::slot_threshold.

Also computes input_t::slots if needed.

Definition at line 779 of file types.c.

References MYMALLOC.

Referenced by main().

static void record ( unsigned  slots,
const output_t poutput,
bounds_t  b_slot,
unsigned  current_slot 
) [inline, static]

Store new per-slot bounds.

Definition at line 887 of file types.c.

References bounds_t::lower, output_t::lower_bound, bounds_t::upper, and output_t::upper_bound.

Referenced by record_hapax(), and record_normal().

static void record_hapax ( unsigned  slots,
const output_t poutput,
bounds_t  b_prev_gap,
bounds_t  b_this_gap,
unsigned  current_slot 
) [inline, static]

Store new per-slot bounds based on per-gap bounds.

This function assumes that we are counting hapaxes. Cf. record_normal.

Definition at line 911 of file types.c.

References bounds_t::lower, MAX, MIN, record(), and bounds_t::upper.

static void record_normal ( unsigned  slots,
const output_t poutput,
bounds_t  b_prev_gap,
bounds_t  b_this_gap,
unsigned  current_slot 
) [inline, static]

Store new per-slot bounds based on per-gap bounds.

For example, if output_t::slot_threshold is 0, 10, 20, etc., and current_slot is 2, then b_prev_gap is the bounds for the gap 10..20, b_this_gap is the bounds for the gap 20..30 and we update the bounds for the slot 20. This function assumes that we are counting types. Cf. record_hapax.

Definition at line 896 of file types.c.

References bounds_t::lower, record(), and bounds_t::upper.

static void update_bounds_hapax ( bounds_t *restrict  pb_this_gap,
const bounds_t pb_sample 
) [inline, static]

Use the bounds for this sample in pb_sample and use it to update the bounds for this gap in pg_this_gap.

This function assumes that we are counting hapaxes. Cf. update_bounds_normal.

Definition at line 879 of file types.c.

References bounds_t::lower, MAX, MIN, and bounds_t::upper.

static void update_bounds_normal ( bounds_t *restrict  pb_this_gap,
const bounds_t pb_sample 
) [inline, static]

Use the bounds for this sample in pb_sample and use it to update the bounds for this gap in pg_this_gap.

This function assumes that we are counting types. Cf. update_bounds_hapax.

Definition at line 867 of file types.c.

References bounds_t::lower, and bounds_t::upper.