Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
151 commits
Select commit Hold shift + click to select a range
076b1a7
Update for TensorKit changes
lkdvos Aug 17, 2024
a835870
Add FiniteMPOHamiltonian
lkdvos Aug 19, 2024
db146a5
Add linearalgebra
lkdvos Aug 20, 2024
d3fd137
Rewrite Operators
lkdvos Sep 5, 2024
5e85893
Add virtualspace functions QP
lkdvos Sep 5, 2024
1bdb19f
Add `axes` multiline
lkdvos Sep 5, 2024
0f62e2a
Add PeriodicVector and PeriodicMatrix constructors
lkdvos Sep 5, 2024
6e6fc0c
update tests
lkdvos Sep 5, 2024
a593f64
Start refactor environments
lkdvos Sep 5, 2024
15852c5
update SVDCut
lkdvos Sep 5, 2024
39828c0
Update excitations
lkdvos Sep 5, 2024
baf7c78
Update TimeEvolution MPO
lkdvos Sep 5, 2024
842c679
Update ED
lkdvos Sep 5, 2024
5d6f5c8
update derivatives and transfers
lkdvos Sep 5, 2024
811df74
Add utility functions
lkdvos Sep 5, 2024
0a44d2d
Update convenience functions
lkdvos Sep 5, 2024
ac070be
fix very important typo
VictorVanthilt Sep 5, 2024
103e603
compat with TensorKitManifolds
VictorVanthilt Sep 6, 2024
0003377
remove @shows
VictorVanthilt Sep 6, 2024
069d1a0
change opp to operator, like it is in `MultipleEnvironments`
VictorVanthilt Sep 6, 2024
b7c9813
add copy methods for `FiniteMPOHamiltonian` and `InfiniteMPOHamiltonian`
VictorVanthilt Sep 9, 2024
407fa43
add creation of `FiniteMPOHamiltonian` and `InfiniteMPOHamiltonian` d…
VictorVanthilt Sep 9, 2024
2646623
change MPOHamiltonian copies to deepcopies
VictorVanthilt Sep 9, 2024
4a95edf
implement scalar multiplication for `FiniteMPOHamiltonian` and `Infin…
VictorVanthilt Sep 9, 2024
43a104c
split MPOHamiltonian creation from local operator into Finite and Inf…
VictorVanthilt Sep 9, 2024
8c9403d
fix typo in fidelity susceptibility testset
VictorVanthilt Sep 9, 2024
b289a41
change WI() to WI
VictorVanthilt Sep 9, 2024
245e1b1
check for (and don't add) zero-valued A-blocks in `AbstractMPOHamilto…
VictorVanthilt Sep 9, 2024
7e56633
formatting
VictorVanthilt Sep 9, 2024
cad8ed6
remove creation of `FiniteMPOHamiltonian` from local operator
VictorVanthilt Sep 9, 2024
95c075d
update BlockTensorKit compat
lkdvos Sep 9, 2024
f7318be
Add WindowMPS environments
lkdvos Sep 9, 2024
cc043d8
Add convenience methods quasiparticles
lkdvos Sep 9, 2024
ef61863
Fix small typo
lkdvos Sep 9, 2024
9acc235
Add length to quasiparticle state tests
lkdvos Sep 9, 2024
5e47b0c
Relax MPO setindex
lkdvos Sep 9, 2024
972ff40
fix some wrong references to fields
lkdvos Sep 9, 2024
7b8a51b
Small style change in linalg
lkdvos Sep 9, 2024
31e12e1
Update some mpo linalg
lkdvos Sep 10, 2024
43282d2
change tensortype inference in `*(::InfiniteMPOHamiltonian, ::Infinit…
VictorVanthilt Sep 10, 2024
34bce01
convenience methods
lkdvos Sep 10, 2024
7bc6b22
Fix some operator tests
lkdvos Sep 10, 2024
8362ef4
update DenseMPO
lkdvos Sep 10, 2024
3aa7c72
Fix type signature
lkdvos Sep 10, 2024
68937a7
add `open_boundary_conditions` and extend all boundary condition meth…
VictorVanthilt Sep 11, 2024
0a76b17
Add more physicalspace methods
lkdvos Sep 11, 2024
f284eb3
readd `propagator` methods and change function signatures to new types
VictorVanthilt Sep 11, 2024
ca53e6f
Add conj
lkdvos Sep 11, 2024
c328ff2
implementing fix from `*(::Inf.Ham.,::Inf.Ham)` in the finite case
VictorVanthilt Sep 11, 2024
e8473cc
Merge branch 'blocktensor2' of github.com:QuantumKitHub/MPSKit.jl int…
VictorVanthilt Sep 11, 2024
497d23b
some more test/operators fixes
lkdvos Sep 11, 2024
dd4576a
add `randomize!(::AbstractBlockTensorMap)`
VictorVanthilt Sep 11, 2024
124eeab
Add *(::InfiniteMPO, ::InfiniteMPS)
lkdvos Sep 11, 2024
bffa4a6
use methods instead of removed MPO properties
VictorVanthilt Sep 11, 2024
557bd13
Merge branch 'blocktensor2' of github.com:QuantumKitHub/MPSKit.jl int…
VictorVanthilt Sep 11, 2024
2db839b
add creation of `InfiniteMPO` from `AbstractTensorMaps`
VictorVanthilt Sep 11, 2024
d2a88eb
fix creation of `DenseMPO`
VictorVanthilt Sep 11, 2024
7b7d2fe
fix periodic boundary conditions test
VictorVanthilt Sep 11, 2024
78070c0
physicalspace never returns SumSpace
lkdvos Sep 11, 2024
9f5ee7a
Fix `*(::InfiniteMPO, ::InfiniteMPS)`
lkdvos Sep 11, 2024
aea9f12
More operator test fixes
lkdvos Sep 11, 2024
06df810
Some more linalg cleanup
lkdvos Sep 11, 2024
f052cb8
some more operators test cleanup
lkdvos Sep 11, 2024
a60ab6f
change dynamical DMRG test case
VictorVanthilt Sep 12, 2024
16baede
Fix DynamicalDMRG
lkdvos Sep 12, 2024
26b1b66
add `show()` for `AbstractMPO`s
VictorVanthilt Sep 12, 2024
3e56d00
Merge branch 'blocktensor2' of github.com:QuantumKitHub/MPSKit.jl int…
VictorVanthilt Sep 12, 2024
3bebc6a
Add / for multiplied operator
lkdvos Sep 12, 2024
2d1475c
small fix
lkdvos Sep 12, 2024
ba9fb1d
Add dropzeros in H*H
lkdvos Sep 12, 2024
c0854c0
add `BlockTensorKit.show_braille(::AbstractHMPO)`
VictorVanthilt Sep 12, 2024
c0e4f15
Merge branch 'blocktensor2' of github.com:QuantumKitHub/MPSKit.jl int…
VictorVanthilt Sep 12, 2024
cf85f54
important copy fix
lkdvos Sep 12, 2024
c0e10f8
Merge branch 'blocktensor2' of github.com:QuantumKitHub/MPSKit.jl int…
VictorVanthilt Sep 12, 2024
1d0f713
little bit cleanup
lkdvos Sep 13, 2024
f3888d3
More generic linalg
lkdvos Sep 13, 2024
b2c2d15
Clean up MPO structs
lkdvos Sep 13, 2024
7f04b53
Fix infiniteMPOEnvironments
lkdvos Sep 13, 2024
06a2405
Fix expval for mpo
lkdvos Sep 13, 2024
5f57d7a
fix overlylong excitations test
lkdvos Sep 13, 2024
d933e09
fidelity_susceptibility fix
lkdvos Sep 13, 2024
9a6745c
Changes to accomodate new `MPOHamiltonian` type
VictorVanthilt Sep 16, 2024
b136bef
Extend `BlockTensorKit.show_braille()` to SparseMPOs
VictorVanthilt Sep 27, 2024
61ab2c8
drop zeros after imposing PBC
VictorVanthilt Sep 27, 2024
67a64c2
change `make_time_mpo` to be compatible with `FiniteMPOHamiltonian`s
VictorVanthilt Sep 30, 2024
908dd4f
implement `remove_orphans` for `FiniteMPO`s
VictorVanthilt Sep 30, 2024
d473430
add conversion to `DenseMPO` from `MPOHamiltonian`s
VictorVanthilt Sep 30, 2024
18ef005
remove redundant check in `remove_orphans!(::FiniteMPO)`
VictorVanthilt Sep 30, 2024
a1fd49b
fix multiplication of `FiniteMPOHamiltonian`s
VictorVanthilt Sep 30, 2024
66f39ab
move boundary condition application step
VictorVanthilt Sep 30, 2024
1d2d18b
use `droptol!()`
VictorVanthilt Sep 30, 2024
4278823
use `droptol!()`
VictorVanthilt Sep 30, 2024
0dd4e73
rename `BlockTensorKit.braille(::SparseMPO)` to `braille(::SparseMPO)…
VictorVanthilt Sep 30, 2024
0b3b3eb
add assert for MPOs that aren't the same size everywhere
VictorVanthilt Sep 30, 2024
2e85e21
use finite Hamiltonian for finite mps test
VictorVanthilt Oct 17, 2024
67e56a7
add L parameter to approximate tests
VictorVanthilt Oct 17, 2024
992b663
fix converting Hamiltonian to 'square' one
VictorVanthilt Oct 17, 2024
1f85679
change only() to TensorMap()
VictorVanthilt Oct 17, 2024
8f6f8ab
compensate for env fieldname changes
VictorVanthilt Oct 18, 2024
be37927
compensate for env namechange
VictorVanthilt Oct 18, 2024
acd8d80
change approximate test
VictorVanthilt Oct 18, 2024
824c771
remove return statement for aesthetics and consistency
VictorVanthilt Oct 18, 2024
546e51e
use dot notation for dropzeros in periodic_boundary_conditions
VictorVanthilt Oct 18, 2024
b762407
change boundary condition application in pbc
VictorVanthilt Oct 18, 2024
26a9f12
delete old environment stuct and code
VictorVanthilt Oct 21, 2024
ce61b1e
rename permpoinfenv to infinitempoenv
VictorVanthilt Oct 21, 2024
18ab2e8
add `FiniteMPO` to finite environments arguments
VictorVanthilt Oct 21, 2024
693fe35
change `permpoinfenv` to `InfiniteMPOEnvironments` in docs
VictorVanthilt Oct 21, 2024
d4f9270
oneline `dropzeros` step in `periodic_boundary_conditions`
VictorVanthilt Oct 21, 2024
46fd012
implement new test for `periodic_boundary_conditions` and comment out…
VictorVanthilt Oct 22, 2024
5cdf463
formatting change
lkdvos Oct 27, 2024
e7b414f
Version changes
lkdvos Oct 27, 2024
fcc52fd
robust `storagetype` handling
lkdvos Oct 28, 2024
dd952f1
implement pr 180 '3 site tests' into blocktensor2 branch
VictorVanthilt Oct 29, 2024
4016e71
format
VictorVanthilt Oct 29, 2024
1d491ab
cleanup and fix `force_planar`
lkdvos Oct 31, 2024
adc0791
Fix arguments being reversed
lkdvos Nov 1, 2024
5056a85
Fix periodic boundary
lkdvos Nov 1, 2024
acc4064
formatter
lkdvos Nov 1, 2024
aad678f
Fix deprecation warning in test
lkdvos Nov 6, 2024
5f66795
Improve implementation of multiplying MPOs
lkdvos Nov 8, 2024
4d41f15
Fix for InfiniteMPOHamiltonian
lkdvos Nov 8, 2024
f97d473
Remove `RecursiveVec`
lkdvos Nov 10, 2024
5166fba
Update outdated names
lkdvos Nov 11, 2024
8b7ce46
improve MPOHamiltonian constructors
lkdvos Nov 11, 2024
7bc2f4a
Add `add_physical_charge`
lkdvos Nov 14, 2024
a82aa9a
fixes MPO constructor
lkdvos Nov 15, 2024
90223ae
Fix mpohamiltonian constructor
lkdvos Nov 15, 2024
32fda87
Fix `make_time_mpo` extensions step
lkdvos Nov 15, 2024
ebeb10d
TaylorCluster optimizations
lkdvos Nov 15, 2024
1bc0e81
Update gitignore
lkdvos Nov 19, 2024
f87ab71
change test tol
lkdvos Nov 19, 2024
a82144d
update oplus syntax
lkdvos Dec 3, 2024
6af902b
Merge branch 'master' into blocktensor2
lkdvos Dec 9, 2024
ceefc7d
Bump julia version in tests
lkdvos Dec 9, 2024
0ad721d
Rename environments/files and cleanup unused code
lkdvos Dec 10, 2024
6b61bb2
remove more unused code
lkdvos Dec 10, 2024
84401f6
remove more unused code
lkdvos Dec 10, 2024
674a837
small fix in examples
lkdvos Dec 10, 2024
6021c82
Add Aqua and fix some tests
lkdvos Dec 10, 2024
fe21134
more unused code deletion
lkdvos Dec 10, 2024
fa18956
more unused code deletion
lkdvos Dec 10, 2024
6163379
small formatting change
lkdvos Dec 10, 2024
cdf0c2f
revert Aqua-related change
lkdvos Dec 10, 2024
a743813
Restrict Aqua tests for now
lkdvos Dec 10, 2024
4c66f24
Merge branch 'master' into blocktensor2
lkdvos Dec 11, 2024
4f0d16a
more unused code removal
lkdvos Dec 11, 2024
ca67022
more unused code removal
lkdvos Dec 11, 2024
2cbea3d
improve test stability
lkdvos Dec 11, 2024
9c26ce4
minor doc updates
lkdvos Dec 11, 2024
dbe4733
Temporary fix for docs
lkdvos Dec 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/Tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
fail-fast: false
matrix:
version:
- '1.8' # minimal supported version
- 'lts' # minimal supported version
- '1' # latest released Julia version
group:
- states
Expand Down
30 changes: 21 additions & 9 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
name = "MPSKit"
uuid = "bb1c41ca-d63c-52ed-829e-0820dda26502"
authors = ["Maarten Van Damme", "Jutho Haegeman", "Lukas Devos", "Gertian Roose", "Markus Hauru", "Daan Maertens"]
version = "0.11.6"
authors = "Lukas Devos, Maarten Van Damme and contributors"
version = "0.12.0"

