With the attached MPO and MPS, this code:
using LinearAlgebra
using T4ATensorTrain
using T4AMPOContractions
using JLD2
data = JLD2.load("debug_T4A_apply_mpo_mps_jld2.txt")
mpo = data["M_T4A"]
mps = data["mps_T4A"]
N = length(mpo.sitetensors)
# check link dimensions
mpo_sz = size.(mpo.sitetensors)
mps_sz = size.(mps.sitetensors)
for i in eachindex(mpo_sz)
i==1 && continue
@assert mpo_sz[i][1]==mpo_sz[i-1][end]
end
for i in eachindex(mps_sz)
i==1 && continue
@assert mps_sz[i][1]==mps_sz[i-1][end]
end
# crashes
res = T4AMPOContractions.contract(
mpo,
mps;
algorithm=:fit,
method=:SVD,
tolerance=1.e-7
)
crashes. I think it's because the first MPO link has size (1,2,2,7), i.e., the block is rank-deficient after reshaping.
A similar problem occurs when calling
T4ATensorTrain.centercanonicalize!(mpo.sitetensors, N)
# crashes
T4ATensorTrain.centercanonicalize!(mps.sitetensors, N)
from T4ATensorTrain.jl. I think in this case line 396 in T4ATensorTrain.jl/src.tensor_train_representations.jl should be changed to something like
sitetensors[i+1] = reshape(tmptt, size(tmptt,1), Base.size(sitetensors[i+1][2:end])...)
and so forth.
debug_T4A_apply_mpo_mps_jld2.txt
With the attached MPO and MPS, this code:
crashes. I think it's because the first MPO link has size (1,2,2,7), i.e., the block is rank-deficient after reshaping.
A similar problem occurs when calling
from
T4ATensorTrain.jl. I think in this case line 396 inT4ATensorTrain.jl/src.tensor_train_representations.jlshould be changed to something likesitetensors[i+1] = reshape(tmptt, size(tmptt,1), Base.size(sitetensors[i+1][2:end])...)and so forth.
debug_T4A_apply_mpo_mps_jld2.txt