#include "error.h"
#include "bucket.h"
-#if KAPS_DUMP
+#if KAPS_DUMP
#include "html_dumper.h"
#endif
#include "kaps.h"
#include "timing.h"
pbqp_edge_t **edge_bucket;
-pbqp_edge_t **rm_bucket;
+static pbqp_edge_t **rm_bucket;
pbqp_node_t **node_buckets[4];
pbqp_node_t **reduced_bucket = NULL;
pbqp_node_t *merged_node = NULL;
unsigned *mapping;
unsigned src_len;
unsigned tgt_len;
- unsigned src_index;
unsigned tgt_index;
unsigned edge_index;
unsigned edge_len;
/* Check that each column has at most one zero entry. */
for (tgt_index = 0; tgt_index < tgt_len; ++tgt_index) {
unsigned onlyOneZero = 0;
+ unsigned src_index;
if (tgt_vec->entries[tgt_index].data == INF_COSTS)
continue;
pbqp->num_rm++;
#endif
-#if KAPS_DUMP
+#if KAPS_DUMP
if (pbqp->dump_file) {
char txt[100];
sprintf(txt, "Merging n%d into n%d", src_node->index, tgt_node->index);
vector_t *other_vec;
unsigned other_len;
unsigned other_index;
- unsigned tgt_index;
assert(old_edge);
if (old_edge == edge)
unsigned src_len;
unsigned tgt_len;
unsigned src_index;
- unsigned tgt_index;
unsigned edge_index;
unsigned edge_len;
/* Check that each row has at most one zero entry. */
for (src_index = 0; src_index < src_len; ++src_index) {
unsigned onlyOneZero = 0;
+ unsigned tgt_index;
if (src_vec->entries[src_index].data == INF_COSTS)
continue;
pbqp->num_rm++;
#endif
-#if KAPS_DUMP
+#if KAPS_DUMP
if (pbqp->dump_file) {
char txt[100];
sprintf(txt, "Merging n%d into n%d", tgt_node->index, src_node->index);
vector_t *other_vec;
unsigned other_len;
unsigned other_index;
- unsigned src_index;
assert(old_edge);
if (is_deleted(edge))
return;
-#if KAPS_DUMP
+#if KAPS_DUMP
if (pbqp->dump_file) {
char txt[100];
sprintf(txt, "Simplification of Edge n%d-n%d", src_node->index, tgt_node->index);
mat = edge->costs;
-#if KAPS_DUMP
+#if KAPS_DUMP
if (pbqp->dump_file) {
fputs("Input:<br>\n", pbqp->dump_file);
dump_simplifyedge(pbqp, edge);
normalize_towards_source(edge);
normalize_towards_target(edge);
-#if KAPS_DUMP
+#if KAPS_DUMP
if (pbqp->dump_file) {
fputs("<br>\nOutput:<br>\n", pbqp->dump_file);
dump_simplifyedge(pbqp, edge);
#endif
if (pbqp_matrix_is_zero(mat, src_vec, tgt_vec)) {
-#if KAPS_DUMP
+#if KAPS_DUMP
if (pbqp->dump_file) {
fputs("edge has been eliminated<br>\n", pbqp->dump_file);
}
ir_timer_start(t_int_simpl);
#endif
-#if KAPS_DUMP
+#if KAPS_DUMP
if (pbqp->dump_file) {
pbqp_dump_input(pbqp);
dump_section(pbqp->dump_file, 1, "2. Simplification of Cost Matrices");
ir_timer_reset_and_start(t_det_solution);
#endif
-#if KAPS_DUMP
+#if KAPS_DUMP
FILE *file;
#endif
(void) pbqp;
-#if KAPS_DUMP
+#if KAPS_DUMP
file = pbqp->dump_file;
if (file) {
solution = pbqp_add(solution,
node->costs->entries[node->solution].data);
-#if KAPS_DUMP
+#if KAPS_DUMP
if (file) {
fprintf(file, "node n%d is set to %d<br>\n", node->index, node->solution);
dump_node(file, node);
#endif
}
-#if KAPS_DUMP
+#if KAPS_DUMP
if (file) {
dump_section(file, 2, "Minimum");
#if KAPS_USE_UNSIGNED
node->solution = pbqp_matrix_get_row_min_index(mat, other->solution, vec);
}
-#if KAPS_DUMP
+#if KAPS_DUMP
if (pbqp->dump_file) {
fprintf(pbqp->dump_file, "node n%d is set to %d<br>\n", node->index, node->solution);
}
node->solution = vector_get_min_index(vec);
-#if KAPS_DUMP
+#if KAPS_DUMP
if (pbqp->dump_file) {
fprintf(pbqp->dump_file, "node n%d is set to %d<br>\n", node->index, node->solution);
}
unsigned node_index;
unsigned node_len = node_bucket_get_length(reduced_bucket);
-#if KAPS_DUMP
+#if KAPS_DUMP
if (pbqp->dump_file) {
dump_section(pbqp->dump_file, 2, "Back Propagation");
}
break;
default:
panic("Only nodes with degree one or two should be in this bucket");
- break;
}
}
}
other_node = edge->src;
}
-#if KAPS_DUMP
+#if KAPS_DUMP
if (pbqp->dump_file) {
char txt[100];
sprintf(txt, "RI-Reduction of Node n%d", node->index);
}
disconnect_edge(other_node, edge);
-#if KAPS_DUMP
+#if KAPS_DUMP
if (pbqp->dump_file) {
fputs("<br>\nAfter reduction:<br>\n", pbqp->dump_file);
dump_node(pbqp->dump_file, other_node);
unsigned col_len;
unsigned row_index;
unsigned row_len;
- unsigned node_len;
assert(pbqp_node_get_degree(node) == 2);
tgt_is_src = tgt_edge->src == node;
}
-#if KAPS_DUMP
+#if KAPS_DUMP
if (pbqp->dump_file) {
char txt[100];
sprintf(txt, "RII-Reduction of Node n%d", node->index);
row_len = src_vec->len;
col_len = tgt_vec->len;
- node_len = node_vec->len;
mat = pbqp_matrix_alloc(pbqp, row_len, col_len);
reorder_node_after_edge_deletion(tgt_node);
}
-#if KAPS_DUMP
+#if KAPS_DUMP
if (pbqp->dump_file) {
fputs("<br>\nAfter reduction:<br>\n", pbqp->dump_file);
dump_edge(pbqp->dump_file, edge);
static void select_row(pbqp_edge_t *edge, unsigned row_index)
{
pbqp_matrix_t *mat;
- pbqp_node_t *src_node;
pbqp_node_t *tgt_node;
vector_t *tgt_vec;
unsigned tgt_len;
unsigned tgt_index;
unsigned new_infinity = 0;
- src_node = edge->src;
tgt_node = edge->tgt;
tgt_vec = tgt_node->costs;