aboutsummaryrefslogtreecommitdiff
path: root/src/benchmarks/espresso/part.c
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fl.fischer@fau.de>2020-05-06 16:56:32 +0200
committerFlorian Fischer <florian.fl.fischer@fau.de>2020-06-02 11:18:47 +0200
commit8174a918ea3b7cb216bf7ea98cfdc10661b5c37d (patch)
tree0747ec3ccb9f8d7eeccfac35977fc17855ca3bbb /src/benchmarks/espresso/part.c
parent8f52e8fc02dd235582f5961941bcd564e9a681cd (diff)
downloadallocbench-8174a918ea3b7cb216bf7ea98cfdc10661b5c37d.tar.gz
allocbench-8174a918ea3b7cb216bf7ea98cfdc10661b5c37d.zip
make the whole project more python idiomatic
* rename src directory to allocbench * make global variable names UPPERCASE * format a lot of code using yapf * use lowercase ld_preload and ld_library_path as Allocator members * name expected Errors 'err' and don't raise a new Exception * disable some pylint messages
Diffstat (limited to 'src/benchmarks/espresso/part.c')
-rw-r--r--src/benchmarks/espresso/part.c114
1 files changed, 0 insertions, 114 deletions
diff --git a/src/benchmarks/espresso/part.c b/src/benchmarks/espresso/part.c
deleted file mode 100644
index c2c2407..0000000
--- a/src/benchmarks/espresso/part.c
+++ /dev/null
@@ -1,114 +0,0 @@
-#include "espresso.h"
-#include "mincov_int.h"
-
-static int visit_col();
-
-static void
-copy_row(A, prow)
-register sm_matrix *A;
-register sm_row *prow;
-{
- register sm_element *p;
-
- for(p = prow->first_col; p != 0; p = p->next_col) {
- (void) sm_insert(A, p->row_num, p->col_num);
- }
-}
-
-
-static int
-visit_row(A, prow, rows_visited, cols_visited)
-sm_matrix *A;
-sm_row *prow;
-int *rows_visited;
-int *cols_visited;
-{
- sm_element *p;
- sm_col *pcol;
-
- if (! prow->flag) {
- prow->flag = 1;
- (*rows_visited)++;
- if (*rows_visited == A->nrows) {
- return 1;
- }
- for(p = prow->first_col; p != 0; p = p->next_col) {
- pcol = sm_get_col(A, p->col_num);
- if (! pcol->flag) {
- if (visit_col(A, pcol, rows_visited, cols_visited)) {
- return 1;
- }
- }
- }
- }
- return 0;
-}
-
-
-static int
-visit_col(A, pcol, rows_visited, cols_visited)
-sm_matrix *A;
-sm_col *pcol;
-int *rows_visited;
-int *cols_visited;
-{
- sm_element *p;
- sm_row *prow;
-
- if (! pcol->flag) {
- pcol->flag = 1;
- (*cols_visited)++;
- if (*cols_visited == A->ncols) {
- return 1;
- }
- for(p = pcol->first_row; p != 0; p = p->next_row) {
- prow = sm_get_row(A, p->row_num);
- if (! prow->flag) {
- if (visit_row(A, prow, rows_visited, cols_visited)) {
- return 1;
- }
- }
- }
- }
- return 0;
-}
-
-int
-sm_block_partition(A, L, R)
-sm_matrix *A;
-sm_matrix **L, **R;
-{
- int cols_visited, rows_visited;
- register sm_row *prow;
- register sm_col *pcol;
-
- /* Avoid the trivial case */
- if (A->nrows == 0) {
- return 0;
- }
-
- /* Reset the visited flags for each row and column */
- for(prow = A->first_row; prow != 0; prow = prow->next_row) {
- prow->flag = 0;
- }
- for(pcol = A->first_col; pcol != 0; pcol = pcol->next_col) {
- pcol->flag = 0;
- }
-
- cols_visited = rows_visited = 0;
- if (visit_row(A, A->first_row, &rows_visited, &cols_visited)) {
- /* we found all of the rows */
- return 0;
- } else {
- *L = sm_alloc();
- *R = sm_alloc();
- for(prow = A->first_row; prow != 0; prow = prow->next_row) {
- if (prow->flag) {
- copy_row(*L, prow);
- } else {
- copy_row(*R, prow);
- }
- }
- return 1;
- }
-}