Skip to content

Commit

Permalink
Add docs for reg_form_Op and reg_form_MPO
Browse files Browse the repository at this point in the history
  • Loading branch information
JanReimers committed Jun 12, 2023
1 parent 5df6f1d commit e1aa17a
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 13 deletions.
10 changes: 9 additions & 1 deletion docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
```
2 changes: 1 addition & 1 deletion src/ITensorMPOCompression.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
24 changes: 18 additions & 6 deletions src/reg_form_MPO.jl
Original file line number Diff line number Diff line change
@@ -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
Expand Down
27 changes: 22 additions & 5 deletions src/reg_form_Op.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,40 @@
#
# 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
iright::Index
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
Expand Down

0 comments on commit e1aa17a

Please sign in to comment.