Speed-up and compatibility of test_belief_propagation.jl

For the test_belief_propagation.jl notebook using a Colab high-ram cpu with the following code is slow to install, import, and add; and receive the following error:

UndefVarError: BeliefPropagationCache not defined

# The Julia bootstrap block
# This should be run for the first time to install Julia kernel, and then refresh this page (e.g., Ctrl-R)
# so that colab will redirect to the installed Julia kernel
# and then doing your own work

# 1. install latest Julia using jill.py
#    tip: one can install specific Julia version using e.g., `jill install 1.7`
!pip install jill && jill install --upstream Official --confirm
# 2. install IJulia kernel
! julia -e 'using Pkg; Pkg.add("IJulia"); using IJulia; installkernel("Julia")'
# 3. hot-fix patch to strip the version suffix of the installed kernel so that this notebook kernelspec is version agnostic
!jupyter kernelspec install $(jupyter kernelspec list | grep julia | tr -s ' ' | cut -d' ' -f3) --replace --name julia

.

# Install the required packages
import Pkg
Pkg.add("ITensors")
Pkg.add("ITensorNetworks")

# Import the installed packages
using ITensors
using ITensorNetworks

I guess you are trying to run the code in this file: ITensorNetworks.jl/test/test_belief_propagation.jl at main · mtfishman/ITensorNetworks.jl · GitHub? My guess is that you are seeing that issue because that code relies on the main branch of the library, which isn’t registered yet. I’m registering a new version now, which should make the latest version of test_belief_propagation.jl work with the latest registered version of the package.

However, please see the warning I added to the README: GitHub - mtfishman/ITensorNetworks.jl: A package with general tools for working with higher-dimensional tensor networks based on ITensor.. The package is not meant for general usage, and we are not giving any guarantees right now that existing code won’t break without warning, that any of the interface will remain stable and won’t be changed from version to version, etc. The package is under active development and should not be considered stable. We are making it public as a pre-release and because we are using it for internal projects. Guaranteeing stability and supporting it for public use at this point would hinder our ability to quickly develop the package, add new features, and get it ready for an official public release.