tensor_network_apply_op_op and tensor_network_apply_op_vec methods in the arbgeom module are broken.
What happened?
Hi,
There are some problems when using the contract and compress options for the methods applying operators to operators and operators to vectors. Specifically, both functions currently have a line like
x^=site
which is problematic since 'site' is an integer there. Further, when compressing you run into
# optionally compress
if compress:
x.compress(**compress_opts)
but there is currently no .compress method for the arbgeom operators or vectors.
I have gotten this to work for my purposes by changing those lines to :
x ^= [x._site_tag_id.format(site),]
and
x.compress_all(**compress_opts)
but I am not sure that the choice of .compress_all is the preferred choice in general. Perhaps the correct fix is to add a .compress method, but I am not sure what the preferred behavior is outside my use case.
Thanks!
What did you expect to happen?
I expected the code to not fail while complaining that it had been given an int rather than an iterable, as well as not running into a not-implemented method when attempting to compress. :)
Minimal Complete Verifiable Example
Relevant log output
Anything else we need to know?
No response
Environment
This bug is present in the latest version. (I just checked the github code on main and the bug seems to be there.)
Hi @AndrewArrasmith, yes that compress call was added assuming calling classes might have an obvious default compress method, but outside of 1D and tree like networks there's not really one obvious choice.
However there is the function tensor_network_ag_compress now, one could probably add that as the default compress method in TensorNetworkGen.