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

  Synopsis    [Initializes the interaction matrix.]

  Description [Initializes the interaction matrix. The interaction
  matrix is implemented as a bit vector storing the upper triangle of
  the symmetric interaction matrix. The bit vector is kept in an array
  of long integers. The computation is based on a series of depth-first
  searches, one for each root of the DAG. Two flags are needed: The
  local visited flag uses the LSB of the then pointer. The global
  visited flag uses the LSB of the next pointer.
  Returns 1 if successful; 0 otherwise.]

  SideEffects [None]

  SeeAlso     []

******************************************************************************/
Function
Synopsis    [Initializes the interaction matrix.]

Description [Initializes the interaction matrix. The interaction
matrix is implemented as a bit vector storing the upper triangle of
the symmetric interaction matrix. The bit vector is kept in an array
of long integers. The computation is based on a series of depth-first
searches, one for each root of the DAG. Two flags are needed: The
local visited flag uses the LSB of the then pointer. The global
visited flag uses the LSB of the next pointer.
Returns 1 if successful; 0 otherwise.]




Function Synopsis [ Initializes the interaction matrix . ] Description [ Initializes the interaction matrix . The interaction matrix is implemented as a bit vector storing the upper triangle of the symmetric interaction matrix . The bit vector is kept in an array of long integers . The computation is based on a series of depth - first searches one for each root of the DAG . Two flags are needed : The local visited flag uses the LSB of the then pointer . The global visited flag uses the LSB of the next pointer . Returns 1 if successful ; 0 otherwise . ]
int
cuddInitInteract(
  DdManager * table)
{
    int i,j,k;
    ABC_UINT64_T words;
    long *interact;
    int *support;
    DdNode *f;
    DdNode *sentinel = &(table->sentinel);
    DdNodePtr *nodelist;
    int slots;
    int n = table->size;
    words = ((n * (n-1)) >> (1 + LOGBPL)) + 1;
    table->interact = interact = ABC_ALLOC(long,(unsigned)words);
    if (interact == NULL) {
        table->errorCode = CUDD_MEMORY_OUT;
        return(0);
    }
    for (i = 0; i < words; i++) {
        interact[i] = 0;
    }
    support = ABC_ALLOC(int,n);
    if (support == NULL) {
        table->errorCode = CUDD_MEMORY_OUT;
        ABC_FREE(interact);
        return(0);
    }
    for (i = 0; i < n; i++) {
        nodelist = table->subtables[i].nodelist;
        slots = table->subtables[i].slots;
        for (j = 0; j < slots; j++) {
            f = nodelist[j];
            while (f != sentinel) {
                if (!Cudd_IsComplement(f->next)) {
                    for (k = 0; k < n; k++) {
                        support[k] = 0;
                    }
                    ddSuppInteract(f,support);
                    ddClearLocal(f);
                    ddUpdateInteract(table,support);
                }
                f = Cudd_Regular(f->next);
            }
        }
    }
    ddClearGlobal(table);
    ABC_FREE(support);
    return(1);
}
int cuddInitInteract ( DdManager * table ) { int i , j , k ; ABC_UINT64_T words ; long * interact ; int * support ; DdNode * f ; DdNode * sentinel = & ( table -> sentinel ) ; DdNodePtr * nodelist ; int slots ; int n = table -> size ; words = ( ( n * ( n - 1 ) ) >> ( 1 + LOGBPL ) ) + 1 ; table -> interact = interact = ABC_ALLOC ( long , ( unsigned ) words ) ; if ( interact == NULL ) { table -> errorCode = CUDD_MEMORY_OUT ; return ( 0 ) ; } for ( i = 0 ; i < words ; i ++ ) { interact [ i ] = 0 ; } support = ABC_ALLOC ( int , n ) ; if ( support == NULL ) { table -> errorCode = CUDD_MEMORY_OUT ; ABC_FREE ( interact ) ; return ( 0 ) ; } for ( i = 0 ; i < n ; i ++ ) { nodelist = table -> subtables [ i ] . nodelist ; slots = table -> subtables [ i ] . slots ; for ( j = 0 ; j < slots ; j ++ ) { f = nodelist [ j ] ; while ( f != sentinel ) { if ( ! Cudd_IsComplement ( f -> next ) ) { for ( k = 0 ; k < n ; k ++ ) { support [ k ] = 0 ; } ddSuppInteract ( f , support ) ; ddClearLocal ( f ) ; ddUpdateInteract ( table , support ) ; } f = Cudd_Regular ( f -> next ) ; } } } ddClearGlobal ( table ) ; ABC_FREE ( support ) ; return ( 1 ) ; }
Function
Synopsis    [Initializes the interaction matrix.]
Function Synopsis [ Initializes the interaction matrix . ]
/* A node is a root of the DAG if it cannot be
                ** reached by nodes above it. If a node was never
                ** reached during the previous depth-first searches,
                ** then it is a root, and we start a new depth-first
                ** search from it.
                */