denseblocks(A) where A is a dense tensor crashes.
This is a funny end case, but I would simply expect it to return A.
using ITensors, ITensorMPS
for conserve_qns in [true, false]
i = siteind("S=1"; conserve_qns)
o = op(i,"Sz") # diagonal matrix in dense format
S = svd(o,i).S # diagonal matrix in diag format
denseblocks(S) # works
denseblocks(o) # fails if conserve_qns==false
end
For context, I ran into this in generic code where I want to initialize a Krylov run with some diagonal matrix, with or without quantum numbers. As adding diagonal matrices is not supported, I use denseblocks to convert the input to a dense (block) matrix. But if the input was already in dense format and without quantum numbers then denseblocks fails.