-
Notifications
You must be signed in to change notification settings - Fork 23
Contraction sequence finding #218
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
Contraction sequence finding #218
Conversation
|
Thanks for taking a look at this @JoeyT1994. Some suggestions:
|
Thanks Matt. I followed your suggestions and made |
ext/ITensorNetworksTensorOperationsExt/ITensorNetworksTensorOperationsExt.jl
Outdated
Show resolved
Hide resolved
Yes, that's a downside of this. We could make a backup definition: function contraction_sequence(alg::Algorithm, tn::Vector{ITensor})
return throw(ArgumentError(#= Error message saying `alg` isn't defined, suggest loading a backend like TensorOperations.jl or OMEinsumContractionOrders.jl =#))
end |
ext/ITensorNetworksTensorOperationsExt/ITensorNetworksTensorOperationsExt.jl
Outdated
Show resolved
Hide resolved
|
@JoeyT1994 looks like you need to add TensorOperations as a test dependency by adding it to |
|
@mtfishman ! Thanks, I forgot about that and wondered what has happening |
|
Looks good, thanks! One step closer to getting rid of more code from ITensors.jl, which is always a good thing. |
This PR makes the default contraction sequence backend for the
tn::AbstractITensorNetworktype theoptimaltreefunction fromTensorOperations.jl.This is achieved by extracting the tensors from the
tnand passing them to the overwritten functionITensors.optimal_contraction_sequence(tensors::Vector{<:ITensor})which strips the tensors down to their indices and passes tooptimaltreewhich happily recognizes theITensorIndextype.This sequence finder is noticeably faster (well over an order of magnitude) than the current
optimal_contraction_sequencefunction inITensors.jlfor a range of different networks tested - especially when a large number of tensors is involved.TensorOperationsis therefore now a dependency forITensorNetworks.A similar PR will be made to
ITensors.jlin order to change the default there.