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

  Synopsis    [Checks two variables for aggregation.]

  Description [Checks two variables for aggregation. The check is based
  on the second difference of the number of nodes as a function of the
  layer. If the second difference is lower than a given threshold
  (typically negative) then the two variables should be aggregated.
  Returns 1 if the two variables pass the test; 0 otherwise.]

  SideEffects [None]

******************************************************************************/
Function
Synopsis    [Checks two variables for aggregation.]

Description [Checks two variables for aggregation. The check is based
on the second difference of the number of nodes as a function of the
layer. If the second difference is lower than a given threshold
(typically negative) then the two variables should be aggregated.
Returns 1 if the two variables pass the test; 0 otherwise.]


Function Synopsis [ Checks two variables for aggregation . ] Description [ Checks two variables for aggregation . The check is based on the second difference of the number of nodes as a function of the layer . If the second difference is lower than a given threshold ( typically negative ) then the two variables should be aggregated . Returns 1 if the two variables pass the test ; 0 otherwise . ]
static int
ddSecDiffCheck(
  DdManager * table,
  int  x,
  int  y)
{
    double Nx,Nx_1;
    double Sx;
    double threshold;
    int    xindex,yindex;
    if (x==0) return(0);
#ifdef DD_STATS
    secdiffcalls++;
#endif
    Nx = (double) table->subtables[x].keys;
    Nx_1 = (double) table->subtables[x-1].keys;
    Sx = (table->subtables[y].keys/Nx) - (Nx/Nx_1);
    threshold = table->recomb / 100.0;
    if (Sx < threshold) {
        xindex = table->invperm[x];
        yindex = table->invperm[y];
        if (cuddTestInteract(table,xindex,yindex)) {
#if defined(DD_DEBUG) && defined(DD_VERBOSE)
            (void) fprintf(table->out,
                           "Second difference for %d = %g Pos(%d)\n",
                           table->invperm[x],Sx,x);
#endif
#ifdef DD_STATS
            secdiff++;
#endif
            return(1);
        } else {
#ifdef DD_STATS
            secdiffmisfire++;
#endif
            return(0);
        }
    }
    return(0);
}
static int ddSecDiffCheck ( DdManager * table , int x , int y ) { double Nx , Nx_1 ; double Sx ; double threshold ; int xindex , yindex ; if ( x == 0 ) return ( 0 ) ; #ifdef DD_STATS secdiffcalls ++ ; #endif Nx = ( double ) table -> subtables [ x ] . keys ; Nx_1 = ( double ) table -> subtables [ x - 1 ] . keys ; Sx = ( table -> subtables [ y ] . keys / Nx ) - ( Nx / Nx_1 ) ; threshold = table -> recomb / 100.0 ; if ( Sx < threshold ) { xindex = table -> invperm [ x ] ; yindex = table -> invperm [ y ] ; if ( cuddTestInteract ( table , xindex , yindex ) ) { #if defined ( DD_DEBUG ) && defined ( DD_VERBOSE ) ( void ) fprintf ( table -> out , " \n " , table -> invperm [ x ] , Sx , x ) ; #endif #ifdef DD_STATS secdiff ++ ; #endif return ( 1 ) ; } else { #ifdef DD_STATS secdiffmisfire ++ ; #endif return ( 0 ) ; } } return ( 0 ) ; }
Function
Synopsis    [Checks two variables for aggregation.]
Function Synopsis [ Checks two variables for aggregation . ]