Skip to content

Commit 4ef210b

Browse files
committed
Run black over the code
1 parent 2979b09 commit 4ef210b

File tree

2 files changed

+40
-26
lines changed

2 files changed

+40
-26
lines changed

varipeps/expectation/triangular_helpers.py

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,10 @@ def partially_traced_vertical_two_site_density_matrices_triangular(
7474
"tensors": [["tensor", "tensor_conj", "T6a", "C1", "C2", "C3", "T3b"]],
7575
"network": [
7676
[
77-
(4, 5, 7, 13, -2 * len(top_i) - 2, 3) + phys_contraction_i_top, # tensor
78-
(9, 10, 11, 14, -2 * len(top_i) - 3, 8) + phys_contraction_i_conj_top, # tensor_conj
77+
(4, 5, 7, 13, -2 * len(top_i) - 2, 3)
78+
+ phys_contraction_i_top, # tensor
79+
(9, 10, 11, 14, -2 * len(top_i) - 3, 8)
80+
+ phys_contraction_i_conj_top, # tensor_conj
7981
(-2 * len(top_i) - 1, 3, 8, 1), # T6a
8082
(1, 4, 9, 2), # C1
8183
(2, 5, 10, 6), # C2
@@ -117,7 +119,8 @@ def partially_traced_vertical_two_site_density_matrices_triangular(
117119
"network": [
118120
[
119121
(13, -2, 3, 4, 5, 7) + phys_contraction_i_bottom, # tensor
120-
(14, -3, 8, 9, 10, 11) + phys_contraction_i_conj_bottom, # tensor_conj
122+
(14, -3, 8, 9, 10, 11)
123+
+ phys_contraction_i_conj_bottom, # tensor_conj
121124
(-4, 3, 8, 1), # T3a
122125
(1, 4, 9, 2), # C4
123126
(2, 5, 10, 6), # C5
@@ -256,8 +259,10 @@ def partially_traced_horizontal_two_site_density_matrices_triangular(
256259
"tensors": [["tensor", "tensor_conj", "T4a", "C5", "C6", "C1", "T1b"]],
257260
"network": [
258261
[
259-
(7, 13, -2 * len(left_i) - 2, 3, 4, 5) + phys_contraction_i_left, # tensor
260-
(11, 14, -2 * len(left_i) - 3, 8, 9, 10) + phys_contraction_i_conj_left, # tensor_conj
262+
(7, 13, -2 * len(left_i) - 2, 3, 4, 5)
263+
+ phys_contraction_i_left, # tensor
264+
(11, 14, -2 * len(left_i) - 3, 8, 9, 10)
265+
+ phys_contraction_i_conj_left, # tensor_conj
261266
(-2 * len(left_i) - 4, 3, 8, 1), # T4a
262267
(1, 4, 9, 2), # C5
263268
(2, 5, 10, 6), # C6
@@ -299,7 +304,8 @@ def partially_traced_horizontal_two_site_density_matrices_triangular(
299304
"network": [
300305
[
301306
(3, 4, 5, 7, 13, -2) + phys_contraction_i_right, # tensor
302-
(8, 9, 10, 11, 14, -3) + phys_contraction_i_conj_right, # tensor_conj
307+
(8, 9, 10, 11, 14, -3)
308+
+ phys_contraction_i_conj_right, # tensor_conj
303309
(-1, 3, 8, 1), # T1a
304310
(1, 4, 9, 2), # C2
305311
(2, 5, 10, 6), # C3
@@ -438,8 +444,10 @@ def partially_traced_diagonal_two_site_density_matrices_triangular(
438444
"tensors": [["tensor", "tensor_conj", "T5a", "C6", "C1", "C2", "T2b"]],
439445
"network": [
440446
[
441-
(5, 7, 13, -2 * len(top_i) - 2, 3, 4) + phys_contraction_i_top, # tensor
442-
(10, 11, 14, -2 * len(top_i) - 3, 8, 9) + phys_contraction_i_conj_top, # tensor_conj
447+
(5, 7, 13, -2 * len(top_i) - 2, 3, 4)
448+
+ phys_contraction_i_top, # tensor
449+
(10, 11, 14, -2 * len(top_i) - 3, 8, 9)
450+
+ phys_contraction_i_conj_top, # tensor_conj
443451
(-2 * len(top_i) - 1, 3, 8, 1), # T5a
444452
(1, 4, 9, 2), # C6
445453
(2, 5, 10, 6), # C1
@@ -481,7 +489,8 @@ def partially_traced_diagonal_two_site_density_matrices_triangular(
481489
"network": [
482490
[
483491
(-2, 3, 4, 5, 7, 13) + phys_contraction_i_bottom, # tensor
484-
(-3, 8, 9, 10, 11, 14) + phys_contraction_i_conj_bottom, # tensor_conj
492+
(-3, 8, 9, 10, 11, 14)
493+
+ phys_contraction_i_conj_bottom, # tensor_conj
485494
(-4, 3, 8, 1), # T2a
486495
(1, 4, 9, 2), # C3
487496
(2, 5, 10, 6), # C4

varipeps/mapping/maple_leaf.py

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ def get_onsite_gates(g_e, b_e, r_e, d):
256256
red_45,
257257
)
258258

259+
259260
def get_onsite_gates_hexagon(b_e, d):
260261
Id_other_sites = jnp.eye(d**4)
261262

@@ -343,6 +344,7 @@ def _calc_onsite_gate(
343344

344345
return result, single_gates
345346

347+
346348
@partial(jit, static_argnums=(1, 2))
347349
def _calc_onsite_gate_hexagon(
348350
blue_gates: Sequence[jnp.ndarray],
@@ -353,9 +355,7 @@ def _calc_onsite_gate_hexagon(
353355

354356
single_gates = [None] * result_length
355357

356-
for i, (b_e, ) in enumerate(
357-
zip(blue_gates, strict=True)
358-
):
358+
for i, (b_e,) in enumerate(zip(blue_gates, strict=True)):
359359
(
360360
blue_12,
361361
blue_23,
@@ -365,14 +365,7 @@ def _calc_onsite_gate_hexagon(
365365
blue_61,
366366
) = get_onsite_gates_hexagon(b_e, d)
367367

368-
result[i] = (
369-
blue_12 +
370-
blue_23 +
371-
blue_34 +
372-
blue_45 +
373-
blue_56 +
374-
blue_61
375-
)
368+
result[i] = blue_12 + blue_23 + blue_34 + blue_45 + blue_56 + blue_61
376369

377370
single_gates[i] = (
378371
blue_12,
@@ -398,6 +391,7 @@ def get_right_gates(b_e, r_e, d):
398391

399392
return red_61, blue_62
400393

394+
401395
def get_right_gates_hexagon(r_e, g_e, d):
402396
Id_other_site = jnp.eye(d**2)
403397

@@ -439,6 +433,7 @@ def _calc_right_gate(
439433

440434
return result, single_gates
441435

436+
442437
@partial(jit, static_argnums=(2, 3))
443438
def _calc_right_gate_hexagon(
444439
red_gates: Sequence[jnp.ndarray],
@@ -468,6 +463,7 @@ def get_down_gates(b_e, r_e, d):
468463

469464
return blue_35, red_36
470465

466+
471467
def get_down_gates_hexagon(r_e, g_e, d):
472468
Id_other_site = jnp.eye(d**2)
473469

@@ -509,6 +505,7 @@ def _calc_down_gate(
509505

510506
return result, single_gates
511507

508+
512509
@partial(jit, static_argnums=(2, 3))
513510
def _calc_down_gate_hexagon(
514511
red_gates: Sequence[jnp.ndarray],
@@ -538,6 +535,7 @@ def get_diagonal_gates(b_e, r_e, d):
538535

539536
return blue_41, red_31
540537

538+
541539
def get_diagonal_gates_hexagon(r_e, g_e, d):
542540
Id_other_site = jnp.eye(d**2)
543541

@@ -579,6 +577,7 @@ def _calc_diagonal_gate(
579577

580578
return result, single_gates
581579

580+
582581
@partial(jit, static_argnums=(2, 3))
583582
def _calc_diagonal_gate_hexagon(
584583
red_gates: Sequence[jnp.ndarray],
@@ -1881,7 +1880,11 @@ def __call__(
18811880
density_matrix_top_left,
18821881
density_matrix_bottom_right,
18831882
) = partially_traced_diagonal_two_site_density_matrices_triangular(
1884-
diagonal_tensors, diagonal_tensor_objs, 2, 6, ((3, 4), (1,)),
1883+
diagonal_tensors,
1884+
diagonal_tensor_objs,
1885+
2,
1886+
6,
1887+
((3, 4), (1,)),
18851888
)
18861889

18871890
if return_single_gate_results:
@@ -2064,6 +2067,7 @@ def load_from_group(cls, grp: h5py.Group):
20642067
spiral_unitary_operator=spiral_unitary_operator,
20652068
)
20662069

2070+
20672071
@dataclass
20682072
class Maple_Leaf_Hexagon_Triangular_CTMRG_Expectation_Value(Expectation_Model):
20692073
"""
@@ -2316,7 +2320,6 @@ def __call__(
23162320
self._full_onsite_tuple,
23172321
)
23182322

2319-
23202323
vertical_tensors_i = view.get_indices((slice(0, 2, None), 0))
23212324
vertical_tensors = [
23222325
peps_tensors[i] for j in vertical_tensors_i for i in j
@@ -2344,7 +2347,6 @@ def __call__(
23442347
self._result_type is jnp.float64,
23452348
)
23462349

2347-
23482350
horizontal_tensors_i = view.get_indices((0, slice(0, 2, None)))
23492351
horizontal_tensors = [
23502352
peps_tensors[i] for j in horizontal_tensors_i for i in j
@@ -2354,7 +2356,11 @@ def __call__(
23542356
density_matrix_left,
23552357
density_matrix_right,
23562358
) = partially_traced_horizontal_two_site_density_matrices_triangular(
2357-
horizontal_tensors, horizontal_tensor_objs, 2, 6, ((2, 3), (5, 6))
2359+
horizontal_tensors,
2360+
horizontal_tensor_objs,
2361+
2,
2362+
6,
2363+
((2, 3), (5, 6)),
23582364
)
23592365

23602366
if return_single_gate_results:
@@ -2372,7 +2378,6 @@ def __call__(
23722378
self._result_type is jnp.float64,
23732379
)
23742380

2375-
23762381
diagonal_tensors_i = view.get_indices(
23772382
(slice(0, 2, None), slice(0, 2, None))
23782383
)
@@ -2566,4 +2571,4 @@ def load_from_group(cls, grp: h5py.Group):
25662571
normalization_factor=grp.attrs["normalization_factor"],
25672572
is_spiral_peps=is_spiral_peps,
25682573
spiral_unitary_operator=spiral_unitary_operator,
2569-
)
2574+
)

0 commit comments

Comments
 (0)