Multiple sparse linear algebra backends.

1. Added support for CXSparse - SparseNormalCholesky and
   SchurComplementSolver support SuiteSparse and CXSparse now.
   I am not sure I will add suport for visibility based
   preconditioning using CXSparse. Its not a high priority.

2. New enum SparseLinearAlgebraLibraryType which allows the user
   to indicate which sparse linear algebra library should be used.

3. Updated tests for SolverImpl and system_test.

4. Build system changes to automatically detect CXSparse and
   link to it by default -- just like SuiteSparse.

5. Minor bug fixes dealing in the cmake files and VBP.

6. Changed the order of the system test.

7. Deduped the unsymmetric linear solver test.

Change-Id: I33252a103c87b722ecb7ed7b5f0ae7fd91249244
diff --git a/internal/ceres/schur_complement_solver_test.cc b/internal/ceres/schur_complement_solver_test.cc
index 5e0cc40..ea5c346 100644
--- a/internal/ceres/schur_complement_solver_test.cc
+++ b/internal/ceres/schur_complement_solver_test.cc
@@ -92,13 +92,17 @@
                   sol_d.get());
   }
 
-  void ComputeAndCompareSolutions(int problem_id,
-                                  bool regularization,
-                                  ceres::LinearSolverType linear_solver_type) {
+  void ComputeAndCompareSolutions(
+      int problem_id,
+      bool regularization,
+      ceres::LinearSolverType linear_solver_type,
+      ceres::SparseLinearAlgebraLibraryType sparse_linear_algebra_library) {
     SetUpFromProblemId(problem_id);
     LinearSolver::Options options;
     options.num_eliminate_blocks = num_eliminate_blocks;
     options.type = linear_solver_type;
+    options.sparse_linear_algebra_library = sparse_linear_algebra_library;
+
     scoped_ptr<LinearSolver> solver(LinearSolver::Create(options));
 
     LinearSolver::PerSolveOptions per_solve_options;
@@ -133,21 +137,30 @@
 };
 
 #ifndef CERES_NO_SUITESPARSE
-
-TEST_F(SchurComplementSolverTest, SparseSchur) {
-  ComputeAndCompareSolutions(2, false, SPARSE_SCHUR);
-  ComputeAndCompareSolutions(3, false, SPARSE_SCHUR);
-  ComputeAndCompareSolutions(2, true, SPARSE_SCHUR);
-  ComputeAndCompareSolutions(3, true, SPARSE_SCHUR);
+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);
 }
-
 #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);
+}
+#endif  // CERES_NO_CXSPARSE
+
 TEST_F(SchurComplementSolverTest, DenseSchur) {
-  ComputeAndCompareSolutions(2, false, DENSE_SCHUR);
-  ComputeAndCompareSolutions(3, false, DENSE_SCHUR);
-  ComputeAndCompareSolutions(2, true, DENSE_SCHUR);
-  ComputeAndCompareSolutions(3, true, DENSE_SCHUR);
+  // 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