ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
dominate.c File Reference
#include "mincov_int.h"
Include dependency graph for dominate.c:

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START int sm_row_dominance (sm_matrix *A)
 
int sm_col_dominance (sm_matrix *A, int *weight)
 

Function Documentation

◆ sm_col_dominance()

int sm_col_dominance ( sm_matrix * A,
int * weight )

Definition at line 58 of file dominate.c.

61{
62 register sm_row *prow;
63 register sm_col *pcol, *pcol1;
64 register sm_element *p;
65 sm_row *least_row;
66 sm_col *next_col;
67 int colcnt;
68
69 colcnt = A->ncols;
70
71 /* Check each column against all other columns */
72 for(pcol = A->first_col; pcol != 0; pcol = next_col) {
73 next_col = pcol->next_col;
74
75 /* Check all rows to find the one with fewest elements */
76 least_row = sm_get_row(A, pcol->first_row->row_num);
77 for(p = pcol->first_row->next_row; p != 0; p = p->next_row) {
78 prow = sm_get_row(A, p->row_num);
79 if (prow->length < least_row->length) {
80 least_row = prow;
81 }
82 }
83
84 /* Only check for containment against columns in this row */
85 for(p = least_row->first_col; p != 0; p = p->next_col) {
86 pcol1 = sm_get_col(A, p->col_num);
87 if (weight != 0 && weight[pcol1->col_num] > weight[pcol->col_num])
88 continue;
89 if ((pcol1->length > pcol->length) ||
90 (pcol1->length == pcol->length &&
91 pcol1->col_num > pcol->col_num)) {
92 if (sm_col_contains(pcol, pcol1)) {
93 sm_delcol(A, pcol->col_num);
94 break;
95 }
96 }
97 }
98 }
99
100 return colcnt - A->ncols;
101}
Cube * p
Definition exorList.c:222
typedefABC_NAMESPACE_HEADER_START struct sm_element_struct sm_element
Definition sparse.h:21
struct sm_col_struct sm_col
Definition sparse.h:23
void sm_delcol()
#define sm_get_row(A, rownum)
Definition sparse.h:93
int sm_col_contains()
struct sm_row_struct sm_row
Definition sparse.h:22
#define sm_get_col(A, colnum)
Definition sparse.h:89
sm_col * next_col
Definition sparse.h:65
int col_num
Definition sparse.h:60
sm_element * first_row
Definition sparse.h:63
sm_col * first_col
Definition sparse.h:82
sm_element * first_col
Definition sparse.h:48
Here is the call graph for this function:

◆ sm_row_dominance()

ABC_NAMESPACE_IMPL_START int sm_row_dominance ( sm_matrix * A)

Definition at line 17 of file dominate.c.

19{
20 register sm_row *prow, *prow1;
21 register sm_col *pcol, *least_col;
22 register sm_element *p, *pnext;
23 int rowcnt;
24
25 rowcnt = A->nrows;
26
27 /* Check each row against all other rows */
28 for(prow = A->first_row; prow != 0; prow = prow->next_row) {
29
30 /* Among all columns with a 1 in this row, choose smallest */
31 least_col = sm_get_col(A, prow->first_col->col_num);
32 for(p = prow->first_col->next_col; p != 0; p = p->next_col) {
33 pcol = sm_get_col(A, p->col_num);
34 if (pcol->length < least_col->length) {
35 least_col = pcol;
36 }
37 }
38
39 /* Only check for containment against rows in this column */
40 for(p = least_col->first_row; p != 0; p = pnext) {
41 pnext = p->next_row;
42
43 prow1 = sm_get_row(A, p->row_num);
44 if ((prow1->length > prow->length) ||
45 (prow1->length == prow->length &&
46 prow1->row_num > prow->row_num)) {
47 if (sm_row_contains(prow, prow1)) {
48 sm_delrow(A, prow1->row_num);
49 }
50 }
51 }
52 }
53
54 return rowcnt - A->nrows;
55}
int sm_row_contains()
void sm_delrow()
sm_row * first_row
Definition sparse.h:79
int row_num
Definition sparse.h:45
sm_row * next_row
Definition sparse.h:50
Here is the call graph for this function: