Skip to content

Commit 2716a82

Browse files
committed
Update documentation
1 parent ef4075e commit 2716a82

File tree

8 files changed

+163
-198
lines changed

8 files changed

+163
-198
lines changed

docs/src/index.md

Lines changed: 9 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -30,126 +30,30 @@ Where:
3030
``\\\hat{\boldsymbol{b}}\quad and\quad\hat{\boldsymbol{c}}`` are operator-valued vectors and
3131
``\\\hat{\boldsymbol{A}}`` is an operator-valued matrix which is *not nessecarily triangular*.
3232

33-
In order to handle all combinations of upper and lower regular forms in conjunction with left and right canonical (orthogonal) forms we must extend ITensors *QR* decomposition capabilities to also include *QL*, *RQ* and *LQ* decomposition. Below and in the code these will be generically referred to as *QX* decomposition.
34-
### The V-block
35-
For lower regular form the V-blocks are:
36-
```math
37-
\hat{V}_{L}=\begin{bmatrix}\hat{\boldsymbol{A}}_{L} & 0\\
38-
\hat{\boldsymbol{c}}_{L} & \hat{\mathbb{I}}
39-
\end{bmatrix}
40-
```
41-
```math
42-
\hat{V}_{R}=\begin{bmatrix}\hat{\mathbb{I}} & 0\\
43-
\hat{\boldsymbol{b}}_{L} & \hat{\boldsymbol{A}}_{L}
44-
\end{bmatrix}
45-
```
46-
where the `L` and `R` subscripts refer to `left` and `right` orthogonal forms being targeted.
47-
### QX decomposition of the V-block
48-
Block respecting *QL* decomposition is defined as *QL* decomposition of the of corresponding V-block:
49-
50-
`1.` Reshape
51-
```math
52-
\hat{V}_{ab}\rightarrow V_{ab}^{mn}\rightarrow V_{\left(mna\right)b}
53-
```
54-
`2.` *QL* decompose
55-
```math
56-
V_{\left(mna\right)b}=\sum_{k=1}^{\chi+1}Q_{\left(mna\right)k}L_{kb}
57-
```
58-
`3.` Reshape
59-
```math
60-
Q_{\left(mna\right)k}\rightarrow\hat{Q}_{ak}
61-
```
62-
`4.` Stuff *Q* back into correct block of *W*.
6333

