Single PEPS tensor (varipeps.peps.PEPS_Tensor)

class varipeps.peps.PEPS_Tensor(tensor: ndarray | Array, C1: ndarray | Array, C2: ndarray | Array, C3: ndarray | Array, C4: ndarray | Array, T1: ndarray | Array, T2: ndarray | Array, T3: ndarray | Array, T4: ndarray | Array, d: int, D: Tuple[int, int, int, int], chi: int, max_chi: int, sanity_checks: bool = True)[source]

Bases: object

Class to model a single a PEPS tensor with the corresponding CTM tensors.

Parameters:
C1: ndarray | Array
C2: ndarray | Array
C3: ndarray | Array
C4: ndarray | Array
D: Tuple[int, int, int, int]
T1: ndarray | Array
T2: ndarray | Array
T3: ndarray | Array
T4: ndarray | Array
__add__(other: PEPS_Tensor, *, checks: bool = True) PEPS_Tensor[source]

Add the environment tensors of two PEPS tensors.

Parameters:

other (PEPS_Tensor) – Other PEPS tensor object which should be added to this one.

Keyword Arguments:

checks (bool, optional) – Enable checks that the addition of the two tensor objects makes sense. Maybe disabled for jax transformations.

Default: True

Returns:

New instance with the added env tensors.

Return type:

PEPS_Tensor

change_chi(new_chi: int, *, reinitialize_env_as_identities: bool = True) PEPS_Tensor[source]

Change the environment bond dimension and returns new object of the class.

Parameters:

new_chi (int) – New value for environment bond dimension.

Keyword Arguments:

reinitialize_env_as_identities (bool, optional) – Reinitialize the CTM tensors as identities if decreasing the dimension.

Default: True

Returns:

New instance of the class with the increased value.

Return type:

PEPS_Tensor

chi: int
d: int
classmethod from_tensor(tensor: ndarray | Array, d: int, D: int | Sequence[int], chi: int, max_chi: int | None = None, *, ctm_tensors_are_identities: bool = True, normalize: bool = True, seed: int | None = None, backend: str = 'jax') PEPS_Tensor[source]

Initialize a PEPS tensor object with a given tensor and new CTM tensors.

Parameters:
  • tensor (numpy.ndarray or jax.numpy.ndarray) – PEPS tensor to initialize the object with

  • d (int) – Physical dimension

  • D (int or sequence of int) – Bond dimensions for the PEPS tensor

  • chi (int) – Bond dimension for the environment tensors

  • max_chi (int, optional) – Maximal allowed bond dimension for the environment tensors

    Default: None

Keyword Arguments:
  • ctm_tensors_are_identities (bool, optional) – Flag if the CTM tensors are initialized as identities. Otherwise, they are initialized randomly. Defaults to True.

    Default: True

  • normalize (bool, optional) – Flag if the generated tensors are normalized. Defaults to True.

    Default: True

  • seed (int, optional) – Seed for the random number generator.

    Default: None

  • backend (str, optional) – Backend for the generated tensors (may be jax or numpy). Defaults to jax.

    Default: 'jax'

Returns:

Instance of PEPS_Tensor with the randomly initialized tensors.

Return type:

PEPS_Tensor

increase_max_chi(new_max_chi: int) PEPS_Tensor[source]

Change the maximal environment bond dimension and returns new object of the class.

Parameters:

new_max_chi (int) – New value for maximal environment bond dimension.

Returns:

New instance of the class with the increased value.

Return type:

PEPS_Tensor

classmethod load_from_group(grp: Group) PEPS_Tensor[source]

Load the PEPS tensor from a HDF5 group.

Parameters:

grp (h5py.Group) – HDF5 group object to load the data from.

max_chi: int
classmethod random(d: int, D: int | Sequence[int], chi: int, dtype: Type[number], max_chi: int | None = None, *, ctm_tensors_are_identities: bool = True, normalize: bool = True, seed: int | None = None, backend: str = 'jax') PEPS_Tensor[source]

Randomly initialize a PEPS tensor with CTM tensors.

Parameters:
  • d (int) – Physical dimension

  • D (int or sequence of int) – Bond dimensions for the PEPS tensor

  • chi (int) – Bond dimension for the environment tensors

  • dtype (numpy.dtype or jax.numpy.dtype) – Dtype of the generated tensors

  • max_chi (int, optional) – Maximal allowed bond dimension for the environment tensors

    Default: None

Keyword Arguments:
  • ctm_tensors_are_identities (bool, optional) – Flag if the CTM tensors are initialized as identities. Otherwise, they are initialized randomly. Defaults to True.

    Default: True

  • normalize (bool, optional) – Flag if the generated tensors are normalized. Defaults to True.

    Default: True

  • seed (int, optional) – Seed for the random number generator.

    Default: None

  • backend (str, optional) – Backend for the generated tensors (may be jax or numpy). Defaults to jax.

    Default: 'jax'

Returns:

Instance of PEPS_Tensor with the randomly initialized tensors.

Return type:

PEPS_Tensor

replace_C1(new_C1: ndarray | Array) PEPS_Tensor[source]

Replace the C1 and returns new object of the class.

Parameters:

new_C1 (numpy.ndarray or jax.numpy.ndarray) – New C1 tensor.

Returns:

New instance of the class with the tensors replaced.

Return type:

PEPS_Tensor

replace_C1_C3(new_C1: ndarray | Array, new_C3: ndarray | Array) PEPS_Tensor[source]

Replace C1 and C3 tensors and returns new object of the class.

Parameters:
Returns:

New instance of the class with the tensors replaced.

Return type:

PEPS_Tensor

