Skip to content

Conversation

@JoeyT1994
Copy link
Collaborator

This small PR allows passing a truncation_error! reference to the apply function in the case of the simple update routine. This will be filled in with the truncerr from the corresponding call to factorize_svd allowing one to keep track of the approximate error induced by the simple update routine.

Note that this is not possible to infer solely from the singular_values! reference object due to the fact that the spectrum is not normalized by factorize_svd!.

Tests are updated in apply_test.jl to make sure the functionality is working.

@mtfishman
Copy link
Member

@JoeyT1994 take a look at the callback design in ITensorMPS.truncate!: https://github.com/ITensor/ITensorMPS.jl/blob/v0.3.17/src/abstractmps.jl#L1692-L1714 (introduced in ITensor/ITensorMPS.jl#99), I think that could be a good code pattern to use here as well since it is more general (it makes it easier for users to decide how to store the output, output different combinations of values, etc.).

@JoeyT1994
Copy link
Collaborator Author

@mtfishman Oh yeah that's quite a nice way to do it. I have updated the code to use a callback for the ITensorNetworks interface instead

@JoeyT1994
Copy link
Collaborator Author

@mtfishman I can't say I understand the reason for the failing tests. I am not seeing anything locally, it seems to be erroring here when running test_contraction_sequence_to_graph.jl but not reporting the reason for the exit code.

@mtfishman
Copy link
Member

Looks good, thanks! I have no idea what's going on with those tests, I've seen that issue randomly but only in this package. Maybe one of the tests uses a lot of memory?

@mtfishman mtfishman merged commit 2e36def into ITensor:main Apr 11, 2025
6 of 11 checks passed
@JoeyT1994
Copy link
Collaborator Author

Yeah maybe next time we see it I can try to remove the test that causes it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants