예제 #1
0
 def test_lazy_ptr_dot_mat_manybody_linear_op(self, psi_mb_abc,
                                              psi_mb_ab_mat):
     sysa = [0, 1, 2, 3, 7, 8, 9]
     rho_ab = psi_mb_abc.ptr(DIMS_MB, sysa)
     psi_out_expected = rho_ab @ psi_mb_ab_mat
     lo = lazy_ptr_linop(psi_mb_abc, DIMS_MB, sysa=sysa)
     psi_out_got = lo @ psi_mb_ab_mat
     assert_allclose(psi_out_expected, psi_out_got)
예제 #2
0
 def test_lazy_ptr_dot_simple_linear_op(self, psi_abc, psi_ab):
     rho_ab = psi_abc.ptr(DIMS, [0, 1])
     psi_out_expected = rho_ab @ psi_ab
     lo = lazy_ptr_linop(psi_abc, DIMS, [0, 1])
     assert hasattr(lo, "H")
     assert lo.dtype == complex
     assert lo.shape == (DIMS[0] * DIMS[1], DIMS[0] * DIMS[1])
     psi_out_got = lo @ psi_ab
     assert_allclose(psi_out_expected, psi_out_got)
예제 #3
0
 def test_approx_spectral_function_ptr_lin_op(self, fn_approx_rtol,
                                              psi_abc, psi_ab, bsz):
     fn, approx, rtol = fn_approx_rtol
     sysa = [0, 1]
     rho_ab = psi_abc.ptr(DIMS, sysa)
     actual_x = sum(fn(eigvalsh(rho_ab)))
     lo = lazy_ptr_linop(psi_abc, DIMS, sysa)
     approx_x = approx(lo, R=50, bsz=bsz, verbosity=2)
     assert_allclose(actual_x, approx_x, rtol=rtol)
예제 #4
0
 def test_lazy_ptr_dot_manybody_linear_op(self, psi_mb_abc, psi_mb_ab):
     sysa = [0, 1, 2, 3, 7, 8, 9]
     rho_ab = psi_mb_abc.ptr(DIMS_MB, sysa)
     psi_out_expected = rho_ab @ psi_mb_ab
     lo = lazy_ptr_linop(psi_mb_abc, DIMS_MB, sysa=sysa)
     assert hasattr(lo, "H")
     assert lo.dtype == complex
     assert lo.shape == (128, 128)
     psi_out_got = lo @ psi_mb_ab
     assert_allclose(psi_out_expected, psi_out_got)
예제 #5
0
 def test_lazy_ptr_dot_mat_simple_linear_op(self, psi_abc, psi_ab_mat):
     rho_ab = psi_abc.ptr(DIMS, [0, 1])
     psi_out_expected = rho_ab @ psi_ab_mat
     lo = lazy_ptr_linop(psi_abc, DIMS, [0, 1])
     psi_out_got = lo @ psi_ab_mat
     assert_allclose(psi_out_expected, psi_out_got)