Skip to main content

Fast sampling from \(\beta \)-ensembles


We investigate sampling \(\beta \)-ensembles with time complexity less than cubic in the cardinality of the ensemble. Following Dumitriu and Edelman (J Math Phys 43(11):5830–5847, 2002), we see the ensemble as the eigenvalues of a random tridiagonal matrix, namely a random Jacobi matrix. First, we provide a unifying and elementary treatment of the tridiagonal models associated with the three classical Hermite, Laguerre, and Jacobi ensembles. For this purpose, we use simple changes of variables between successive reparametrizations of the coefficients defining the tridiagonal matrix. Second, we derive an approximate sampler for the simulation of more general \(\beta \)-ensembles and illustrate how fast it can be for polynomial potentials. This method combines a Gibbs sampler on Jacobi matrices and the diagonalization of these matrices. In practice, even for large ensembles, only a few Gibbs passes suffice for the marginal distribution of the eigenvalues to fit the expected theoretical distribution. When the conditionals in the Gibbs sampler can be simulated exactly, the same fast empirical convergence is observed for the fluctuations of the largest eigenvalue. Our experimental results support a conjecture by Krishnapur et al. (Commun Pure Appl Math 69(1): 145–199, 2016), that the Gibbs chain on Jacobi matrices of size N mixes in \(\mathcal {O}(\log N)\).

