Skip to content

Commit 2862b88

Browse files
committed
Support parameters in other PEPS_Tensor classes as well
1 parent df04730 commit 2862b88

File tree

2 files changed

+22
-7
lines changed

2 files changed

+22
-7
lines changed

varipeps/peps/tensor.py

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1390,6 +1390,7 @@ def change_chi(
13901390
new_chi: int,
13911391
*,
13921392
reinitialize_env_as_identities: bool = True,
1393+
reset_max_chi: bool = False,
13931394
) -> T_PEPS_Tensor:
13941395
"""
13951396
Change the environment bond dimension and returns new object of the class.
@@ -1400,6 +1401,8 @@ def change_chi(
14001401
Keyword args:
14011402
reinitialize_env_as_identities (:obj:`bool`):
14021403
Reinitialize the CTM tensors as identities if decreasing the dimension.
1404+
reset_max_chi (:obj:`bool`):
1405+
Set maximal bond dimension to the same new value.
14031406
Returns:
14041407
:obj:`~varipeps.peps.PEPS_Tensor`:
14051408
New instance of the class with the increased value.
@@ -1409,6 +1412,8 @@ def change_chi(
14091412
"Increase above the max value for environment bond dimension."
14101413
)
14111414

1415+
new_max_chi = new_chi if reset_max_chi else self.max_chi
1416+
14121417
if new_chi < self.chi and reinitialize_env_as_identities:
14131418
return type(self)(
14141419
tensor=self.tensor,
@@ -1447,7 +1452,7 @@ def change_chi(
14471452
d=self.d,
14481453
D=self.D,
14491454
chi=new_chi,
1450-
max_chi=self.max_chi,
1455+
max_chi=new_max_chi,
14511456
)
14521457
else:
14531458
return type(self)(
@@ -1471,7 +1476,7 @@ def change_chi(
14711476
d=self.d,
14721477
D=self.D,
14731478
chi=new_chi,
1474-
max_chi=self.max_chi,
1479+
max_chi=new_max_chi,
14751480
)
14761481

14771482
def increase_max_chi(
@@ -2167,6 +2172,8 @@ def change_chi(
21672172
new_chi: int,
21682173
*,
21692174
reinitialize_env_as_identities: bool = True,
2175+
reset_max_chi: bool = False,
2176+
reset_interlayer_chi: bool = True,
21702177
) -> T_PEPS_Tensor_Split_Transfer:
21712178
"""
21722179
Change the environment bond dimension and returns new object of the class.
@@ -2177,6 +2184,10 @@ def change_chi(
21772184
Keyword args:
21782185
reinitialize_env_as_identities (:obj:`bool`):
21792186
Reinitialize the CTM tensors as identities if decreasing the dimension.
2187+
reset_max_chi (:obj:`bool`):
2188+
Set maximal bond dimension to the same new value.
2189+
reset_interlayer_chi (:obj:`bool`):
2190+
Set interlayer bond dimension to the same new value.
21802191
Returns:
21812192
:obj:`~peps_ad.peps.PEPS_Tensor_Split_Transfer`:
21822193
New instance of the class with the increased value.
@@ -2186,6 +2197,10 @@ def change_chi(
21862197
"Increase above the max value for environment bond dimension."
21872198
)
21882199

2200+
new_max_chi = new_chi if reset_max_chi else self.max_chi
2201+
2202+
new_interlayer_chi = new_chi if reset_interlayer_chi else self.interlayer_chi
2203+
21892204
if new_chi < self.chi and reinitialize_env_as_identities:
21902205
return type(self)(
21912206
tensor=self.tensor,
@@ -2208,8 +2223,8 @@ def change_chi(
22082223
d=self.d,
22092224
D=self.D,
22102225
chi=new_chi,
2211-
max_chi=self.max_chi,
2212-
interlayer_chi=self.interlayer_chi,
2226+
max_chi=new_max_chi,
2227+
interlayer_chi=new_interlayer_chi,
22132228
)
22142229
else:
22152230
return type(self)(
@@ -2229,8 +2244,8 @@ def change_chi(
22292244
d=self.d,
22302245
D=self.D,
22312246
chi=new_chi,
2232-
max_chi=self.max_chi,
2233-
interlayer_chi=self.interlayer_chi,
2247+
max_chi=new_max_chi,
2248+
interlayer_chi=new_interlayer_chi,
22342249
)
22352250

22362251
def increase_max_chi(

varipeps/peps/unitcell.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ def convert_to_split_transfer(
496496
)
497497

498498
def convert_to_full_transfer(
499-
self: T_PEPS_Unit_Cell, interlayer_chi: Optional[int] = None
499+
self: T_PEPS_Unit_Cell
500500
) -> T_PEPS_Unit_Cell:
501501
"""
502502
Convert the list of unique tensors to the full transfer ansatz.

0 commit comments

Comments
 (0)