[deps]
Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697"
BlockTensorKit = "5f87ffc2-9cf1-4a46-8172-465d160bd8cd"
FLoops = "cc61a311-1640-44b5-9fba-1b764f453329"
FastClosures = "9aa1b823-49e4-5ca5-8b0f-3971ec8bab6a"
FoldsThreads = "9c68100b-dfe1-47cf-94c8-95104e173443"
Expand All @@ -14,37 +15,48 @@ LoggingExtras = "e6f89c97-d47a-5376-807f-9c37f3926c36"
OptimKit = "77e91f04-9b3b-57a6-a776-40b61faaebe0"
Preferences = "21216c6a-2e73-6563-6e65-726566657250"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
TensorKit = "07d1fe3e-3e46-537d-9eac-e9e13d0d4cec"
TensorKitManifolds = "11fa318c-39cb-4a83-b1ed-cdc7ba1e3684"
TensorOperations = "6aa20fa7-93e2-5fca-9bc0-fbd0db3c71a2"
Transducers = "28d57a85-8fef-5791-bfe6-a80928e7c999"
TupleTools = "9d95972d-f1c8-5527-a6e0-b4b365fa01f6"
VectorInterface = "409d34a3-91d5-4945-b6ec-7529ddf182d8"

[compat]
Accessors = "0.1"
Aqua = "0.8.9"
BlockTensorKit = "0.1.1"
FLoops = "0.1, 0.2"
FastClosures = "0.3"
FoldsThreads = "0.1"
KrylovKit = "0.8.3"
LinearAlgebra = "1.6"
LoggingExtras = "1"
LoggingExtras = "~1.0"
OptimKit = "0.3.1"
Pkg = "1"
Plots = "1.40"
Preferences = "1"
Printf = "1"
Random = "1"
RecipesBase = "1.1"
TensorKit = "0.12"
TensorKitManifolds = "0.5, 0.6, 0.7"
TensorOperations = "4"
TensorKit = "0.13"
TensorKitManifolds = "0.7"
TensorOperations = "5"
Test = "1"
TestExtras = "0.3"
Transducers = "0.4"
TupleTools = "1.6.0"
VectorInterface = "0.2, 0.3, 0.4, 0.5"
julia = "1.8"
julia = "1.10"