This is a preview of subscription content, access via your institution.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6





  • Anderson, G.W., Guionnet, A., Zeitouni, O.: An Introduction to Random Matrices, volume 118 of Cambridge Studies in Advanced Mathematics. Cambridge University Press (2009)

  • Bardenet, R., Hardy, A.: Monte Carlo with determinantal point processes. Ann. Appl. Probab. 30(1), (2020)

  • Belhadji, A., Bardenet, R., Chainais, P.: Kernel quadrature with DPPs. Adv. Neural Inf. Process. Syst. 32, 12927–12937 (2019)

    Google Scholar 

  • Bornemann, F.: On the numerical evaluation of Fredholm determinants. Math. Comput. 79(270), 871–915 (2009)

    Article  MathSciNet  MATH  Google Scholar 

  • Cartan, H.: Differential calculus. Hermann, (1971)

  • Chafaï, D., Ferré, G.: Simulating coulomb and log-gases with hybrid Monte Carlo algorithms. J. Stat. Phys. 174(3), 692–714 (2018)

    Article  MathSciNet  MATH  Google Scholar 

  • Chihara, T.S.: On the true interval of orthogonality. Quart. J. Math. 22(4), 605–607 (1971)

    Article  MathSciNet  MATH  Google Scholar 

  • Chihara, T.S.: An Introduction to Orthogonal Polynomials. Gordon and Breach, New York (1978)

    MATH  Google Scholar 

  • Claeys, T., Krasovsky, I., Its, A.: Higher-order analogues of the Tracy-Widom distribution and the Painlevé II hierarchy. Commun. Pure Appl. Math. 63(3), 62–412 (2009)

    MATH  Google Scholar 

  • Coakley, E.S., Rokhlin, V.: A fast divide-and-conquer algorithm for computing the spectra of real symmetric tridiagonal matrices. Appl. Comput. Harmonic Anal. 34(3), 379–414 (2013)

    Article  MathSciNet  MATH  Google Scholar 

  • Coeurjolly, J.-F., Mazoyer, A., Amblard, P.-O.: Monte Carlo integration of non-differentiable functions on \([0,1]^\iota \), \(\iota =1,\dots ,d\), using a single determinantal point pattern defined on \([0,1]^d\). ArXiv e-prints, (2020). arXiv:2003.10323

  • Deift, P.: Orthogonal polynomials and random matrices : a Riemann-Hilbert approach. In Courant Lecture Notes, volume 3. American Mathematical Society, (2000)

  • Deift, P., Gioev, D.: Universality at the edge of the spectrum for unitary, orthogonal and symplectic ensembles of random matrices. Commun. Pure Appl. Math. 60(6), 867–910 (2005)

    Article  MathSciNet  MATH  Google Scholar 

  • Dette, H., Nagel, J.: Distributions on unbounded moment space and random moment sequences. Ann. Probab 40(6), 2690–2704 (2012)

    Article  MathSciNet  MATH  Google Scholar 

  • Dette, H., Studden, W.J.: The Theory of Canonical Moments with Applications in Statistics, Probability, and Analysis. Wiley, New York (1997)

    MATH  Google Scholar 

  • Devroye, L.: A note on generating random variables with log-concave densities. Stat. Probab. Lett. 82(5), 1035–1039 (2012)

    Article  MathSciNet  MATH  Google Scholar 

  • Duane, S., Kennedy, A.D., Pendleton, B.J., Roweth, D.: Hybrid Monte Carlo. Phys. Lett. B 195(2), 216–222 (1987)

    Article  MathSciNet  Google Scholar 

  • Dumitriu, I., Edelman, A.: Matrix models for beta ensembles. J. Math. Phys. 43(11), 5830–5847 (2002)

    Article  MathSciNet  MATH  Google Scholar 

  • Forrester, P.J.: Log-Gases and Random Matrices. Princeton University Press, Princeton (2010)

    Book  MATH  Google Scholar 

  • Forrester, P.J., Rains, E.M.: Jacobians and rank 1 perturbations relating to unitary Hessenberg matrices. Int. Math. Res. Notice. (2006)

  • Gamboa, F., Rouault, A.: Canonical Moments and Random Spectral Measures. J. Theor. Probab. 23(4), 1015–1038 (2010)

    Article  MathSciNet  MATH  Google Scholar 

  • Gamboa, F., Nagel, J., Rouault, A.: Sum rules via large deviations. J. Funct. Anal. 270(2), 509–559 (2016)

    Article  MathSciNet  MATH  Google Scholar 

  • Gautier, G., Bardenet, R., Valko, M.: Zonotope hit-and-run for efficient sampling from projection DPPs. Int. Confer. Mach. Learn. 70, 1223–1232 (2017)

    Google Scholar 

  • Gautier, G., Bardenet, R., Valko, M.: On two ways to use determinantal point processes for Monte Carlo integration. Adv. Neural Inf. Process. Syst. 32, 7770–7779 (2019a)

    Google Scholar 

  • Gautier, G., Polito, G., Bardenet, R., Valko, M.: DPPy: DPP sampling with python. J. Mach. Learn. Res. Mach. Learn. Open Source Softw. 20(180), 1–7 (2019b)

    Google Scholar 

  • Gautschi, W.: Orthogonal Polynomials: Computation and Approximation. Oxford University Press, Oxford (2004)

    Book  MATH  Google Scholar 

  • Golub, G.H., Van Loan, C.F.: Matrix Computations, 4th edn. Johns Hopkins University Press, Oxford (2013)

    Book  MATH  Google Scholar 

  • Ha, T., Gibson, J.: A note on the determinant of a functional confluent vandermonde matrix and controllability. Linear Algebra Appl. 30, 69–75 (1980)

    Article  MathSciNet  MATH  Google Scholar 

  • Hardy, A.: Polynomial ensembles and recurrence coefficients. Construct. Approx. 48(1), 137–162 (2017)

    Article  MathSciNet  MATH  Google Scholar 

  • Hough, J.B., Krishnapur, M., Peres, Y., Virág, B.: Determinantal processes and independence. Probab. Surv. 3, 206–229 (2006)

    Article  MathSciNet  MATH  Google Scholar 

  • Killip, R., Nenciu, I.: Matrix models for circular ensembles. Int. Math. Res Notices 2004(50), 2665–2701 (2004)

    Article  MathSciNet  MATH  Google Scholar 

  • Killip, R., Nenciu, I.: CMV: the unitary analogue of Jacobi matrices. Commun. Pure Appl. Math. 60(8), 1148–1188 (2007)

    Article  MathSciNet  MATH  Google Scholar 

  • König, W.: Orthogonal polynomial ensembles in probability theory. Probab. Surv. 2, 385–447 (2005)

    Article  MathSciNet  MATH  Google Scholar 

  • Krishnapur, M., Rider, B., Virág, B.: Universality of the stochastic airy operator. Commun. Pure Appl. Math. 69(1), 145–199 (2016)

    Article  MathSciNet  MATH  Google Scholar 

  • Lacanster, P., Tismenetsky, M.: The theory of matrices: with application, 2nd edn. Academic Press (1985)

  • Lasserre, J.-B.: Moments, Positive Polynomials and their Applications. Imperial College Press, Oxford (2010)

    MATH  Google Scholar 

  • Le Caër, G., Delannay, R.: The fixed-trace \(\beta \)-Hermite ensemble of random matrices and the low temperature distribution of the determinant of an N \(\times \) N \(\beta \)-Hermite matrix. J. Phys. A: Math. Theor. 40(7), 1561–1584 (2007)

    Article  MathSciNet  MATH  Google Scholar 

  • Li, X.H., Menon, G.: Numerical solution of dyson brownian motion and a sampling scheme for invariant matrix ensembles. J. Stat. Phys. 153(5), 801–812 (2013)

    Article  MathSciNet  Google Scholar 

  • Macchi, O.: The coincidence approach to stochastic point processes. Adv. Appl. Probab. 7(1), 83–122 (1975)

    Article  MathSciNet  MATH  Google Scholar 

  • Majumdar, S.N., Nadal, C., Scardicchio, A., Vivo, P.: How many eigenvalues of a Gaussian random matrix are positive? Phys. Rev. E 83(4), 041105 (2011)

    Article  Google Scholar 

  • Molinari, L.G.: Notes on Random Matrices. Technical report, (2018)

  • Neal, R.M.: MCMC using hamiltonian dynamics. In Handbook of Markov Chain Monte Carlo, chapter 5: 113–162. Chapman & Hall, CRC Press, (2011)

  • Olver, S.: Computation of equilibrium measures. J. Approx. Theory 163(9), 1185–1207 (2011)

    Article  MathSciNet  MATH  Google Scholar 

  • Olver, S., Trogdon, T.: Numerical solution of Riemann-Hilbert problems: random matrix theory and orthogonal polynomials. Constr. Approx. 39(1), 101–149 (2014)

    Article  MathSciNet  MATH  Google Scholar 

  • Olver, S., Nadakuditi, R.R., Trogdon, T.: Sampling unitary invariant ensembles. Random Matric. Theory Appl. 4(1), 1550002 (2014)

    Article  MATH  Google Scholar 

  • Robert, C.P., Casella, G.: Monte Carlo Statistical Methods. Springer, New York (2004)

    Book  MATH  Google Scholar 

  • Ryu, E.K., Boyd, S.P.: Extensions of Gauss quadrature via linear programming. Found. Comput. Math. 15(4), 953–971 (2015)

    Article  MathSciNet  MATH  Google Scholar 

  • Serfaty, S.: Coulomb Gases and Ginzburg-Landau Vortices. European Mathematical Society Publishing House, Zuerich (2015)

    Book  MATH  Google Scholar 

  • Simon, B.: Szegő’s Theorem and its Descendants. Princeton University Press, Princeton (2011)

    MATH  Google Scholar 

  • Stieltjes, T.-J.: Recherches sur les fractions continues. Annales de la Faculté des sciences de Toulouse : Mathématiques 8(4), J1–J122 (1894)

    MathSciNet  MATH  Google Scholar 

  • Wall, H.S.: Continued fractions and totally monotone sequences. Trans. Am. Math. Soc. 48(2), 165–184 (1940)

    Article  MathSciNet  MATH  Google Scholar 

