adpeps.utils.tlist

List object with additional features, used for storing the iPEPS tensors

Items in the list can be accessed by either a linear index or a (i,j) double index, where i and j will be automatically taken modulo the unit cell size (i.e. i = i % n_x)

Additionally, convenience functions that work on tensors can be defined for the whole list, e.g. conj()

cur_loc(*loc)[source]

Shift the locations of the tensors relative to a new zero (loc) while in this context

Parameters

loc (int) – shifts (x,y)

Example

>>> l = TList([[1,2], [3,4]])
>>> l[0,0]
1
>>> with cur_loc(1,0):
>>>     l[0,0]
2
>>>     l[0,1]
4
>>> l[0,0]
1

Note that this applies to ALL TList objects while inside the context

hold_write(*lists)[source]

Hold off on writing to the list while inside the context

Parameters

lists (adpeps.utils.tlist.TList) – one or more TList objects that should have the writing action delayed until the context is disabled

Example

>>> l = TList([[1,2], [3,4]])
>>> with hold_write(l):
>>>    l[0,0] = 100
>>>    l[0,0]
1
>>> l[0,0]
100
set_pattern(pattern)[source]

Set pattern for all new TLists that are created while the context is active

Parameters

pattern