tensornetwork.FiniteMPS

class tensornetwork.FiniteMPS(tensors: List[Any], center_position: Optional[int] = None, canonicalize: Optional[bool] = True, backend: Union[str, tensornetwork.backends.abstract_backend.AbstractBackend, None] = None)

An MPS class for finite systems.

MPS tensors are stored as a list. FiniteMPS has a central site, also called orthogonality center. The position of this central site is stored in FiniteMPS.center_position, and it can be be shifted using the FiniteMPS.position method. FiniteMPS.position uses QR and RQ methods to shift center_position.

FiniteMPS can be initialized either from a list of tensors, or by calling the classmethod FiniteMPS.random.

By default, FiniteMPS is initialized in canonical form, i.e. the state is normalized, and all tensors to the left of center_position are left orthogonal, and all tensors to the right of center_position are right orthogonal. The tensor at FiniteMPS.center_position is neither left nor right orthogonal.

Note that canonicalization can be computationally relatively costly and scales \(\propto ND^3\).

__init__(tensors: List[Any], center_position: Optional[int] = None, canonicalize: Optional[bool] = True, backend: Union[str, tensornetwork.backends.abstract_backend.AbstractBackend, None] = None) → None
Initialize a FiniteMPS. If canonicalize is True the state
is brought into canonical form, with BaseMPS.center_position at center_position. if center_position is None and canonicalize = True, BaseMPS.center_position is set to 0.
Parameters:
  • tensors – A list of Tensor objects.
  • center_position – The initial position of the center site.
  • canonicalize – If True the mps is canonicalized at initialization.
  • backend – The name of the backend that should be used to perform contractions. Available backends are currently ‘numpy’, ‘tensorflow’, ‘pytorch’, ‘jax’

Methods

__init__(tensors, center_position, …) Initialize a FiniteMPS. If canonicalize is True the state
apply_one_site_gate(gate, site) Apply a one-site gate to an MPS.
apply_transfer_operator(site, direction, …) Compute the action of the MPS transfer-operator at site site.
apply_two_site_gate(gate, site1, site2, …) Apply a two-site gate to an MPS.
canonicalize(normalize) Bring the MPS into canonical form according to center_position.
check_canonical() Check whether the MPS is in the expected canonical form.
check_orthonormality(which, site) Check orthonormality of tensor at site site.
get_tensor(site) Returns the Tensor object at site.
left_envs(sites) Compute left reduced density matrices for site sites.
measure_local_operator(ops, sites) Measure the expectation value of local operators ops site sites.
measure_two_body_correlator(op1, op2, site1, …) Compute the correlator \(\langle\) op1[site1], op2[s]\(\rangle\) between site1 and all sites s in sites2.
position(site, normalize, D, max_truncation_err) Shift center_position to site.
random(d, D, dtype, canonicalize, backend, …) Initialize a random FiniteMPS.
right_envs(sites) Compute right reduced density matrices for site sites.This returns a dict `right_envs mapping sites (int) to Tensors.
save(path)

Attributes

bond_dimensions A list of bond dimensions of BaseMPS
dtype
physical_dimensions A list of physical Hilbert-space dimensions of BaseMPS
canonicalize(normalize: bool = True) → numpy.number

Bring the MPS into canonical form according to center_position. If center_position is None, the MPS is canonicalized with center_position = 0.

Parameters:normalize – If True, normalize matrices when shifting the orthogonality center.
Returns:The norm of the MPS.
Return type:Tensor
check_canonical() → Any

Check whether the MPS is in the expected canonical form.

Returns:The L2 norm of the vector of local deviations.
left_envs(sites: Sequence[int]) → Dict[KT, VT]

Compute left reduced density matrices for site sites. This returns a dict left_envs mapping sites (int) to Tensors. left_envs[site] is the left-reduced density matrix to the left of site site.

Parameters:sites (list of int) – A list of sites of the MPS.
Returns:
The left-reduced density matrices
at each site in sites.
Return type:dict mapping int to Tensor
classmethod random(d: List[int], D: List[int], dtype: Type[numpy.number], canonicalize: bool = True, backend: Union[str, tensornetwork.backends.abstract_backend.AbstractBackend, None] = None) → tensornetwork.matrixproductstates.finite_mps.FiniteMPS

Initialize a random FiniteMPS. The resulting state is normalized. Its center-position is at 0.

Parameters:
  • d – A list of physical dimensions.
  • D – A list of bond dimensions.
  • dtype – A numpy dtype.
  • backend – An optional backend.
Returns:

FiniteMPS

right_envs(sites: Sequence[int]) → Dict[KT, VT]

Compute right reduced density matrices for site sites. This returns a dict `right_envs mapping sites (int) to Tensors. right_envs[site] is the right-reduced density matrix to the right of site site.

Parameters:sites (list of int) – A list of sites of the MPS.
Returns:
The right-reduced density matrices
at each site in sites.
Return type:dict mapping int to Tensor