You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed that TensorMap constructor is extraordinarily slow when applied to an array. Here is a minimal example:
space=Z2Space(0=>10,1=>10);
@time A=TensorMap(randn,space⊗space←space⊗space); # takes time of roder 1e-4s
A_array=convert(Array,A);
@time A_copy_1=TensorMap(A_array,space⊗space←space⊗space); # takes time of order 10s
println(A_copy_1==A) # prints true
At the same time, the following code takes time of order 1e-4s:
@time begin
dom=space⊗space
codom=dom
A_copy_2=TensorMap(zeros,codom←dom)
for (f1,f2) in fusiontrees(A_copy_2)
a3,a4=axes(dom,f2.uncoupled)
a1,a2=axes(dom,f1.uncoupled)
A_copy_2[f1,f2]=A_array[a1,a2,a3,a4]
end
end
println(A_copy_1==A)
The text was updated successfully, but these errors were encountered:
The code for this in the latest tagged version is indeed quite suboptimal, because this is not something that is expected to be used in computation-heavy parts of the code. We figured this would be used only to initialise some small tensors such as single-site operators or two-site hamiltonians. However, on the development version that we are currently working on, this has been improved quite dramatically, and this specifica example currently takes only order 2*10^-3 seconds on my computer.
Hi!
I noticed that TensorMap constructor is extraordinarily slow when applied to an array. Here is a minimal example:
At the same time, the following code takes time of order 1e-4s:
The text was updated successfully, but these errors were encountered: