totalTimeDefault -= System.currentTimeMillis();
SumLattice defaultLattice = new SumLatticeDefault(crf, input,
true);
totalTimeDefault += System.currentTimeMillis();
totalTimeScaling -= System.currentTimeMillis();
SumLattice scalingLattice = new SumLatticeScaling(crf, input,
true);
totalTimeScaling += System.currentTimeMillis();
if (iter == 0) {
// check that total weight is same
assertEquals(defaultLattice.getTotalWeight(),
scalingLattice.getTotalWeight(), 0.0001);
// check that gammas
double[][] g1 = defaultLattice.getGammas(), g2 = scalingLattice
.getGammas();
for (int i = 0; i < g1.length; i++) {
for (int j = 0; j < g1[i].length; j++) {
assertEquals(g1[i][j], g2[i][j], 0.0001);
}
}
// check that xis match
double[][][] x1 = defaultLattice.getXis(), x2 = scalingLattice
.getXis();
for (int i = 0; i < x1.length; i++) {
for (int j = 0; j < x1[i].length; j++) {
for (int k = 0; k < x1[i][j].length; k++) {
assertEquals(x1[i][j][k], x2[i][j][k], 0.0001);