ITensor / ITensor/ITensorMPS.jl
[ITensors] [ENHANCEMENT] Passing site-dependent keyword arguments to `siteinds`
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 85
- Forks
- 27
- Avg merge
- 22m
- Merged PRs (30d)
- 1
Description
Is your feature request related to a problem? Please describe.
Currently the site types included in ITensors.jl don't accept arbitrary keyword args through kwargs.... This is ok, but blocks the use of something like siteinds(n -> isodd(n) ? "Fermion" : "Boson", N; dim=3) since the "Boson" space function accepts dim but the "Fermion" one does not. But it might not be desireable to pass such a keyword this way anyway, because what if "Fermion" did accept dim but we only wanted to apply it to "Boson" sites?
Describe the solution you'd like
It should be possible to make something like the following work:
siteinds(n -> isodd(n) ? "Fermion" : ("Boson", (dim=3,)), 4) =
[isodd(n) ? siteind("Fermion", n) : siteind("Boson", n; dim=3) for n in 1:4]
Describe alternatives you've considered
An alternative is just to use the array comprehension notation above.
Additional context
The motivation was a question by a user here: http://itensor.org/support/3879/autompo-using-operators-with-more-arguments
and a discussion with @mtfishman
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.
Research direction
Start by tracing the siteinds and siteind entry points described in the issue, then inspect how the site type returned for each index is constructed. Implement the requested per-site keyword form and verify that the example creates Fermion sites without dim and Boson sites with dim=3; add or update focused tests if the existing test suite has coverage for these entry points.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100