Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ITensors] [ENHANCEMENT] In-place contraction with symmetric tensors #1159

Open
ArtemStrashko opened this issue Jul 24, 2023 · 1 comment
Open
Labels
enhancement New feature or request ITensors Issues or pull requests related to the `ITensors` package.

Comments

@ArtemStrashko
Copy link

Is your feature request related to a problem? Please describe.

While in-place contraction A .= B .* C is implemented for dense tensors, it seems to be missing for symmetric tensors. Using code from a manual as an example, we can construct

using ITensors
i = Index([QN(0) => 2, QN(1) => 3], "i")
j = Index([QN(0) => 2, QN(1) => 3], "j")
A = randomITensor(i, dag(j))
C = combiner(i, dag(j); tags = "c", dir = dir(i))
A * C # works
D = A * C # works
D .= A .* C # does not work
D = randomITensor(inds(A*C))
D .= A .* C # does not work
D .+= A .* C # does not work either

Here is an error I get in my use case:
MethodError: no method matching contract!(::NDTensors.BlockSparseTensor{Float64, 2, Tuple{Index{Vector{Pair{QN, Int64}}}, Index{Vector{Pair{QN, Int64}}}}, NDTensors.BlockSparse{Float64, Vector{Float64}, 2}}, ::Tuple{Int64, Int64}, ::NDTensors.BlockSparseTensor{Float64, 2, Tuple{Index{Vector{Pair{QN, Int64}}}, Index{Vector{Pair{QN, Int64}}}}, NDTensors.BlockSparse{Float64, Vector{Float64}, 2}}, ::Tuple{Int64, Int64}, ::NDTensors.BlockSparseTensor{Float64, 2, Tuple{Index{Vector{Pair{QN, Int64}}}, Index{Vector{Pair{QN, Int64}}}}, NDTensors.BlockSparse{Float64, Vector{Float64}, 2}}, ::Tuple{Int64, Int64})

Describe the solution you'd like

Support of in-place contractions A .= B .* C and A .+= B .* C for symmetric (block--sparse) tensors.

@ArtemStrashko ArtemStrashko added enhancement New feature or request ITensors Issues or pull requests related to the `ITensors` package. labels Jul 24, 2023
@mtfishman
Copy link
Member

Thanks for the report @ArtemStrashko. We'll look into it. We are in the process of rewriting and simplifying a lot of the NDTensors library so it's good to keep track of issues like this to make sure we fix them during that process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request ITensors Issues or pull requests related to the `ITensors` package.
Projects
None yet
Development

No branches or pull requests

2 participants