summaryrefslogtreecommitdiff
path: root/linear-assignment.h
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2018-08-14 14:21:46 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2018-08-14 14:22:21 -0700
commitfe8f41fb2a61b36d51099f895e9902fcccc2a2df (patch)
treea6e3756cb551ffc507ca6d80e89db3b401b490bd /linear-assignment.h
parentFifth batch for 2.19 cycle (diff)
parentrange-diff: use dim/bold cues to improve dual color mode (diff)
downloadtgif-fe8f41fb2a61b36d51099f895e9902fcccc2a2df.tar.xz
Merge branch 'js/range-diff' into es/format-patch-rangediff
* js/range-diff: (21 commits) range-diff: use dim/bold cues to improve dual color mode range-diff: make --dual-color the default mode range-diff: left-pad patch numbers completion: support `git range-diff` range-diff: populate the man page range-diff --dual-color: skip white-space warnings range-diff: offer to dual-color the diffs diff: add an internal option to dual-color diffs of diffs color: add the meta color GIT_COLOR_REVERSE range-diff: use color for the commit pairs range-diff: add tests range-diff: do not show "function names" in hunk headers range-diff: adjust the output of the commit pairs range-diff: suppress the diff headers range-diff: indent the diffs just like tbdiff range-diff: right-trim commit messages range-diff: also show the diff between patches range-diff: improve the order of the shown commits range-diff: first rudimentary implementation Introduce `range-diff` to compare iterations of a topic branch ...
Diffstat (limited to 'linear-assignment.h')
-rw-r--r--linear-assignment.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/linear-assignment.h b/linear-assignment.h
new file mode 100644
index 0000000000..1dfea76629
--- /dev/null
+++ b/linear-assignment.h
@@ -0,0 +1,22 @@
+#ifndef LINEAR_ASSIGNMENT_H
+#define LINEAR_ASSIGNMENT_H
+
+/*
+ * Compute an assignment of columns -> rows (and vice versa) such that every
+ * column is assigned to at most one row (and vice versa) minimizing the
+ * overall cost.
+ *
+ * The parameter `cost` is the cost matrix: the cost to assign column j to row
+ * i is `cost[j + column_count * i].
+ *
+ * The arrays column2row and row2column will be populated with the respective
+ * assignments (-1 for unassigned, which can happen only if column_count !=
+ * row_count).
+ */
+void compute_assignment(int column_count, int row_count, int *cost,
+ int *column2row, int *row2column);
+
+/* The maximal cost in the cost matrix (to prevent integer overflows). */
+#define COST_MAX (1<<16)
+
+#endif