code: public static double dirichletPdf(double[] pi, double a) {
          double probability=1.0;
          
          int piLength=pi.length;
          
          for(int i=0;i<piLength;++i) {
              probability*=Math.pow(pi[i], a-1);
          }
          
          double sumAi=piLength*a;
          double productGammaAi=Math.pow(gamma(a), piLength);
          probability*=gamma(sumAi)/productGammaAi;
          
          return probability;
      }
docs: Implementation for single alpha value.
  
  @param pi    The vector with probabilities.
  @param a     The alpha parameter for all pseudocounts.
  @return      The probability