'Calculate the cofactor of an element.
See Also
cofactor_matrix
minor
minor_submatrix'

def cofactor(self, i, j, method='berkowitz'):

    if ((self.rows != self.cols) or (self.rows < 1)):
        raise NonSquareMatrixError()
    return (((-1) ** ((i + j) % 2)) * self.minor(i, j, method))
