コード例 #1
0
 def test_approx_spectral_function(self, fn_matrix_rtol, bsz, mpi):
     fn, matrix, rtol = fn_matrix_rtol
     a = matrix(2**7)
     pos = fn == np.sqrt
     actual_x = sum(fn(eigvalsh(a)))
     approx_x = approx_spectral_function(a, fn, mpi=mpi, pos=pos,
                                         bsz=bsz, verbosity=2)
     assert_allclose(actual_x, approx_x, rtol=rtol)
コード例 #2
0
 def test_approx_spectral_function_ptr_ppt_lin_op(self, fn_approx_rtol,
                                                  psi_abc, psi_ab, bsz):
     fn, approx, rtol = fn_approx_rtol
     rho_ab_ppt = partial_transpose(psi_abc.ptr(DIMS, [0, 1]), DIMS[:-1], 0)
     actual_x = sum(fn(eigvalsh(rho_ab_ppt)))
     lo = lazy_ptr_ppt_linop(psi_abc, DIMS, sysa=0, sysb=1)
     approx_x = approx_spectral_function(lo, fn, K=20, R=20, bsz=bsz)
     assert_allclose(actual_x, approx_x, rtol=rtol)
コード例 #3
0
ファイル: test_approx_spectral.py プロジェクト: caidish/quimb
 def test_approx_spectral_function_with_v0(self, fn_matrix_rtol, bsz):
     fn, matrix, rtol = fn_matrix_rtol
     a = matrix(2**7)
     actual_x = sum(fn(eigvals(a)))
     # check un-normalized state work properly
     v0 = (neel_state(7) + neel_state(7, down_first=True))
     v0 = v0.A.reshape(-1)
     pos = fn == np.sqrt
     approx_x = approx_spectral_function(a, fn, K=20, v0=v0, pos=pos,
                                         bsz=bsz)
     assert_allclose(actual_x, approx_x, rtol=rtol)