Ejemplo n.º 1
0
 def test_singlular_values(self):
     a = POD('svd')
     a.reduce(snapshots)
     np.testing.assert_allclose(
         a.singular_values,
         np.array([887.15704, 183.2508, 84.11757, 26.40448]),
         rtol=1e-6,
         atol=1e-8)
Ejemplo n.º 2
0
 def test_modes(self):
     a = POD('svd')
     a.reduce(snapshots)
     np.testing.assert_allclose(a.modes, modes)
Ejemplo n.º 3
0
 def test_correlation_matirix_savemem_old(self):
     pod = POD('correlation_matrix', save_memory=True).fit(snapshots)
     snapshots_ = pod.expand(pod.reduce(snapshots))
     np.testing.assert_array_almost_equal(snapshots, snapshots_, decimal=4)
Ejemplo n.º 4
0
 def test_randomized_svd_old(self):
     pod = POD('randomized_svd', save_memory=False).fit(snapshots)
     snapshots_ = pod.expand(pod.reduce(snapshots))
     np.testing.assert_array_almost_equal(snapshots, snapshots_, decimal=4)
Ejemplo n.º 5
0
 def test_correlation_matrix_old(self):
     pod = POD('correlation_matrix').fit(snapshots)
     snapshots_ = pod.expand(pod.reduce(snapshots))
     np.testing.assert_array_almost_equal(snapshots, snapshots_, decimal=3)
Ejemplo n.º 6
0
 def test_numpysvd_old(self):
     pod = POD('svd').fit(snapshots)
     snapshots_ = pod.expand(pod.reduce(snapshots))
     np.testing.assert_array_almost_equal(snapshots, snapshots_, decimal=4)
Ejemplo n.º 7
0
 def test_truncation_08(self):
     a = POD(method='randomized_svd', rank=0.995)
     a.reduce(snapshots)
     assert a.singular_values.shape[0] == 3
Ejemplo n.º 8
0
 def test_truncation_07(self):
     a = POD(method='svd', rank=0.8)
     a.reduce(snapshots)
     assert a.singular_values.shape[0] == 1
Ejemplo n.º 9
0
 def test_truncation_06(self):
     a = POD(method='correlation_matrix', rank=4)
     a.reduce(snapshots)
     assert a.singular_values.shape[0] == 4