Enable postordering when computing the sparse factorization. Previously when using a natural ordering, we had postordering turned off. This is not a good idea. Enabling postordering will also has the possibility of improving the size of the supernodes. Change-Id: I8c270e54751b8bed53b38a0b461f647f5c8f5640
diff --git a/internal/ceres/suitesparse.cc b/internal/ceres/suitesparse.cc index 8f7a4c7..88ef935 100644 --- a/internal/ceres/suitesparse.cc +++ b/internal/ceres/suitesparse.cc
@@ -166,18 +166,8 @@ string* message) { cc_.nmethods = 1; cc_.method[0].ordering = OrderingTypeToCHOLMODEnum(ordering_type); - cc_.supernodal = CHOLMOD_AUTO; - - // TODO(sameeragarwal): The following modification exists entirely - // to preserve existing behaviour. It is not clear if this is - // actually the optimal thing to do. Once I understand the use of - // postordering better, I will come back and document this/remove it - // as the case maybe. - if (ordering_type == OrderingType::NATURAL) { - cc_.postorder = 0; - } - cholmod_factor* factor = cholmod_analyze(A, &cc_); + if (cc_.status != CHOLMOD_OK) { *message = StringPrintf("cholmod_analyze failed. error code: %d", cc_.status); @@ -198,9 +188,9 @@ cc_.nmethods = 1; cc_.method[0].ordering = CHOLMOD_GIVEN; - cholmod_factor* factor = cholmod_analyze_p(A, const_cast<int*>(&ordering[0]), nullptr, 0, &cc_); + if (cc_.status != CHOLMOD_OK) { *message = StringPrintf("cholmod_analyze failed. error code: %d", cc_.status);