Пример #1
0
 def test_dmd_complex128(self):
     m, n = 9, 7
     a = np.array(np.fliplr(np.vander(np.random.rand(m)+1, n)) + 1j*np.fliplr(np.vander(np.random.rand(m), n)), 
                  np.complex128, order='F')
     a_gpu = gpuarray.to_gpu(a)
     f_gpu, b_gpu, v_gpu, omega = linalg.dmd(a_gpu, modes='standard', return_amplitudes=True, return_vandermonde=True)
     assert np.allclose(a[:,:(n-1)], np.dot(f_gpu.get(), np.dot(np.diag(b_gpu.get()), v_gpu.get()) ), atol_float64)
Пример #2
0
 def test_cdmd_complex128(self):
     # Define time and space discretizations
     x = np.linspace(-5, 5, 50)
     t = np.linspace(0, 8 * np.pi, 20)
     dt = t[2] - t[1]
     X, T = np.meshgrid(x, t)
     # Create two patio-temporal patterns
     F1 = 0.5 * np.cos(X) * (1. + 0. * T)
     F2 = ((1. / np.cosh(X)) * np.tanh(X)) * (2. * np.exp(1j * 2.8 * T))
     D = F1 + F2
     a = np.array(D.real, np.complex128, order='F')
     a_gpu = gpuarray.to_gpu(a)
     dmdf_gpu, dmdb_gpu, dmdv_gpu, dmdomega = linalg.dmd(
         a_gpu,
         k=2,
         modes='exact',
         return_amplitudes=True,
         return_vandermonde=True)
     f_gpu, b_gpu, v_gpu, omega = rlinalg.cdmd(a_gpu,
                                               k=2,
                                               c=10,
                                               modes='exact',
                                               return_amplitudes=True,
                                               return_vandermonde=True)
     assert np.allclose(dmdomega.get().real, omega.get().real, atol_float64)
Пример #3
0
 def test_cdmd_complex128(self):
     # Define time and space discretizations
     x=np.linspace( -5, 5, 50)
     t=np.linspace(0, 8*np.pi , 20) 
     dt=t[2]-t[1]
     X, T = np.meshgrid(x,t)
     # Create two patio-temporal patterns
     F1 = 0.5* np.cos(X)*(1.+0.* T)
     F2 = ( (1./np.cosh(X)) * np.tanh(X)) *(2.*np.exp(1j*2.8*T))
     D = F1+F2
     a = np.array(D.real, np.complex128, order='F')
     a_gpu = gpuarray.to_gpu(a)
     dmdf_gpu, dmdb_gpu, dmdv_gpu, dmdomega = linalg.dmd(a_gpu, k=2, modes='exact', return_amplitudes=True, return_vandermonde=True)
     f_gpu, b_gpu, v_gpu, omega = rlinalg.cdmd(a_gpu, k=2, c=10, modes='exact', return_amplitudes=True, return_vandermonde=True)
     assert np.allclose(dmdomega.get().real, omega.get().real, atol_float64)