From: Michael Orlitzky Date: Sun, 22 Nov 2020 15:23:02 +0000 (-0500) Subject: eja: add a test for invalid bilinear forms in BilinearFormEJA. X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=e0031c84e8b7d89071f052f44d1cf28b2370b161;p=sage.d.git eja: add a test for invalid bilinear forms in BilinearFormEJA. --- diff --git a/mjo/eja/eja_algebra.py b/mjo/eja/eja_algebra.py index 4cbc88e..8219c5b 100644 --- a/mjo/eja/eja_algebra.py +++ b/mjo/eja/eja_algebra.py @@ -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)]