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:
objectClass to model a single a PEPS tensor with the corresponding CTM tensors.
- Parameters:
tensor (
numpy.ndarrayorjax.numpy.ndarray) – PEPS tensorC1 (
numpy.ndarrayorjax.numpy.ndarray) – C1 tensorC2 (
numpy.ndarrayorjax.numpy.ndarray) – C2 tensorC3 (
numpy.ndarrayorjax.numpy.ndarray) – C3 tensorC4 (
numpy.ndarrayorjax.numpy.ndarray) – C4 tensorT1 (
numpy.ndarrayorjax.numpy.ndarray) – T1 tensorT2 (
numpy.ndarrayorjax.numpy.ndarray) – T2 tensorT3 (
numpy.ndarrayorjax.numpy.ndarray) – T3 tensorT4 (
numpy.ndarrayorjax.numpy.ndarray) – T4 tensord (
int) – Physical dimension of the PEPS tensorD (sequence of
int) – Sequence of the bond dimensions of the PEPS tensorchi (
int) – Bond dimension for the CTM tensorsmax_chi (
int) – Maximal allowed bond dimension of environment tensors.
- __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:
- 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:
- 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.ndarrayorjax.numpy.ndarray) – PEPS tensor to initialize the object withd (
int) – Physical dimensionD (
intor sequence ofint) – Bond dimensions for the PEPS tensorchi (
int) – Bond dimension for the environment tensorsmax_chi (
int, optional) – Maximal allowed bond dimension for the environment tensorsDefault: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:Truenormalize (
bool, optional) – Flag if the generated tensors are normalized. Defaults to True.Default:Trueseed (
int, optional) – Seed for the random number generator.Default:Nonebackend (
str, optional) – Backend for the generated tensors (may bejaxornumpy). Defaults tojax.Default:'jax'- Returns:
Instance of PEPS_Tensor with the randomly initialized tensors.
- Return type:
- 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:
- 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.
- 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 dimensionD (
intor sequence ofint) – Bond dimensions for the PEPS tensorchi (
int) – Bond dimension for the environment tensorsdtype (
numpy.dtypeorjax.numpy.dtype) – Dtype of the generated tensorsmax_chi (
int, optional) – Maximal allowed bond dimension for the environment tensorsDefault: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:Truenormalize (
bool, optional) – Flag if the generated tensors are normalized. Defaults to True.Default:Trueseed (
int, optional) – Seed for the random number generator.Default:Nonebackend (
str, optional) – Backend for the generated tensors (may bejaxornumpy). Defaults tojax.Default:'jax'- Returns:
Instance of PEPS_Tensor with the randomly initialized tensors.
- Return type:
- replace_C1(new_C1: ndarray | Array) PEPS_Tensor[source]
Replace the C1 and returns new object of the class.
- Parameters:
new_C1 (
numpy.ndarrayorjax.numpy.ndarray) – New C1 tensor.- Returns:
New instance of the class with the tensors replaced.
- Return type:
- 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:
new_C1 (
numpy.ndarrayorjax.numpy.ndarray) – New C1 tensor.new_C3 (
numpy.ndarrayorjax.numpy.ndarray) – New C4 tensor.
- Returns:
New instance of the class with the tensors replaced.
- Return type:
- replace_C2(new_C2: ndarray | Array) PEPS_Tensor[source]
Replace the C2 and returns new object of the class.
- Parameters:
new_C2 (
numpy.ndarrayorjax.numpy.ndarray) – New C2 tensor.- Returns:
New instance of the class with the tensors replaced.
- Return type:
- replace_C3(new_C3: ndarray | Array) PEPS_Tensor[source]
Replace the C3 and returns new object of the class.
- Parameters:
new_C3 (
numpy.ndarrayorjax.numpy.ndarray) – New C3 tensor.- Returns:
New instance of the class with the tensors replaced.
- Return type:
- replace_C4(new_C4: ndarray | Array) PEPS_Tensor[source]
Replace the C4 and returns new object of the class.
- Parameters:
new_C4 (
numpy.ndarrayorjax.numpy.ndarray) – New C4 tensor.- Returns:
New instance of the class with the tensors replaced.
- Return type:
- replace_T1(new_T1: ndarray | Array) PEPS_Tensor[source]
Replace the T1 and returns new object of the class.
- Parameters:
new_T1 (
numpy.ndarrayorjax.numpy.ndarray) – New T1 tensor.- Returns:
New instance of the class with the tensors replaced.
- Return type:
- 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:
new_T1 (
numpy.ndarrayorjax.numpy.ndarray) – New T1 tensor.new_C2 (
numpy.ndarrayorjax.numpy.ndarray) – New C2 tensor.new_T2 (
numpy.ndarrayorjax.numpy.ndarray) – New T2 tensor.new_T3 (
numpy.ndarrayorjax.numpy.ndarray) – New T3 tensor.new_C4 (
numpy.ndarrayorjax.numpy.ndarray) – New C4 tensor.new_T4 (
numpy.ndarrayorjax.numpy.ndarray) – New T4 tensor.
- Returns:
New instance of the class with the tensors replaced.
- Return type:
- replace_T2(new_T2: ndarray | Array) PEPS_Tensor[source]
Replace the T2 and returns new object of the class.
- Parameters:
new_T2 (
numpy.ndarrayorjax.numpy.ndarray) – New T2 tensor.- Returns:
New instance of the class with the tensors replaced.
- Return type:
- replace_T3(new_T3: ndarray | Array) PEPS_Tensor[source]
Replace the T3 and returns new object of the class.
- Parameters:
new_T3 (
numpy.ndarrayorjax.numpy.ndarray) – New T3 tensor.- Returns:
New instance of the class with the tensors replaced.
- Return type:
- replace_T4(new_T4: ndarray | Array) PEPS_Tensor[source]
Replace the T4 and returns new object of the class.
- Parameters:
new_T4 (
numpy.ndarrayorjax.numpy.ndarray) – New T4 tensor.- Returns:
New instance of the class with the tensors replaced.
- Return type:
- 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:
new_C4 (
numpy.ndarrayorjax.numpy.ndarray) – New C4 tensor.new_T3 (
numpy.ndarrayorjax.numpy.ndarray) – New T3 tensor.new_C3 (
numpy.ndarrayorjax.numpy.ndarray) – New C3 tensor.
- Returns:
New instance of the class with the tensors replaced.
- Return type:
- 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:
new_C1 (
numpy.ndarrayorjax.numpy.ndarray) – New C1 tensor.new_T4 (
numpy.ndarrayorjax.numpy.ndarray) – New T4 tensor.new_C4 (
numpy.ndarrayorjax.numpy.ndarray) – New C4 tensor.
- Returns:
New instance of the class with the tensors replaced.
- Return type:
- 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:
new_C2 (
numpy.ndarrayorjax.numpy.ndarray) – New C2 tensor.new_T2 (
numpy.ndarrayorjax.numpy.ndarray) – New T2 tensor.new_C3 (
numpy.ndarrayorjax.numpy.ndarray) – New C3 tensor.
- Returns:
New instance of the class with the tensors replaced.
- Return type:
- 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.ndarrayorjax.numpy.ndarray) – New PEPS tensor.- Keyword Arguments:
reinitialize_env_as_identities (
bool, optional) – Reinitialize the CTM tensors as identities.Default:Truenew_D (
tupleof fourint, optional) – Tuple of new iPEPS bond dimensions if tensor has changed dimensionsDefault:None- Returns:
New instance of the class with the tensor replaced.
- Return type:
- 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:
new_C1 (
numpy.ndarrayorjax.numpy.ndarray) – New C1 tensor.new_T1 (
numpy.ndarrayorjax.numpy.ndarray) – New T1 tensor.new_C2 (
numpy.ndarrayorjax.numpy.ndarray) – New C2 tensor.
- Returns:
New instance of the class with the tensors replaced.
- Return type:
- 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.
- 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:
- zeros_like_self() PEPS_Tensor[source]
Wrapper around
zeros_likewith the self object as argument. For details see there.