[extras]
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
TensorOperations = "6aa20fa7-93e2-5fca-9bc0-fbd0db3c71a2"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
TestExtras = "5ed8adda-3752-4e41-b88a-e8b09835ee3a"

[targets]
test = ["Pkg", "Test", "TestExtras", "Plots"]
test = ["Aqua", "Pkg", "Test", "TestExtras", "Plots"]
1 change: 0 additions & 1 deletion docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
KrylovKit = "0b1a1467-8014-51b9-945f-bf0ae24f4b77"
MPSKit = "bb1c41ca-d63c-52ed-829e-0820dda26502"
MPSKitModels = "ca635005-6f8c-4cd1-b51d-8491250ef2ab"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
Polynomials = "f27b6e38-b328-58d1-80ce-0feddd5e7a45"
Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7"
Expand Down
26 changes: 17 additions & 9 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ operators and models.
using TensorOperations
using TensorKit
using MPSKit
using MPSKitModels
using LinearAlgebra: norm
```

Expand All @@ -48,7 +47,6 @@ using LinearAlgebra
using TensorOperations
using TensorKit
using MPSKit
using MPSKitModels
```

Finite MPS are characterised by a set of tensors, one for each site, which each have 3 legs.
Expand Down Expand Up @@ -106,10 +104,16 @@ Using the pre-defined models in `MPSKitModels`, we can construct the groundstate
transverse field Ising model:

