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 operations with unequal dimensions of indices. #1160

Open
ArtemStrashko opened this issue Jul 24, 2023 · 1 comment
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.

Allocations reduction is a key to writing performant code. While, e.g., an operation like A .= B .* C is available, it assumes that A and B*C have the same indices, which, among other things, means that dimensions of indices must be the same. To write optimal code, sometimes it would be useful to lift this requirement.

For example, suppose we do a 2-site DMRG update. This requires merging m_combined = m_{i} * m_{i+1}, updating it m_combined -> m_combined^*, splitting it m_combined^* = U * S * V, cutting S and then updating m_{i} -> U and m_{i+1} = S * V, i.e. creating new m_{i} and m_{i+1} tensors. For some applications, to reduce allocations, it would be useful to be able to pre-allocate large enough m_i and update them in-place. While it is simple in pure Julia, I wonder how hard it would be to have it in ITensors.

Describe the solution you'd like

It would be useful to have some helper functions allowing for in-place operations with tensors with indices of unequal dimensions.

Describe alternatives you've considered

So far, alternatives have been writing code in pure Julia and miss rich ITensors functionality or to enjoy simplicity and power of ITensors at a cost of extra allocations.

@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

We have been discussing a general buffer system which can help automate pre-allocating data to decrease allocations in tensor operations (@kmp5VT was testing out a prototype in #1011), while being more flexible than the current interface. Definitely a priority on our ever-growing todo list.

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