replace_C2(new_C2: ndarray | Array) PEPS_Tensor[source]

Replace the C2 and returns new object of the class.

Parameters:

new_C2 (numpy.ndarray or jax.numpy.ndarray) – New C2 tensor.

Returns:

New instance of the class with the tensors replaced.

Return type:

PEPS_Tensor

replace_C3(new_C3: ndarray | Array) PEPS_Tensor[source]

Replace the C3 and returns new object of the class.

Parameters:

new_C3 (numpy.ndarray or jax.numpy.ndarray) – New C3 tensor.

Returns:

New instance of the class with the tensors replaced.

Return type:

PEPS_Tensor

replace_C4(new_C4: ndarray | Array) PEPS_Tensor[source]

Replace the C4 and returns new object of the class.

Parameters:

new_C4 (numpy.ndarray or jax.numpy.ndarray) – New C4 tensor.

Returns:

New instance of the class with the tensors replaced.

Return type:

PEPS_Tensor

replace_T1(new_T1: ndarray | Array) PEPS_Tensor[source]

Replace the T1 and returns new object of the class.

Parameters:

new_T1 (numpy.ndarray or jax.numpy.ndarray) – New T1 tensor.

Returns:

New instance of the class with the tensors replaced.

Return type:

PEPS_Tensor

replace_T1_C2_T2_T3_C4_T4(new_T1: ndarray | Array, new_C2: ndarray | Array, new_T2: ndarray | Array, new_T3: ndarray | Array, new_C4: ndarray | Array, new_T4: ndarray | Array) PEPS_Tensor[source]

Replace all but C1 and C3 tensors and returns new object of the class.

Parameters:
Returns:

New instance of the class with the tensors replaced.

Return type:

PEPS_Tensor

replace_T2(new_T2: ndarray | Array) PEPS_Tensor[source]

Replace the T2 and returns new object of the class.

Parameters:

new_T2 (numpy.ndarray or jax.numpy.ndarray) – New T2 tensor.

Returns:

New instance of the class with the tensors replaced.

Return type:

PEPS_Tensor

replace_T3(new_T3: ndarray | Array) PEPS_Tensor[source]

Replace the T3 and returns new object of the class.

Parameters:

new_T3 (numpy.ndarray or jax.numpy.ndarray) – New T3 tensor.

Returns:

New instance of the class with the tensors replaced.

Return type:

PEPS_Tensor

replace_T4(new_T4: ndarray | Array) PEPS_Tensor[source]

Replace the T4 and returns new object of the class.

Parameters:

new_T4 (numpy.ndarray or jax.numpy.ndarray) – New T4 tensor.

Returns:

New instance of the class with the tensors replaced.

Return type:

PEPS_Tensor

replace_bottom_env_tensors(new_C4: ndarray | Array, new_T3: ndarray | Array, new_C3: ndarray | Array) PEPS_Tensor[source]

Replace the bottom CTMRG tensors and returns new object of the class.

Parameters:
Returns:

New instance of the class with the tensors replaced.

Return type:

PEPS_Tensor

replace_left_env_tensors(new_C1: ndarray | Array, new_T4: ndarray | Array, new_C4: ndarray | Array) PEPS_Tensor[source]

Replace the left CTMRG tensors and returns new object of the class.

Parameters:
Returns:

New instance of the class with the tensors replaced.

Return type:

PEPS_Tensor

replace_right_env_tensors(new_C2: ndarray | Array, new_T2: ndarray | Array, new_C3: ndarray | Array) PEPS_Tensor[source]

Replace the right CTMRG tensors and returns new object of the class.

Parameters:
Returns:

New instance of the class with the tensors replaced.

Return type:

PEPS_Tensor

replace_tensor(new_tensor: ndarray | Array, *, reinitialize_env_as_identities: bool = True, new_D: Tuple[int, int, int, int] | None = None) PEPS_Tensor[source]

Replace the PEPS tensor and returns new object of the class.

Parameters:

new_tensor (numpy.ndarray or jax.numpy.ndarray) – New PEPS tensor.

Keyword Arguments:
  • reinitialize_env_as_identities (bool, optional) – Reinitialize the CTM tensors as identities.

    Default: True

  • new_D (tuple of four int, optional) – Tuple of new iPEPS bond dimensions if tensor has changed dimensions

    Default: None

Returns:

New instance of the class with the tensor replaced.

Return type:

PEPS_Tensor

replace_top_env_tensors(new_C1: ndarray | Array, new_T1: ndarray | Array, new_C2: ndarray | Array) PEPS_Tensor[source]

Replace the top CTMRG tensors and returns new object of the class.

Parameters:
Returns:

New instance of the class with the tensors replaced.

Return type:

PEPS_Tensor

sanity_checks: bool = True
save_to_group(grp: Group) None[source]

Store the PEPS tensor into a HDF5 group.

Parameters:

grp (h5py.Group) – HDF5 group object to save the data into.

tensor: ndarray | Array
tree_flatten() Tuple[Tuple[Any, ...], Tuple[Any, ...]][source]
classmethod tree_unflatten(aux_data: Tuple[Any, ...], children: Tuple[Any, ...]) PEPS_Tensor[source]
classmethod zeros_like(t: PEPS_Tensor) PEPS_Tensor[source]

Create a PEPS tensor with same shape as another one but with zeros everywhere.

Parameters:

t (PEPS_Tensor) – Other PEPS tensor object whose shape should be copied.

Returns:

New instance with the zero initialized tensors.

Return type:

PEPS_Tensor

zeros_like_self() PEPS_Tensor[source]

Wrapper around zeros_like with the self object as argument. For details see there.