diff options
Diffstat (limited to 'libsolve.py')
-rw-r--r-- | libsolve.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libsolve.py b/libsolve.py index e9a0677..92f2b78 100644 --- a/libsolve.py +++ b/libsolve.py @@ -300,7 +300,7 @@ class Matrix: parts.append(' & '.join(map(str, row.lst))) return '\\begin{bmatrix}\n' + '\\\\\n'.join(parts) + '\n\\end{bmatrix}' - def triangulate(self): + def triangulate(self, swap=False): for i in range(self.shape[1]): for j in range(i, self.shape[0]): assert(self[j][i].deg() == 0) @@ -315,6 +315,9 @@ class Matrix: continue coef = -Fraction(self[k][i].vec[0]) / Fraction(self[j][i].vec[0]) self[k] = self[k] + self[j] * coef + + if swap: + self.make_U(j, i) break class Permutation: |