#include "espresso.h"
Go to the source code of this file.
Defines | |
#define | MAGIC 500 |
Functions | |
pcover | cv_sharp (pcover A, pcover B) |
pcover | cb_sharp (pcube c, pcover T) |
pcover | cb_recur_sharp (pcube c, pcover T, int first, int last, int level) |
pcover | sharp (pcube a, pcube b) |
pcover | make_disjoint (pcover A) |
pcover | cv_dsharp (pcover A, pcover B) |
pcover | cb1_dsharp (pcover T, pcube c) |
pcover | cb_dsharp (pcube c, pcover T) |
pcover | dsharp (pcube a, pcube b) |
pcover | cv_intersect (pcover A, pcover B) |
Variables | |
long | start_time |
pcover cb1_dsharp | ( | pcover | T, | |
pcube | c | |||
) |
pcover cb_dsharp | ( | pcube | c, | |
pcover | T | |||
) |
Definition at line 146 of file sharp.c.
00149 { 00150 pcube last, p; 00151 pcover Y, Y1; 00152 00153 if (T->count == 0) { 00154 Y = sf_addset(new_cover(1), c); 00155 } else { 00156 Y = new_cover(T->count); 00157 set_copy(GETSET(Y,Y->count++), c); 00158 foreach_set(T, last, p) { 00159 Y1 = cb1_dsharp(Y, p); 00160 free_cover(Y); 00161 Y = Y1; 00162 } 00163 } 00164 return Y; 00165 }
pcover cb_recur_sharp | ( | pcube | c, | |
pcover | T, | |||
int | first, | |||
int | last, | |||
int | level | |||
) |
Definition at line 49 of file sharp.c.
00053 { 00054 pcover temp, left, right; 00055 int middle; 00056 00057 if (first == last) { 00058 temp = sharp(c, GETSET(T, first)); 00059 } else { 00060 middle = (first + last) / 2; 00061 left = cb_recur_sharp(c, T, first, middle, level+1); 00062 right = cb_recur_sharp(c, T, middle+1, last, level+1); 00063 temp = cv_intersect(left, right); 00064 if ((debug & SHARP) && level < 4) { 00065 printf("# SHARP[%d]: %4d = %4d x %4d, time = %s\n", 00066 level, temp->count, left->count, right->count, 00067 print_time(ptime() - start_time)); 00068 (void) fflush(stdout); 00069 } 00070 free_cover(left); 00071 free_cover(right); 00072 } 00073 return temp; 00074 }
pcover cb_sharp | ( | pcube | c, | |
pcover | T | |||
) |
Definition at line 34 of file sharp.c.
00037 { 00038 if (T->count == 0) { 00039 T = sf_addset(new_cover(1), c); 00040 } else { 00041 start_time = ptime(); 00042 T = cb_recur_sharp(c, T, 0, T->count-1, 0); 00043 } 00044 return T; 00045 }
pcover cv_dsharp | ( | pcover | A, | |
pcover | B | |||
) |
pcover cv_intersect | ( | pcover | A, | |
pcover | B | |||
) |
Definition at line 213 of file sharp.c.
00215 { 00216 register pcube pi, pj, lasti, lastj, pt; 00217 pcover T, Tsave = NULL; 00218 00219 /* How large should each temporary result cover be ? */ 00220 T = new_cover(MAGIC); 00221 pt = T->data; 00222 00223 /* Form pairwise intersection of each cube of A with each cube of B */ 00224 foreach_set(A, lasti, pi) { 00225 foreach_set(B, lastj, pj) { 00226 if (cdist0(pi, pj)) { 00227 (void) set_and(pt, pi, pj); 00228 if (++T->count >= T->capacity) { 00229 if (Tsave == NULL) 00230 Tsave = sf_contain(T); 00231 else 00232 Tsave = sf_union(Tsave, sf_contain(T)); 00233 T = new_cover(MAGIC); 00234 pt = T->data; 00235 } else 00236 pt += T->wsize; 00237 } 00238 } 00239 } 00240 00241 00242 if (Tsave == NULL) 00243 Tsave = sf_contain(T); 00244 else 00245 Tsave = sf_union(Tsave, sf_contain(T)); 00246 return Tsave; 00247 }
pcover cv_sharp | ( | pcover | A, | |
pcover | B | |||
) |
pcover dsharp | ( | pcube | a, | |
pcube | b | |||
) |
Definition at line 169 of file sharp.c.
00171 { 00172 register pcube mask, diff, and, temp, temp1 = cube.temp[0]; 00173 int var; 00174 pcover r; 00175 00176 r = new_cover(cube.num_vars); 00177 00178 if (cdist0(a, b)) { 00179 diff = set_diff(new_cube(), a, b); 00180 and = set_and(new_cube(), a, b); 00181 mask = new_cube(); 00182 for(var = 0; var < cube.num_vars; var++) { 00183 /* check if position var of "a and not b" is not empty */ 00184 if (! setp_disjoint(diff, cube.var_mask[var])) { 00185 00186 /* coordinate var equals the difference between a and b */ 00187 temp = GETSET(r, r->count++); 00188 (void) set_and(temp, diff, cube.var_mask[var]); 00189 00190 /* coordinates 0 ... var-1 equal the intersection */ 00191 INLINEset_and(temp1, and, mask); 00192 INLINEset_or(temp, temp, temp1); 00193 00194 /* coordinates var+1 .. cube.num_vars equal a */ 00195 set_or(mask, mask, cube.var_mask[var]); 00196 INLINEset_diff(temp1, a, mask); 00197 INLINEset_or(temp, temp, temp1); 00198 } 00199 } 00200 free_cube(diff); 00201 free_cube(and); 00202 free_cube(mask); 00203 } else { 00204 r = sf_addset(r, a); 00205 } 00206 return r; 00207 }
pcover make_disjoint | ( | pcover | A | ) |
pcover sharp | ( | pcube | a, | |
pcube | b | |||
) |
Definition at line 78 of file sharp.c.
00080 { 00081 register int var; 00082 register pcube d=cube.temp[0], temp=cube.temp[1], temp1=cube.temp[2]; 00083 pcover r = new_cover(cube.num_vars); 00084 00085 if (cdist0(a, b)) { 00086 set_diff(d, a, b); 00087 for(var = 0; var < cube.num_vars; var++) { 00088 if (! setp_empty(set_and(temp, d, cube.var_mask[var]))) { 00089 set_diff(temp1, a, cube.var_mask[var]); 00090 set_or(GETSET(r, r->count++), temp, temp1); 00091 } 00092 } 00093 } else { 00094 r = sf_addset(r, a); 00095 } 00096 return r; 00097 }
long start_time |