abc/src/base/io/ioReadPlaMo.c
// merge distance-1 with contained output part
merge distance-1 with contained output part
merge distance - 1 with contained output part
int Mop_ManMergeDist1Pairs2( Mop_Man_t * p, Vec_Int_t * vGroup, Vec_Int_t * vGroupPrev )
{
    int w, c1, c2, iCube1, iCube2, Count = 0;
    Vec_IntForEachEntry( vGroup, iCube1, c1 )
    if ( iCube1 != -1 )
    {
        word * pCube1Out, * pCube1 = Mop_ManCubeIn( p, iCube1 );
        Vec_IntForEachEntryStart( vGroup, iCube2, c2, c1+1 )
        if ( iCube2 != -1 )
        {
            word * pCube2Out, * pCube2 = Mop_ManCubeIn( p, iCube2 );
            if ( !Mop_ManCheckDist1(pCube1, pCube2, p->nWordsIn) )
                continue;
            pCube1Out = Mop_ManCubeOut( p, iCube1 );
            pCube2Out = Mop_ManCubeOut( p, iCube2 );
            assert( memcmp(pCube1Out, pCube2Out, sizeof(word)*p->nWordsOut) );
            if ( Mop_ManCheckContain(pCube1Out, pCube2Out, p->nWordsOut) ) 
            {
                for ( w = 0; w < p->nWordsIn; w++ )
                    pCube2[w] &= pCube1[w];
                for ( w = 0; w < p->nWordsOut; w++ )
                    pCube1Out[w] &= ~pCube2Out[w];
                Vec_IntPush( vGroupPrev, iCube2 );
                Vec_IntWriteEntry( vGroup, c2, -1 );
                Count++;
            }
            else if ( Mop_ManCheckContain(pCube2Out, pCube1Out, p->nWordsOut) ) 
            {
                for ( w = 0; w < p->nWordsIn; w++ )
                    pCube1[w] &= pCube2[w];
                for ( w = 0; w < p->nWordsOut; w++ )
                    pCube2Out[w] &= ~pCube1Out[w];
                Vec_IntPush( vGroupPrev, iCube1 );
                Vec_IntWriteEntry( vGroup, c1, -1 );
                Count++;
            }
        }
    }
    if ( Count )
        Map_ManGroupCompact( vGroup );
    return Count;
}
int Mop_ManMergeDist1Pairs2 ( Mop_Man_t * p , Vec_Int_t * vGroup , Vec_Int_t * vGroupPrev ) { int w , c1 , c2 , iCube1 , iCube2 , Count = 0 ; Vec_IntForEachEntry ( vGroup , iCube1 , c1 ) if ( iCube1 != -1 ) { word * pCube1Out , * pCube1 = Mop_ManCubeIn ( p , iCube1 ) ; Vec_IntForEachEntryStart ( vGroup , iCube2 , c2 , c1 + 1 ) if ( iCube2 != -1 ) { word * pCube2Out , * pCube2 = Mop_ManCubeIn ( p , iCube2 ) ; if ( ! Mop_ManCheckDist1 ( pCube1 , pCube2 , p -> nWordsIn ) ) continue ; pCube1Out = Mop_ManCubeOut ( p , iCube1 ) ; pCube2Out = Mop_ManCubeOut ( p , iCube2 ) ; assert ( memcmp ( pCube1Out , pCube2Out , sizeof ( word ) * p -> nWordsOut ) ) ; if ( Mop_ManCheckContain ( pCube1Out , pCube2Out , p -> nWordsOut ) ) { for ( w = 0 ; w < p -> nWordsIn ; w ++ ) pCube2 [ w ] &= pCube1 [ w ] ; for ( w = 0 ; w < p -> nWordsOut ; w ++ ) pCube1Out [ w ] &= ~ pCube2Out [ w ] ; Vec_IntPush ( vGroupPrev , iCube2 ) ; Vec_IntWriteEntry ( vGroup , c2 , -1 ) ; Count ++ ; } else if ( Mop_ManCheckContain ( pCube2Out , pCube1Out , p -> nWordsOut ) ) { for ( w = 0 ; w < p -> nWordsIn ; w ++ ) pCube1 [ w ] &= pCube2 [ w ] ; for ( w = 0 ; w < p -> nWordsOut ; w ++ ) pCube2Out [ w ] &= ~ pCube1Out [ w ] ; Vec_IntPush ( vGroupPrev , iCube1 ) ; Vec_IntWriteEntry ( vGroup , c1 , -1 ) ; Count ++ ; } } } if ( Count ) Map_ManGroupCompact ( vGroup ) ; return Count ; }
merge distance-1 with contained output part
merge distance - 1 with contained output part
// pCube1 has more outputs // update the input part // sharp the output part // move to another group // pCube2 has more outputs // update the input part // sharp the output part // move to another group