mapped to the amplitude of a wavefunction (as MPS) and observables are mapped to operators (as MPO). Expected values $\bar{f}=\braket{p|\hat{O}_f|p}$ are obtained by contracting three layers of tensors with physical dimensions $d$ and bond dimensions $\sim \chi.$ This has a cost $\mathcal{O}(3d^2\chi^4)$ and causes each tensor to appear twice—in other words, $\bar{f}$ is a quadratic function w.r.t. each tensor.[]{data-label="fig:mps-quadratic"}](fig-mps-quadratic.pdf){width="0.8\linewidth"}

Our overarching goal for the rest of this work is to encode multivariate functions using a virtual quantum register, and to store this register efficiently as an MPS. If the function we want to encode is non-negative—such as a probability distribution—, we can follow Sect. \[eq:quantum-register\], identify $\sqrt{p}$ with a quantum register wavefunction  and use the MPS representation  to compress it. In this representation, observables $f(x)$ become Matrix-Product operators (MPO’s) $$\hat{O}_f^{(m)}= \sum_{\alpha,s} B^{s_1,r_1}_{\beta_1}B^{s_2,r_2}_{\beta_2,\beta_3}\cdots B^{s_m,r_m}_{\beta_m}{\ensuremath{\ket{s_1,s_2\ldots s_m}\!\bra{r_1,r_2\ldots r_m}}}.
  \label{eq:mpo}$$ We call this the *quadratic MPS representation* because the mean value of an observable $\bar{f}\sim \braket{p|\hat{O}_f|p}$ is a quadratic function of any of the tensors in the MPS state \[cf. Fig. \[fig:mps-quadratic\]\].

In the alternative encoding from equation , both observables $f(x)$ and probability distributions $p(x)$ become unnormalized vectors in a Hilbert space $$\begin{aligned}
  \ket{f^{(m)}} &= \sum_{s}f^{(m)}(s)\ket{s} = \sum_{\alpha,s} F^{s_1}_{\beta_1}F^{s_2}_{\beta_2,\beta_3}\cdots F^{s_m}_{\beta_m}\ket{s_1,s_2\ldots s_m},
  \\
  \ket{p^{(m)}}&= 