diff --git a/src/ITensors.jl b/src/ITensors.jl index 1eca390..ec8310b 100644 --- a/src/ITensors.jl +++ b/src/ITensors.jl @@ -183,14 +183,16 @@ end # Handle orthogonality center correctly Base.getindex(ψ::MPS, r::UnitRange{Int}) = MPS([ψ[n] for n in r]) -Base.zero(T::ITensor) = false * T - -function ITensors.NDTensors.datatype( - ::ITensors.EmptyStorage{Float64,ITensors.NDTensors.BlockSparse{Float64,Vector{Float64},N}} -) where {N} - return Vector{Float64} -end +# Base.zero(T::ITensor) = false * T +# +# function ITensors.NDTensors.datatype( +# ::ITensors.EmptyStorage{Float64,ITensors.NDTensors.BlockSparse{Float64,Vector{Float64},N}} +# ) where {N} +# return Vector{Float64} +# end # # function ITensors.NDTensors.datatype(T::ITensors.NDTensors.TensorStorage{Float64}) # return typeof(data(T)) # end + +Base.fill!(::NDTensors.NoData, ::Any) = 0 diff --git a/src/infinitempo.jl b/src/infinitempo.jl index fd8c777..abf8967 100644 --- a/src/infinitempo.jl +++ b/src/infinitempo.jl @@ -44,11 +44,6 @@ function cat_to_itensor(Hm::Matrix{ITensor}) end append!(input, [Hm[x, ly] * onehot(T, right_links[ly] => 1) => right_links[ly]]) H, ir = directsum(input...; tags="Link, right") - # H, ir = directsum( - # [((y == 1 || y == ly) ? Hm[x, y] * onehot(T, right_links[y] => 1) : Hm[x, y]) => - # right_links[y] for y in 1:ly]...; - # tags="Link, right", - # ) if x == 1 append!(new_rs, [ir]) else @@ -62,11 +57,6 @@ function cat_to_itensor(Hm::Matrix{ITensor}) end append!(input, [Ls[lx] * onehot(T, left_links[lx] => 1) => left_links[lx]]) H, new_l = directsum(input...; tags="Link, left") - # H, new_l = directsum( - # [((x == 1 || x == lx) ? Ls[x] * onehot(T, left_links[x] => 1) : Ls[x]) => left_links[x] for - # x in 1:lx]...; - # tags="Link, left", - # ) return H, new_l, new_rs[1] end # diff --git a/src/infinitempomatrix.jl b/src/infinitempomatrix.jl index 25eaf8c..2522af8 100644 --- a/src/infinitempomatrix.jl +++ b/src/infinitempomatrix.jl @@ -220,15 +220,15 @@ function apply_tensor(A::Array{ITensor,N}, B::ITensor...) where {N} return new_A end -import ITensors._add -function ITensors._add( - A::T1, B::T2 -) where {T1<:ITensors.NDTensors.EmptyTensor,T2<:ITensors.NDTensors.EmptyTensor} - ndims(A) != ndims(B) && throw( - ITensors.DimensionMismatch("cannot add ITensors with different numbers of indices") - ) - indices = inds(A) - length(commoninds(indices, B)) != length(inds(B)) && - error("cannot add ITensors with different indices") - return ITensor(promote_type(eltype(A), eltype(B)), indices) -end +# import ITensors._add +# function ITensors._add( +# A::T1, B::T2 +# ) where {T1<:ITensors.NDTensors.EmptyTensor,T2<:ITensors.NDTensors.EmptyTensor} +# ndims(A) != ndims(B) && throw( +# ITensors.DimensionMismatch("cannot add ITensors with different numbers of indices") +# ) +# indices = inds(A) +# length(commoninds(indices, B)) != length(inds(B)) && +# error("cannot add ITensors with different indices") +# return ITensor(promote_type(eltype(A), eltype(B)), indices) +# end