Open mtfishman opened 3 years ago
Something to consider is having a specialized version for contract(::DiagTensor, ::DenseTensor)
for cases when the diagonal tensor is order-2, and only contracts one index with the dense tensor, i.e.:
/ /
---D---T = ---R
\ \
This type of contraction could be treated directly as a diagonal matrix-dense matrix multiplication, where we could make a special optimized algorithm (or try out Julia's Diagonal * Matrix
operation).
Also another data point: in CTMRG, right now it is faster to convert the diagonal tensor to dense, and then do a dense-dense tensor contraction. So a concrete goal would be to make the diag-dense contraction faster than converting to dense.
I noticed when comparing CTMRG benchmarks in ITensors.jl to C++ ITensor, ITensors.jl is a bit slower (maybe by 20% with no BLAS threading). Based on profiling, it looks like the contraction between DiagTensor and DenseTensor is probably the culprit.