Repository: sympy/sympy

Issue:
Misspelling of "Bareiss" in Matrix module
There are several references to the "Bareis" method for determinants, though his name appears to be spelled "Bareiss".  I assume this should be fixed and the one `s` version should be deprecated.

https://en.wikipedia.org/wiki/Bareiss_algorithm
https://www.genealogy.math.ndsu.nodak.edu/id.php?id=12730

Discussion:

Patch:
diff --git a/sympy/matrices/dense.py b/sympy/matrices/dense.py
index d27235ee4d..5fe717e5e2 100644
--- a/sympy/matrices/dense.py
+++ b/sympy/matrices/dense.py
@@ -1386,7 +1386,7 @@ def randMatrix(r, c=None, min=0, max=99, seed=None, symmetric=False,
     return m
 
 
-def wronskian(functions, var, method='bareis'):
+def wronskian(functions, var, method='bareiss'):
     """
     Compute Wronskian for [] of functions
 
diff --git a/sympy/matrices/matrices.py b/sympy/matrices/matrices.py
index 51ab724042..b6808b58d9 100644
--- a/sympy/matrices/matrices.py
+++ b/sympy/matrices/matrices.py
@@ -23,6 +23,8 @@
 from sympy.core.compatibility import reduce, as_int, string_types
 from sympy.assumptions.refine import refine
 from sympy.core.decorators import call_highest_priority
+from sympy.core.decorators import deprecated
+from sympy.utilities.exceptions import SymPyDeprecationWarning
 
 from types import FunctionType
 
@@ -2630,8 +2632,12 @@ def D(self):
             raise AttributeError
         return self.H * mgamma(0)
 
+    @deprecated(useinstead="det_bareiss", issue=12363, deprecated_since_version="1.1")
     def det_bareis(self):
-        """Compute matrix determinant using Bareis' fraction-free
+        return self.det_bareiss()
+
+    def det_bareiss(self):
+        """Compute matrix determinant using Bareiss' fraction-free
         algorithm which is an extension of the well known Gaussian
         elimination method. This approach is best suited for dense
         symbolic matrices and will result in a determinant with
@@ -2680,7 +2686,7 @@ def det_bareis(self):
                     else:
                         return S.Zero
 
-                # proceed with Bareis' fraction-free (FF)
+                # proceed with Bareiss' fraction-free (FF)
                 # form of Gaussian elimination algorithm
                 for i in range(k + 1, n):
                     for j in range(k + 1, n):
@@ -2714,7 +2720,7 @@ def det_LU_decomposition(self):
 
 
         det
-        det_bareis
+        det_bareiss
         berkowitz_det
         """
         if not self.is_square:
@@ -2733,18 +2739,18 @@ def det_LU_decomposition(self):
 
         return prod.expand()
 
-    def det(self, method="bareis"):
+    def det(self, method="bareiss"):
         """Computes the matrix determinant using the method "method".
 
         Possible values for "method":
-          bareis ... det_bareis
+          bareiss ... det_bareiss
           berkowitz ... berkowitz_det
           det_LU ... det_LU_decomposition
 
         See Also
         ========
 
-        det_bareis
+        det_bareiss
         berkowitz_det
         det_LU
         """
@@ -2752,12 +2758,18 @@ def det(self, method="bareis"):
         # if methods were made internal and all determinant calculations
         # passed through here, then these lines could be factored out of
         # the method routines
+        if method == "bareis":
+            SymPyDeprecationWarning(
+                            feature="Using 'bareis' to compute matrix determinant",
+                            useinstead="'bareiss'",
+                            issue=12363, deprecated_since_version="1.1").warn()
+            method = "bareiss"
         if not self.is_square:
             raise NonSquareMatrixError()
         if not self:
             return S.One
-        if method == "bareis":
-            return self.det_bareis()
+        if method == "bareiss":
+            return self.det_bareiss()
         elif method == "berkowitz":
             return self.berkowitz_det()
         elif method == "det_LU":


Test patch:
diff --git a/sympy/matrices/tests/test_matrices.py b/sympy/matrices/tests/test_matrices.py
index f667690a81..33e1220722 100644
--- a/sympy/matrices/tests/test_matrices.py
+++ b/sympy/matrices/tests/test_matrices.py
@@ -309,7 +309,7 @@ def test_determinant():
     for M in [Matrix(), Matrix([[1]])]:
         assert (
             M.det() ==
-            M.det_bareis() ==
+            M.det_bareiss() ==
             M.berkowitz_det() ==
             M.det_LU_decomposition() ==
             1)
@@ -317,20 +317,20 @@ def test_determinant():
     M = Matrix(( (-3,  2),
                  ( 8, -5) ))
 
-    assert M.det(method="bareis") == -1
+    assert M.det(method="bareiss") == -1
     assert M.det(method="berkowitz") == -1
 
     M = Matrix(( (x,   1),
                  (y, 2*y) ))
 
-    assert M.det(method="bareis") == 2*x*y - y
+    assert M.det(method="bareiss") == 2*x*y - y
     assert M.det(method="berkowitz") == 2*x*y - y
 
     M = Matrix(( (1, 1, 1),
                  (1, 2, 3),
                  (1, 3, 6) ))
 
-    assert M.det(method="bareis") == 1
+    assert M.det(method="bareiss") == 1
     assert M.det(method="berkowitz") == 1
 
     M = Matrix(( ( 3, -2,  0, 5),
@@ -338,7 +338,7 @@ def test_determinant():
                  ( 0, -2,  5, 0),
                  ( 5,  0,  3, 4) ))
 
-    assert M.det(method="bareis") == -289
+    assert M.det(method="bareiss") == -289
     assert M.det(method="berkowitz") == -289
 
     M = Matrix(( ( 1,  2,  3,  4),
@@ -346,7 +346,7 @@ def test_determinant():
                  ( 9, 10, 11, 12),
                  (13, 14, 15, 16) ))
 
-    assert M.det(method="bareis") == 0
+    assert M.det(method="bareiss") == 0
     assert M.det(method="berkowitz") == 0
 
     M = Matrix(( (3, 2, 0, 0, 0),
@@ -355,7 +355,7 @@ def test_determinant():
                  (0, 0, 0, 3, 2),
                  (2, 0, 0, 0, 3) ))
 
-    assert M.det(method="bareis") == 275
+    assert M.det(method="bareiss") == 275
     assert M.det(method="berkowitz") == 275
 
     M = Matrix(( (1, 0,  1,  2, 12),
@@ -364,7 +364,7 @@ def test_determinant():
                  (3, 2, -1,  1,  8),
                  (1, 1,  1,  0,  6) ))
 
-    assert M.det(method="bareis") == -55
+    assert M.det(method="bareiss") == -55
     assert M.det(method="berkowitz") == -55
 
     M = Matrix(( (-5,  2,  3,  4,  5),
@@ -373,7 +373,7 @@ def test_determinant():
                  ( 1,  2,  3, -2,  5),
                  ( 1,  2,  3,  4, -1) ))
 
-    assert M.det(method="bareis") == 11664
+    assert M.det(method="bareiss") == 11664
     assert M.det(method="berkowitz") == 11664
 
     M = Matrix(( ( 2,  7, -1, 3, 2),
@@ -382,14 +382,14 @@ def test_determinant():
                  (-3, -2,  4, 5, 3),
                  ( 1,  0,  0, 0, 1) ))
 
-    assert M.det(method="bareis") == 123
+    assert M.det(method="bareiss") == 123
     assert M.det(method="berkowitz") == 123
 
     M = Matrix(( (x, y, z),
                  (1, 0, 0),
                  (y, z, x) ))
 
-    assert M.det(method="bareis") == z**2 - x*y
+    assert M.det(method="bareiss") == z**2 - x*y
     assert M.det(method="berkowitz") == z**2 - x*y
 
 
@@ -1807,7 +1807,7 @@ def test_errors():
     raises(NonSquareMatrixError, lambda: Matrix([1, 2]).det())
     raises(ValueError,
         lambda: Matrix([[1, 2], [3, 4]]).det(method='Not a real method'))
-    raises(NonSquareMatrixError, lambda: Matrix([1, 2]).det_bareis())
+    raises(NonSquareMatrixError, lambda: Matrix([1, 2]).det_bareiss())
     raises(NonSquareMatrixError, lambda: Matrix([1, 2]).berkowitz())
     raises(NonSquareMatrixError, lambda: Matrix([1, 2]).berkowitz_det())
     raises(ValueError,