```@example finitemps
H = transverse_field_ising(; J=1.0, g=0.5)
J = 1.0
g = 0.5
lattice = fill(ComplexSpace(2), 10)
X = TensorMap(ComplexF64[0 1; 1 0], ComplexSpace(2), ComplexSpace(2))
Z = TensorMap(ComplexF64[1 0; 0 -1], space(X))
H = FiniteMPOHamiltonian(lattice, (i, i+1) => -J * X ⊗ X for i in 1:length(lattice)-1) +
FiniteMPOHamiltonian(lattice, (i,) => - g * Z for i in 1:length(lattice))
find_groundstate!(mps, H, DMRG(; maxiter=10))
E0 = expectation_value(mps, H)
println("<mps|H|mps> = $(sum(real(E0)) / length(mps))")
println("<mps|H|mps> = $real(E0)")
```

### Infinite Matrix Product States
Expand All @@ -119,7 +123,6 @@ using LinearAlgebra
using TensorOperations
using TensorKit
using MPSKit
using MPSKitModels
```

Similarly, an infinite MPS can be constructed by specifying the tensors for the unit cell,
Expand Down Expand Up @@ -173,11 +176,16 @@ println("<mps|𝕀₁|mps> = $N2")
observable computed from the MPS would either blow up to infinity or vanish to zero.

Finally, the MPS can be optimized in order to determine groundstates of given Hamiltonians.
Using the pre-defined models in `MPSKitModels`, we can construct the groundstate for the
transverse field Ising model:
There are plenty of pre-defined models in `MPSKitModels`, but we can also manually construct
the groundstate for the transverse field Ising model:

```@example infinitemps
H = transverse_field_ising(; J=1.0, g=0.5)
J = 1.0
g = 0.5
lattice = PeriodicVector([ComplexSpace(2)])
X = TensorMap(ComplexF64[0 1; 1 0], ComplexSpace(2), ComplexSpace(2))
Z = TensorMap(ComplexF64[1 0; 0 -1], space(X))
H = InfiniteMPOHamiltonian(lattice, (1, 2) => -J * X ⊗ X, (1,) => - g * Z)
mps, = find_groundstate(mps, H, VUMPS(; maxiter=10))
E0 = expectation_value(mps, H)
println("<mps|H|mps> = $(sum(real(E0)) / length(mps))")
Expand Down Expand Up @@ -212,4 +220,4 @@ request or an issue on the [GitHub repository](https://github.com/QuantumKitHub/
- Gertian Roose, Laurens Vanderstraeten, Jutho Haegeman, and Nick Bultinck. Anomalous domain wall condensation in a modified ising chain. Phys. Rev. B, 99: 195132, May 2019. 10.1103/​PhysRevB.99.195132.
https:/​/​doi.org/​10.1103/​PhysRevB.99.195132
- Roose, G., Bultinck, N., Vanderstraeten, L. et al. Lattice regularisation and entanglement structure of the Gross-Neveu model. J. High Energ. Phys. 2021, 207 (2021). https://doi.org/10.1007/JHEP07(2021)207
- Roose, G., Haegeman, J., Van Acoleyen, K. et al. The chiral Gross-Neveu model on the lattice via a Landau-forbidden phase transition. J. High Energ. Phys. 2022, 19 (2022). https://doi.org/10.1007/JHEP06(2022)019
- Roose, G., Haegeman, J., Van Acoleyen, K. et al. The chiral Gross-Neveu model on the lattice via a Landau-forbidden phase transition. J. High Energ. Phys. 2022, 19 (2022). https://doi.org/10.1007/JHEP06(2022)019
33 changes: 8 additions & 25 deletions docs/src/lib/lib.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,36 +10,19 @@ MPSMultiline

## Operators
```@docs
FiniteMPO
SparseMPO
DenseMPO
AbstractMPO
MPO
MPOHamiltonian
```

## Environments
```@docs
MPSKit.AbstractInfEnv
MPSKit.PerMPOInfEnv
MPSKit.MPOHamInfEnv
MPSKit.FinEnv
MPSKit.IDMRGEnvs
```

## Generic actions
```@docs
∂C
∂∂C
∂AC
∂∂AC
∂AC2
∂∂AC2
c_proj
ac_proj
ac2_proj
transfer_left
transfer_right
MPSKit.AbstractMPSEnvironments
MPSKit.AbstractInfiniteEnvironments
MPSKit.InfiniteMPOEnvironments
MPSKit.InfiniteMPOHamiltonianEnvironments
MPSKit.FiniteEnvironments
MPSKit.IDMRGEnvironments
```

## Algorithms
Expand Down
24 changes: 16 additions & 8 deletions docs/src/man/algorithms.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
```@meta
DocTestSetup = quote
using MPSKit, MPSKitModels, TensorKit
end
DocTestSetup = :( using MPSKit, TensorKit)
```

# [Algorithms](@id um_algorithms)
Expand Down Expand Up @@ -168,7 +166,9 @@ in the transverse field Ising model, we calculate the first excited state as sho
provided code snippet, amd check the accuracy against theoretical values. Some deviations
are expected, both due to finite-bond-dimension and finite-size effects.

```jldoctest; output = false
<!-- TODO: reenable doctest -->

```julia
# Model parameters
g = 10.0
L = 16
Expand All @@ -194,7 +194,9 @@ in the unit cell in a plane-wave superposition, requiring momentum specification
[Haldane gap](https://iopscience.iop.org/article/10.1088/0953-8984/1/19/001) computation in
the Heisenberg model illustrates this approach.

```jldoctest; output = false
<!-- TODO: reenable doctest -->

```julia
# Setting up the model and momentum
momentum = π
H = heisenberg_XXX()
Expand All @@ -219,7 +221,9 @@ trivial total charge. However, quasiparticles with different charges can be obta
the sector keyword. For instance, in the transverse field Ising model, we consider an
excitation built up of flipping a single spin, aligning with `Z2Irrep(1)`.

```jldoctest; output = false
<!-- TODO: reenable doctest -->

```julia
g = 10.0
L = 16
H = transverse_field_ising(Z2Irrep; g)
Expand Down Expand Up @@ -260,7 +264,9 @@ often referred to as the 'Chepiga ansatz', named after one of the authors of thi

This is supported via the following syntax:

```jldoctest
<!-- TODO: reenable doctest -->

```julia
g = 1.0
L = 16
H = transverse_field_ising(; g)
Expand All @@ -278,7 +284,9 @@ true
In order to improve the accuracy, a two-site version also exists, which varies two
neighbouring sites:

```jldoctest
<!-- TODO: reenable doctest -->

```julia
g = 1.0
L = 16
H = transverse_field_ising(; g)
Expand Down
59 changes: 15 additions & 44 deletions docs/src/man/operators.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ O_xzx_sum * FiniteMPS(3, ℂ^2, ℂ^4)
make sure that the virtual spaces do not increase past the maximal virtual space that
is dictated by the requirement of being full-rank tensors.

## MPOHamiltonian
## FiniteMPOHamiltonian

We can also represent quantum Hamiltonians in the same form. This is done by converting a
sum of local operators into a single MPO operator. The resulting operator has a very
specific structure, and is often referred to as a *Jordan block MPO*.

This object can be constructed as an MPO by using the [`MPOHamiltonian`](@ref) constructor,
This object can be constructed as an MPO by using the [`FiniteMPOHamiltonian`](@ref) constructor,
which takes two crucial pieces of information:

1. An array of `VectorSpace` objects, which determines the local Hilbert spaces of the
Expand All @@ -103,16 +103,16 @@ h = 0.5
chain = fill(ℂ^2, 3) # a finite chain of 4 sites, each with a 2-dimensional Hilbert space
single_site_operators = [1 => -h * S_z, 2 => -h * S_z, 3 => -h * S_z]
two_site_operators = [(1, 2) => -J * S_x ⊗ S_x, (2, 3) => -J * S_x ⊗ S_x]
H_ising = MPOHamiltonian(chain, single_site_operators..., two_site_operators...);
H_ising = FiniteMPOHamiltonian(chain, single_site_operators..., two_site_operators...);
```

Various alternative constructions are possible, such as using a `Dict` with key-value pairs
that specify the operators, or using generator expressions to simplify the construction.

```@example operators
H_ising′ = -J * MPOHamiltonian(chain,
H_ising′ = -J * FiniteMPOHamiltonian(chain,
(i, i + 1) => S_x ⊗ S_x for i in 1:(length(chain) - 1)) -
h * MPOHamiltonian(chain, i => S_z for i in 1:length(chain))
h * FiniteMPOHamiltonian(chain, i => S_z for i in 1:length(chain))
isapprox(H_ising, H_ising′; atol=1e-6)
```

Expand Down Expand Up @@ -147,9 +147,9 @@ for I in eachindex(IndexCartesian(), square)
end
end
H_ising_2d = MPOHamiltonian(square, local_operators) +
MPOHamiltonian(square, horizontal_operators) +
MPOHamiltonian(square, vertical_operators);
H_ising_2d = FiniteMPOHamiltonian(square, local_operators) +
FiniteMPOHamiltonian(square, horizontal_operators) +
FiniteMPOHamiltonian(square, vertical_operators);
```

There are various utility functions available for constructing more advanced lattices, for
Expand Down Expand Up @@ -224,20 +224,22 @@ Vᵣ = [0, 0, 1]
expand(Vₗ * prod(Ws) * Vᵣ)
```

The `MPOHamiltonian` constructor can also be used to construct the operator from this most
The `FiniteMPOHamiltonian` constructor can also be used to construct the operator from this most
general form, by supplying a 3-dimensional array $W$ to the constructor. Here, the first
dimension specifies the site in the unit cell, the second dimension specifies the row of the
matrix, and the third dimension specifies the column of the matrix.

```@example operators
<!-- TODO: reenable doctest -->

```julia
data = Array{Any,3}(missing, 1, 3, 3) # missing is interpreted as zero
data[1, 1, 1] = id(Matrix{ComplexF64}, ℂ^2)
data[1, 1, 1] = id(ComplexF64, ℂ^2)
data[1, 3, 3] = 1 # regular numbers are interpreted as identity operators
data[1, 1, 2] = -J * S_x
data[1, 2, 3] = S_x
data[1, 1, 3] = -h * S_z
data_range = repeat(data, 4, 1, 1) # make 4 sites long
H_ising″ = MPOHamiltonian(data_range)
H_ising″ = FiniteMPOHamiltonian(data_range)
```

MPSKit will then automatically attach the correct boundary vectors to the Hamiltonian whenever this is required.
Expand All @@ -255,42 +257,11 @@ MPSKit will then automatically attach the correct boundary vectors to the Hamilt
!!! warning
This part is still a work in progress

Because of the discussion above, the `MPOHamiltonian` object is in fact just a `FiniteMPO`,
Because of the discussion above, the `FiniteMPOHamiltonian` object is in fact just an `AbstractMPO`,
with some additional structure. This means that similar operations and properties are
available, such as the virtual spaces, or the individual tensors. However, the block
structure of the operator means that now the virtual spaces are not just a single space, but
a collection (direct sum) of spaces, one for each row/column.

<!-- TODO: add examples virtualspace once blocktensors are in place -->

## DenseMPO

This operator is used for statistical physics problems. It is simply a periodic array of mpo tensors.

Can be created using
```julia
DenseMPO(t::AbstractArray{T,1}) where T<:MPOTensor
```

## SparseMPO

`SparseMPO` is similar to a `DenseMPO`, in that it again represents an mpo tensor, periodically repeated. However this type keeps track of all internal zero blocks, allowing for a more efficient representation of certain operators (such as time evolution operators and quantum hamiltonians). You can convert a sparse mpo to a densempo, but the converse does not hold.


Indexing a `SparseMPO` returns a `SparseMPOSlice` object, which has 3 fields

```@docs
MPSKit.SparseMPOSlice
```

When indexing a `SparseMPOSlice` at index `[j, k]` (or equivalently `SparseMPO[i][j, k]`), the code looks up the corresponding field in `Os[j, k]`. Either that element is a tensormap, in which case it gets returned. If it equals `zero(E)`, then we return a tensormap
```julia
domspaces[j] * pspace pspace * imspaces[k]
```
with norm zero. If the element is a nonzero number, then implicitly we have the identity operator there (multiplied by that element).

The idea here is that you don't have to worry about the underlying structure, you can just index into a sparsempo as if it is a vector of matrices. Behind the scenes we then optimize certain contractions by using the sparsity structure.

SparseMPO are always assumed to be periodic in the first index (position).
In this way, we can both represent periodic infinite mpos and place dependent finite mpos.

Loading
Loading