64-
`5.` Resize and transfer *L* to the next site:
65-
```math
66-
\hat{W}^{\left(i+1\right)}\rightarrow L\hat{W}^{\left(i+1\right)}
67-
```
68-
Fortunately, under the hood, ITensor takes care of all the reshaping for us. After this process *W* will now be in left canonical form. Other cases and some additional details are described in tech notes.
34+
# Truncation (SVD compression)
35+
Truncation (or compression) of an MPO starts with 2 orthogonalization sweeps using column pivoting, rank reducing QR decomposoitions. These sweeps will significantly reduce the bond dimensions of the MPO. A final sweep using SVD decomposition and compression of the internal degrees of freedom will then yield a bond spectrum at each bond site. The users can control the rank reduction and SVD compression using parameters described below.
6936
```@docs
70-
block_qx
37+
ITensorMPOCompression.truncate!
7138
```
7239
# Orthogonalization (Canonical forms)
73-
This is achieved by simply sweeping through the lattice and carrying out block respecting *QX* steps described above. For left canoncical form one starts at the left and sweeps right, and the converse applies for right canonical form.
40+
Most users will not need to deal directly with orthogonalization, as the truncation routine will do this automaticlly. This is achieved by simply sweeping through the lattice and carrying out block respecting *QX* steps described in the technical notes. For left canoncical form one starts at the left and sweeps right, and the converse applies for right canonical form.
7441
```@docs
7542
ITensorMPOCompression.orthogonalize!
7643
```
77-
# Truncation (SVD compression)
78-
## Finite lattice
79-
Prior to truncation the MPO must first be rendered into canoncial form using the orthogonalize! function described above. If for example the MPO is right-lower canonical form then a truncation sweep starts by doing a block repsecting *QL* decomposition on site 1:
80-
```math
81-
\hat{W}^{1}\rightarrow\hat{Q}^{1}L^{1}
82-
```
83-
We now must further factor *L* as follows
84-
```math
85-
L=\begin{bmatrix}1 & 0 & 0\\
86-
0 & \mathsf{L} & 0\\
87-
0 & t & 1
88-
\end{bmatrix}=ML^{\prime}=\begin{bmatrix}1 & 0 & 0\\
89-
0 & \mathsf{M} & 0\\
90-
0 & 0 & 1
91-
\end{bmatrix}\begin{bmatrix}1 & 0 & 0\\
92-
0 & \mathsf{\mathbb{I}} & 0\\
93-
0 & t & 1
94-
\end{bmatrix}
95-
```
96-
where internal sans-M matrix is what gets decomposed with SVD. Picking out this internal matrix is really the secret sauce for avoiding diverging singular values when the lattice size grows. After decomposition `M=UsV` the `U` matrix is absorbed to the left such that `W=QU` which is left canoncial. *sV* gets combined with L' and transfered to next site to the right. There are many details to consider and these are explained in the technical notes.
97-
98-
## Infinite lattice
99-
Truncation for an infinite lattice operates on the gauge transforms `G` that relate the left and right orthogonal forms:
100-
```math
101-
G^{\left(n-1\right)}\hat{W}_{R}^{n}=\hat{W}_{L}^{n}G^{n}\;n=1\cdots N_{cell}
102-
```
103-
Where `Ncell` is the number of lattice sites in the repeating unit cell. The gauge transforms are the output from left orthogonalizatio of a right orthogonalized iMPO. As usual we don't decompose `G` directly, but instead do a block respecting `svd` in order to only attack the non-extensive degrees of freedom. Small singular values can be truncated at this stage.
104-
```math
105-
G^{n}=\begin{bmatrix}1 & 0 & 0\\
106-
0 & \mathsf{G^{n}} & 0\\
107-
0 & 0 & 1
108-
\end{bmatrix}=\begin{bmatrix}1 & 0 & 0\\
109-
0 & \mathsf{U^{n}}\mathsf{s^{n}}\mathsf{V^{n}} & 0\\
110-
0 & 0 & 1
111-
\end{bmatrix}\approx\begin{bmatrix}1 & 0 & 0\\
112-
0 & \mathsf{\tilde{U}^{n}}\mathsf{\tilde{s}^{n}}\mathsf{\tilde{V}^{n}} & 0\\
113-
0 & 0 & 1
114-
\end{bmatrix}=\tilde{U}^{n}\tilde{s}^{n}\tilde{V}^{n}
115-
```
116-
117-
We then use the unitary tensors to transform the MPO tensors:
118-
```math
119-
\hat{W}_{R^{\prime}}^{n}=\tilde{V}^{n-1}\hat{W}_{R}^{n}\tilde{V}^{\dagger n},\quad\hat{W}_{L^{\prime}}^{n}=\tilde{U}^{\dagger n-1}\hat{W}_{L}^{n}\tilde{U}^{n}
120-
```
121-
which should be reduced in size if there was any truncation. The new gauge transforms, `s`, are now diagonal:
122-
```math
123-
\tilde{s}^{n-1}\hat{W}_{R^{\prime}}^{n}=\hat{W}_{L^{\prime}}^{n}\tilde{s}^{n}\;n=1\cdots N_{cell}
124-
```
125-
This looks rather elegant compared to the finite lattice case.
126-
127-
## Truncate functions
128-
```@docs
129-
truncate!
130-
```
13144

13245
# Characterizations
13346

