Need an algorithm to make all rows and columns have non-negative sums -


i'm trying figure out problem. have matrix integer values. goal every row sum , every column sum non-negative. things can change signs of entire row or entire column.

here's i've tried. row or column negative sum, , flip it. works on examples tried, have explain why, , i'm not sure. when number of negative sums goes up, when flip row, there more bad columns afterwards. can't find example doesn't work, , don't know how else problem.

flipping row or column negative sum correct , lead situation rows , columns have nonnegative (not positive -- consider 0's matrix) sums.

the problem should not keep track of how many rows or columns need flip, sum of entries is. let matrix, , let sum of entries. when flip row or column sum -s (s positive), adds 2s a. since bounded above, process must terminate.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -