-
Notifications
You must be signed in to change notification settings - Fork 23
[WIP] Add approximation tensor network contraction subpackage #11
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
Closed
Closed
Changes from 3 commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
23c8fd8
Add approximation tn contraction subpackage
LinjianMa 3050275
Remove some logs, adding back test manifest
LinjianMa 73e080a
Nit
LinjianMa 83e1719
[ApproximateContraction] Remove retired functions, get more test case…
LinjianMa fb87429
Merge conflicts
LinjianMa 1046d00
[ApproxContraction] get 3D cube working
LinjianMa 3442177
[ApproxContraction] get contract tests working
LinjianMa 8088e98
[ApproxContraction] correct all test functions
LinjianMa fcf4279
[Approximate contract] split norm out in the output of approximate_co…
LinjianMa 9d3bea5
Merge branch 'main' into main
LinjianMa 1a1fc1f
[Approximate contraction] Add MPS ansatz, fix multiple caching bugs
LinjianMa dd22bd4
Merge branch 'mtfishman:main' into main
LinjianMa 4fad6de
Merge branch 'mtfishman:main' into main
LinjianMa dc102ef
Update 3d cube benchmark file
LinjianMa da41e28
Merge branch 'main' of https://github.com/LinjianMa/ITensorNetworks.jl
LinjianMa 1703e4b
Merge branch 'main' into main
LinjianMa da09971
Modify approximate contract 3dcube example
LinjianMa 4422333
[ApproxContraction] Retire tensornetwork_graph.jl, rewrite mincut_tree
LinjianMa 9a99007
Remove unused examples/peps/utils.jl
LinjianMa 1d2ffe3
[ApproxContraction] Remove old files
LinjianMa feb5b3d
[ApproxContraction] Remove old files
LinjianMa 56edb27
[ApproxContract] Retire ising_partition
LinjianMa 9e33bb5
[ApproxContraction] Retire unused itensor functions
LinjianMa c17a143
[approxContract] add orthogonalization (performance not as expected)
LinjianMa c0177e8
[ApproxContraction] update orthogonalize
LinjianMa 78953a1
[ApproxContraction] update 3dcube env interface in contraction tree
LinjianMa e705c3d
[ApproxContraction] Update 3dcube.jl
LinjianMa 5262160
Merge branch 'main' into main
LinjianMa 8c82b0b
[ApproxContract] Rewrite tree embedding, add tree approximation using…
LinjianMa d3592b6
General ising_network with external force
LinjianMa 71215d9
Update 3dcube.jl
LinjianMa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| @reexport module ApproximateTNContraction | ||
|
|
||
| using ITensors | ||
|
|
||
| using ITensors: data, contract | ||
|
|
||
| using TimerOutputs | ||
|
|
||
| const timer = TimerOutput() | ||
|
|
||
| include("ITensors.jl") | ||
| include("orthogonal_tensor.jl") | ||
| include("networks/lattices.jl") | ||
| include("networks/inds_network.jl") | ||
| include("networks/itensor_network.jl") | ||
| include("networks/3d_classical_ising.jl") | ||
| include("models/models.jl") | ||
| include("interfaces/sweep_contractor.jl") | ||
| include("contract/contract.jl") | ||
|
|
||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| # | ||
| # ITensors.jl extensions | ||
| # | ||
|
|
||
| # Generalize siteind to n-dimensional lattice | ||
| function ITensors.siteind(st::SiteType, N1::Integer, N2::Integer, Ns::Integer...; kwargs...) | ||
| s = siteind(st; kwargs...) | ||
| if !isnothing(s) | ||
| ts = "n1=$N1,n2=$N2" | ||
| for i in eachindex(Ns) | ||
| ts *= ",n$(i + 2)=$(Ns[i])" | ||
| end | ||
| return addtags(s, ts) | ||
| end | ||
| return isnothing(s) && error(space_error_message(st)) | ||
| end | ||
|
|
||
| # Generalize siteinds to n-dimensional lattice | ||
| function ITensors.siteinds( | ||
| str::AbstractString, N1::Integer, N2::Integer, Ns::Integer...; kwargs... | ||
| ) | ||
| st = SiteType(str) | ||
| return [siteind(st, ns...) for ns in Base.product(1:N1, 1:N2, UnitRange.(1, Ns)...)] | ||
| end | ||
|
|
||
| # Get the promoted type of the Index objects in a collection | ||
| # of Index (Tuple, Vector, ITensor, etc.) | ||
| indtype(i::Index) = typeof(i) | ||
| indtype(T::Type{<:Index}) = T | ||
| indtype(is::Tuple{Vararg{<:Index}}) = eltype(is) | ||
| indtype(is::Vector{<:Index}) = eltype(is) | ||
| indtype(A::ITensor...) = indtype(inds.(A)) | ||
|
|
||
| indtype(tn1, tn2) = promote_type(indtype(tn1), indtype(tn2)) | ||
| indtype(tn) = mapreduce(indtype, promote_type, tn) | ||
|
|
||
| # | ||
| # MPS functionality extensions | ||
| # | ||
|
|
||
| Base.keytype(m::MPS) = keytype(data(m)) | ||
|
|
||
| # A version of indexing which returns an empty order-0 ITensor | ||
| # when out of bounds | ||
| get_itensor(x::MPS, n::Int) = n in 1:length(x) ? x[n] : ITensor() | ||
LinjianMa marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| # Reverse the site ordering of an MPS. | ||
| # XXX: also reverse the orthogonality limits. | ||
| Base.reverse(x::MPS) = MPS(reverse(x.data)) | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.