#include "util.h"
#include "cuddInt.h"
Go to the source code of this file.
Functions | |
DdNode * | Cudd_addScalarInverse (DdManager *dd, DdNode *f, DdNode *epsilon) |
DdNode * | cuddAddScalarInverseRecur (DdManager *dd, DdNode *f, DdNode *epsilon) |
Variables | |
static char rcsid[] | DD_UNUSED = "$Id: cuddAddInv.c,v 1.9 2004/08/13 18:04:45 fabio Exp $" |
AutomaticStart AutomaticEnd Function********************************************************************
Synopsis [Computes the scalar inverse of an ADD.]
Description [Computes an n ADD where the discriminants are the multiplicative inverses of the corresponding discriminants of the argument ADD. Returns a pointer to the resulting ADD in case of success. Returns NULL if any discriminants smaller than epsilon is encountered.]
SideEffects [None]
Definition at line 116 of file cuddAddInv.c.
00120 { 00121 DdNode *res; 00122 00123 if (!cuddIsConstant(epsilon)) { 00124 (void) fprintf(dd->err,"Invalid epsilon\n"); 00125 return(NULL); 00126 } 00127 do { 00128 dd->reordered = 0; 00129 res = cuddAddScalarInverseRecur(dd,f,epsilon); 00130 } while (dd->reordered == 1); 00131 return(res); 00132 00133 } /* end of Cudd_addScalarInverse */
Function********************************************************************
Synopsis [Performs the recursive step of addScalarInverse.]
Description [Returns a pointer to the resulting ADD in case of success. Returns NULL if any discriminants smaller than epsilon is encountered.]
SideEffects [None]
Definition at line 152 of file cuddAddInv.c.
00156 { 00157 DdNode *t, *e, *res; 00158 CUDD_VALUE_TYPE value; 00159 00160 statLine(dd); 00161 if (cuddIsConstant(f)) { 00162 if (ddAbs(cuddV(f)) < cuddV(epsilon)) return(NULL); 00163 value = 1.0 / cuddV(f); 00164 res = cuddUniqueConst(dd,value); 00165 return(res); 00166 } 00167 00168 res = cuddCacheLookup2(dd,Cudd_addScalarInverse,f,epsilon); 00169 if (res != NULL) return(res); 00170 00171 t = cuddAddScalarInverseRecur(dd,cuddT(f),epsilon); 00172 if (t == NULL) return(NULL); 00173 cuddRef(t); 00174 00175 e = cuddAddScalarInverseRecur(dd,cuddE(f),epsilon); 00176 if (e == NULL) { 00177 Cudd_RecursiveDeref(dd, t); 00178 return(NULL); 00179 } 00180 cuddRef(e); 00181 00182 res = (t == e) ? t : cuddUniqueInter(dd,(int)f->index,t,e); 00183 if (res == NULL) { 00184 Cudd_RecursiveDeref(dd, t); 00185 Cudd_RecursiveDeref(dd, e); 00186 return(NULL); 00187 } 00188 cuddDeref(t); 00189 cuddDeref(e); 00190 00191 cuddCacheInsert2(dd,Cudd_addScalarInverse,f,epsilon,res); 00192 00193 return(res); 00194 00195 } /* end of cuddAddScalarInverseRecur */
char rcsid [] DD_UNUSED = "$Id: cuddAddInv.c,v 1.9 2004/08/13 18:04:45 fabio Exp $" [static] |
CFile***********************************************************************
FileName [cuddAddInv.c]
PackageName [cudd]
Synopsis [Function to compute the scalar inverse of an ADD.]
Description [External procedures included in this module:
Internal procedures included in this module:
]
Author [Fabio Somenzi]
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 78 of file cuddAddInv.c.