-
Notifications
You must be signed in to change notification settings - Fork 7
NDTensors.jl incompatible with Optim.jl #62
Comments
Sorry, I just noticed this. I'm not sure why I don't get notifications about issues raised, I'll have to look into my settings. Thanks for pointing that out. It would be great to have |
This should be fixed on master and will be included in the next ITensors release (v0.1.38), please let me know if you continue to have problems like this. |
Hi, I'm not sure whether I should be posting in this Issue or opening a new one - apologies if the latter. Today I tried using ITensors.jl to do some calculations and had this same problem. If I use a package which depends on ArrayInterface.jl and then try to run, for instance, the first half of the DMRG example script https://itensor.org/docs.cgi?vers=julia&page=getting_started/dmrg : using ITensors
let
N = 100
sites = siteinds("S=1",N)
ampo = AutoMPO()
for j=1:N-1
ampo += "Sz",j,"Sz",j+1
ampo += 1/2,"S+",j,"S-",j+1
ampo += 1/2,"S-",j,"S+",j+1
end
H = MPO(ampo,sites)
end I get the same error. I fixed it by extending your fix to accept two integer arguments # This is needed to fix an ambiguity error with ArrayInterface.jl
# https://github.com/ITensor/NDTensors.jl/issues/62
@propagate_inbounds function setindex(T::EmptyTensor, x, I::Int, J::Int)
return _setindex(T, x, I, J)
end I assume this happens because when constructing the MPO from the AutoMPO, ITensors needs to set two indices at once when instantiating the local operators, and the previous solution only fixed it when setting one index. |
Thanks for pointing that out, I'm fixing it now (more generically by defining |
Hello everybody,
I am trying to minimise a function of some variables and quantum state by ITensors.jl's means to measure an MPS. However, the Optim.jl package has a dependency on FiniteDiff.jl which in turn has a dependency on ArrayInterface.jl which in turn overloads the method
setindex
of NDTensors.jl. This throws an error when using the elementary methodsetelt()
in ITensors.jlAn example:
I think it would be great to be able to use Optim.jl in conjuction with ITensors.jl. I have however no idea if the proposed solution by the compiler
Possible fix, define setindex(::NDTensors.Tensor{T,1,StoreT,IndsT} where StoreT<:NDTensors.Empty where IndsT where T<:Number, ::Any, ::Int64)
would be suitableCheers
Jan
The text was updated successfully, but these errors were encountered: