precomp.c File Reference

#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include "precomp.h"

Include dependency graph for precomp.c:

Go to the source code of this file.

Data Structures

struct  tnode
struct  lnode

Defines

#define INFINITY   (1.0 / 0.0)
#define EPSILON   (1.0 / (1UL << PREC_INTER))
#define ABOVE_MIN(len, delta, z)   ((len) + PREC_INTER - log2(delta) + (z) + EPSILON >= min)
#define MIN(x, y)   ((x < y) ? x : y)

Typedefs

typedef struct tnodetree_t
typedef struct lnodelist_t

Functions

list_t list_alloc (tree_t a, list_t s)
tree_t leaf_alloc (int m, int t)
tree_t tree_alloc (int m, int t, tree_t *s)
int l2 (unsigned long x)
int is_leaf (int m, int t)
double bino_d (int a, int b)
double binomial_d (int a, int b)
double log_bino_d (int a, int b)
double log_binomial_d (int a, int b)
double dicho_si_lb_node (int i, distrib_t d)
double dicho_si_lb_leaf (int m, int t, int l)
void dicho_si_lb_rec (int m, int t, precomp_t p, double **pe)
double ** dicho_si_lb (precomp_t p)
double dicho_si_node (int i, distrib_t d)
double dicho_si_leaf (int m, int t, int l)
void dicho_si_rec (int m, int t, precomp_t p, double **pe)
double ** dicho_si (precomp_t p)
double * dicho_self_info_bounds (precomp_t p)
unsigned long update_delta (int i, distrib_t d, unsigned long delta)
unsigned long adjust_delta (unsigned long delta, int *l)
double dicho_si_from_list (list_t l, unsigned long delta, int len, double z, precomp_t p)
double tree_search (tree_t a, list_t path, list_t todo, unsigned long delta, int len, double z, precomp_t p)
tree_t dicho_build_tree (int m, int t, precomp_t p)
void clear_tree (tree_t a, precomp_t p)
double dicho_searchmin (precomp_t p, double min_value)
distrib_t init_proba (int m, int t, int i)
leaf_info_t leaf_info (int m, int t)
double max_si_loss (int m, int t, distrib_t d)
void distrib_clear (distrib_t dist)
precomp_t precomp_build (int m, int t, int reduc)
void write_precomp (precomp_t p, FILE *output_stream)
void clear_precomp (precomp_t p)

Variables

double ** si_lb
double min = 0


Define Documentation

#define ABOVE_MIN ( len,
delta,
 )     ((len) + PREC_INTER - log2(delta) + (z) + EPSILON >= min)

Definition at line 334 of file precomp.c.

Referenced by dicho_si_from_list(), and tree_search().

#define EPSILON   (1.0 / (1UL << PREC_INTER))

Definition at line 294 of file precomp.c.

Referenced by dicho_self_info_bounds().

#define INFINITY   (1.0 / 0.0)

Definition at line 27 of file precomp.c.

Referenced by dicho_si_from_list(), log_binomial_d(), and tree_search().

#define MIN ( x,
 )     ((x < y) ? x : y)


Typedef Documentation

typedef struct lnode * list_t

typedef struct tnode * tree_t


Function Documentation

unsigned long adjust_delta ( unsigned long  delta,
int *  l 
)

Definition at line 329 of file precomp.c.

References l2(), and PREC_INTER.

Referenced by dicho_si_from_list(), and tree_search().

Here is the call graph for this function:

double bino_d ( int  a,
int  b 
)

Definition at line 119 of file precomp.c.

Referenced by binomial_d().

double binomial_d ( int  a,
int  b 
)

Definition at line 125 of file precomp.c.

References bino_d().

Referenced by dicho_si_from_list(), dicho_si_lb_leaf(), dicho_si_leaf(), init_proba(), leaf_info(), and max_si_loss().

Here is the call graph for this function:

void clear_precomp ( precomp_t  p  ) 

Definition at line 727 of file precomp.c.

References precomp::distrib, distrib_clear(), is_leaf(), precomp::m, distrib_t::max, MIN, precomp::offset, and precomp::t.

Referenced by main().

Here is the call graph for this function:

void clear_tree ( tree_t  a,
precomp_t  p 
)

Definition at line 446 of file precomp.c.

References tnode::m, distrib_t::max, distrib_t::min, precomp_get_distrib, tnode::sons, and tnode::t.

Referenced by dicho_searchmin().

tree_t dicho_build_tree ( int  m,
int  t,
precomp_t  p 
)

Definition at line 420 of file precomp.c.

References is_leaf(), leaf_alloc(), distrib_t::max, distrib_t::min, precomp_get_distrib, and tree_alloc().

Referenced by dicho_searchmin().

Here is the call graph for this function:

double dicho_searchmin ( precomp_t  p,
double  min_value 
)

Definition at line 459 of file precomp.c.

References clear_tree(), dicho_build_tree(), dicho_si_lb(), precomp::m, min, PREC_INTER, precomp::real_m, precomp::real_t, si_lb, precomp::t, and tree_search().

Referenced by main().

Here is the call graph for this function:

double* dicho_self_info_bounds ( precomp_t  p  ) 

Definition at line 296 of file precomp.c.

References dicho_si(), dicho_si_lb(), EPSILON, precomp::m, precomp::real_m, precomp::real_t, si_lb, and precomp::t.

Referenced by main().

Here is the call graph for this function:

double** dicho_si ( precomp_t  p  ) 

Definition at line 274 of file precomp.c.

References dicho_si_rec(), precomp::m, and precomp::t.

Referenced by dicho_self_info_bounds().

