double docTotal = wordCounts.zSum();
int docLength = wordCounts.size(); // cardinality of document vectors
// initialize variational approximation to p(z|doc)
Vector gamma = new DenseVector(state.getNumTopics());
gamma.assign(state.getTopicSmoothing() + docTotal / state.getNumTopics());
Vector nextGamma = new DenseVector(state.getNumTopics());
createPhiMatrix(docLength);
Vector digammaGamma = digammaGamma(gamma);