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 inFiniteMPS.center_position
, and it can be be shifted using theFiniteMPS.position
method.FiniteMPS.position
uses QR and RQ methods to shiftcenter_position
.FiniteMPS
can be initialized either from alist
of tensors, or by calling the classmethodFiniteMPS.random
.By default,
FiniteMPS
is initialized in canonical form, i.e. the state is normalized, and all tensors to the left ofcenter_position
are left orthogonal, and all tensors to the right ofcenter_position
are right orthogonal. The tensor atFiniteMPS.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
. Ifcanonicalize
isTrue
the state - is brought into canonical form, with
BaseMPS.center_position
atcenter_position
. ifcenter_position
isNone
andcanonicalize = 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’
- Initialize a
Methods
__init__
(tensors, center_position, …)Initialize a FiniteMPS
. Ifcanonicalize
isTrue
the 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 Tensor
object atsite
.left_envs
(sites)Compute left reduced density matrices for site sites
.measure_local_operator
(ops, sites)Measure the expectation value of local operators ops
sitesites
.measure_two_body_correlator
(op1, op2, site1, …)Compute the correlator \(\langle\) op1[site1], op2[s]
\(\rangle\) betweensite1
and all sitess
insites2
.position
(site, normalize, D, max_truncation_err)Shift center_position
tosite
.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
. Ifcenter_position
isNone
, 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_envs
mapping 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: dict
mappingint
toTensor
-
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_envs
mapping 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: dict
mappingint
toTensor
-