'Compute the indexes for the lowest-cost pairings between rows and
columns in the database. Returns a list of (row, column) tuples
that can be used to traverse the matrix.
:Parameters:
cost_matrix : list of lists
The cost matrix. If this cost matrix is not square, it
will be padded with zeros, via a call to ``pad_matrix()``.
(This method does *not* modify the caller\'s matrix. It
operates on a copy of the matrix.)
**WARNING**: This code handles square and rectangular
matrices. It does *not* handle irregular matrices.
:rtype: list
:return: A list of ``(row, column)`` tuples that describe the lowest
cost path through the matrix'

def compute(self, cost_matrix):

    self.C = self.pad_matrix(cost_matrix)
    self.n = len(self.C)
    self.original_length = len(cost_matrix)
    self.original_width = len(cost_matrix[0])
    self.row_covered = [False for i in range(self.n)]
    self.col_covered = [False for i in range(self.n)]
    self.Z0_r = 0
    self.Z0_c = 0
    self.path = self.__make_matrix((self.n * 2), 0)
    self.marked = self.__make_matrix(self.n, 0)
    done = False
    step = 1
    steps = {1: self.__step1, 2: self.__step2, 3: self.__step3, 4: self.__step4, 5: self.__step5, 6: self.__step6}
    while (not done):
        try:
            func = steps[step]
            step = func()
        except KeyError:
            done = True
    results = []
    for i in range(self.original_length):
        for j in range(self.original_width):
            if (self.marked[i][j] == 1):
                results += [(i, j)]
    return results
