diff options
Diffstat (limited to 'internal/ceres/schur_complement_solver_test.cc')
-rw-r--r-- | internal/ceres/schur_complement_solver_test.cc | 58 |
1 files changed, 38 insertions, 20 deletions
diff --git a/internal/ceres/schur_complement_solver_test.cc b/internal/ceres/schur_complement_solver_test.cc index 206d4b5..d91c162 100644 --- a/internal/ceres/schur_complement_solver_test.cc +++ b/internal/ceres/schur_complement_solver_test.cc @@ -87,7 +87,8 @@ class SchurComplementSolverTest : public ::testing::Test { int problem_id, bool regularization, ceres::LinearSolverType linear_solver_type, - ceres::SparseLinearAlgebraLibraryType sparse_linear_algebra_library, + ceres::DenseLinearAlgebraLibraryType dense_linear_algebra_library_type, + ceres::SparseLinearAlgebraLibraryType sparse_linear_algebra_library_type, bool use_postordering) { SetUpFromProblemId(problem_id); LinearSolver::Options options; @@ -95,7 +96,10 @@ class SchurComplementSolverTest : public ::testing::Test { options.elimination_groups.push_back( A->block_structure()->cols.size() - num_eliminate_blocks); options.type = linear_solver_type; - options.sparse_linear_algebra_library = sparse_linear_algebra_library; + options.dense_linear_algebra_library_type = + dense_linear_algebra_library_type; + options.sparse_linear_algebra_library_type = + sparse_linear_algebra_library_type; options.use_postordering = use_postordering; scoped_ptr<LinearSolver> solver(LinearSolver::Create(options)); @@ -131,53 +135,67 @@ class SchurComplementSolverTest : public ::testing::Test { 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, EigenBasedDenseSchurWithSmallProblem) { + ComputeAndCompareSolutions(2, false, DENSE_SCHUR, EIGEN, SUITE_SPARSE, true); + ComputeAndCompareSolutions(2, true, DENSE_SCHUR, EIGEN, SUITE_SPARSE, true); } -TEST_F(SchurComplementSolverTest, DenseSchurWithLargeProblem) { - ComputeAndCompareSolutions(3, false, DENSE_SCHUR, SUITE_SPARSE, true); - ComputeAndCompareSolutions(3, true, DENSE_SCHUR, SUITE_SPARSE, true); +TEST_F(SchurComplementSolverTest, EigenBasedDenseSchurWithLargeProblem) { + ComputeAndCompareSolutions(3, false, DENSE_SCHUR, EIGEN, SUITE_SPARSE, true); + ComputeAndCompareSolutions(3, true, DENSE_SCHUR, EIGEN, SUITE_SPARSE, true); } +#ifndef CERES_NO_LAPACK +TEST_F(SchurComplementSolverTest, LAPACKBasedDenseSchurWithSmallProblem) { + ComputeAndCompareSolutions(2, false, DENSE_SCHUR, LAPACK, SUITE_SPARSE, true); + ComputeAndCompareSolutions(2, true, DENSE_SCHUR, LAPACK, SUITE_SPARSE, true); +} + +TEST_F(SchurComplementSolverTest, LAPACKBasedDenseSchurWithLargeProblem) { + ComputeAndCompareSolutions(3, false, DENSE_SCHUR, LAPACK, SUITE_SPARSE, true); + ComputeAndCompareSolutions(3, true, DENSE_SCHUR, LAPACK, SUITE_SPARSE, true); +} +#endif + #ifndef CERES_NO_SUITESPARSE TEST_F(SchurComplementSolverTest, SparseSchurWithSuiteSparseSmallProblemNoPostOrdering) { - ComputeAndCompareSolutions(2, false, SPARSE_SCHUR, SUITE_SPARSE, false); - ComputeAndCompareSolutions(2, true, SPARSE_SCHUR, SUITE_SPARSE, false); + ComputeAndCompareSolutions( + 2, false, SPARSE_SCHUR, EIGEN, SUITE_SPARSE, false); + ComputeAndCompareSolutions(2, true, SPARSE_SCHUR, EIGEN, SUITE_SPARSE, false); } TEST_F(SchurComplementSolverTest, SparseSchurWithSuiteSparseSmallProblemPostOrdering) { - ComputeAndCompareSolutions(2, false, SPARSE_SCHUR, SUITE_SPARSE, true); - ComputeAndCompareSolutions(2, true, SPARSE_SCHUR, SUITE_SPARSE, true); + ComputeAndCompareSolutions(2, false, SPARSE_SCHUR, EIGEN, SUITE_SPARSE, true); + ComputeAndCompareSolutions(2, true, SPARSE_SCHUR, EIGEN, SUITE_SPARSE, true); } TEST_F(SchurComplementSolverTest, SparseSchurWithSuiteSparseLargeProblemNoPostOrdering) { - ComputeAndCompareSolutions(3, false, SPARSE_SCHUR, SUITE_SPARSE, false); - ComputeAndCompareSolutions(3, true, SPARSE_SCHUR, SUITE_SPARSE, false); + ComputeAndCompareSolutions( + 3, false, SPARSE_SCHUR, EIGEN, SUITE_SPARSE, false); + ComputeAndCompareSolutions(3, true, SPARSE_SCHUR, EIGEN, SUITE_SPARSE, false); } TEST_F(SchurComplementSolverTest, SparseSchurWithSuiteSparseLargeProblemPostOrdering) { - ComputeAndCompareSolutions(3, false, SPARSE_SCHUR, SUITE_SPARSE, true); - ComputeAndCompareSolutions(3, true, SPARSE_SCHUR, SUITE_SPARSE, true); + ComputeAndCompareSolutions(3, false, SPARSE_SCHUR, EIGEN, SUITE_SPARSE, true); + ComputeAndCompareSolutions(3, true, SPARSE_SCHUR, EIGEN, SUITE_SPARSE, true); } #endif // CERES_NO_SUITESPARSE #ifndef CERES_NO_CXSPARSE TEST_F(SchurComplementSolverTest, SparseSchurWithSuiteSparseSmallProblem) { - ComputeAndCompareSolutions(2, false, SPARSE_SCHUR, SUITE_SPARSE, true); - ComputeAndCompareSolutions(2, true, SPARSE_SCHUR, SUITE_SPARSE, true); + ComputeAndCompareSolutions(2, false, SPARSE_SCHUR, EIGEN, CX_SPARSE, true); + ComputeAndCompareSolutions(2, true, SPARSE_SCHUR, EIGEN, CX_SPARSE, true); } TEST_F(SchurComplementSolverTest, SparseSchurWithSuiteSparseLargeProblem) { - ComputeAndCompareSolutions(3, false, SPARSE_SCHUR, SUITE_SPARSE, true); - ComputeAndCompareSolutions(3, true, SPARSE_SCHUR, SUITE_SPARSE, true); + ComputeAndCompareSolutions(3, false, SPARSE_SCHUR, EIGEN, CX_SPARSE, true); + ComputeAndCompareSolutions(3, true, SPARSE_SCHUR, EIGEN, CX_SPARSE, true); } #endif // CERES_NO_CXSPARSE |