More pre-ordering support.
1. CX_SPARSE supports pre-ordering of the jacobian.
2. Add support for constrained approximate minimum degree ordering
for SuiteSparse versions >= 4.2.0
3. Using 2, support for pre-ordering for SPARSE_SCHUR when used
with SUITE_SPARSE.
4. Using 2, support for user orderings in SPARSE_NORMAL_CHOLESKY.
5. Minor cleanups in documentation and code all around.
6. Test update and refactoring.
Change-Id: Ibfe3ac95d59d54ab14d1d60a07f767688070f29f
diff --git a/internal/ceres/schur_complement_solver_test.cc b/internal/ceres/schur_complement_solver_test.cc
index 1820bc9..57fd263 100644
--- a/internal/ceres/schur_complement_solver_test.cc
+++ b/internal/ceres/schur_complement_solver_test.cc
@@ -87,7 +87,8 @@
int problem_id,
bool regularization,
ceres::LinearSolverType linear_solver_type,
- ceres::SparseLinearAlgebraLibraryType sparse_linear_algebra_library) {
+ ceres::SparseLinearAlgebraLibraryType sparse_linear_algebra_library,
+ bool use_postordering) {
SetUpFromProblemId(problem_id);
LinearSolver::Options options;
options.elimination_groups.push_back(num_eliminate_blocks);
@@ -95,6 +96,7 @@
A->block_structure()->cols.size() - num_eliminate_blocks);
options.type = linear_solver_type;
options.sparse_linear_algebra_library = sparse_linear_algebra_library;
+ options.use_postordering = use_postordering;
scoped_ptr<LinearSolver> solver(LinearSolver::Create(options));
@@ -129,32 +131,49 @@
scoped_array<double> sol_d;
};
+TEST_F(SchurComplementSolverTest, DenseSchurWithSmallProblem) {
+ ComputeAndCompareSolutions(2, false, DENSE_SCHUR, SUITE_SPARSE, true);
+ ComputeAndCompareSolutions(2, true, DENSE_SCHUR, SUITE_SPARSE, true);
+}
+
+TEST_F(SchurComplementSolverTest, DenseSchurWithLargeProblem) {
+ ComputeAndCompareSolutions(3, false, DENSE_SCHUR, SUITE_SPARSE, true);
+ ComputeAndCompareSolutions(3, true, DENSE_SCHUR, SUITE_SPARSE, true);
+}
+
#ifndef CERES_NO_SUITESPARSE
-TEST_F(SchurComplementSolverTest, SparseSchurWithSuiteSparse) {
- ComputeAndCompareSolutions(2, false, SPARSE_SCHUR, SUITE_SPARSE);
- ComputeAndCompareSolutions(3, false, SPARSE_SCHUR, SUITE_SPARSE);
- ComputeAndCompareSolutions(2, true, SPARSE_SCHUR, SUITE_SPARSE);
- ComputeAndCompareSolutions(3, true, SPARSE_SCHUR, SUITE_SPARSE);
+TEST_F(SchurComplementSolverTest, SparseSchurWithSuiteSparseSmallProblemNoPostOrdering) {
+ ComputeAndCompareSolutions(2, false, SPARSE_SCHUR, SUITE_SPARSE, false);
+ ComputeAndCompareSolutions(2, true, SPARSE_SCHUR, SUITE_SPARSE, false);
+}
+
+TEST_F(SchurComplementSolverTest, SparseSchurWithSuiteSparseSmallProblemPostOrdering) {
+ ComputeAndCompareSolutions(2, false, SPARSE_SCHUR, SUITE_SPARSE, true);
+ ComputeAndCompareSolutions(2, true, SPARSE_SCHUR, SUITE_SPARSE, true);
+}
+
+TEST_F(SchurComplementSolverTest, SparseSchurWithSuiteSparseLargeProblemNoPostOrdering) {
+ ComputeAndCompareSolutions(3, false, SPARSE_SCHUR, SUITE_SPARSE, false);
+ ComputeAndCompareSolutions(3, true, SPARSE_SCHUR, SUITE_SPARSE, false);
+}
+
+TEST_F(SchurComplementSolverTest, SparseSchurWithSuiteSparseLargeProblemPostOrdering) {
+ ComputeAndCompareSolutions(3, false, SPARSE_SCHUR, SUITE_SPARSE, true);
+ ComputeAndCompareSolutions(3, true, SPARSE_SCHUR, SUITE_SPARSE, true);
}
#endif // CERES_NO_SUITESPARSE
#ifndef CERES_NO_CXSPARSE
-TEST_F(SchurComplementSolverTest, SparseSchurWithCXSparse) {
- ComputeAndCompareSolutions(2, false, SPARSE_SCHUR, CX_SPARSE);
- ComputeAndCompareSolutions(3, false, SPARSE_SCHUR, CX_SPARSE);
- ComputeAndCompareSolutions(2, true, SPARSE_SCHUR, CX_SPARSE);
- ComputeAndCompareSolutions(3, true, SPARSE_SCHUR, CX_SPARSE);
+TEST_F(SchurComplementSolverTest, SparseSchurWithSuiteSparseSmallProblem) {
+ ComputeAndCompareSolutions(2, false, SPARSE_SCHUR, SUITE_SPARSE, true);
+ ComputeAndCompareSolutions(2, true, SPARSE_SCHUR, SUITE_SPARSE, true);
+}
+
+TEST_F(SchurComplementSolverTest, SparseSchurWithSuiteSparseLargeProblem) {
+ ComputeAndCompareSolutions(3, false, SPARSE_SCHUR, SUITE_SPARSE, true);
+ ComputeAndCompareSolutions(3, true, SPARSE_SCHUR, SUITE_SPARSE, true);
}
#endif // CERES_NO_CXSPARSE
-TEST_F(SchurComplementSolverTest, DenseSchur) {
- // The sparse linear algebra library type is ignored for
- // DENSE_SCHUR.
- ComputeAndCompareSolutions(2, false, DENSE_SCHUR, SUITE_SPARSE);
- ComputeAndCompareSolutions(3, false, DENSE_SCHUR, SUITE_SPARSE);
- ComputeAndCompareSolutions(2, true, DENSE_SCHUR, SUITE_SPARSE);
- ComputeAndCompareSolutions(3, true, DENSE_SCHUR, SUITE_SPARSE);
-}
-
} // namespace internal
} // namespace ceres