docs: def get_diagonalisation(frequencies, rate_matrix=None):
      """
      Normalises and diagonalises the rate matrix.
  
      :param frequencies: character state frequencies.
      :type frequencies: numpy.array
      :param rate_matrix: (optional) rate matrix (by default an all-equal-rate matrix is used)
      :type rate_matrix: numpy.ndarray
      :return: matrix diagonalisation (d, A, A^{-1})
          such that A.dot(np.diag(d))).dot(A^{-1}) = 1/mu Q (normalised generator)
      :rtype: tuple
      """
      Q = get_normalised_generator(frequencies, rate_matrix)
      d, A = np.linalg.eig(Q)
      return d, A, np.linalg.inv(A)