Canonizing MPS/MPO#

MPS/MPO can be put into canonical form to reveal the most advantageous truncation or as a part of the setup for many algorithms, including DMRG and TDVP.

See examples at Canonical form by QR and Canonical form by SVD.

The canonical form obtained by QR decomposition is fast, but does not allow for truncation of the virtual spaces of MPS/MPO.

MpsMpoOBC.canonize_(to='first', normalize=True) MpsMpoOBC[source]#

Sweep through the MPS/MPO and put it in right/left canonical form (to='first' or to='last', respectively) using QR decomposition. It is assumed that tensors are enumerated by index increasing from 0 ('first') to N-1 ('last').

Finally, the trivial central block of dimension \(1\) obtained for terminal sites is attached at the end of the chain.

It updates MPS/MPO in place.

Parameters:
  • to (str) – 'first' (the default) or 'last'.

  • normalize (bool) – Whether to keep track of the norm of the state by accumulating it in self.factor; The default is True, i.e., sets the norm to \(1\). The individual tensors at the end of the procedure are in a proper canonical form.

The canonization by SVD allows truncating virtual dimension/spaces with the lowest weights (smallest singular values).

MpsMpoOBC.truncate_(to='last', opts_svd=None, normalize=True) Number[source]#

Sweep through the MPS/MPO and put it in right/left canonical form (to='first' or to='last', respectively) using yastn.linalg.svd_with_truncation(). It is assumed that tensors are enumerated by index increasing from 0 ('first') to N-1 ('last').

Access to singular values during the sweep allows truncation of virtual spaces.

The truncation is effective when it is done in the canonical form. The canonical form has to be ensured prior to truncation by setting it opposite to the direction of the sweep in truncate_. I.e., prepare MPS/MPO in the right canonical form (to='first') for truncation using to='last' and the left canonical form (to='last') for truncation using to='first'.

The MPS/MPO is updated in place.

Returns the norm of truncated elements normalized by the norm of the untruncated state.

Parameters:
  • to (str) – 'last' (the default) or 'first'.

  • normalize (bool) – Whether to keep in self.factor the norm of the initial state projected on the direction of the truncated state. The default is True, i.e., sets the norm to \(1\). The individual tensors at the end of the procedure are in a proper canonical form.

  • opts_svd (dict) – options passed to yastn.linalg.svd_with_truncation(), including options governing truncation.

The above routines operate on entire MPS or MPO. They are built from functions operating on individual tensors of MPS/MPO:

MpsMpoOBC.orthogonalize_site_(n, to='first', normalize=True) None[source]#

Performs QR (or RQ) decomposition of on-site tensor at n-th site. Two modes of usage are:

  • to='last' - Advance left canonical form: Assuming first n-1 sites are already in the left canonical form, brings n-th site to left canonical form, i.e., extends left canonical form by one site towards the 'last' site:

     --A---            --
    |  |    = Identity|
     --A*--            --
    
  • to='first' - Advance right canonical form: Assuming all m > n sites are already in right canonical form, brings n-th site to right canonical form, i.e., extends right canonical form by one site towards the 'first' site:

    --A---    --
      |   | =   |Identity
    --A*--    --
    
Parameters:
  • n (int) – index of site to be orthogonalized

  • to (str) – a choice of canonical form: 'last' or 'first'.

  • normalize (bool) – Whether to keep track of the norm by accumulating it in self.factor; The default is True, i.e., sets the norm to \(1\). The central blocks at the end of the procedure is normalized to unity.

MpsMpoOBC.absorb_central_(to='last') None[source]#

Absorb central block towards the 'first' or the 'last' site.

If the central block is outside of the chain, it goes in the one direction possible. Do nothing if central does not exist.

Parameters:

to (str) – 'last' (the default) or 'first'.

MpsMpoOBC.diagonalize_central_(opts_svd, normalize=True) Number[source]#

Use svd() to perform SVD of the central block C = U @ S @ V, where S contains singular (Schmidt) values. Truncation is done based on opts_svd.

Attach U and V respectively to the left and right sites (or to the central site at the edges when there are no left or right sites).

Returns the norm of truncated Schmidt values, normalized by the norm of all Schmidt values.

Parameters:
  • opts_svd (dict) – Options passed to yastn.linalg.truncation_mask(). It includes information on how to truncate the Schmidt values.

  • normalize (bool) – Whether to keep track of the norm of retained Schmidt values by accumulating it in self.factor. The default is True, i.e., sets the norm to \(1\). The truncated Schmidt values (central block) at the end of the procedure are normalized to unity.