diff --git a/dlib/optimization/find_max_factor_graph_viterbi.h b/dlib/optimization/find_max_factor_graph_viterbi.h index 987b9c5cf..9d20367ae 100644 --- a/dlib/optimization/find_max_factor_graph_viterbi.h +++ b/dlib/optimization/find_max_factor_graph_viterbi.h @@ -18,7 +18,7 @@ namespace dlib { struct viterbi_data { - viterbi_data() :val(0), back_index(0) {} + viterbi_data() :val(-std::numeric_limits::infinity()), back_index(0) {} double val; unsigned long back_index; }; diff --git a/dlib/test/find_max_factor_graph_viterbi.cpp b/dlib/test/find_max_factor_graph_viterbi.cpp index a2d4b2979..d618e4359 100644 --- a/dlib/test/find_max_factor_graph_viterbi.cpp +++ b/dlib/test/find_max_factor_graph_viterbi.cpp @@ -187,8 +187,17 @@ namespace do_test<0,3,8>(); do_test<4,3,1>(); do_test<4,3,0>(); - do_test<0,3,0>(); + do_test<3,2,1>(); + do_test<3,2,0>(); + do_test<3,2,2>(); + do_test<2,2,1>(); + do_test_negative<3,2,1>(); + do_test_negative<3,2,0>(); + do_test_negative<3,2,2>(); + do_test_negative<2,2,1>(); + + do_test<0,3,0>(); do_test<1,2,8>(); do_test<2,2,7>(); do_test<3,2,8>();