abc/src/bdd/cudd/cuddAPI.c
/**Function********************************************************************

  Synopsis    [Computes the expected fraction of used slots in the unique
  table.]

  Description [Computes the fraction of slots in the unique table that
  should be in use. This expected value is based on the assumption
  that the hash function distributes the keys randomly; it can be
  compared with the result of Cudd_ReadUsedSlots to monitor the
  performance of the unique table hash function.]

  SideEffects [None]

  SeeAlso     [Cudd_ReadSlots Cudd_ReadUsedSlots]

******************************************************************************/
Function
Synopsis    [Computes the expected fraction of used slots in the unique
table.]

Description [Computes the fraction of slots in the unique table that
should be in use. This expected value is based on the assumption
that the hash function distributes the keys randomly; it can be
compared with the result of Cudd_ReadUsedSlots to monitor the
performance of the unique table hash function.]




Function Synopsis [ Computes the expected fraction of used slots in the unique table . ] Description [ Computes the fraction of slots in the unique table that should be in use . This expected value is based on the assumption that the hash function distributes the keys randomly ; it can be compared with the result of Cudd_ReadUsedSlots to monitor the performance of the unique table hash function . ]
double
Cudd_ExpectedUsedSlots(
  DdManager * dd)
{
    int i;
    int size = dd->size;
    DdSubtable *subtable;
    double empty = 0.0;
    for (i = 0; i < size; i++) {
        subtable = &(dd->subtables[i]);
        empty += (double) subtable->slots *
            exp(-(double) subtable->keys / (double) subtable->slots);
    }
    size = dd->sizeZ;
    for (i = 0; i < size; i++) {
        subtable = &(dd->subtableZ[i]);
        empty += (double) subtable->slots *
            exp(-(double) subtable->keys / (double) subtable->slots);
    }
    subtable = &(dd->constants);
    empty += (double) subtable->slots *
        exp(-(double) subtable->keys / (double) subtable->slots);
    return(1.0 - empty / (double) dd->slots);
}
double Cudd_ExpectedUsedSlots ( DdManager * dd ) { int i ; int size = dd -> size ; DdSubtable * subtable ; double empty = 0.0 ; for ( i = 0 ; i < size ; i ++ ) { subtable = & ( dd -> subtables [ i ] ) ; empty += ( double ) subtable -> slots * exp ( - ( double ) subtable -> keys / ( double ) subtable -> slots ) ; } size = dd -> sizeZ ; for ( i = 0 ; i < size ; i ++ ) { subtable = & ( dd -> subtableZ [ i ] ) ; empty += ( double ) subtable -> slots * exp ( - ( double ) subtable -> keys / ( double ) subtable -> slots ) ; } subtable = & ( dd -> constants ) ; empty += ( double ) subtable -> slots * exp ( - ( double ) subtable -> keys / ( double ) subtable -> slots ) ; return ( 1.0 - empty / ( double ) dd -> slots ) ; }
Function
Synopsis    [Computes the expected fraction of used slots in the unique
table.]
Function Synopsis [ Computes the expected fraction of used slots in the unique table . ]
/* To each subtable we apply the corollary to Theorem 8.5 (occupancy
    ** distribution) from Sedgewick and Flajolet's Analysis of Algorithms.
    ** The corollary says that for a table with M buckets and a load ratio
    ** of r, the expected number of empty buckets is asymptotically given
    ** by M * exp(-r).
    */ /* Scan each BDD/ADD subtable. */ /* Scan the ZDD subtables. */ /* Constant table. */