Dear admins and moderators,
I designed and executed the following program, but an error occurred:
function MakeVidalMPS(psi, maxdim)
Gm=[]; Ld=[]
U, Sv, V = svd(psi[1] * psi[2] , inds(psi[1]); maxdim=maxdim, cutoff=eps(Float64))
Sv /= norm(Sv)
push!(Gm, U)
push!(Ld, Sv)
push!(Gm, noprime(V))
Gm[2], Sv, Gm[1] = svd(Gm[2] * Gm[1], inds(Gm[2]); maxdim=maxdim, cutoff=eps(Float64))
Sv /= norm(Sv)
push!(Ld, Sv)
return Gm, Ld
end
sites = siteinds("S=1/2", 2; conserve_sz=true)
states = [isodd(n) ? "Up" : "Dn" for n in 1:2]
psi = MPS(sites,states)
Gamma, Lambda = MakeVidalMPS(psi, 100)
f_lambda = h5open("Lambd.h5", "w")
write(f_lambda, "Lambda", Lambda[2])
close(f_lambda)
The error message was as follows:
ERROR: MethodError: no method matching strides(::NDTensors.DiagBlockSparse{Float64, Vector{Float64}, 2})
The function `strides` exists, but no method is defined for this combination of argument types.
Closest candidates are:
strides(::StaticArraysCore.MArray)
@ StaticArrays ~/.julia/packages/StaticArrays/MSJcA/src/abstractarray.jl:19
strides(::LinearAlgebra.Adjoint{<:Real, <:AbstractMatrix})
@ LinearAlgebra ~/.julia/juliaup/julia-1.11.0+0.x64.linux.gnu/share/julia/stdlib/v1.11/LinearAlgebra/src/adjtrans.jl:349
strides(::LinearAlgebra.Adjoint{<:Real, <:AbstractVector})
@ LinearAlgebra ~/.julia/juliaup/julia-1.11.0+0.x64.linux.gnu/share/julia/stdlib/v1.11/LinearAlgebra/src/adjtrans.jl:346
...
Stacktrace:
[1] stride(A::NDTensors.DiagBlockSparse{Float64, Vector{Float64}, 2}, k::Int64)
@ Base ./abstractarray.jl:595
[2] _check_invalid(dataset::HDF5.Dataset, buf::NDTensors.DiagBlockSparse{Float64, Vector{Float64}, 2})
@ HDF5 ~/.julia/packages/HDF5/Z859u/src/datasets.jl:501
[3] write_dataset(dataset::HDF5.Dataset, memtype::HDF5.Datatype, buf::NDTensors.DiagBlockSparse{…}, xfer::HDF5.DatasetTransferProperties)
@ HDF5 ~/.julia/packages/HDF5/Z859u/src/datasets.jl:521
[4] write_dataset(dataset::HDF5.Dataset, memtype::HDF5.Datatype, buf::NDTensors.DiagBlockSparse{Float64, Vector{Float64}, 2})
@ HDF5 ~/.julia/packages/HDF5/Z859u/src/datasets.jl:521
[5] write_dataset(parent::HDF5.Group, name::String, data::NDTensors.DiagBlockSparse{Float64, Vector{…}, 2}; pv::@Kwargs{})
@ HDF5 ~/.julia/packages/HDF5/Z859u/src/datasets.jl:320
[6] write_dataset(parent::HDF5.Group, name::String, data::NDTensors.DiagBlockSparse{Float64, Vector{Float64}, 2})
@ HDF5 ~/.julia/packages/HDF5/Z859u/src/datasets.jl:315
[7] write(parent::HDF5.Group, name::String, data::NDTensors.DiagBlockSparse{Float64, Vector{Float64}, 2}; pv::@Kwargs{})
@ HDF5 ~/.julia/packages/HDF5/Z859u/src/datasets.jl:342
[8] write(parent::HDF5.File, name::String, T::ITensor)
@ ITensorsHDF5Ext ~/.julia/packages/ITensors/fUsvl/ext/ITensorsHDF5Ext/itensor.jl:11
[9] top-level scope
@ REPL[23]:1
Some type information was truncated. Use `show(err)` to see complete types.
I believe the issue is that the ITensor, which I want to save in the HDF5 file, has a QN. In fact, ITensors without a QN can be saved to the HDF5 file without any issues. Even though MPS has a QN, it can be saved without any problems. Why is it that ITensor cannot be saved, but MPS can?