abc/src/misc/mvc/mvcUtils.c
/**Function*************************************************************

  Synopsis    [Transposes the cube cover.]

  Description [Returns the cube cover that looks like a transposed
  matrix, compared to the matrix derived from the original cover.]
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
Function
Synopsis    [Transposes the cube cover.]

Description [Returns the cube cover that looks like a transposed
matrix, compared to the matrix derived from the original cover.]




Function Synopsis [ Transposes the cube cover . ] Description [ Returns the cube cover that looks like a transposed matrix compared to the matrix derived from the original cover . ]
Mvc_Cover_t * Mvc_CoverTranspose( Mvc_Cover_t * pCover )
{
    Mvc_Cover_t * pRes;
    Mvc_Cube_t * pCubeRes, * pCube;
    int nWord, nBit, i, iCube;
    pRes = Mvc_CoverAlloc( pCover->pMem, Mvc_CoverReadCubeNum(pCover) );
    for ( i = 0; i < pCover->nBits; i++ )
    {
        nWord = Mvc_CubeWhichWord(i);
        nBit  = Mvc_CubeWhichBit(i);
        pCubeRes = Mvc_CubeAlloc( pRes );
        Mvc_CubeBitClean( pCubeRes );
        iCube = 0;
        Mvc_CoverForEachCube( pCover, pCube )
        {
            if ( pCube->pData[nWord] & (1<<nBit) )
                Mvc_CubeBitInsert( pCubeRes, iCube );
            iCube++;
        }
        Mvc_CoverAddCubeTail( pRes, pCubeRes ); 
    }
    return pRes;
}
Mvc_Cover_t * Mvc_CoverTranspose ( Mvc_Cover_t * pCover ) { Mvc_Cover_t * pRes ; Mvc_Cube_t * pCubeRes , * pCube ; int nWord , nBit , i , iCube ; pRes = Mvc_CoverAlloc ( pCover -> pMem , Mvc_CoverReadCubeNum ( pCover ) ) ; for ( i = 0 ; i < pCover -> nBits ; i ++ ) { nWord = Mvc_CubeWhichWord ( i ) ; nBit = Mvc_CubeWhichBit ( i ) ; pCubeRes = Mvc_CubeAlloc ( pRes ) ; Mvc_CubeBitClean ( pCubeRes ) ; iCube = 0 ; Mvc_CoverForEachCube ( pCover , pCube ) { if ( pCube -> pData [ nWord ] & ( 1 << nBit ) ) Mvc_CubeBitInsert ( pCubeRes , iCube ) ; iCube ++ ; } Mvc_CoverAddCubeTail ( pRes , pCubeRes ) ; } return pRes ; }
Function
Synopsis    [Transposes the cube cover.]
Function Synopsis [ Transposes the cube cover . ]
// get the word and bit of this literal // get the transposed cube