Hi,

I am very new to this tensor library and am trying to understand the code under mps.py. Just wondering the default option for MPS in the code is in B matrices, i.e. right canonical form. But where does it initialize this? Thought if one wants to bring an arbitrary initial MPS to a right-canonical form, one has to do QR decomposition from the r.h.s.? Could someone point this out or I miss something?

Thanks a lot!

## about initial MPS canonical form

### Re: about initial MPS canonical form

When you just call the MPS.__init__() function, it will just assume that it is in right-canonical form. In most cases, people will in some way intialize the MPS from a product state with bond dimension 1 (using MPS.from_product_state or MPS.from_lat_product_state), which is trivially in both left- and right-canonical form (as long as the on-site state is normalized), with a single singular value of 1.

After initialization, it just keeps track of which form each tensor is in; after each SVD of a two-site theta, you get the tensors in left/right canonical form. Eg during TEBD, it will just use keep each site in right-canonical B form (by multiplying with (inverses) of singular values on the left/right virtual bond as appropriate. DMRG sweeps from the left end (which requires an initially right-canonical MPS) to the right end (such that the MPS is temorarily in left-canonical form A) and then to the left end again, which again leaves the MPS in the right-canonical form that most MPS methods work best with.

There are also the methods MPS.canonical_form_finite() and MPS.canonical_form_infinite(), which can bring the MPS form arbitrary form into canonical form, using QR/SVD, and in the infinite case a diagonalization of the MPS transfer matrix.

So you can also initialize an MPS with

After initialization, it just keeps track of which form each tensor is in; after each SVD of a two-site theta, you get the tensors in left/right canonical form. Eg during TEBD, it will just use keep each site in right-canonical B form (by multiplying with (inverses) of singular values on the left/right virtual bond as appropriate. DMRG sweeps from the left end (which requires an initially right-canonical MPS) to the right end (such that the MPS is temorarily in left-canonical form A) and then to the left end again, which again leaves the MPS in the right-canonical form that most MPS methods work best with.

There are also the methods MPS.canonical_form_finite() and MPS.canonical_form_infinite(), which can bring the MPS form arbitrary form into canonical form, using QR/SVD, and in the infinite case a diagonalization of the MPS transfer matrix.

So you can also initialize an MPS with

`form=None`

and then bring it into canonical form afterwards (which will also compute the singular values for you).