DenseMatrix pWgT = new DenseMatrix(numTopics, numWords);
double[] logTotals = new double[numTopics];
double ll = 0.0;
IntPairWritable key = new IntPairWritable();
DoubleWritable value = new DoubleWritable();
for (FileStatus status : fs.globStatus(new Path(dir, "part-*"))) {
Path path = status.getPath();
SequenceFile.Reader reader = new SequenceFile.Reader(fs, path, job);
while (reader.next(key, value)) {
int topic = key.getFirst();
int word = key.getSecond();
if (word == TOPIC_SUM_KEY) {
logTotals[topic] = value.get();
if (Double.isInfinite(value.get())) {
throw new IllegalArgumentException();
}
} else if (topic == LOG_LIKELIHOOD_KEY) {
ll = value.get();
} else {
if (!((topic >= 0) && (word >= 0))) {
throw new IllegalArgumentException(topic + " " + word);
}
if (pWgT.getQuick(topic, word) != 0.0) {
throw new IllegalArgumentException();
}
pWgT.setQuick(topic, word, value.get());
if (Double.isInfinite(pWgT.getQuick(topic, word))) {
throw new IllegalArgumentException();
}
}
}