Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanlevy committed Oct 14, 2024
1 parent 08329c9 commit a70d54a
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,33 +21,32 @@ This package is a work in progress. Here are some examples of the interface:
julia> using ITensors, ITensorMPS, ITensorInfiniteMPS

julia> s = siteinds("S=1/2", 3)
3-element Array{Index{Int64},1}:
(dim=2|id=652|"S=1/2,Site,n=1")
(dim=2|id=984|"S=1/2,Site,n=2")
(dim=2|id=569|"S=1/2,Site,n=3")
3-element Vector{Index{Int64}}:
(dim=2|id=988|"S=1/2,Site,n=1")
(dim=2|id=220|"S=1/2,Site,n=2")
(dim=2|id=650|"S=1/2,Site,n=3")

julia> ψ = InfiniteMPS(s) # Infinite MPS with 3-site unit cell
InfiniteMPS
[1] IndexSet{3} (dim=1|id=317|"Link,c=0,l=3") (dim=2|id=652|"S=1/2,Site,c=1,n=1") (dim=1|id=77|"Link,c=1,l=1")
[2] IndexSet{3} (dim=1|id=77|"Link,c=1,l=1") (dim=2|id=984|"S=1/2,Site,c=1,n=2") (dim=1|id=868|"Link,c=1,l=2")
[3] IndexSet{3} (dim=1|id=868|"Link,c=1,l=2") (dim=2|id=569|"S=1/2,Site,c=1,n=3") (dim=1|id=317|"Link,c=1,l=3")

[1] ((dim=1|id=108|"Link,c=0,l=3"), (dim=2|id=988|"S=1/2,Site,c=1,n=1"), (dim=1|id=112|"Link,c=1,l=1"))
[2] ((dim=1|id=112|"Link,c=1,l=1"), (dim=2|id=220|"S=1/2,Site,c=1,n=2"), (dim=1|id=429|"Link,c=1,l=2"))
[3] ((dim=1|id=429|"Link,c=1,l=2"), (dim=2|id=650|"S=1/2,Site,c=1,n=3"), (dim=1|id=108|"Link,c=1,l=3"))

julia> ψ[2] == replacetags(ψ[5], "c=2" => "c=1") # Indexing outside of the unit cell gets tensors from other unit cells
true

julia> ψ₁ = ψ[1:3] # Create a finite MPS from the tensors of the first unit cell
MPS
[1] IndexSet{3} (dim=1|id=317|"Link,c=0,l=3") (dim=2|id=652|"S=1/2,Site,c=1,n=1") (dim=1|id=77|"Link,c=1,l=1")
[2] IndexSet{3} (dim=1|id=77|"Link,c=1,l=1") (dim=2|id=984|"S=1/2,Site,c=1,n=2") (dim=1|id=868|"Link,c=1,l=2")
[3] IndexSet{3} (dim=1|id=868|"Link,c=1,l=2") (dim=2|id=569|"S=1/2,Site,c=1,n=3") (dim=1|id=317|"Link,c=1,l=3")
[1] ((dim=1|id=108|"Link,c=0,l=3"), (dim=2|id=988|"S=1/2,Site,c=1,n=1"), (dim=1|id=112|"Link,c=1,l=1"))
[2] ((dim=1|id=112|"Link,c=1,l=1"), (dim=2|id=220|"S=1/2,Site,c=1,n=2"), (dim=1|id=429|"Link,c=1,l=2"))
[3] ((dim=1|id=429|"Link,c=1,l=2"), (dim=2|id=650|"S=1/2,Site,c=1,n=3"), (dim=1|id=108|"Link,c=1,l=3"))


julia> ψ₂ = ψ[4:6] # Create a finite MPS from the tensors of the second unit cell
MPS
[1] IndexSet{3} (dim=1|id=317|"Link,c=1,l=3") (dim=2|id=652|"S=1/2,Site,c=2,n=1") (dim=1|id=77|"Link,c=2,l=1")
[2] IndexSet{3} (dim=1|id=77|"Link,c=2,l=1") (dim=2|id=984|"S=1/2,Site,c=2,n=2") (dim=1|id=868|"Link,c=2,l=2")
[3] IndexSet{3} (dim=1|id=868|"Link,c=2,l=2") (dim=2|id=569|"S=1/2,Site,c=2,n=3") (dim=1|id=317|"Link,c=2,l=3")
[1] ((dim=1|id=108|"Link,c=1,l=3"), (dim=2|id=988|"S=1/2,Site,c=2,n=1"), (dim=1|id=112|"Link,c=2,l=1"))
[2] ((dim=1|id=112|"Link,c=2,l=1"), (dim=2|id=220|"S=1/2,Site,c=2,n=2"), (dim=1|id=429|"Link,c=2,l=2"))
[3] ((dim=1|id=429|"Link,c=2,l=2"), (dim=2|id=650|"S=1/2,Site,c=2,n=3"), (dim=1|id=108|"Link,c=2,l=3"))
```
Useful operations like gauging and optimization are in progress, so stay tuned!

Expand Down

0 comments on commit a70d54a

Please sign in to comment.