ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
fxuUpdate.c
Go to the documentation of this file.
1
18
19#include "fxuInt.h"
20
22
23
27
28static void Fxu_UpdateDoublePairs( Fxu_Matrix * p, Fxu_Double * pDouble, Fxu_Var * pVar );
29static void Fxu_UpdateMatrixDoubleCreateCubes( Fxu_Matrix * p, Fxu_Cube * pCube1, Fxu_Cube * pCube2, Fxu_Double * pDiv );
30static void Fxu_UpdateMatrixDoubleClean( Fxu_Matrix * p, Fxu_Cube * pCubeUse, Fxu_Cube * pCubeRem );
31static void Fxu_UpdateMatrixSingleClean( Fxu_Matrix * p, Fxu_Var * pVar1, Fxu_Var * pVar2, Fxu_Var * pVarNew );
32
33static void Fxu_UpdateCreateNewVars( Fxu_Matrix * p, Fxu_Var ** ppVarC, Fxu_Var ** ppVarD, int nCubes );
34static int Fxu_UpdatePairCompare( Fxu_Pair ** ppP1, Fxu_Pair ** ppP2 );
35static void Fxu_UpdatePairsSort( Fxu_Matrix * p, Fxu_Double * pDouble );
36
37static void Fxu_UpdateCleanOldDoubles( Fxu_Matrix * p, Fxu_Double * pDiv, Fxu_Cube * pCube );
38static void Fxu_UpdateAddNewDoubles( Fxu_Matrix * p, Fxu_Cube * pCube );
39static void Fxu_UpdateCleanOldSingles( Fxu_Matrix * p );
40static void Fxu_UpdateAddNewSingles( Fxu_Matrix * p, Fxu_Var * pVar );
41
45
57void Fxu_Update( Fxu_Matrix * p, Fxu_Single * pSingle, Fxu_Double * pDouble )
58{
59 Fxu_Cube * pCube, * pCubeNew;
60 Fxu_Var * pVarC, * pVarD;
61 Fxu_Var * pVar1, * pVar2;
62
63 // consider trivial cases
64 if ( pSingle == NULL )
65 {
66 assert( pDouble->Weight == Fxu_HeapDoubleReadMaxWeight( p->pHeapDouble ) );
68 return;
69 }
70 if ( pDouble == NULL )
71 {
72 assert( pSingle->Weight == Fxu_HeapSingleReadMaxWeight( p->pHeapSingle ) );
74 return;
75 }
76
77 // get the variables of the single
78 pVar1 = pSingle->pVar1;
79 pVar2 = pSingle->pVar2;
80
81 // remove the best double from the heap
82 Fxu_HeapDoubleDelete( p->pHeapDouble, pDouble );
83 // remove the best divisor from the table
84 Fxu_ListTableDelDivisor( p, pDouble );
85
86 // create two new columns (vars)
87 Fxu_UpdateCreateNewVars( p, &pVarC, &pVarD, 1 );
88 // create one new row (cube)
89 pCubeNew = Fxu_MatrixAddCube( p, pVarD, 0 );
90 pCubeNew->pFirst = pCubeNew;
91 // set the first cube of the positive var
92 pVarD->pFirst = pCubeNew;
93
94 // start collecting the affected vars and cubes
97 // add the vars
98 Fxu_MatrixRingVarsAdd( p, pVar1 );
99 Fxu_MatrixRingVarsAdd( p, pVar2 );
100 // remove the literals and collect the affected cubes
101 // remove the divisors associated with this cube
102 // add to the affected cube the literal corresponding to the new column
103 Fxu_UpdateMatrixSingleClean( p, pVar1, pVar2, pVarD );
104 // replace each two cubes of the pair by one new cube
105 // the new cube contains the base and the new literal
106 Fxu_UpdateDoublePairs( p, pDouble, pVarC );
107 // stop collecting the affected vars and cubes
110
111 // add the literals to the new cube
112 assert( pVar1->iVar < pVar2->iVar );
113 assert( Fxu_SingleCountCoincidence( p, pVar1, pVar2 ) == 0 );
114 Fxu_MatrixAddLiteral( p, pCubeNew, pVar1 );
115 Fxu_MatrixAddLiteral( p, pCubeNew, pVar2 );
116
117 // create new doubles; we cannot add them in the same loop
118 // because we first have to create *all* new cubes for each node
120 Fxu_UpdateAddNewDoubles( p, pCube );
121 // update the singles after removing some literals
122 Fxu_UpdateCleanOldSingles( p );
123
124 // undo the temporary rings with cubes and vars
127 // we should undo the rings before creating new singles
128
129 // create new singles
130 Fxu_UpdateAddNewSingles( p, pVarC );
131 Fxu_UpdateAddNewSingles( p, pVarD );
132
133 // recycle the divisor
134 MEM_FREE_FXU( p, Fxu_Double, 1, pDouble );
135 p->nDivs3++;
136}
137
150{
151 Fxu_Single * pSingle;
152 Fxu_Cube * pCube, * pCubeNew;
153 Fxu_Var * pVarC, * pVarD;
154 Fxu_Var * pVar1, * pVar2;
155
156 // read the best divisor from the heap
157 pSingle = Fxu_HeapSingleReadMax( p->pHeapSingle );
158 // get the variables of this single-cube divisor
159 pVar1 = pSingle->pVar1;
160 pVar2 = pSingle->pVar2;
161
162 // create two new columns (vars)
163 Fxu_UpdateCreateNewVars( p, &pVarC, &pVarD, 1 );
164 // create one new row (cube)
165 pCubeNew = Fxu_MatrixAddCube( p, pVarD, 0 );
166 pCubeNew->pFirst = pCubeNew;
167 // set the first cube
168 pVarD->pFirst = pCubeNew;
169
170 // start collecting the affected vars and cubes
173 // add the vars
174 Fxu_MatrixRingVarsAdd( p, pVar1 );
175 Fxu_MatrixRingVarsAdd( p, pVar2 );
176 // remove the literals and collect the affected cubes
177 // remove the divisors associated with this cube
178 // add to the affected cube the literal corresponding to the new column
179 Fxu_UpdateMatrixSingleClean( p, pVar1, pVar2, pVarD );
180 // stop collecting the affected vars and cubes
183
184 // add the literals to the new cube
185 assert( pVar1->iVar < pVar2->iVar );
186 assert( Fxu_SingleCountCoincidence( p, pVar1, pVar2 ) == 0 );
187 Fxu_MatrixAddLiteral( p, pCubeNew, pVar1 );
188 Fxu_MatrixAddLiteral( p, pCubeNew, pVar2 );
189
190 // create new doubles; we cannot add them in the same loop
191 // because we first have to create *all* new cubes for each node
193 Fxu_UpdateAddNewDoubles( p, pCube );
194 // update the singles after removing some literals
195 Fxu_UpdateCleanOldSingles( p );
196 // we should undo the rings before creating new singles
197
198 // unmark the cubes
201
202 // create new singles
203 Fxu_UpdateAddNewSingles( p, pVarC );
204 Fxu_UpdateAddNewSingles( p, pVarD );
205 p->nDivs1++;
206}
207
220{
221 Fxu_Double * pDiv;
222 Fxu_Cube * pCube, * pCubeNew1, * pCubeNew2;
223 Fxu_Var * pVarC, * pVarD;
224
225 // remove the best divisor from the heap
226 pDiv = Fxu_HeapDoubleGetMax( p->pHeapDouble );
227 // remove the best divisor from the table
228 Fxu_ListTableDelDivisor( p, pDiv );
229
230 // create two new columns (vars)
231 Fxu_UpdateCreateNewVars( p, &pVarC, &pVarD, 2 );
232 // create two new rows (cubes)
233 pCubeNew1 = Fxu_MatrixAddCube( p, pVarD, 0 );
234 pCubeNew1->pFirst = pCubeNew1;
235 pCubeNew2 = Fxu_MatrixAddCube( p, pVarD, 1 );
236 pCubeNew2->pFirst = pCubeNew1;
237 // set the first cube
238 pVarD->pFirst = pCubeNew1;
239
240 // add the literals to the new cubes
241 Fxu_UpdateMatrixDoubleCreateCubes( p, pCubeNew1, pCubeNew2, pDiv );
242
243 // start collecting the affected cubes and vars
246 // replace each two cubes of the pair by one new cube
247 // the new cube contains the base and the new literal
248 Fxu_UpdateDoublePairs( p, pDiv, pVarD );
249 // stop collecting the affected cubes and vars
252
253 // create new doubles; we cannot add them in the same loop
254 // because we first have to create *all* new cubes for each node
256 Fxu_UpdateAddNewDoubles( p, pCube );
257 // update the singles after removing some literals
258 Fxu_UpdateCleanOldSingles( p );
259
260 // undo the temporary rings with cubes and vars
263 // we should undo the rings before creating new singles
264
265 // create new singles
266 Fxu_UpdateAddNewSingles( p, pVarC );
267 Fxu_UpdateAddNewSingles( p, pVarD );
268
269 // recycle the divisor
270 MEM_FREE_FXU( p, Fxu_Double, 1, pDiv );
271 p->nDivs2++;
272}
273
285void Fxu_UpdateDoublePairs( Fxu_Matrix * p, Fxu_Double * pDouble, Fxu_Var * pVar )
286{
287 Fxu_Pair * pPair;
288 Fxu_Cube * pCubeUse, * pCubeRem;
289 int i;
290
291 // collect and sort the pairs
292 Fxu_UpdatePairsSort( p, pDouble );
293// for ( i = 0; i < p->nPairsTemp; i++ )
294 for ( i = 0; i < p->vPairs->nSize; i++ )
295 {
296 // get the pair
297// pPair = p->pPairsTemp[i];
298 pPair = (Fxu_Pair *)p->vPairs->pArray[i];
299 // out of the two cubes, select the one which comes earlier
300 pCubeUse = Fxu_PairMinCube( pPair );
301 pCubeRem = Fxu_PairMaxCube( pPair );
302 // collect the affected cube
303 assert( pCubeUse->pOrder == NULL );
304 Fxu_MatrixRingCubesAdd( p, pCubeUse );
305
306 // remove some literals from pCubeUse and all literals from pCubeRem
307 Fxu_UpdateMatrixDoubleClean( p, pCubeUse, pCubeRem );
308 // add a literal that depends on the new variable
309 Fxu_MatrixAddLiteral( p, pCubeUse, pVar );
310 // check the literal count
311 assert( pCubeUse->lLits.nItems == pPair->nBase + 1 );
312 assert( pCubeRem->lLits.nItems == 0 );
313
314 // update the divisors by removing useless pairs
315 Fxu_UpdateCleanOldDoubles( p, pDouble, pCubeUse );
316 Fxu_UpdateCleanOldDoubles( p, pDouble, pCubeRem );
317 // remove the pair
318 MEM_FREE_FXU( p, Fxu_Pair, 1, pPair );
319 }
320 p->vPairs->nSize = 0;
321}
322
334void Fxu_UpdateMatrixDoubleCreateCubes( Fxu_Matrix * p, Fxu_Cube * pCube1, Fxu_Cube * pCube2, Fxu_Double * pDiv )
335{
336 Fxu_Lit * pLit1, * pLit2;
337 Fxu_Pair * pPair;
338 int nBase, nLits1, nLits2;
339
340 // fill in the SOP and copy the fanins
341 nBase = nLits1 = nLits2 = 0;
342 pPair = pDiv->lPairs.pHead;
343 pLit1 = pPair->pCube1->lLits.pHead;
344 pLit2 = pPair->pCube2->lLits.pHead;
345 while ( 1 )
346 {
347 if ( pLit1 && pLit2 )
348 {
349 if ( pLit1->iVar == pLit2->iVar )
350 { // skip the cube free part
351 pLit1 = pLit1->pHNext;
352 pLit2 = pLit2->pHNext;
353 nBase++;
354 }
355 else if ( pLit1->iVar < pLit2->iVar )
356 { // add literal to the first cube
357 Fxu_MatrixAddLiteral( p, pCube1, pLit1->pVar );
358 // move to the next literal in this cube
359 pLit1 = pLit1->pHNext;
360 nLits1++;
361 }
362 else
363 { // add literal to the second cube
364 Fxu_MatrixAddLiteral( p, pCube2, pLit2->pVar );
365 // move to the next literal in this cube
366 pLit2 = pLit2->pHNext;
367 nLits2++;
368 }
369 }
370 else if ( pLit1 && !pLit2 )
371 { // add literal to the first cube
372 Fxu_MatrixAddLiteral( p, pCube1, pLit1->pVar );
373 // move to the next literal in this cube
374 pLit1 = pLit1->pHNext;
375 nLits1++;
376 }
377 else if ( !pLit1 && pLit2 )
378 { // add literal to the second cube
379 Fxu_MatrixAddLiteral( p, pCube2, pLit2->pVar );
380 // move to the next literal in this cube
381 pLit2 = pLit2->pHNext;
382 nLits2++;
383 }
384 else
385 break;
386 }
387 assert( pPair->nLits1 == nLits1 );
388 assert( pPair->nLits2 == nLits2 );
389 assert( pPair->nBase == nBase );
390}
391
392
404void Fxu_UpdateMatrixDoubleClean( Fxu_Matrix * p, Fxu_Cube * pCubeUse, Fxu_Cube * pCubeRem )
405{
406 Fxu_Lit * pLit1, * bLit1Next;
407 Fxu_Lit * pLit2, * bLit2Next;
408
409 // initialize the starting literals
410 pLit1 = pCubeUse->lLits.pHead;
411 pLit2 = pCubeRem->lLits.pHead;
412 bLit1Next = pLit1? pLit1->pHNext: NULL;
413 bLit2Next = pLit2? pLit2->pHNext: NULL;
414 // go through the pair and remove the literals in the base
415 // from the first cube and all literals from the second cube
416 while ( 1 )
417 {
418 if ( pLit1 && pLit2 )
419 {
420 if ( pLit1->iVar == pLit2->iVar )
421 { // this literal is present in both cubes - it belongs to the base
422 // mark the affected var
423 if ( pLit1->pVar->pOrder == NULL )
424 Fxu_MatrixRingVarsAdd( p, pLit1->pVar );
425 // leave the base in pCubeUse; delete it from pCubeRem
426 Fxu_MatrixDelLiteral( p, pLit2 );
427 // step to the next literals
428 pLit1 = bLit1Next;
429 pLit2 = bLit2Next;
430 bLit1Next = pLit1? pLit1->pHNext: NULL;
431 bLit2Next = pLit2? pLit2->pHNext: NULL;
432 }
433 else if ( pLit1->iVar < pLit2->iVar )
434 { // this literal is present in pCubeUse - remove it
435 // mark the affected var
436 if ( pLit1->pVar->pOrder == NULL )
437 Fxu_MatrixRingVarsAdd( p, pLit1->pVar );
438 // delete this literal
439 Fxu_MatrixDelLiteral( p, pLit1 );
440 // step to the next literals
441 pLit1 = bLit1Next;
442 bLit1Next = pLit1? pLit1->pHNext: NULL;
443 }
444 else
445 { // this literal is present in pCubeRem - remove it
446 // mark the affected var
447 if ( pLit2->pVar->pOrder == NULL )
448 Fxu_MatrixRingVarsAdd( p, pLit2->pVar );
449 // delete this literal
450 Fxu_MatrixDelLiteral( p, pLit2 );
451 // step to the next literals
452 pLit2 = bLit2Next;
453 bLit2Next = pLit2? pLit2->pHNext: NULL;
454 }
455 }
456 else if ( pLit1 && !pLit2 )
457 { // this literal is present in pCubeUse - leave it
458 // mark the affected var
459 if ( pLit1->pVar->pOrder == NULL )
460 Fxu_MatrixRingVarsAdd( p, pLit1->pVar );
461 // delete this literal
462 Fxu_MatrixDelLiteral( p, pLit1 );
463 // step to the next literals
464 pLit1 = bLit1Next;
465 bLit1Next = pLit1? pLit1->pHNext: NULL;
466 }
467 else if ( !pLit1 && pLit2 )
468 { // this literal is present in pCubeRem - remove it
469 // mark the affected var
470 if ( pLit2->pVar->pOrder == NULL )
471 Fxu_MatrixRingVarsAdd( p, pLit2->pVar );
472 // delete this literal
473 Fxu_MatrixDelLiteral( p, pLit2 );
474 // step to the next literals
475 pLit2 = bLit2Next;
476 bLit2Next = pLit2? pLit2->pHNext: NULL;
477 }
478 else
479 break;
480 }
481}
482
494void Fxu_UpdateMatrixSingleClean( Fxu_Matrix * p, Fxu_Var * pVar1, Fxu_Var * pVar2, Fxu_Var * pVarNew )
495{
496 Fxu_Lit * pLit1, * bLit1Next;
497 Fxu_Lit * pLit2, * bLit2Next;
498
499 // initialize the starting literals
500 pLit1 = pVar1->lLits.pHead;
501 pLit2 = pVar2->lLits.pHead;
502 bLit1Next = pLit1? pLit1->pVNext: NULL;
503 bLit2Next = pLit2? pLit2->pVNext: NULL;
504 while ( 1 )
505 {
506 if ( pLit1 && pLit2 )
507 {
508 if ( pLit1->pCube->pVar->iVar == pLit2->pCube->pVar->iVar )
509 { // these literals coincide
510 if ( pLit1->iCube == pLit2->iCube )
511 { // these literals coincide
512
513 // collect the affected cube
514 assert( pLit1->pCube->pOrder == NULL );
515 Fxu_MatrixRingCubesAdd( p, pLit1->pCube );
516
517 // add the literal to this cube corresponding to the new column
518 Fxu_MatrixAddLiteral( p, pLit1->pCube, pVarNew );
519 // clean the old cubes
520 Fxu_UpdateCleanOldDoubles( p, NULL, pLit1->pCube );
521
522 // remove the literals
523 Fxu_MatrixDelLiteral( p, pLit1 );
524 Fxu_MatrixDelLiteral( p, pLit2 );
525
526 // go to the next literals
527 pLit1 = bLit1Next;
528 pLit2 = bLit2Next;
529 bLit1Next = pLit1? pLit1->pVNext: NULL;
530 bLit2Next = pLit2? pLit2->pVNext: NULL;
531 }
532 else if ( pLit1->iCube < pLit2->iCube )
533 {
534 pLit1 = bLit1Next;
535 bLit1Next = pLit1? pLit1->pVNext: NULL;
536 }
537 else
538 {
539 pLit2 = bLit2Next;
540 bLit2Next = pLit2? pLit2->pVNext: NULL;
541 }
542 }
543 else if ( pLit1->pCube->pVar->iVar < pLit2->pCube->pVar->iVar )
544 {
545 pLit1 = bLit1Next;
546 bLit1Next = pLit1? pLit1->pVNext: NULL;
547 }
548 else
549 {
550 pLit2 = bLit2Next;
551 bLit2Next = pLit2? pLit2->pVNext: NULL;
552 }
553 }
554 else if ( pLit1 && !pLit2 )
555 {
556 pLit1 = bLit1Next;
557 bLit1Next = pLit1? pLit1->pVNext: NULL;
558 }
559 else if ( !pLit1 && pLit2 )
560 {
561 pLit2 = bLit2Next;
562 bLit2Next = pLit2? pLit2->pVNext: NULL;
563 }
564 else
565 break;
566 }
567}
568
580void Fxu_UpdatePairsSort( Fxu_Matrix * p, Fxu_Double * pDouble )
581{
582 Fxu_Pair * pPair;
583 // order the pairs by the first cube to ensure that new literals are added
584 // to the matrix from top to bottom - collect pairs into the array
585 p->vPairs->nSize = 0;
586 Fxu_DoubleForEachPair( pDouble, pPair )
587 Vec_PtrPush( p->vPairs, pPair );
588 if ( p->vPairs->nSize < 2 )
589 return;
590 // sort
591 qsort( (void *)p->vPairs->pArray, (size_t)p->vPairs->nSize, sizeof(Fxu_Pair *),
592 (int (*)(const void *, const void *)) Fxu_UpdatePairCompare );
593 assert( Fxu_UpdatePairCompare( (Fxu_Pair**)p->vPairs->pArray, (Fxu_Pair**)p->vPairs->pArray + p->vPairs->nSize - 1 ) < 0 );
594}
595
607int Fxu_UpdatePairCompare( Fxu_Pair ** ppP1, Fxu_Pair ** ppP2 )
608{
609 Fxu_Cube * pC1 = (*ppP1)->pCube1;
610 Fxu_Cube * pC2 = (*ppP2)->pCube1;
611 int iP1CubeMin, iP2CubeMin;
612 if ( pC1->pVar->iVar < pC2->pVar->iVar )
613 return -1;
614 if ( pC1->pVar->iVar > pC2->pVar->iVar )
615 return 1;
616 iP1CubeMin = Fxu_PairMinCubeInt( *ppP1 );
617 iP2CubeMin = Fxu_PairMinCubeInt( *ppP2 );
618 if ( iP1CubeMin < iP2CubeMin )
619 return -1;
620 if ( iP1CubeMin > iP2CubeMin )
621 return 1;
622 assert( 0 );
623 return 0;
624}
625
626
638void Fxu_UpdateCreateNewVars( Fxu_Matrix * p, Fxu_Var ** ppVarC, Fxu_Var ** ppVarD, int nCubes )
639{
640 Fxu_Var * pVarC, * pVarD;
641
642 // add a new column for the complement
643 pVarC = Fxu_MatrixAddVar( p );
644 pVarC->nCubes = 0;
645 // add a new column for the divisor
646 pVarD = Fxu_MatrixAddVar( p );
647 pVarD->nCubes = nCubes;
648
649 // mark this entry in the Value2Node array
650// assert( p->pValue2Node[pVarC->iVar] > 0 );
651// p->pValue2Node[pVarD->iVar ] = p->pValue2Node[pVarC->iVar];
652// p->pValue2Node[pVarD->iVar+1] = p->pValue2Node[pVarC->iVar]+1;
653
654 *ppVarC = pVarC;
655 *ppVarD = pVarD;
656}
657
658
670void Fxu_UpdateCleanOldDoubles( Fxu_Matrix * p, Fxu_Double * pDiv, Fxu_Cube * pCube )
671{
672 Fxu_Double * pDivCur;
673 Fxu_Pair * pPair;
674 int i;
675
676 // if the cube is a recently introduced one
677 // it does not have pairs allocated
678 // in this case, there is nothing to update
679 if ( pCube->pVar->ppPairs == NULL )
680 return;
681
682 // go through all the pairs of this cube
683 Fxu_CubeForEachPair( pCube, pPair, i )
684 {
685 // get the divisor of this pair
686 pDivCur = pPair->pDiv;
687 // skip the current divisor
688 if ( pDivCur == pDiv )
689 continue;
690 // remove this pair
691 Fxu_ListDoubleDelPair( pDivCur, pPair );
692 // the divisor may have become useless by now
693 if ( pDivCur->lPairs.nItems == 0 )
694 {
695 assert( pDivCur->Weight == pPair->nBase - 1 );
696 Fxu_HeapDoubleDelete( p->pHeapDouble, pDivCur );
697 Fxu_MatrixDelDivisor( p, pDivCur );
698 }
699 else
700 {
701 // update the divisor's weight
702 pDivCur->Weight -= pPair->nLits1 + pPair->nLits2 - 1 + pPair->nBase;
703 Fxu_HeapDoubleUpdate( p->pHeapDouble, pDivCur );
704 }
705 MEM_FREE_FXU( p, Fxu_Pair, 1, pPair );
706 }
707 // finally erase all the pair info associated with this cube
708 Fxu_PairClearStorage( pCube );
709}
710
724void Fxu_UpdateAddNewDoubles( Fxu_Matrix * p, Fxu_Cube * pCube )
725{
726 Fxu_Cube * pTemp;
727 assert( pCube->pOrder );
728
729 // if the cube is a recently introduced one
730 // it does not have pairs allocated
731 // in this case, there is nothing to update
732 if ( pCube->pVar->ppPairs == NULL )
733 return;
734
735 for ( pTemp = pCube->pFirst; pTemp->pVar == pCube->pVar; pTemp = pTemp->pNext )
736 {
737 // do not add pairs with the empty cubes
738 if ( pTemp->lLits.nItems == 0 )
739 continue;
740 // to prevent adding duplicated pairs of the new cubes
741 // do not add the pair, if the current cube is marked
742 if ( pTemp->pOrder && pTemp->iCube >= pCube->iCube )
743 continue;
744 Fxu_MatrixAddDivisor( p, pTemp, pCube );
745 }
746}
747
759void Fxu_UpdateCleanOldSingles( Fxu_Matrix * p )
760{
761 Fxu_Single * pSingle, * pSingle2;
762 int WeightNew;
763 int Counter = 0;
764
765 Fxu_MatrixForEachSingleSafe( p, pSingle, pSingle2 )
766 {
767 // if at least one of the variables is marked, recalculate
768 if ( pSingle->pVar1->pOrder || pSingle->pVar2->pOrder )
769 {
770 Counter++;
771 // get the new weight
772 WeightNew = -2 + Fxu_SingleCountCoincidence( p, pSingle->pVar1, pSingle->pVar2 );
773 if ( WeightNew >= 0 )
774 {
775 pSingle->Weight = WeightNew;
776 Fxu_HeapSingleUpdate( p->pHeapSingle, pSingle );
777 }
778 else
779 {
780 Fxu_HeapSingleDelete( p->pHeapSingle, pSingle );
781 Fxu_ListMatrixDelSingle( p, pSingle );
782 MEM_FREE_FXU( p, Fxu_Single, 1, pSingle );
783 }
784 }
785 }
786// printf( "Called procedure %d times.\n", Counter );
787}
788
800void Fxu_UpdateAddNewSingles( Fxu_Matrix * p, Fxu_Var * pVar )
801{
803}
804
808
809
811
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
Cube * p
Definition exorList.c:222
void Fxu_HeapDoubleUpdate(Fxu_HeapDouble *p, Fxu_Double *pDiv)
Definition fxuHeapD.c:223
int Fxu_HeapDoubleReadMaxWeight(Fxu_HeapDouble *p)
Definition fxuHeapD.c:319
void Fxu_HeapDoubleDelete(Fxu_HeapDouble *p, Fxu_Double *pDiv)
Definition fxuHeapD.c:250
Fxu_Double * Fxu_HeapDoubleGetMax(Fxu_HeapDouble *p)
Definition fxuHeapD.c:291
Fxu_Single * Fxu_HeapSingleReadMax(Fxu_HeapSingle *p)
Definition fxuHeapS.c:275
void Fxu_HeapSingleUpdate(Fxu_HeapSingle *p, Fxu_Single *pSingle)
Definition fxuHeapS.c:226
void Fxu_HeapSingleDelete(Fxu_HeapSingle *p, Fxu_Single *pSingle)
Definition fxuHeapS.c:251
int Fxu_HeapSingleReadMaxWeight(Fxu_HeapSingle *p)
Definition fxuHeapS.c:321
void Fxu_ListTableDelDivisor(Fxu_Matrix *p, Fxu_Double *pDiv)
Definition fxuList.c:254
Fxu_Var * Fxu_MatrixAddVar(Fxu_Matrix *p)
Definition fxuMatrix.c:161
int Fxu_SingleCountCoincidence(Fxu_Matrix *p, Fxu_Var *pVar1, Fxu_Var *pVar2)
Definition fxuSingle.c:241
struct FxuVar Fxu_Var
Definition fxuInt.h:67
#define Fxu_PairMinCubeInt(pPair)
Definition fxuInt.h:289
void Fxu_PairClearStorage(Fxu_Cube *pCube)
Definition fxuPair.c:476
#define Fxu_MatrixRingVarsStart( Matrix)
Definition fxuInt.h:386
#define Fxu_MatrixForEachCubeInRing(Matrix, Cube)
Definition fxuInt.h:397
#define Fxu_MatrixRingVarsAdd( Matrix, Var)
Definition fxuInt.h:395
void Fxu_MatrixAddLiteral(Fxu_Matrix *p, Fxu_Cube *pCube, Fxu_Var *pVar)
Definition fxuMatrix.c:205
struct FxuSingle Fxu_Single
Definition fxuInt.h:73
void Fxu_MatrixDelDivisor(Fxu_Matrix *p, Fxu_Double *pDiv)
Definition fxuMatrix.c:233
#define Fxu_PairMaxCube(pPair)
Definition fxuInt.h:288
typedefABC_NAMESPACE_HEADER_START struct FxuMatrix Fxu_Matrix
INCLUDES ///.
Definition fxuInt.h:63
void Fxu_MatrixDelLiteral(Fxu_Matrix *p, Fxu_Lit *pLit)
Definition fxuMatrix.c:252
struct FxuPair Fxu_Pair
Definition fxuInt.h:71
struct FxuCube Fxu_Cube
Definition fxuInt.h:66
#define Fxu_MatrixForEachSingleSafe(Matrix, Single, Single2)
Definition fxuInt.h:316
struct FxuDouble Fxu_Double
Definition fxuInt.h:72
#define Fxu_PairMinCube(pPair)
Definition fxuInt.h:287
#define Fxu_MatrixRingCubesStop( Matrix)
Definition fxuInt.h:388
void Fxu_MatrixAddDivisor(Fxu_Matrix *p, Fxu_Cube *pCube1, Fxu_Cube *pCube2)
Definition fxuMatrix.c:301
#define Fxu_DoubleForEachPair(Div, Pair)
Definition fxuInt.h:357
#define Fxu_MatrixRingCubesStart(Matrix)
Definition fxuInt.h:385
#define Fxu_CubeForEachPair(pCube, pPair, i)
Definition fxuInt.h:368
Fxu_Cube * Fxu_MatrixAddCube(Fxu_Matrix *p, Fxu_Var *pVar, int iCube)
Definition fxuMatrix.c:183
#define MEM_FREE_FXU(Manager, Type, Size, Pointer)
Definition fxuInt.h:431
#define Fxu_MatrixRingVarsStop( Matrix)
Definition fxuInt.h:389
void Fxu_ListMatrixDelSingle(Fxu_Matrix *p, Fxu_Single *pSingle)
Definition fxuList.c:194
#define Fxu_MatrixRingCubesAdd(Matrix, Cube)
Definition fxuInt.h:394
void Fxu_MatrixComputeSinglesOne(Fxu_Matrix *p, Fxu_Var *pVar)
Definition fxuSingle.c:184
void Fxu_ListDoubleDelPair(Fxu_Double *pDiv, Fxu_Pair *pPair)
Definition fxuList.c:489
struct FxuLit Fxu_Lit
Definition fxuInt.h:68
void Fxu_UpdateDouble(Fxu_Matrix *p)
Definition fxuUpdate.c:219
void Fxu_UpdateSingle(Fxu_Matrix *p)
Definition fxuUpdate.c:149
void Fxu_Update(Fxu_Matrix *p, Fxu_Single *pSingle, Fxu_Double *pDouble)
FUNCTION DEFINITIONS ///.
Definition fxuUpdate.c:57
void Fxu_MatrixRingCubesUnmark(Fxu_Matrix *p)
Definition fxu.c:185
void Fxu_MatrixRingVarsUnmark(Fxu_Matrix *p)
Definition fxu.c:206
Fxu_Cube * pOrder
Definition fxuInt.h:209
Fxu_Cube * pFirst
Definition fxuInt.h:204
int iCube
Definition fxuInt.h:203
Fxu_ListLit lLits
Definition fxuInt.h:206
Fxu_Cube * pNext
Definition fxuInt.h:208
Fxu_Var * pVar
Definition fxuInt.h:205
int Weight
Definition fxuInt.h:258
Fxu_ListPair lPairs
Definition fxuInt.h:260
int nItems
Definition fxuInt.h:111
Fxu_Lit * pHead
Definition fxuInt.h:109
Fxu_Pair * pHead
Definition fxuInt.h:117
int nItems
Definition fxuInt.h:119
Fxu_Lit * pHNext
Definition fxuInt.h:233
Fxu_Lit * pVNext
Definition fxuInt.h:235
Fxu_Cube * pCube
Definition fxuInt.h:230
int iVar
Definition fxuInt.h:228
Fxu_Var * pVar
Definition fxuInt.h:231
int iCube
Definition fxuInt.h:229
int nBase
Definition fxuInt.h:243
Fxu_Double * pDiv
Definition fxuInt.h:244
int nLits2
Definition fxuInt.h:242
Fxu_Cube * pCube1
Definition fxuInt.h:245
int nLits1
Definition fxuInt.h:241
Fxu_Cube * pCube2
Definition fxuInt.h:246
int Weight
Definition fxuInt.h:271
Fxu_Var * pVar2
Definition fxuInt.h:273
Fxu_Var * pVar1
Definition fxuInt.h:272
int nCubes
Definition fxuInt.h:216
Fxu_Var * pOrder
Definition fxuInt.h:222
int iVar
Definition fxuInt.h:215
Fxu_ListLit lLits
Definition fxuInt.h:219
Fxu_Pair *** ppPairs
Definition fxuInt.h:218
Fxu_Cube * pFirst
Definition fxuInt.h:217
#define assert(ex)
Definition util_old.h:213