code: def prior_rev(C, alpha=-1.0):
      r
      if isdense(C):
          return sparse.prior.prior_rev(C, alpha=alpha)
      else:
          warnings.warn("Prior will be a dense matrix for sparse input")
          return sparse.prior.prior_rev(C, alpha=alpha)
docs: r"""Prior counts for sampling of reversible transition
      matrices.
  
      Prior is defined as
  
      b_ij= alpha if i<=j
      b_ij=0         else
  
      Parameters
      ----------
      C : (M, M) ndarray or scipy.sparse matrix
          Count matrix
      alpha : float (optional)
          Value of prior counts
  
      Returns
      -------
      B : (M, M) ndarray
          Matrix of prior counts
  
      Notes
      -----
      The reversible prior is a matrix with -1 on the upper triangle.
      Adding this prior respects the fact that
      for a reversible transition matrix the degrees of freedom
      correspond essentially to the upper triangular part of the matrix.
  
      The prior is defined as
  
      .. math:: b_{ij} = \left \{ \begin{array}{rl}
                         \alpha & i \leq j \\
                         0      & \text{elsewhere}
                         \end{array} \right .
  
      Examples
      --------
  
      >>> import numpy as np
      >>> from msmtools.estimation import prior_rev
  
      >>> C = np.array([[10, 1, 0], [2, 0, 3], [0, 1, 4]])
      >>> B = prior_rev(C)
      >>> B
      array([[-1., -1., -1.],
             [ 0., -1., -1.],
             [ 0.,  0., -1.]])