ITensor / ITensor/ITensorMPS.jl
`eachsiteinds` for lazy iteration over site indices of MPS/MPO
Open
@mtfishman is already working on this.
Since Feb 5, 2021.
- Dominant language
- Julia
- Stars
- 85
- Forks
- 27
- Avg merge
- 22m
- Merged PRs (30d)
- 1
Description
A common requirement in MPS and MPO code is to iterate over link or site indices (for example to prime them, etc.). It may be helpful to have a function that returns a lazy iteration over site indices or link indices, for example using a Base.Generator:
eachsiteinds(ψ) = (siteinds(ψ, n) for n in eachindex(ψ))
eachlinkind(ψ) = (linkind(ψ, n) for n in eachindex(ψ)[1:end-1])
s = siteinds("S=1/2", 4)
ψ = productMPS(s, "↑")
for s in eachsiteinds(ψ) @show s; end
for l in eachlinkind(ψ) @show l; end
returns:
s = IndexSet{1} (dim=2|id=317|"S=1/2,Site,n=1")
s = IndexSet{1} (dim=2|id=366|"S=1/2,Site,n=2")
s = IndexSet{1} (dim=2|id=155|"S=1/2,Site,n=3")
s = IndexSet{1} (dim=2|id=556|"S=1/2,Site,n=4")
l = (dim=1|id=986|"Link,l=1")
l = (dim=1|id=392|"Link,l=2")
l = (dim=1|id=691|"Link,l=3")
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.