def _lcanonicalize(self, to_site):
"""Right-canonicalizes all local tensors _ltens[to_site:] in place
:param to_site: Index of the site up to which canonicalization is to be
performed
"""
assert 0 < to_site <= len(self), 'to_site={!r}'.format(to_site)
lcanon, rcanon = self.canonical_form
for site in range(rcanon - 1, to_site - 1, -1):
ltens = self._lt[site]
q, r = qr(ltens.reshape((ltens.shape[0], -1)).T)
# if ltens.shape[-1] > prod(ltens.phys_shape) --> trivial comp.
# can be accounted by adapting rank here
newtens = (matdot(self._lt[site - 1], r.T),
q.T.reshape((-1,) + ltens.shape[1:]))
self._lt.update(slice(site - 1, site + 1), newtens,
canonicalization=(None, 'right'))
评论列表
文章目录