Apply the reduction method in the appendix of Scholtus (2008) to a matrix.
Let *A* with coefficients in *\{-1,0,1\}*. If, after a possible
permutation of columns it can be written
in the form *A=[B,C]* where each column in *B* has at most 1 nonzero
element, then *A* is totally unimodular if and only if *C* is totally
unimodular. By transposition, a similar theorem holds for the rows of A. This
function iteratively removes rows and columns with only 1 nonzero element
from *A* and returns the reduced result.

1 | ```
reduceMatrix(A)
``` |

`A` |
An object of class matrix in |

The reduction of A.

Scholtus S (2008). Algorithms for correcting some obvious inconsistencies and rounding errors in business survey data. Technical Report 08015, Netherlands.

`is_totally_unimodular`

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.