Download references


We acknowledge support from ANR grant BoB (ANR-16-CE23-0003) and from ERC grant Blackjack (ERC-2019-STG-851866).

Author information

Authors and Affiliations


Corresponding author

Correspondence to Guillaume Gautier.

Ethics declarations

Conflicts of interest

The authors declare no conflict of interest.

Additional information

Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.



1.1 Appendix A


(of Lemma 1) For \(n \in \mathbb {N}\), we note

$$\begin{aligned} \varDelta _n\left( x_{1}, \dots , x_{N} \right) \triangleq \begin{bmatrix} 1 &{} \cdots &{} 1 \\ x_1 &{} \cdots &{} x_N \\ &{} \vdots &{} \\ x_1^{n-1} &{} \cdots &{} x_N^{n-1} \end{bmatrix}. \end{aligned}$$

Then, for any \(1\le n\le N\), the Cauchy–Binet formula (Lacanster and Tismenetsky 1985, Section 2.5) yields

$$\begin{aligned}&\det { \underline{H}_{2n-2} } = \det \left[ \sum _{k=1}^N w_k x_k^{i+j} \right] _{i,j=0}^{n-1} \nonumber \\&\quad = \det \left( \varDelta _n\left( x_{1}, \dots , x_{N} \right) \begin{bmatrix} w_1 &{} &{} \\ &{} \ddots &{} \\ &{} &{} w_N \end{bmatrix} \varDelta _n\left( x_{1}, \dots , x_{N} \right) ^{\textsf {T}} \right) \nonumber \\&\quad = \sum _{\left\{ i_1,\dots ,i_n \right\} \subset [N]} \left( \det \varDelta _n\left( x_{i_1}, \dots , x_{i_n} \right) \right) ^2 \prod _{k=1}^n w_{i_k} > 0. \end{aligned}$$

