Jutho / TensorOperations.jl

Julia package for tensor contractions and related operations
https://jutho.github.io/TensorOperations.jl/stable/
Other
443 stars 56 forks source link

NCon cannot do partial trace? #132

Closed GibbsJR closed 1 year ago

GibbsJR commented 1 year ago

Hello,

I would like to use the ncon function to do a partial trace, however it does not seem like this is possible e.g.

d = 10;
A = rand(d,d,d,d,d,d);

B = ncon(Any[A],Any[[-1,-2,1,-3,-4,1]]);

Gives the error

ArgumentError: do not use `ncon` for less than two tensors

Stacktrace:
 [1] ncon(tensors::Vector{Any}, network::Vector{Any}, conjlist::Vector{Bool}, sym::Nothing; order::Nothing, output::Nothing)
   @ TensorOperations ~/.julia/packages/TensorOperations/LDxfx/src/functions/ncon.jl:30
 [2] ncon (repeats 2 times)
   @ ~/.julia/packages/TensorOperations/LDxfx/src/functions/ncon.jl:27 [inlined]
 [3] top-level scope
   @ In[25]:5
 [4] eval
   @ ./boot.jl:368 [inlined]
 [5] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
   @ Base ./loading.jl:1428

Could this functionality be enabled?

Jutho commented 1 year ago

I've fixed this in a patch update (3.2.5) which I will tag in a minute.