From e0031c84e8b7d89071f052f44d1cf28b2370b161 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sun, 22 Nov 2020 10:23:02 -0500 Subject: [PATCH] eja: add a test for invalid bilinear forms in BilinearFormEJA. --- mjo/eja/eja_algebra.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) 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)] -- 2.44.2