-
Notifications
You must be signed in to change notification settings - Fork 126
site_range keyword for truncate! #971
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Seems like a good idea. An alternative interface could be to allow passing a Vector of s = siteinds("S=1/2", 6)
psi = randomMPS(s; linkdims=4)
truncate!(psi; maxdim=[2, 3, 3, 3, 2]) Just bringing that up for debate but I think the For MPOs that only act on part of the MPS, I was picturing we could support something like this: N = 10
site_range = 2:4
s = siteinds("S=1/2", N)
H = MPO(s[site_range])
psi = randomMPS(s)
Hpsi_sub = apply(H, psi[site_range])
Hpsi = copy(psi)
Hpsi[site_range] = Hpsi_sub Not all of these operations are supported right now but it shouldn't be hard to support them. Note that the |
Interesting comments. I was thinking that we could eventually have an interface like how we have Something like
This is really helpful in particular for quantum computing simulations, which is the main use case for where I need it. It makes a big difference in the efficiency of the code. |
The issue I'd have with the separate maxdims for the number of links is that to prevent any truncation, would one either have to put very large maxdims on the bonds you want the code to skip and or know the current linkdims in advance? (Not that they are hard to find out, but it just requires extra code.) Relatedly, even if the maxdim is high, the cutoff might still incur a truncation which one doesn't want, just because of some context where the truncation is known to be avoidable. |
Benchmark resultJudge resultBenchmark Report for /home/runner/work/ITensors.jl/ITensors.jlJob Properties
ResultsA ratio greater than
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfoTarget
Baseline
Target resultBenchmark Report for /home/runner/work/ITensors.jl/ITensors.jlJob Properties
ResultsBelow is a table of this job's results, obtained by running the benchmarks.
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfo
Baseline resultBenchmark Report for /home/runner/work/ITensors.jl/ITensors.jlJob Properties
ResultsBelow is a table of this job's results, obtained by running the benchmarks.
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfo
Runtime information
|
Benchmark resultJudge resultBenchmark Report for /home/runner/work/ITensors.jl/ITensors.jlJob Properties
ResultsA ratio greater than
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfoTarget
Baseline
Target resultBenchmark Report for /home/runner/work/ITensors.jl/ITensors.jlJob Properties
ResultsBelow is a table of this job's results, obtained by running the benchmarks.
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfo
Baseline resultBenchmark Report for /home/runner/work/ITensors.jl/ITensors.jlJob Properties
ResultsBelow is a table of this job's results, obtained by running the benchmarks.
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfo
Runtime information
|
Yeah that's a clear disadvantage of specifying a vector of Agreed it would be good to support that kind of interface for |
Benchmark resultJudge resultBenchmark Report for /home/runner/work/ITensors.jl/ITensors.jlJob Properties
ResultsA ratio greater than
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfoTarget
Baseline
Target resultBenchmark Report for /home/runner/work/ITensors.jl/ITensors.jlJob Properties
ResultsBelow is a table of this job's results, obtained by running the benchmarks.
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfo
Baseline resultBenchmark Report for /home/runner/work/ITensors.jl/ITensors.jlJob Properties
ResultsBelow is a table of this job's results, obtained by running the benchmarks.
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfo
Runtime information
|
Codecov Report
@@ Coverage Diff @@
## main #971 +/- ##
==========================================
+ Coverage 65.94% 66.53% +0.59%
==========================================
Files 91 91
Lines 9279 9918 +639
==========================================
+ Hits 6119 6599 +480
- Misses 3160 3319 +159
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Benchmark resultJudge resultBenchmark Report for /home/runner/work/ITensors.jl/ITensors.jlJob Properties
ResultsA ratio greater than
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfoTarget
Baseline
Target resultBenchmark Report for /home/runner/work/ITensors.jl/ITensors.jlJob Properties
ResultsBelow is a table of this job's results, obtained by running the benchmarks.
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfo
Baseline resultBenchmark Report for /home/runner/work/ITensors.jl/ITensors.jlJob Properties
ResultsBelow is a table of this job's results, obtained by running the benchmarks.
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfo
Runtime information
|
Looks good to me, feel free to merge when ready. |
Description
Adds a
site_range
keyword argument fortruncate!
. This is helpful for algorithms where it is known that only part of the MPS was changed, so as to avoid doing extra work. (Recent application of this is a specialized routine for applying MPOs which only act on part of an MPS.)How Has This Been Tested?
Added a unit test to test/mps.jl
Checklist:
using JuliaFormatter; format(".")
in the base directory of the repository (~/.julia/dev/ITensors
) to format your code according to our style guidelines.