-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Description
During the creation of MPOMatrices, I experienced some significant slowdown, in particular when not using the base translate function (though not only) because accessing a tensor in fact often creates a copy of it.
Would it not be better to add a small modification in all our translatecell such that if we ask a translation of 0, it directly return the original tensor. Something akin to (in the celledvectors.jl file):
#Transfer the functional properties
#translatecell(translator, T::ITensor, n::Integer) = translator(T, n)
function translatecell(translator::Function, T::ITensor, n::Integer)
if n == 0
return T
end
return ITensors.setinds(T, translatecell(translator, inds(T), n))
end
translatecell(translator::Function, T::MPO, n::Integer) = n==0 ? T : translatecell.(translator, T, n)
function translatecell(translator::Function, T::Matrix{ITensor}, n::Integer)
if n == 0
return T
end
return translatecell.(translator, T, n)
end ###etcThis should drastically reduce the memory footprint and speed up some parts of the code.
Metadata
Metadata
Assignees
Labels
No labels