Ejemplo n.º 1
0
Archivo: compl.c Proyecto: spl/ivy
/* complement -- compute the complement of T */
pcover complement(pset *T)
         			/* T will be disposed of */
{
    register pcube cl, cr;
    register int best;
    pcover Tbar, Tl, Tr;
    int lifting;
    static int compl_level = 0;

    if (debug & COMPL)
	debug_print(T, "COMPLEMENT", compl_level++);

    T = compl_special_cases(T, &Tbar);
    if (T != NULL){

	/* Allocate space for the partition cubes */
	cl = new_cube();
	cr = new_cube();
	best = binate_split_select(T, cl, cr, COMPL);

	/* Complement the left and right halves */
	Tl = complement(scofactor(T, cl, best));
	Tr = complement(scofactor(T, cr, best));

	if (Tr->count*Tl->count > (Tr->count+Tl->count)*CUBELISTSIZE(T)) {
	    lifting = USE_COMPL_LIFT_ONSET;
	} else {
	    lifting = USE_COMPL_LIFT;
	}
	Tbar = compl_merge(T, Tl, Tr, cl, cr, best, lifting);

	free_cube(cl);
	free_cube(cr);
	free_cubelist(T);
    }

    if (debug & COMPL)
	debug1_print(Tbar, "exit COMPLEMENT", --compl_level);
        
    return Tbar;
}
Ejemplo n.º 2
0
Archivo: compl.c Proyecto: GtTmy/pyeda
// complement -- compute the complement of T
set_family_t *
complement(set **T)
{
    set *cl, *cr;
    int best;
    set_family_t *Tbar, *Tl, *Tr;
    int lifting;
    static int compl_level = 0;

    if (debug & COMPL)
        debug_print(T, "COMPLEMENT", compl_level++);

    if (compl_special_cases(T, &Tbar) == MAYBE) {
        // Allocate space for the partition cubes
        cl = set_new(CUBE.size);
        cr = set_new(CUBE.size);
        best = binate_split_select(T, cl, cr, COMPL);

        // Complement the left and right halves
        Tl = complement(scofactor(T, cl, best));
        Tr = complement(scofactor(T, cr, best));

        if (Tr->count*Tl->count > (Tr->count+Tl->count)*CUBELISTSIZE(T)) {
            lifting = USE_COMPL_LIFT_ONSET;
        } else {
            lifting = USE_COMPL_LIFT;
        }
        Tbar = compl_merge(T, Tl, Tr, cl, cr, best, lifting);

        set_free(cl);
        set_free(cr);
        free_cubelist(T);
    }

    if (debug & COMPL)
        debug1_print(Tbar, "exit COMPLEMENT", --compl_level);

    return Tbar;
}