00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #include "espresso.h"
00011
00012
00013 pset
00014 do_sm_minimum_cover(A)
00015 pset_family A;
00016 {
00017 sm_matrix *M;
00018 sm_row *sparse_cover;
00019 sm_element *pe;
00020 pset cover;
00021 register int i, base, rownum;
00022 register unsigned val;
00023 register pset last, p;
00024
00025 M = sm_alloc();
00026 rownum = 0;
00027 foreach_set(A, last, p) {
00028 foreach_set_element(p, i, val, base) {
00029 (void) sm_insert(M, rownum, base);
00030 }
00031 rownum++;
00032 }
00033
00034 sparse_cover = sm_minimum_cover(M, NIL(int), 1, 0);
00035 sm_free(M);
00036
00037 cover = set_new(A->sf_size);
00038 sm_foreach_row_element(sparse_cover, pe) {
00039 set_insert(cover, pe->col_num);
00040 }
00041 sm_row_free(sparse_cover);
00042
00043 return cover;
00044 }