@@ -3157,7 +3157,6 @@ class TestDeterminants(unittest2.TestCase):
31573157
31583158 def test_matrix_determinant (self ):
31593159 """Test the matrix_determinant function."""
3160-
31613160 test_ops = [
31623161 np .eye (3 ),
31633162 np .eye (10 , dtype = DTYPE ),
@@ -3208,7 +3207,6 @@ def test_diagonal_determinant(self):
32083207
32093208 def test_kronecker_determinant_simple (self ):
32103209 """Test determinants of Kronecker products of simple inputs."""
3211-
32123210 kron_classes = (
32133211 atmos_flux_inversion .linalg .DaskKroneckerProductOperator ,
32143212 atmos_flux_inversion .correlations .SchmidtKroneckerProduct ,
@@ -3259,25 +3257,46 @@ def test_kronecker_determinant_hard(self):
32593257 expected = la .det (np .kron (left , right ))
32603258 self .assertAlmostEqual (result , expected )
32613259
3262- def test_fourier_determinants (self ):
3263- """Test determinants of HomogeneousIsotropicCorrelation."""
3260+ def test_cyclic_fourier_determinants (self ):
3261+ """Test determinants of periodic HomogeneousIsotropicCorrelation."""
3262+ from_function = (atmos_flux_inversion .correlations .
3263+ HomogeneousIsotropicCorrelation .from_function )
3264+ test_dists = (.3 , 1 , 3 ,)
3265+ test_shapes = (10 , 15 , (4 , 5 ))
3266+
3267+ for test_dist , corr_class , shape in itertools .product (
3268+ test_dists ,
3269+ atmos_flux_inversion .correlations .
3270+ DistanceCorrelationFunction .__subclasses__ (),
3271+ test_shapes
3272+ ):
3273+ with self .subTest (test_dist = test_dist ,
3274+ corr_class = corr_class .__name__ ,
3275+ shape = shape ):
3276+ op = from_function (corr_class (test_dist ), shape ,
3277+ is_cyclic = True )
3278+ mat = op .dot (np .eye (* op .shape ))
3279+
3280+ self .assertAlmostEqual (op .det (), la .det (mat ), 6 )
3281+
3282+ def test_acyclic_fourier_determinants (self ):
3283+ """Test determinants of aperiodic HomogeneousIsotropicCorrelation."""
32643284 from_function = (atmos_flux_inversion .correlations .
32653285 HomogeneousIsotropicCorrelation .from_function )
32663286 test_dists = (.3 , 1 , 3 ,)
32673287 test_shapes = (10 , 15 , (4 , 5 ))
32683288
3269- for test_dist , corr_class , shape , is_cyclic in itertools .product (
3289+ for test_dist , corr_class , shape in itertools .product (
32703290 test_dists ,
32713291 atmos_flux_inversion .correlations .
32723292 DistanceCorrelationFunction .__subclasses__ (),
3273- test_shapes ,
3274- (True , False )
3293+ test_shapes
32753294 ):
32763295 with self .subTest (test_dist = test_dist ,
32773296 corr_class = corr_class .__name__ ,
3278- shape = shape ,
3279- is_cyclic = is_cyclic ):
3280- op = from_function ( corr_class ( test_dist ), shape , is_cyclic )
3297+ shape = shape ):
3298+ op = from_function ( corr_class ( test_dist ), shape ,
3299+ is_cyclic = False )
32813300 mat = op .dot (np .eye (* op .shape ))
32823301
32833302 self .assertAlmostEqual (op .det (), la .det (mat ), 4 )
0 commit comments