1717 _two_site_workhorse ,
1818 _two_site_diagonal_workhorse ,
1919)
20+ from varipeps .expectation .triangular_helpers import (
21+ partially_traced_vertical_two_site_density_matrices_triangular ,
22+ partially_traced_horizontal_two_site_density_matrices_triangular ,
23+ partially_traced_diagonal_two_site_density_matrices_triangular ,
24+ )
2025from varipeps .expectation .triangular_one_site import calc_triangular_one_site
2126from varipeps .expectation .triangular_two_sites import (
2227 calc_triangular_two_sites_workhorse ,
@@ -2836,32 +2841,6 @@ def __call__(
28362841 self ._full_onsite_tuple ,
28372842 )
28382843
2839- horizontal_tensors_i = view .get_indices ((0 , slice (0 , 2 , None )))
2840- horizontal_tensors = [
2841- peps_tensors [i ] for j in horizontal_tensors_i for i in j
2842- ]
2843- horizontal_tensor_objs = [t for tl in view [0 , :2 ] for t in tl ]
2844- (
2845- density_matrix_left ,
2846- density_matrix_right ,
2847- ) = maple_leaf_triangular_ctmrg_density_matrix_horizontal (
2848- horizontal_tensors , horizontal_tensor_objs , ((2 , 3 ), (5 , 6 ))
2849- )
2850-
2851- if return_single_gate_results :
2852- step_result_horizontal = calc_triangular_two_sites_workhorse (
2853- density_matrix_left ,
2854- density_matrix_right ,
2855- working_h_gates + working_h_single_gates ,
2856- self ._result_type is jnp .float64 ,
2857- )
2858- else :
2859- step_result_horizontal = calc_triangular_two_sites_workhorse (
2860- density_matrix_left ,
2861- density_matrix_right ,
2862- working_h_gates ,
2863- self ._result_type is jnp .float64 ,
2864- )
28652844
28662845 vertical_tensors_i = view .get_indices ((slice (0 , 2 , None ), 0 ))
28672846 vertical_tensors = [
@@ -2871,8 +2850,8 @@ def __call__(
28712850 (
28722851 density_matrix_top ,
28732852 density_matrix_bottom ,
2874- ) = maple_leaf_triangular_ctmrg_density_matrix_vertical (
2875- vertical_tensors , vertical_tensor_objs , ((4 , 5 ), (1 , 2 ))
2853+ ) = partially_traced_vertical_two_site_density_matrices_triangular (
2854+ vertical_tensors , vertical_tensor_objs , 2 , 6 , ((4 , 5 ), (1 , 2 ))
28762855 )
28772856
28782857 if return_single_gate_results :
@@ -2890,6 +2869,35 @@ def __call__(
28902869 self ._result_type is jnp .float64 ,
28912870 )
28922871
2872+
2873+ horizontal_tensors_i = view .get_indices ((0 , slice (0 , 2 , None )))
2874+ horizontal_tensors = [
2875+ peps_tensors [i ] for j in horizontal_tensors_i for i in j
2876+ ]
2877+ horizontal_tensor_objs = [t for tl in view [0 , :2 ] for t in tl ]
2878+ (
2879+ density_matrix_left ,
2880+ density_matrix_right ,
2881+ ) = partially_traced_horizontal_two_site_density_matrices_triangular (
2882+ horizontal_tensors , horizontal_tensor_objs , 2 , 6 , ((2 , 3 ), (5 , 6 ))
2883+ )
2884+
2885+ if return_single_gate_results :
2886+ step_result_horizontal = calc_triangular_two_sites_workhorse (
2887+ density_matrix_left ,
2888+ density_matrix_right ,
2889+ working_h_gates + working_h_single_gates ,
2890+ self ._result_type is jnp .float64 ,
2891+ )
2892+ else :
2893+ step_result_horizontal = calc_triangular_two_sites_workhorse (
2894+ density_matrix_left ,
2895+ density_matrix_right ,
2896+ working_h_gates ,
2897+ self ._result_type is jnp .float64 ,
2898+ )
2899+
2900+
28932901 diagonal_tensors_i = view .get_indices (
28942902 (slice (0 , 2 , None ), slice (0 , 2 , None ))
28952903 )
@@ -2901,10 +2909,8 @@ def __call__(
29012909 (
29022910 density_matrix_top_left ,
29032911 density_matrix_bottom_right ,
2904- ) = maple_leaf_triangular_ctmrg_density_matrix_diagonal (
2905- diagonal_tensors ,
2906- diagonal_tensor_objs ,
2907- ((3 , 4 ), (1 , 6 )),
2912+ ) = partially_traced_diagonal_two_site_density_matrices_triangular (
2913+ diagonal_tensors , diagonal_tensor_objs , 2 , 6 , ((3 , 4 ), (1 , 6 ))
29082914 )
29092915
29102916 if return_single_gate_results :
0 commit comments