]> gitweb.michael.orlitzky.com - sage.d.git/commitdiff
eja: add a test for invalid bilinear forms in BilinearFormEJA.
authorMichael Orlitzky <michael@orlitzky.com>
Sun, 22 Nov 2020 15:23:02 +0000 (10:23 -0500)
committerMichael Orlitzky <michael@orlitzky.com>
Sun, 22 Nov 2020 15:23:02 +0000 (10:23 -0500)
mjo/eja/eja_algebra.py

index 4cbc88eb883d78bb5e85a9860b53330c9b980845..8219c5b4ff32b7acdb55de21aac53f657a11b20f 100644 (file)
@@ -2111,6 +2111,20 @@ class BilinearFormEJA(RationalBasisEuclideanJordanAlgebra):
         sage: J0.multiplication_table() == J0.multiplication_table()
         True
 
+    An error is raised if the matrix `B` does not correspond to a
+    positive-definite bilinear form::
+
+        sage: B = matrix.random(QQ,2,3)
+        sage: J = BilinearFormEJA(B)
+        Traceback (most recent call last):
+        ...
+        ValueError: bilinear form is not positive-definite
+        sage: B = matrix.zero(QQ,3)
+        sage: J = BilinearFormEJA(B)
+        Traceback (most recent call last):
+        ...
+        ValueError: bilinear form is not positive-definite
+
     TESTS:
 
     We can create a zero-dimensional algebra::
@@ -2151,7 +2165,7 @@ class BilinearFormEJA(RationalBasisEuclideanJordanAlgebra):
         n = B.nrows()
 
         if not B.is_positive_definite():
-            raise TypeError("matrix B is not positive-definite")
+            raise ValueError("bilinear form is not positive-definite")
 
         V = VectorSpace(field, n)
         mult_table = [[V.zero() for j in range(n)] for i in range(n)]