diff --git a/docs/src/index.md b/docs/src/index.md index 565dc6c..95c2e8e 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -63,7 +63,7 @@ The definition of orthogonal forms for MPOs or operator-valued matrices are more ```math \sum_{a}\left\langle \hat{W}_{ab}^{\dagger},\hat{W}_{ac}\right\rangle =\frac{\sum_{a}^{}Tr\left[\hat{W}_{ab}\hat{W}_{ac}\right]}{Tr\left[\hat{\mathbb{I}}\right]}=\delta_{bc} ``` -Where the summation limits depend on where the V-block is for `left`/`right` and `lower`/`upper`. The specifics for all four cases are shown in table 6 in the [Technical Notes](../TechnicalDetails.pdf) +Where the summation limits depend on where the V-block is for `left`/`right` and `lower`/`upper`. The specifics for all four cases are shown in table 6 in the [Technical Notes](https://github.com/JanReimers/ITensorMPOCompression.jl/blob/main/docs/TechnicalDetails.pdf) ```@docs ITensorMPOCompression.orth_type @@ -85,3 +85,11 @@ MPOs for various models. Right now we have four Hamiltonians available 4. The 3-body model in eq. 34 of the Parker paper, built with autoMPO. The autoMPO MPOs come pre-truncated so they are not as useful for testing truncation. The automated truncation in AutoMPO can **partially** disabled by providing the the keyword argument `cutoff=-1.0` which gets passed down in the svd/truncate call used when building the MPO +# Internal structures + +Internally the orthogonalization and truncation code uses these structures for storing and manipulating MPOs and matrix operators: Ŵ. + +```@docs +reg_form_Op +reg_form_MPO +``` diff --git a/src/ITensorMPOCompression.jl b/src/ITensorMPOCompression.jl index ef2de9f..e7aa2cd 100644 --- a/src/ITensorMPOCompression.jl +++ b/src/ITensorMPOCompression.jl @@ -26,7 +26,7 @@ export bond_spectrums # Display helpers export @pprint, pprint, show_directions # Wrapped MPO types -export reg_form_MPO +export reg_form_Op, reg_form_MPO macro mpoc_assert(ex) esc(:($Base.@assert $ex)) diff --git a/src/reg_form_MPO.jl b/src/reg_form_MPO.jl index d5aed56..6848d67 100644 --- a/src/reg_form_MPO.jl +++ b/src/reg_form_MPO.jl @@ -1,9 +1,21 @@ -#----------------------------------------------------------------------- -# -# Finite lattice with open BCs, of regulat form Tensos: l*W1*W2...*WN*r -# Edge tensors have dim=1 dummy indices (order(W)==4) so generic code can work the same -# on all tensors. -# +@doc """ + `mutable struct reg_form_MPO <: AbstractMPS` + +# Fields +- `data`::`Vector{reg_form_Op}` string of order 4 operators Ŵ +- `llim`::`Int64` One site left of ortho center +- `rlim`::`Int64` One site right of ortho center +- `d0` ::`ITensor` onehot tensor used to add a dummy, dim=1 index at the left edge of the `MPO` +- `dN` ::`ITensor` onehot tensor used to add a dummy, dim=1 index at the right edge of the `MPO` +- `ul` ::`reg_form` Flag indicating {`lower`,`upper`} regular form. + +# Description + Finite lattice with open boundary condicitions, of regular form Tensors: l*Ŵ₁*Ŵ₂...*Ŵₙ*r + Edge tensors have dim=1 dummy indices (so that order(Ŵ)==4) so generic code can work the same + on all tensors. `d0` and `dN` are stored and used later to remove the dummy indices when converting back to an `MPO`. + Dummy indices are created, and `lower`/`upper` detection is performed at construction time. + +""" mutable struct reg_form_MPO <: AbstractMPS data::Vector{reg_form_Op} llim::Int # orthocenter-1 diff --git a/src/reg_form_Op.jl b/src/reg_form_Op.jl index 826c19c..65708cc 100644 --- a/src/reg_form_Op.jl +++ b/src/reg_form_Op.jl @@ -2,8 +2,25 @@ # # Manage an MPO/iMPO tensor and track the left and right facing indices. This # seems to be easiest way to avoid tag hunting. -# Also track lower or upper regular form in ul member. +# Also track lower or upper regular form in ul member. # +@doc """ +`mutable struct reg_form_Op` + +# Fields +- `W::ITensor` Order 4 four operator valued matrix: Ŵ +- `ileft::Index` Left facing link index +- `iright::Index` Right facing link index +- `ul::reg_form` Flag indicating {upper,lower} regular form + +# Description +During construction the data in `W` is interrogated once to confirm either upper or lower regular form. Similarly for +the left and right link indices, except that various function overloads may automatically update the indices as needed. +This appraoch greatly simplifies all the orthogonalization and truncation code which needs to know `ileft` and `iright` at almost +every step. + + +""" mutable struct reg_form_Op W::ITensor ileft::Index @@ -11,14 +28,14 @@ mutable struct reg_form_Op ul::reg_form function reg_form_Op(W::ITensor, ileft::Index, iright::Index, ul::reg_form) if !hasinds(W, ileft, iright) - @show inds(W, tags="Link") ileft iright + @show inds(W, tags="Link") ileft iright end @assert hasinds(W, ileft, iright) return new(W, ileft, iright, ul) end - function reg_form_Op(W::ITensor, ul::reg_form) - return new(W, Index(1), Index(1), ul) - end + # function reg_form_Op(W::ITensor, ul::reg_form) + # return new(W, Index(1), Index(1), ul) + # end end # # Internal consistency checks