Does orthogonalize! move or create the orthogonality center?

The documentation says that orthogonalize! Moves the orthogonality center of the MPS to site j. However, it seems to me that the MPS does not remember its orthogonality center in any way, meaning that at each call the complete orthogonalization from the extremities would have to be performed. Am I right then that if one knows the orthogonality center and wants to shift it, say, by only a site, doing an SVD manually could be faster than calling orthogonalize?

Thank you for your work!

The MPS knows the orthogonality center through ortho_lims, and should be “remembered” throughout a calculation, once it has been set. If you create a new MPS that you know is orthogonalized you can use set_ortho_lims! so that orthogonalize is efficient. See also preserve_ortho for a similar utility.

P.S. qr may be more efficient than svd for moving the center without truncating

Oh thank you! I was not aware of those functionalities. Unfortunately if I use the search function on https://itensor.github.io/ITensors.jl/ I can’t find anything when typing ortho_lims, set_ortho_lims!or preserve_ortho, am I looking in the wrong place?

The MPS code has been moved to GitHub - ITensor/ITensorMPS.jl: MPS and MPO methods based on ITensor (ITensors.jl)

(be sure to check out the news on how to upgrade codes with the new package setup)

Thanks again for the quick reply! I was aware of that change, but I thought that this served as documentation also for ITensorMPS, as many other ITensorMPS functions are indeed documented there. Your link points to the ITensorMPS repository, so is there no documentation for it? Should I just look at the source code?

Ahh I see the confusion. That link does have many ITensorMPS functions. Some of them you’ll want to use the help mode in the julia REPL:

julia> using ITensorMPS

julia> ? #typing a question mark turns this into help mode

help?> ortho_lims
search: ortho_lims set_ortho_lims! reset_ortho_lims! orthogonalize dropdims orthogonalize!

  ortho_lims(::MPS/MPO)

  Returns the range of sites of the orthogonality center of the MPS/MPO.

  Examples
  ≡≡≡≡≡≡≡≡

  s = siteinds("S=½", 5)
  ψ = random_mps(s)
  ψ = orthogonalize(ψ, 3)

  # ortho_lims(ψ) = 3:3
  @show ortho_lims(ψ)

  ψ[2] = random_itensor(inds(ψ[2]))

  # ortho_lims(ψ) = 2:3
  @show ortho_lims(ψ)

help?> set_ortho_lims!
search: set_ortho_lims! reset_ortho_lims! ortho_lims set_rightlim! set_leftlim!

  ITensors.set_ortho_lims!(::MPS/MPO, r::UnitRange{Int})

  Sets the range of sites of the orthogonality center of the MPS/MPO.

  This is not exported and is an advanced feature that should be used with care. Setting the orthogonality limits wrong can lead to incorrect results when using ITensor MPS/MPO functions.

  If you are modifying an MPS/MPO and want the orthogonality limits to be preserved, please see the @preserve_ortho macro.


help?> @preserve_ortho
  @preserve_ortho

  Specify that a block of code preserves the orthogonality limits of an MPS/MPO that is being modified in-place. The first input is either a single MPS/MPO or a tuple of the MPS/MPO whose orthogonality limits
  should be preserved.

  Examples
  ≡≡≡≡≡≡≡≡

  s = siteinds("S=1/2", 4)

  # Make random MPS with bond dimension 2
  ψ₁ = random_mps(s, "↑"; linkdims=2)
  ψ₂ = random_mps(s, "↑"; linkdims=2)
  ψ₁ = orthogonalize(ψ₁, 1)
  ψ₂ = orthogonalize(ψ₂, 1)

  # ortho_lims(ψ₁) = 1:1
  @show ortho_lims(ψ₁)

  # ortho_lims(ψ₂) = 1:1
  @show ortho_lims(ψ₂)

  @preserve_ortho (ψ₁, ψ₂) begin
    ψ₁ .= addtags.(ψ₁, "x₁"; tags = "Link")
    ψ₂ .= addtags.(ψ₂, "x₂"; tags = "Link")
  end

  # ortho_lims(ψ₁) = 1:1
  @show ortho_lims(ψ₁)

  # ortho_lims(ψ₂) = 1:1
  @show ortho_lims(ψ₂)

@mtfishman now that there’s the split, maybe the docs should be “rebranded”? Or somehow include exported ITensorMPS functions on the website (like tdvp or these)

Ahh I see, thank you! This is very helpful. Of course, to use the help mode one needs to know the names of these functions, so it would indeed be useful to have them on the same website, or at least point to the fact that there might be more functionalities than the one there, I really did not know there was more than what listed.

Some of these are deliberately not put in the public documentation since they are not meant to be used by end users. In general users shouldn’t be setting orthogonality limits themselves. (Just because a function exists, it doesn’t mean we want people using it! They may be for internal use.)