@@ -1877,26 +1877,19 @@ def test_car_rng_fn(sparse):
1877
1877
assert p > delta
1878
1878
1879
1879
1880
- def test_posdef_symmetric1 ():
1881
- data = np .array ([[1.0 , 0 ], [0 , 1 ]], dtype = aesara .config .floatX )
1882
- assert posdef (data ) == 1
1883
-
1884
-
1885
- def test_posdef_symmetric2 ():
1886
- data = np .array ([[1.0 , 2 ], [2 , 1 ]], dtype = aesara .config .floatX )
1887
- assert posdef (data ) == 0
1888
-
1889
-
1890
- def test_posdef_symmetric3 ():
1891
- """The test return 0 if the matrix has 0 eigenvalue.
1880
+ @pytest .mark .parametrize (
1881
+ "matrix, result" ,
1882
+ [
1883
+ ([[1.0 , 0 ], [0 , 1 ]], 1 ),
1884
+ ([[1.0 , 2 ], [2 , 1 ]], 0 ),
1885
+ ([[1.0 , 1 ], [1 , 1 ]], 0 ),
1886
+ ([[1 , 0.99 , 1 ], [0.99 , 1 , 0.999 ], [1 , 0.999 , 1 ]], 0 ),
1887
+ ],
1888
+ )
1889
+ def test_posdef_symmetric (matrix , result ):
1890
+ """The test returns 0 if the matrix has 0 eigenvalue.
1892
1891
1893
1892
Is this correct?
1894
1893
"""
1895
- data = np .array ([[1.0 , 1 ], [1 , 1 ]], dtype = aesara .config .floatX )
1896
- assert posdef (data ) == 0
1897
-
1898
-
1899
- def test_posdef_symmetric4 ():
1900
- d = np .array ([[1 , 0.99 , 1 ], [0.99 , 1 , 0.999 ], [1 , 0.999 , 1 ]], aesara .config .floatX )
1901
-
1902
- assert posdef (d ) == 0
1894
+ data = np .array (matrix , dtype = aesara .config .floatX )
1895
+ assert posdef (data ) == result
0 commit comments