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.
FiniteMPShas a central site, also called orthogonality center. The position of this central site is stored inFiniteMPS.center_position, and it can be be shifted using theFiniteMPS.positionmethod.FiniteMPS.positionuses QR and RQ methods to shiftcenter_position.FiniteMPScan be initialized either from alistof tensors, or by calling the classmethodFiniteMPS.random.By default,
FiniteMPSis initialized in canonical form, i.e. the state is normalized, and all tensors to the left ofcenter_positionare left orthogonal, and all tensors to the right ofcenter_positionare right orthogonal. The tensor atFiniteMPS.center_positionis 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. IfcanonicalizeisTruethe state - is brought into canonical form, with
BaseMPS.center_positionatcenter_position. ifcenter_positionisNoneandcanonicalize = True,BaseMPS.center_positionis set to 0.
Parameters: - tensors – A list of
Tensorobjects. - center_position – The initial position of the center site.
- canonicalize – If
Truethe 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’
- Initialize a
Methods
__init__(tensors, center_position, …)Initialize a FiniteMPS. IfcanonicalizeisTruethe stateapply_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 Tensorobject atsite.left_envs(sites)Compute left reduced density matrices for site sites.measure_local_operator(ops, sites)Measure the expectation value of local operators opssitesites.measure_two_body_correlator(op1, op2, site1, …)Compute the correlator \(\langle\) op1[site1], op2[s]\(\rangle\) betweensite1and all sitessinsites2.position(site, normalize, D, max_truncation_err)Shift center_positiontosite.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_envsmapping sites (int) to Tensors.save(path)Attributes
bond_dimensionsA list of bond dimensions of BaseMPSdtypephysical_dimensionsA list of physical Hilbert-space dimensions of BaseMPS-
canonicalize(normalize: bool = True) → numpy.number¶ Bring the MPS into canonical form according to
center_position. Ifcenter_positionisNone, the MPS is canonicalized withcenter_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 dictleft_envsmapping sites (int) to Tensors.left_envs[site]is the left-reduced density matrix to the left of sitesite.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: dictmappinginttoTensor
-
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:
-
right_envs(sites: Sequence[int]) → Dict[KT, VT]¶ Compute right reduced density matrices for site
sites. This returns a dict `right_envsmapping sites (int) to Tensors.right_envs[site]is the right-reduced density matrix to the right of sitesite.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: dictmappinginttoTensor
-