The particular case \(n=N\) yields

$$\begin{aligned} \det { \underline{H}_{2N-2} } = \left( \det \varDelta _N\left( x_{1}, \dots , x_{N} \right) \right) ^2 \prod _{n=1}^N w_{n}. \end{aligned}$$

For \(n>N\), (45) clearly shows that \(\underline{H}_{2n-2}\) is rank deficient. The two other determinants are obtained similarly. \(\square \)

1.2 Appendix B


(of Proposition 4) Moments define monic OPs; see Proposition 3. By Favard’s theorem, here Theorem 5, monic OPs in turn define the atoms and weights of \(\mu \) uniquely. Thus, \(\phi \) is injective. Moreover, \(\mathbb {R}_>^N\times S_N\subset \mathbb {R}^{2N-1}\) is open, and \(\phi \) is \(C^1\). By the classical inverse function theorem, see, e.g., Cartan (1971, Corollary 4.2.2), it is thus enough to show that the Jacobian of \(\phi \) never vanishes.

To compute the partial derivative w.r.t. the nodes and weights, we write i-th moment of \(\mu \) in two forms

$$\begin{aligned} m_i = \sum _{j= 1}^{N} w_j x_j^i = \sum _{j= 1}^{N- 1} w_j \left( x_j^i - x_N^i \right) + x_N^i. \end{aligned}$$

Thus, the Jacobian of \(\phi \) reads

$$\begin{aligned}&\left| \frac{ \partial m_{1:2N- 1} }{ \partial x_{1:N}, w_{1:N- 1} } \right| = \left| \left[ \left[ \frac{\partial m_i}{\partial x_j} ~ \frac{\partial m_i}{\partial w_j} \right] _{j= 1}^{N- 1} ~ \left[ \frac{\partial m_i}{\partial x_N} \right] \right] _{i= 1}^{2N- 1} \right| \nonumber \\&\quad = \left| \left[ \left[ i w_j x_j^{i-1} ~~ x_j^{i} - x_N^{i} \right] _{j= 1}^{N- 1} ~ i w_N x_N^{i-1} \right] _{i= 1}^{2N- 1} \right| \nonumber \\&\quad = \left| \left[ \left[ (i-1)x_j^{i-2} ~~ x_j^{i-1} - x_N^{i-1} \right] _{j= 1}^{N- 1} ~ (i-1)x_N^{i-2} ~~ x_N^{i-1} \right] _{i= 1}^{2N} \right| \nonumber \\&\qquad \times \prod _{n=1}^N w_n \nonumber \\&\quad = \left| \left[ (i-1)x_j^{i-2} ~~ x_j^{i-1} \right] _{i=1,j= 1}^{2N,N} \right| \prod _{n=1}^N w_n. \end{aligned}$$

The last equality is obtained by adding the last column to all other even columns. The determinant in (47) is called a confluent Vandermonde determinant and has closed form expression given by \(\prod _{i<j} (x_j-x_i)^{2\times 2} = \left( \det \varDelta _N(x_1,\dots ,x_N) \right) ^4\), see, e.g., Ha and Gibson (1980, Corollary 1, with \(\eta _i \equiv 2\)). In particular, (47) never vanishes on \(\mathbb {R}_>^N\times S_N\). \(\square \)

1.3 Appendix C


(of Proposition 5) Using Theorem 5 and Proposition 4, \(\rho = \psi \circ \phi ^{-1}\), so that \(\rho \) is bijective. As in the proof of Proposition 4, we apply the inverse function theorem (Cartan 1971, Corollary 4.2.2), but this time to \(\rho ^{-1}\). We first note that \(\mathbb {R}^N \times (0, +\infty )^{N-1}\subset \mathbb {R}^{2N-1}\) is open. It is thus enough to show that \(\rho ^{-1}\) is \(C^1\) and that its Jacobian never vanishes. To this end, we borrow an elegant lattice path representation of the recurrence relations for OPs from Hardy (2017, Equation 1.8). This allows us to express the successive moments as polynomials in the recurrence coefficients.

To provide intuition, we first compute the first few moments by hand, recursively applying the recurrence relation (12). It comes

Fig. 7
figure 7

The lattice path of Hardy (2017) used to compute \(m_n=\left\langle x^nP_0, P_0 \right\rangle \) is displayed in (a). The paths used for the computation of \(m_3\) (48) are highlighted in be with the corresponding weight as caption

