#include <math.h>
#include "util.h"
#include "cuddInt.h"
Go to the source code of this file.
Functions | |
static int | cuddZddDagInt (DdNode *n, st_table *tab) |
int | Cudd_zddDagSize (DdNode *p_node) |
double | Cudd_zddCountMinterm (DdManager *zdd, DdNode *node, int path) |
void | Cudd_zddPrintSubtable (DdManager *table) |
Variables | |
static char rcsid[] | DD_UNUSED = "$Id: cuddZddMisc.c,v 1.17 2009/03/08 02:49:02 fabio Exp $" |
Function********************************************************************
Synopsis [Counts the number of minterms of a ZDD.]
Description [Counts the number of minterms of the ZDD rooted at node
. This procedure takes a parameter path
that specifies how many variables are in the support of the function. If the procedure runs out of memory, it returns (double) CUDD_OUT_OF_MEM.]
SideEffects [None]
SeeAlso [Cudd_zddCountDouble]
Definition at line 154 of file cuddZddMisc.c.
00158 { 00159 double dc_var, minterms; 00160 00161 dc_var = (double)((double)(zdd->sizeZ) - (double)path); 00162 minterms = Cudd_zddCountDouble(zdd, node) / pow(2.0, dc_var); 00163 return(minterms); 00164 00165 } /* end of Cudd_zddCountMinterm */
int Cudd_zddDagSize | ( | DdNode * | p_node | ) |
AutomaticEnd Function********************************************************************
Synopsis [Counts the number of nodes in a ZDD.]
Description [Counts the number of nodes in a ZDD. This function duplicates Cudd_DagSize and is only retained for compatibility.]
SideEffects [None]
SeeAlso [Cudd_DagSize]
Definition at line 123 of file cuddZddMisc.c.
00125 { 00126 00127 int i; 00128 st_table *table; 00129 00130 table = st_init_table(st_ptrcmp, st_ptrhash); 00131 i = cuddZddDagInt(p_node, table); 00132 st_free_table(table); 00133 return(i); 00134 00135 } /* end of Cudd_zddDagSize */
void Cudd_zddPrintSubtable | ( | DdManager * | table | ) |
Function********************************************************************
Synopsis [Prints the ZDD table.]
Description [Prints the ZDD table for debugging purposes.]
SideEffects [None]
SeeAlso []
Definition at line 180 of file cuddZddMisc.c.
00182 { 00183 int i, j; 00184 DdNode *z1, *z1_next, *base; 00185 DdSubtable *ZSubTable; 00186 00187 base = table->one; 00188 for (i = table->sizeZ - 1; i >= 0; i--) { 00189 ZSubTable = &(table->subtableZ[i]); 00190 printf("subtable[%d]:\n", i); 00191 for (j = ZSubTable->slots - 1; j >= 0; j--) { 00192 z1 = ZSubTable->nodelist[j]; 00193 while (z1 != NIL(DdNode)) { 00194 (void) fprintf(table->out, 00195 #if SIZEOF_VOID_P == 8 00196 "ID = 0x%lx\tindex = %u\tr = %u\t", 00197 (ptruint) z1 / (ptruint) sizeof(DdNode), 00198 z1->index, z1->ref); 00199 #else 00200 "ID = 0x%x\tindex = %hu\tr = %hu\t", 00201 (ptruint) z1 / (ptruint) sizeof(DdNode), 00202 z1->index, z1->ref); 00203 #endif 00204 z1_next = cuddT(z1); 00205 if (Cudd_IsConstant(z1_next)) { 00206 (void) fprintf(table->out, "T = %d\t\t", 00207 (z1_next == base)); 00208 } 00209 else { 00210 #if SIZEOF_VOID_P == 8 00211 (void) fprintf(table->out, "T = 0x%lx\t", 00212 (ptruint) z1_next / (ptruint) sizeof(DdNode)); 00213 #else 00214 (void) fprintf(table->out, "T = 0x%x\t", 00215 (ptruint) z1_next / (ptruint) sizeof(DdNode)); 00216 #endif 00217 } 00218 z1_next = cuddE(z1); 00219 if (Cudd_IsConstant(z1_next)) { 00220 (void) fprintf(table->out, "E = %d\n", 00221 (z1_next == base)); 00222 } 00223 else { 00224 #if SIZEOF_VOID_P == 8 00225 (void) fprintf(table->out, "E = 0x%lx\n", 00226 (ptruint) z1_next / (ptruint) sizeof(DdNode)); 00227 #else 00228 (void) fprintf(table->out, "E = 0x%x\n", 00229 (ptruint) z1_next / (ptruint) sizeof(DdNode)); 00230 #endif 00231 } 00232 00233 z1_next = z1->next; 00234 z1 = z1_next; 00235 } 00236 } 00237 } 00238 putchar('\n'); 00239 00240 } /* Cudd_zddPrintSubtable */
AutomaticStart
Function********************************************************************
Synopsis [Performs the recursive step of Cudd_zddDagSize.]
Description [Performs the recursive step of Cudd_zddDagSize. Does not check for out-of-memory conditions.]
SideEffects [None]
SeeAlso []
Definition at line 261 of file cuddZddMisc.c.
00264 { 00265 if (n == NIL(DdNode)) 00266 return(0); 00267 00268 if (st_is_member(tab, (char *)n) == 1) 00269 return(0); 00270 00271 if (Cudd_IsConstant(n)) 00272 return(0); 00273 00274 (void)st_insert(tab, (char *)n, NIL(char)); 00275 return(1 + cuddZddDagInt(cuddT(n), tab) + 00276 cuddZddDagInt(cuddE(n), tab)); 00277 00278 } /* cuddZddDagInt */
char rcsid [] DD_UNUSED = "$Id: cuddZddMisc.c,v 1.17 2009/03/08 02:49:02 fabio Exp $" [static] |
CFile***********************************************************************
FileName [cuddZddMisc.c]
PackageName [cudd]
Synopsis [Miscellaneous utility functions for ZDDs.]
Description [External procedures included in this module:
Internal procedures included in this module:
procedures included in this module:
]
SeeAlso []
Author [Hyong-Kyoon Shin, In-Ho Moon]
Copyright [Copyright (c) 1995-2004, Regents of the University of Colorado
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of the University of Colorado nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.]
Definition at line 86 of file cuddZddMisc.c.