Ehrenfest

An \(n \times n\) Ehrenfest matrix is the transition matrix for the famous Ehrenfest urns: a set of two urns collectively contains \(n-1\) balls, and, at each step, a ball is selected at random and moved to the other urn.

The transition matrix for the Markov chain is described by a tridiagonal matrix where the main diagonal is zero, the superdiagonal is of the form \(\frac{1}{N-1},\frac{2}{N-1},...,1\), and the subdiagonal is of the form \(1,\frac{N-2}{N-1},...,\frac{1}{N-1}\).

There is a well-known connection between this model and a random walk over the corners of a hypercube. Please see Lloyd N. Trefethen and S. J. Chapman’s Wave packet pseudomodes of twisted Toepitz matrices for more details.

C++ API

void Ehrenfest(Matrix<F> &P, Int n)
void Ehrenfest(AbstractDistMatrix<F> &P, Int n)
void Ehrenfest(AbstractBlockDistMatrix<F> &P, Int n)
void Ehrenfest(Matrix<F> &P, Matrix<F> &PInf, Int n)
void Ehrenfest(AbstractDistMatrix<F> &P, AbstractDistMatrix<F> &PInf, Int n)
void Ehrenfest(AbstractBlockDistMatrix<F> &P, AbstractBlockDistMatrix<F> &PInf, Int n)
void EhrenfestStationary(Matrix<F> &PInf, Int n)
void EhrenfestStationary(AbstractDistMatrix<F> &PInf, Int n)
void EhrenfestStationary(AbstractBlockDistMatrix<F> &PInf, Int n)
void EhrenfestDecay(Matrix<F> &A, Int n)
void EhrenfestDecay(AbstractDistMatrix<F> &A, Int n)

C API

ElError ElEhrenfest_s(ElMatrix_s P, ElInt n)
ElError ElEhrenfest_d(ElMatrix_d P, ElInt n)
ElError ElEhrenfest_c(ElMatrix_c P, ElInt n)
ElError ElEhrenfest_z(ElMatrix_z P, ElInt n)
ElError ElEhrenfestDist_s(ElMatrix_s P, ElInt n)
ElError ElEhrenfestDist_d(ElMatrix_d P, ElInt n)
ElError ElEhrenfestDist_c(ElMatrix_c P, ElInt n)
ElError ElEhrenfestDist_z(ElMatrix_z P, ElInt n)
ElError ElEhrenfestStationary_s(ElMatrix_s PInf, ElInt n)
ElError ElEhrenfestStationary_d(ElMatrix_d PInf, ElInt n)
ElError ElEhrenfestStationary_c(ElMatrix_c PInf, ElInt n)
ElError ElEhrenfestStationary_z(ElMatrix_z PInf, ElInt n)
ElError ElEhrenfestStationaryDist_s(ElDistMatrix_s PInf, ElInt n)
ElError ElEhrenfestStationaryDist_d(ElDistMatrix_d PInf, ElInt n)
ElError ElEhrenfestStationaryDist_c(ElDistMatrix_c PInf, ElInt n)
ElError ElEhrenfestStationaryDist_z(ElDistMatrix_z PInf, ElInt n)
ElError ElEhrenfestDecay_s(ElMatrix_s A, ElInt n)
ElError ElEhrenfestDecay_d(ElMatrix_d A, ElInt n)
ElError ElEhrenfestDecay_c(ElMatrix_c A, ElInt n)
ElError ElEhrenfestDecay_z(ElMatrix_z A, ElInt n)
ElError ElEhrenfestDecayDist_s(ElDistMatrix_s A, ElInt n)
ElError ElEhrenfestDecayDist_d(ElDistMatrix_d A, ElInt n)
ElError ElEhrenfestDecayDist_c(ElDistMatrix_c A, ElInt n)
ElError ElEhrenfestDecayDist_z(ElDistMatrix_z A, ElInt n)

Python API

Ehrenfest(P, n)
EhrenfestStationary(PInf, n)
EhrenfestDecay(A, n)