Example #1
0
File: set.c Project: spl/ivy
/* sf_and -- form the "and" of all sets in a set family */
pset sf_and(pset_family A)
{
    register pset and, last, p;

    and = set_fill(set_new(A->sf_size), A->sf_size);
    foreach_set(A, last, p)
	INLINEset_and(and, and, p);
    return and;
}
Example #2
0
static bool
primes_consensus_special_cases(pset *T, pset_family *Tnew)
  /* will be disposed if answer is determined */
  /* returned only if answer determined */
{
  register pcube *T1, p, ceil, cof=T[0];
  pcube last;
  pcover A;

  /* Check for no cubes in the cover */
  if (T[2] == NULL) {
    *Tnew = new_cover(0);
    free_cubelist(T);
    return TRUE;
  }

  /* Check for only a single cube in the cover */
  if (T[3] == NULL) {
    *Tnew = sf_addset(new_cover(1), set_or(cof, cof, T[2]));
    free_cubelist(T);
    return TRUE;
  }

  /* Check for a row of all 1's (implies function is a tautology) */
  for(T1 = T+2; (p = *T1++) != NULL; ) {
    if (full_row(p, cof)) {
      *Tnew = sf_addset(new_cover(1), cube.fullset);
      free_cubelist(T);
      return TRUE;
    }
  }

  /* Check for a column of all 0's which can be factored out */
  ceil = set_save(cof);
  for(T1 = T+2; (p = *T1++) != NULL; ) {
    INLINEset_or(ceil, ceil, p);
  }
  if (! setp_equal(ceil, cube.fullset)) {
    p = new_cube();
    (void) set_diff(p, cube.fullset, ceil);
    (void) set_or(cof, cof, p);
    free_cube(p);

    A = primes_consensus(T);
    foreach_set(A, last, p) {
      INLINEset_and(p, p, ceil);
    }
Example #3
0
static pcover compl_merge(pset *T1, pset_family L, pset_family R, register pset cl, register pset cr, int var, int lifting)
  /* Original ON-set */
  /* Complement from each recursion branch */
  /* cubes used for cofactoring */
  /* splitting variable */
  /* whether to perform lifting or not */
{
  register pcube p, last, pt;
  pcover T, Tbar;
  pcube *L1, *R1;

  if (debug & COMPL) {
    printf("compl_merge: left %d, right %d\n", L->count, R->count);
    printf("%s (cl)\n%s (cr)\nLeft is\n", pc1(cl), pc2(cr));
    cprint(L);
    printf("Right is\n");
    cprint(R);
  }

  /* Intersect each cube with the cofactored cube */
  foreach_set(L, last, p) {
    INLINEset_and(p, p, cl);
    SET(p, ACTIVE);
  }
Example #4
0
 foreach_set(R, last, p) {
   INLINEset_and(p, p, cr);
   SET(p, ACTIVE);
 }