Here is the call graph for this function:

double dicho_si_from_list ( list_t  l,
unsigned long  delta,
int  len,
double  z,
precomp_t  p 
)

Definition at line 336 of file precomp.c.

References ABOVE_MIN, adjust_delta(), binomial_d(), leaf_info_t::deadbits, INFINITY, precomp::leaf_info, tnode::m, min, lnode::next, PREC_INTER, si_lb, tnode::t, and lnode::tree.

Referenced by tree_search().

Here is the call graph for this function:

double** dicho_si_lb ( precomp_t  p  ) 

Definition at line 208 of file precomp.c.

References dicho_si_lb_rec(), precomp::m, and precomp::t.

Referenced by dicho_searchmin(), and dicho_self_info_bounds().

Here is the call graph for this function:

double dicho_si_lb_leaf ( int  m,
int  t,
int  l 
)

Definition at line 167 of file precomp.c.

References binomial_d(), and PREC_INTER.

Referenced by dicho_si_lb_rec().

Here is the call graph for this function:

double dicho_si_lb_node ( int  i,
distrib_t  d 
)

Definition at line 154 of file precomp.c.

References distrib_get_proba, distrib_t::max, PREC_INTER, and PREC_PROBA.

Referenced by dicho_si_lb_rec(), and max_si_loss().

void dicho_si_lb_rec ( int  m,
int  t,
precomp_t  p,
double **  pe 
)

Definition at line 179 of file precomp.c.

References leaf_info_t::deadbits, dicho_si_lb_leaf(), dicho_si_lb_node(), is_leaf(), precomp::leaf_info, distrib_t::max, distrib_t::min, and precomp_get_distrib.

Referenced by dicho_si_lb(), and dicho_si_rec().

Here is the call graph for this function:

double dicho_si_leaf ( int  m,
int  t,
int  l 
)

Definition at line 239 of file precomp.c.

References binomial_d().

Referenced by dicho_si_rec().

Here is the call graph for this function:

double dicho_si_node ( int  i,
distrib_t  d 
)

Definition at line 226 of file precomp.c.

References distrib_get_proba, distrib_t::max, and PREC_PROBA.

Referenced by dicho_si_rec().

void dicho_si_rec ( int  m,
int  t,
precomp_t  p,
double **  pe 
)

Definition at line 247 of file precomp.c.

References leaf_info_t::deadbits, dicho_si_lb_rec(), dicho_si_leaf(), dicho_si_node(), is_leaf(), precomp::leaf_info, distrib_t::max, distrib_t::min, and precomp_get_distrib.

Referenced by dicho_si().

Here is the call graph for this function:

void distrib_clear ( distrib_t  dist  ) 

Definition at line 544 of file precomp.c.

References distrib_t::prob.

Referenced by clear_precomp(), and precomp_build().

distrib_t init_proba ( int  m,
int  t,
int  i 
)

Definition at line 475 of file precomp.c.

References binomial_d(), distrib_get_proba, distrib_t::max, distrib_t::min, PREC_PROBA, distrib_t::prob, and round().

Referenced by precomp_build().

Here is the call graph for this function:

int is_leaf ( int  m,
int  t 
)

Definition at line 107 of file precomp.c.

int l2 ( unsigned long  x  ) 

Definition at line 63 of file precomp.c.

tree_t leaf_alloc ( int  m,
int  t 
)

Definition at line 47 of file precomp.c.

References tnode::m, tnode::sons, and tnode::t.

Referenced by dicho_build_tree().

leaf_info_t leaf_info ( int  m,
int  t 
)

Definition at line 499 of file precomp.c.

References binomial_d(), leaf_info_t::deadbits, l2(), leaf_info_t::maximum, PREC_INTER, and PREC_PROBA.

Referenced by precomp_build().

Here is the call graph for this function:

list_t list_alloc ( tree_t  a,
list_t  s 
)

Definition at line 40 of file precomp.c.

References lnode::next, and lnode::tree.

Referenced by tree_search().

double log_bino_d ( int  a,
int  b 
)

Definition at line 133 of file precomp.c.

Referenced by log_binomial_d().

double log_binomial_d ( int  a,
int  b 
)

Definition at line 139 of file precomp.c.

References INFINITY, and log_bino_d().

Referenced by main().

Here is the call graph for this function:

double max_si_loss ( int  m,
int  t,
distrib_t  d 
)

Definition at line 528 of file precomp.c.

References binomial_d(), dicho_si_lb_node(), distrib_t::max, and distrib_t::min.

Referenced by precomp_build().

Here is the call graph for this function:

precomp_t precomp_build ( int  m,
int  t,
int  reduc 
)

tree_t tree_alloc ( int  m,
int  t,
tree_t s 
)

Definition at line 55 of file precomp.c.

References tnode::m, tnode::sons, and tnode::t.

Referenced by dicho_build_tree().

double tree_search ( tree_t  a,
list_t  path,
list_t  todo,
unsigned long  delta,
int  len,
double  z,
precomp_t  p 
)

unsigned long update_delta ( int  i,
distrib_t  d,
unsigned long  delta 
)

Definition at line 320 of file precomp.c.

References distrib_get_proba, distrib_t::max, and PREC_PROBA.

Referenced by tree_search().

void write_precomp ( precomp_t  p,
FILE *  output_stream 
)


Variable Documentation

double min = 0

Definition at line 289 of file precomp.c.

Referenced by best_wf(), dicho_searchmin(), dicho_si_from_list(), main(), workfactor(), and write_precomp().

double** si_lb


This work was partially suported by Europian Network of Excellence, ECRYPT; ECRYPT