/**Function************************************************************* Synopsis [Removes the contained cubes.] Description [Returns 1 if the cover has been changed.] SideEffects [] SeeAlso [] ***********************************************************************/ int Mvc_CoverContain( Mvc_Cover_t * pCover ) { int nCubes; nCubes = Mvc_CoverReadCubeNum( pCover ); if ( nCubes < 2 ) return 0; Mvc_CoverSetCubeSizes(pCover); Mvc_CoverSort( pCover, NULL, Mvc_CubeCompareSizeAndInt ); Mvc_CoverRemoveDuplicates( pCover ); if ( nCubes > 1 ) Mvc_CoverRemoveContained( pCover ); return (nCubes != Mvc_CoverReadCubeNum(pCover)); }
/**Function************************************************************* Synopsis [Returns the quick divisor of the cover.] Description [Returns NULL, if there is not divisor other than trivial.] SideEffects [] SeeAlso [] ***********************************************************************/ Mvc_Cover_t * Mvc_CoverDivisor( Mvc_Cover_t * pCover ) { Mvc_Cover_t * pKernel; if ( Mvc_CoverReadCubeNum(pCover) <= 1 ) return NULL; // allocate the literal array and count literals if ( Mvc_CoverAnyLiteral( pCover, NULL ) == -1 ) return NULL; // duplicate the cover pKernel = Mvc_CoverDup(pCover); // perform the kerneling Mvc_CoverDivisorZeroKernel( pKernel ); assert( Mvc_CoverReadCubeNum(pKernel) ); return pKernel; }
/**Function************************************************************* Synopsis [Transfers the cubes from the array into list.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ void Mvc_CoverArray2List( Mvc_Cover_t * pCover ) { Mvc_Cube_t * pCube; int nCubes, i; assert( pCover->pCubes ); nCubes = Mvc_CoverReadCubeNum(pCover); if ( nCubes == 0 ) return; if ( nCubes == 1 ) { pCube = pCover->pCubes[0]; pCube->pNext = NULL; pCover->lCubes.pHead = pCover->lCubes.pTail = pCube; return; } // set up the first cube pCube = pCover->pCubes[0]; pCover->lCubes.pHead = pCube; // set up the last cube pCube = pCover->pCubes[nCubes-1]; pCube->pNext = NULL; pCover->lCubes.pTail = pCube; // link all cubes starting from the first one for ( i = 0; i < nCubes - 1; i++ ) pCover->pCubes[i]->pNext = pCover->pCubes[i+1]; }
/**Function************************************************************* Synopsis [Transfers the cubes from the list into the array.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ void Mvc_CoverList2Array( Mvc_Cover_t * pCover ) { Mvc_Cube_t * pCube; int Counter; // resize storage if necessary Mvc_CoverAllocateArrayCubes( pCover ); // iterate through the cubes Counter = 0; Mvc_CoverForEachCube( pCover, pCube ) pCover->pCubes[ Counter++ ] = pCube; assert( Counter == Mvc_CoverReadCubeNum(pCover) ); }