Skip to content

Conversation

@JoeyT1994
Copy link
Collaborator

This PR fixes a bug where the rescale(bpc::BeliefPropagationCache, ...) function would automatically convert messages to 32-bit floating point precision because of them being normalized by an inverse power which automatically converts everything to 64-bit precision.

A test is added that checks calling normalize now appropriately conserves the precision.

@mtfishman
Copy link
Member

@JoeyT1994 this is the same process we went through in ITensors.jl and ITensorMPS.jl when we upgraded those codes to work on GPU. It'll be nice to have the code more generic for other reasons, for example these kinds of changes should make it easier to use exotic number types like BigFloat or tropical numbers.

@JoeyT1994
Copy link
Collaborator Author

@mtfishman Yeah I noticed it when trying to do some sampling from 2D PEPS on GPU (which pre-normalizes for stability). Definitely will be good to have it all working for all sort of different number types (as far as I can tell we have done a pretty good job as this was all I could find).

@mtfishman
Copy link
Member

@mtfishman Yeah I noticed it when trying to do some sampling from 2D PEPS on GPU (which pre-normalizes for stability). Definitely will be good to have it all working for all sort of different number types (as far as I can tell we have done a pretty good job as this was all I could find).

Something I do with tests now is set them up so they loop over different element types and array types: https://github.com/ITensor/BlockSparseArrays.jl/blob/8cfd7f9ea56a6cfb7c185903298879c1dfdb9e61/test/test_basics.jl#L49-L61, we should start doing that with ITensorNetworks tests.

@mtfishman mtfishman merged commit 11e1c83 into ITensor:main Aug 25, 2025
10 of 11 checks passed
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