120 int i, Num, nRefs, nPairs = 0,
nTotal = 0, Counter[21] = {0};
121 Num = Hash_IntManEntryNum( pHash );
122 for ( i = 1; i <= Num; i++ )
124 nRefs = Abc_MinInt( 20, Hash_IntObjData2(pHash, i) );
127 nPairs += (nRefs > 1);
143 printf(
"Statistics for pairs appearing less than 20 times:\n" );
144 for ( i = 0; i < 21; i++ )
145 if ( Counter[i] > 0 )
146 printf(
"%3d : %7d %7.2f %%\n", i, Counter[i], 100.0 * Counter[i] * i / Abc_MaxInt(
nTotal, 1) );
147 printf(
"Pairs: Total = %8d Init = %8d %7.2f %% Final = %8d %7.2f %% Real = %8d %7.2f %%\n", nTotal0,
148 nPairs0, 100.0 * nPairs0 / Abc_MaxInt(nTotal0, 1),
149 nPairs, 100.0 * nPairs / Abc_MaxInt(nTotal0, 1),
150 nPairs1, 100.0 * nPairs1 / Abc_MaxInt(nTotal0, 1) );
156 Vec_Int_t * vPairs = Vec_IntAlloc( 1000 );
157 Vec_Int_t * vNum2Obj = Vec_IntStart( 1 );
159 int nTotal = 0, nPairs0 = 0, nPairs = 0;
160 int i, k, j, FanK, FanJ, Num, nRefs;
164 nTotal += Gia_ObjLutSize(
p->pGia, i) * (Gia_ObjLutSize(
p->pGia, i) - 1) / 2;
165 pObj = Gia_ManObj(
p->pGia, i );
167 Vec_IntClear(
p->vLeaves );
169 if ( Gia_ObjRefNumId(
p->pGia, Num) > 1 )
170 Vec_IntPush(
p->vLeaves, Num );
171 if ( Vec_IntSize(
p->vLeaves) < 2 )
173 nPairs0 += Vec_IntSize(
p->vLeaves) * (Vec_IntSize(
p->vLeaves) - 1) / 2;
180 Num = Hash_Int2ManInsert( pHash, FanK, FanJ, 0 );
181 nRefs = Hash_Int2ObjInc(pHash, Num);
184 assert( Num == Hash_IntManEntryNum(pHash) );
185 assert( Num == Vec_IntSize(vNum2Obj) );
186 Vec_IntPush( vNum2Obj, i );
191 assert( Num < Vec_IntSize(vNum2Obj) );
192 Vec_IntPush( vPairs, Vec_IntEntry(vNum2Obj, Num) );
193 Vec_IntPush( vPairs, FanK );
194 Vec_IntPush( vPairs, FanJ);
196 Vec_IntPush( vPairs, i );
197 Vec_IntPush( vPairs, FanK );
198 Vec_IntPush( vPairs, FanJ );
201 Vec_IntFree( vNum2Obj );
204 Hash_IntManStop( pHash );
210 Vec_Int_t * vNodes = Vec_IntAlloc( 1000 );
211 Vec_Str_t * vMarks = Vec_StrStart( nObjs );
int i;
212 for ( i = 0; i < Vec_IntSize(vPairs); i += 3 )
213 Vec_StrWriteEntry( vMarks, Vec_IntEntry(vPairs, i), 1 );
214 for ( i = 0; i < nObjs; i++ )
215 if ( Vec_StrEntry( vMarks, i ) )
216 Vec_IntPush( vNodes, i );
217 Vec_StrFree( vMarks );
218 printf(
"The number of used nodes = %d\n", Vec_IntSize(vNodes) );
225 int i, k, iObj, iNode;
227 vTruths = Vec_WrdAlloc( Vec_IntSize(
p->vUsed) );
228 vTruthsTemp = Vec_WrdStart( Gia_ManObjNum(
p->pGia) );
231 assert( Gia_ObjIsLut(
p->pGia, iObj) );
233 Vec_IntClear(
p->vLeaves );
235 Vec_IntPush(
p->vLeaves, iNode );
236 assert( Vec_IntSize(
p->vLeaves) <= 6 );
239 Vec_WrdPush( vTruths, uTruth );
243 Vec_WrdFreeP( &vTruthsTemp );
260 word uTruth;
int nNonUnique = 0;
261 int i, k, j, s, iObj, iNode, iUsed, FanK, FanJ, Res, Num, nRefs;
262 Vec_Int_t * vNum2Obj = Vec_IntStart( 1 );
263 Vec_Int_t * vPairs2 = Vec_IntAlloc( 1000 );
264 assert( Hash_IntManEntryNum(
p->pHash) == 0 );
265 for ( i = 0; i < Vec_IntSize(vPairs); i += 3 )
267 iObj = Vec_IntEntry( vPairs, i );
268 assert( Gia_ObjIsLut(
p->pGia, iObj) );
270 Vec_IntClear(
p->vLeaves );
272 Vec_IntPush(
p->vLeaves, iNode );
273 assert( Vec_IntSize(
p->vLeaves) <= 6 );
274 FanK = Vec_IntEntry(vPairs, i+1);
275 FanJ = Vec_IntEntry(vPairs, i+2);
276 k = Vec_IntFind(
p->vLeaves, FanK );
277 j = Vec_IntFind(
p->vLeaves, FanJ );
279 iUsed = Vec_IntEntry(
p->vId2Used, iObj );
280 uTruth = Vec_WrdEntry(
p->vTruths, iUsed );
281 Res = Abc_TtCheckDsdAnd( uTruth, k, j, NULL );
285 FanK = Abc_Var2Lit( FanK, ((Res >> 0) & 1) );
286 FanJ = Abc_Var2Lit( FanJ, ((Res >> 1) & 1) );
289 Num = Hash_Int2ManInsert(
p->pHash, FanK, FanJ, 0 );
290 nRefs = Hash_Int2ObjInc(
p->pHash, Num);
293 assert( Num == Hash_IntManEntryNum(
p->pHash) );
294 assert( Num == Vec_IntSize(vNum2Obj) );
295 Vec_IntPush( vNum2Obj, iObj );
300 assert( Num < Vec_IntSize(vNum2Obj) );
301 Vec_IntPush( vPairs2, Vec_IntEntry(vNum2Obj, Num) );
302 Vec_IntPush( vPairs2, FanK );
303 Vec_IntPush( vPairs2, FanJ );
306 Vec_IntPush( vPairs2, iObj );
307 Vec_IntPush( vPairs2, FanK );
308 Vec_IntPush( vPairs2, FanJ );
310 Vec_IntFree( vNum2Obj );
312 Unm_ManPrintPairStats(
p->pHash, Vec_IntSize(vPairs)/3, Hash_IntManEntryNum(
p->pHash), Vec_IntSize(vPairs2)/3, 1 );