summaryrefslogtreecommitdiffstats
path: root/src/misc/espresso/sminterf.c
blob: d1abe5346e7c799594ee08593522d7940babdf0b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
 * Revision Control Information
 *
 * $Source$
 * $Author$
 * $Revision$
 * $Date$
 *
 */
#include "espresso.h"

ABC_NAMESPACE_IMPL_START



pset
do_sm_minimum_cover(A)
pset_family A;
{
    sm_matrix *M;
    sm_row *sparse_cover;
    sm_element *pe;
    pset cover;
    register int i, base, rownum;
    register unsigned val;
    register pset last, p;

    M = sm_alloc();
    rownum = 0;
    foreach_set(A, last, p) {
    foreach_set_element(p, i, val, base) {
        (void) sm_insert(M, rownum, base);
    }
    rownum++;
    }

    sparse_cover = sm_minimum_cover(M, NIL(int), 1, 0);
    sm_free(M);

    cover = set_new(A->sf_size);
    sm_foreach_row_element(sparse_cover, pe) {
    set_insert(cover, pe->col_num);
    }
    sm_row_free(sparse_cover);

    return cover;
}
ABC_NAMESPACE_IMPL_END