示例#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)
示例#2
0
 def test_modes(self):
     a = POD('svd')
     a.reduce(snapshots)
     np.testing.assert_allclose(a.modes, modes)
示例#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)
示例#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)
示例#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)
示例#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)
示例#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
示例#8
0
 def test_truncation_07(self):
     a = POD(method='svd', rank=0.8)
     a.reduce(snapshots)
     assert a.singular_values.shape[0] == 1
示例#9
0
 def test_truncation_06(self):
     a = POD(method='correlation_matrix', rank=4)
     a.reduce(snapshots)
     assert a.singular_values.shape[0] == 4