More generally, when computing \(m_k = \left\langle x^k P_0, P_0 \right\rangle \), successive applications of the recurrence relation (12) allow to decrease the power of x from k to 0 until each term in the expansion is proportional to the inner product of \(P_0=1\) with another monic OP. The only nonzero such inner product is \(\left\langle P_0,P_0 \right\rangle =1\). Consequently, each nonzero term in the final expansion of \(m_k\) corresponds to a path of length at most k that leaves from the lower left corner of the graph in Fig. 7a and ends up on the bottom row. In between, the path has to remain above the bottom row, and can only move North-East, East, or South-East. Each edge corresponds to picking one of the three terms in the recurrence relation (12). For example, the expansion of \(m_3\) in (48) corresponds to three such paths, shown in orange in Fig. 7. The product of the coefficients along each path forms the resulting term in the expansion.

In the end, odd moments \(m_{2i-1}\), resp. even moments \(m_{2i}\), are the sum of the weights of the paths below the i-th red, respectively blue path, counting from the bottom left. More precisely,

$$\begin{aligned} m_{2i-1}&= { a_{i} \prod _{k= 1}^{i-1} b_{k} } + f_1( a_{1:i-1}, b_{1:i-2}), \text { and} \nonumber \\ m_{2i}&= { \prod _{k= 1}^{i} b_{k} } + f_2( a_{1:i}, b_{1:i-1}). \end{aligned}$$

Thus, the Jacobian matrix is triangular with determinant

$$\begin{aligned} \left| \frac{ \partial m_{1:2N-1} }{ \partial a_{1:N}, b_{1:N-1} } \right| =\prod _{i= 1}^N \frac{\partial m_{2i-1}}{\partial a_{i}} \prod _{i= 1}^{N-1} \frac{\partial m_{2i}}{\partial b_{i}} ,\end{aligned}$$

and the formulation (49) yields

$$\begin{aligned}&\left| \frac{ \partial m_{1:2N-1} }{ \partial a_{1:N}, b_{1:N-1} } \right| = \prod _{i= 1}^N \prod _{k= 1}^{i-1} b_{k} \prod _{i= 1}^{N-1} \prod _{k= 1}^{i-1} b_{k}\\&\quad = \frac{ \left[ \prod _{i= 1}^{N} \prod _{k= 1}^{i-1} b_{k} \right] ^2 }{ \prod _{k= 1}^{N-1} b_{k} } = \frac{ \left[ \prod _{n= 1}^{N-1} b_{n}^{N- n} \right] ^2 }{ \prod _{n= 1}^{N-1} b_{n} },\end{aligned}$$

which does not vanish since all \(b_n\)s are positive by construction. Finally, the last equality in (23) follows from Lemma 2. \(\square \)

1.4 Appendix D


(of Lemma 6) First, combine the result of Lemma 4 and the definition of the canonical moments in (35) to get

$$\begin{aligned} \prod _{n=1}^N x_n&= \xi _1 \prod _{n=2}^N \xi _{2n-1} \\&= c_1 \prod _{n=2}^N (1-c_{2n-2})c_{2n-1} = \prod _{n=1}^N c_{2n-1} (1-c_{2n}). \end{aligned}$$

Then, Lemma 1 yields

$$\begin{aligned} \prod _{n= 1}^N (1-x_n) = \frac{\det { \overline{H}_{2N-1} } }{\det { \underline{H}_{2N-2} } } \cdot \end{aligned}$$

The denominator can be expressed using the \(\xi _{1:2N-1}\) parameters,


For the numerator, we follow Dette and Studden (1997, Theorem 1.4.10) who introduced additional quantities \(\gamma _{1:2N-1}\) to get

$$\begin{aligned} \det { \overline{H}_{2N-1} } = \gamma _{1}^N \prod _{n=1}^{N- 1} \left[ \gamma _{2n}\gamma _{2n+1} \right] ^{N-n}, \end{aligned}$$

where \(\xi _1 = c_1, \gamma _1 = 1 - c_1\), and for any \(1\le n \le 2N-1\),

$$\begin{aligned} \xi _n = (1-c_{n-1})c_n, \text { and } \gamma _{n} = c_{n-1} (1-c_n). \end{aligned}$$

We plug these results back into (50) and conclude that

\(\square \)

Rights and permissions

Reprints and Permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Gautier, G., Bardenet, R. & Valko, M. Fast sampling from \(\beta \)-ensembles. Stat Comput 31, 7 (2021).

Download citation

  • Received:

  • Accepted:

  • Published:

  • DOI:


Mathematics Subject Classification