Tensor-network implementation of the partition function of some classical $O(N)$ models,
$$
\mathcal{Z}(\beta) = \sum_{{s}} \exp(-\beta H(s)) \text{ with } H(s) = -\sum_{\langle i, j \rangle} \left ( \vec{s}_i \cdot \vec{s}_j \right )^p
$$
where $\vec{s}_i$ denotes an $N$-component classical spin of unit length at site $i$
of the $d$-dimensional hypercubic lattice.
In $d=2$ dimensions, we provide implementations of the constituent partition function tensor
for the classical $XY$ ($N=2, p=1$), Heisenberg ($N=3, p=1$) and $RP^2$ ($N=3, p=1$) models.
These can be combined with MPSKit.jl and
TNRKit.jl to, for example, reproduce some of
the results of:
For $d=3$, the constituent tensors can be combined with
PEPSKit.jl to contract the corresponding
infinite cubic partition function using a method similar to that or
Phys. Rev. E 98, 042145 (2018).