134-
The module has a number of functions for characterization of MPOs and operator-valued matrices. Some
135-
points to keep in mind:
136-
1. An MPO must be in one of the regular forms in order for orthogonalization to work.
137-
2. An MPO must be in one ot the orthonormal (canonical) forms prior to SVD truncation (compression). However the truncate! function will detect this and do the orthogonalization if needed.
138-
3. Lower (upper) regular form does not mean that the MPO is lower (upper) triangular. As explained in the [Technical Notes](../TechnicalDetails.pdf) the `A`-block does not need to be triangular.
139-
4. Having said all that, most common hand constructed MPOs are either lower or upper triangular. Lower happens to be the more common convention.
140-
5. The orthogonalize! operation just happens to preserve lower (upper) trianglur form. However truncation (SVD) does not preserve triangular form.
141-
47+
The module has a number of functions for viewing and characterization of MPOs and operator-valued matrices.
14248

14349
## Regular forms
14450

14551
Regular forms are defined above in section [Regular Forms](@ref)
14652

14753
```@docs
148-
reg_form
54+
ITensorMPOCompression.reg_form
14955
detect_regular_form
15056
is_regular_form
151-
is_lower_regular_form
152-
is_upper_regular_form
15357
```
15458

15559
## Orthogonal forms
@@ -162,9 +66,9 @@ The definition of orthogonal forms for MPOs or operator-valued matrices are more
16266
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)
16367

16468
```@docs
165-
orth_type
166-
isortho
167-
check_ortho
69+
ITensorMPOCompression.orth_type
70+
ITensors.isortho
71+
ITensorMPOCompression.check_ortho
16872
```
16973

17074
# Some utility functions
@@ -181,12 +85,3 @@ MPOs for various models. Right now we have four Hamiltonians available
18185
4. The 3-body model in eq. 34 of the Parker paper, built with autoMPO.
18286
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
18387

184-
```@docs
185-
transIsing_MPO
186-
transIsing_AutoMPO
187-
Heisenberg_AutoMPO
188-
three_body_MPO
189-
transIsing_iMPO
190-
191-
192-
```

examples/truncate_MPO_demo.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ NNN = 7; #Include up to 7th nearest neighbour interactions
99
sites = siteinds("S=1/2", N);
1010
H = transIsing_MPO(sites, NNN);
1111
is_regular_form(H,lower) == true
12+
@show get_Dw(H)
1213
spectrums = truncate!(H,left)
1314
pprint(H[5])
1415
@show get_Dw(H)

src/ITensorMPOCompression.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import Base: similar, reverse, transpose
1717
# reg_form and orth_type values and functions
1818
export upper, lower, left, right, mirror, flip
1919
# lots of characterization functions
20-
export is_regular_form, isortho, check_ortho
20+
export is_regular_form, isortho, check_ortho, detect_regular_form
2121
# MPO bond dimensions and bond spectrum
2222
export get_Dw, min, max
2323
export bond_spectrums
@@ -45,7 +45,7 @@ end
4545

4646
default_eps = 1e-14 #for characterization routines, floats abs()<default_eps are considered to be zero.
4747

48-
"""
48+
@doc """
4949
@enum reg_form upper lower
5050
5151
Indicates that an MPO or operator-valued matrix has either an `upper` or `lower` regular form.
@@ -54,7 +54,7 @@ See also [`detect_regular_form`](@ref) and related functions
5454
"""
5555
@enum reg_form upper lower
5656

57-
"""
57+
@doc """
5858
@enum orth_type left right
5959
6060
Indicates that an MPO matrix satisfies the conditions for `left` or `right` canonical form

src/characterization.jl

Lines changed: 20 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -143,21 +143,6 @@ end
143143
#
144144
# Detection of canonical (orthogonal) forms
145145
#
146-
147-
@doc """
148-
check_ortho(H,lr[,eps])::Bool
149-
150-
Test if all sites in an MPO statisfty the condition for `lr` orthogonal (canonical) form.
151-
152-
# Arguments
153-
- `H:MPO` : MPO to be characterized.
154-
- `lr::orth_type` : choose `left` or `right` orthogonality condition to test for.
155-
- `eps::Float64 = 1e-14` : operators inside H with norm(W[i,j])<eps are assumed to be zero.
156-
157-
Returns `true` if the MPO is in `lr` orthogonal (canonical) form. This is an expensive operation which scales as N*Dw^3 which should mostly be used only for unit testing code or in debug mode. In production code use isortho which looks at the cached ortho state.
158-
159-
"""
160-
161146
@doc """
162147
isortho(H,lr)::Bool
163148
@@ -200,38 +185,42 @@ end
200185
# We must therefore test for both and return true if either one is true.
201186
#
202187

188+
203189
@doc """
204-
detect_regular_form(W[,eps])::Tuple{Bool,Bool}
190+
detect_regular_form(H)::Tuple{Bool,Bool}
205191
206-
Inspect the structure of an operator-valued matrix W to see if it satisfies the regular form
207-
conditions as specified in Section III, definition 3 of
208-
> *Daniel E. Parker, Xiangyu Cao, and Michael P. Zaletel Phys. Rev. B 102, 035147*
192+
Inspect the structure of an MPO `H` to see if it satisfies the regular form conditions.
209193
210194
# Arguments
211-
- `W::ITensor` : operator-valued matrix to be characterized. W is expected to have 2 "Site" indices and 1 or 2 "Link" indices
212-
- `eps::Float64 = 1e-14` : operators inside W with norm(W[i,j])<eps are assumed to be zero.
195+
- `H::MPO` : MPO to be characterized.
196+
197+
# Keywords
198+
- `eps::Float64 = 1e-14` : operators inside `W` with norm(W[i,j])<eps are assumed to be zero.
213199
214200
# Returns a Tuple containing
215-
- `reg_lower::Bool` Indicates W is in lower regular form.
216-
- `reg_upper::Bool` Indicates W is in upper regular form.
217-
The function returns two Bools in order to handle cases where W is not in regular form, returning
218-
(false,false) and W is in a special pseudo diagonal regular form, returning (true,true).
201+
- `reg_lower::Bool` Indicates all sites in `H` are in lower regular form.
202+
- `reg_upper::Bool` Indicates all sites in `H` are in upper regular form.
203+
The function returns two Bools in order to handle cases where `H` is not regular form, returning (`false`,`false`) and `H` is in a special pseudo-diagonal regular form, returning (`true`,`true`).
219204
220205
"""
206+
function detect_regular_form(H::AbstractMPS;kwargs...)::Tuple{Bool,Bool}
207+
return is_regular_form(H, lower;kwargs...), is_regular_form(H, upper;kwargs...)
208+
end
221209

222210
@doc """
223-
detect_regular_form(H[,eps])::Tuple{Bool,Bool}
211+
is_regular_form(H::MPO,ul::reg_form)::Bool
224212
225-
Inspect the structure of an MPO `H` to see if it satisfies the regular form conditions.
213+
Inspect the structure of an MPO `H` to see if it satisfies the `lower/upper` regular form conditions.
226214
227215
# Arguments
228216
- `H::MPO` : MPO to be characterized.
217+
- `ul::reg_form` : Select whether to test for `lower` or `upper` regular form.
218+
219+
# Keywords
229220
- `eps::Float64 = 1e-14` : operators inside `W` with norm(W[i,j])<eps are assumed to be zero.
230221
231-
# Returns a Tuple containing
232-
- `reg_lower::Bool` Indicates all sites in `H` are in lower regular form.
233-
- `reg_upper::Bool` Indicates all sites in `H` are in upper regular form.
234-
The function returns two Bools in order to handle cases where `H` is not regular form, returning (`false`,`false`) and `H` is in a special pseudo-diagonal regular form, returning (`true`,`true`).
222+
# Returns
223+
- `regular::Bool` Indicates all sites in `H` are in `ul` regular form.
235224
236225
"""
237226
function is_regular_form(H::AbstractMPS, ul::reg_form;kwargs...)::Bool
@@ -247,9 +236,6 @@ function is_regular_form(H::AbstractMPS, ul::reg_form;kwargs...)::Bool
247236
end
248237

249238

250-
function detect_regular_form(H::AbstractMPS;kwargs...)::Tuple{Bool,Bool}
251-
return is_regular_form(H, lower;kwargs...), is_regular_form(H, upper;kwargs...)
252-
end
253239

254240
function get_Dw(H::MPO)::Vector{Int64}
255241
N = length(H)

0 commit comments

Comments
 (0)