Remove support for CXSparse Eigen provides all the functionality that we need from CXSparse with a more liberal license. I will update the documentation in a follow up CL. Change-Id: I0b9fd8be3c27754cc2986cc0e06595c8b3fdec0b
diff --git a/CMakeLists.txt b/CMakeLists.txt index d72fe29..21eaefb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt
@@ -137,7 +137,6 @@ option(MINIGLOG "Use a stripped down version of glog." OFF) option(GFLAGS "Enable Google Flags." ON) option(SUITESPARSE "Enable SuiteSparse." ON) -option(CXSPARSE "Enable CXSparse." ON) if (APPLE) option(ACCELERATESPARSE "Enable use of sparse solvers in Apple's Accelerate framework." ON) @@ -193,7 +192,7 @@ # Apple claims that the BLAS call dsyrk_ is a private API, and will not allow # you to submit to the Apple Store if the symbol is present. update_cache_variable(LAPACK OFF) - message(STATUS "Building for iOS: SuiteSparse, CXSparse, LAPACK, gflags, " + message(STATUS "Building for iOS: SuiteSparse, LAPACK, gflags, " "and OpenMP are not available.") update_cache_variable(BUILD_EXAMPLES OFF) @@ -291,32 +290,6 @@ list(APPEND CERES_COMPILE_OPTIONS CERES_NO_SUITESPARSE) endif (SUITESPARSE) -# CXSparse. -if (CXSPARSE) - # Don't search with REQUIRED as we can continue without CXSparse. - find_package(CXSparse) - if (CXSparse_FOUND) - set(CXSparse_DEPENDENCY "find_dependency(CXSparse ${CXSparse_VERSION})") - # By default, if CXSparse and all dependencies are found, Ceres is - # built with CXSparse support. - message("-- Found CXSparse version: ${CXSparse_VERSION}, " - "building with CXSparse.") - - if (CXSparse_NO_CMAKE OR NOT CXSparse_DIR) - install(FILES ${Ceres_SOURCE_DIR}/cmake/FindCXSparse.cmake - DESTINATION ${RELATIVE_CMAKECONFIG_INSTALL_DIR}) - endif (CXSparse_NO_CMAKE OR NOT CXSparse_DIR) - else (CXSparse_FOUND) - # Disable use of CXSparse if it cannot be found and continue. - message("-- Did not find CXSparse, Building without CXSparse.") - update_cache_variable(CXSPARSE OFF) - list(APPEND CERES_COMPILE_OPTIONS CERES_NO_CXSPARSE) - endif (CXSparse_FOUND) -else (CXSPARSE) - message("-- Building without CXSparse.") - list(APPEND CERES_COMPILE_OPTIONS CERES_NO_CXSPARSE) -endif (CXSPARSE) - if (ACCELERATESPARSE) find_package(AccelerateSparse) if (AccelerateSparse_FOUND) @@ -336,9 +309,9 @@ endif() # Ensure that the user understands they have disabled all sparse libraries. -if (NOT SUITESPARSE AND NOT CXSPARSE AND NOT EIGENSPARSE AND NOT ACCELERATESPARSE) +if (NOT SUITESPARSE AND NOT EIGENSPARSE AND NOT ACCELERATESPARSE) message(" ===============================================================") - message(" Compiling without any sparse library: SuiteSparse, CXSparse ") + message(" Compiling without any sparse library: SuiteSparse, ") message(" EigenSparse & Apple's Accelerate are all disabled or unavailable. ") message(" No sparse linear solvers (SPARSE_NORMAL_CHOLESKY & SPARSE_SCHUR)") message(" will be available when Ceres is used.")
diff --git a/bazel/ceres.bzl b/bazel/ceres.bzl index c76e23a..87dca32 100644 --- a/bazel/ceres.bzl +++ b/bazel/ceres.bzl
@@ -56,7 +56,6 @@ "cost_function.cc", "covariance.cc", "covariance_impl.cc", - "cxsparse.cc", "dense_cholesky.cc", "dense_normal_cholesky_solver.cc", "dense_qr.cc", @@ -72,7 +71,6 @@ "evaluator.cc", "file.cc", "first_order_function.cc", - "float_cxsparse.cc", "float_suitesparse.cc", "function_sample.cc", "gradient_checker.cc", @@ -206,7 +204,7 @@ # https://github.com/ceres-solver/ceres-solver/issues/396 defines = [ "CERES_NO_SUITESPARSE", - "CERES_NO_CXSPARSE", + "CERES_NO_METIS", "CERES_NO_ACCELERATE_SPARSE", "CERES_NO_LAPACK", "CERES_USE_EIGEN_SPARSE",
diff --git a/cmake/CeresCompileOptionsToComponents.cmake b/cmake/CeresCompileOptionsToComponents.cmake index 5be0fb2..0baf214 100644 --- a/cmake/CeresCompileOptionsToComponents.cmake +++ b/cmake/CeresCompileOptionsToComponents.cmake
@@ -77,8 +77,6 @@ add_to_output_if_not_found(CURRENT_CERES_COMPILE_OPTIONS ${CERES_COMPONENTS_VAR} CERES_NO_SUITESPARSE "SuiteSparse;SparseLinearAlgebraLibrary") add_to_output_if_not_found(CURRENT_CERES_COMPILE_OPTIONS ${CERES_COMPONENTS_VAR} - CERES_NO_CXSPARSE "CXSparse;SparseLinearAlgebraLibrary") - add_to_output_if_not_found(CURRENT_CERES_COMPILE_OPTIONS ${CERES_COMPONENTS_VAR} CERES_NO_ACCELERATE_SPARSE "AccelerateSparse;SparseLinearAlgebraLibrary") add_to_output_if_not_found(CURRENT_CERES_COMPILE_OPTIONS ${CERES_COMPONENTS_VAR} CERES_RESTRICT_SCHUR_SPECIALIZATION "SchurSpecializations")
diff --git a/cmake/CeresConfig.cmake.in b/cmake/CeresConfig.cmake.in index 4745483..028eabb 100644 --- a/cmake/CeresConfig.cmake.in +++ b/cmake/CeresConfig.cmake.in
@@ -179,7 +179,6 @@ find_dependency(Threads) # Optional dependencies -@CXSparse_DEPENDENCY@ @SuiteSparse_DEPENDENCY@ # As imported CMake targets are not re-exported when a dependent target is
diff --git a/cmake/FindCXSparse.cmake b/cmake/FindCXSparse.cmake deleted file mode 100644 index afd1ebf..0000000 --- a/cmake/FindCXSparse.cmake +++ /dev/null
@@ -1,240 +0,0 @@ -# Ceres Solver - A fast non-linear least squares minimizer -# Copyright 2022 Google Inc. All rights reserved. -# http://ceres-solver.org/ -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# * Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# * Neither the name of Google Inc. nor the names of its contributors may be -# used to endorse or promote products derived from this software without -# specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -# Author: alexs.mac@gmail.com (Alex Stewart) -# - -#[=======================================================================[.rst: -FindCXSparse -============ - -Find CXSparse and its dependencies. - -This module defines the following variables which should be referenced by the -caller to use the library. - -``CXSparse_FOUND`` - ``TRUE`` iff CXSparse and all dependencies have been found. - -``CXSparse_VERSION`` - Extracted from ``cs.h``. - -``CXSparse_VERSION_MAJOR`` - Equal to 3 if ``CXSparse_VERSION`` = 3.1.2 - -``CXSparse_VERSION_MINOR`` - Equal to 1 if ``CXSparse_VERSION`` = 3.1.2 - -``CXSparse_VERSION_PATCH`` - Equal to 2 if ``CXSparse_VERSION`` = 3.1.2 - -The following variables control the behaviour of this module: - -``CXSparse_NO_CMAKE`` - Do not attempt to use the native CXSparse CMake package configuration. - -Targets -------- - -The following target defines CXSparse. - -``CXSparse::CXSparse`` - The main CXSparse to be linked against. - -The following variables are also defined by this module, but in line with CMake -recommended ``find_package`` module style should NOT be referenced directly by -callers (use the plural variables detailed above instead). These variables do -however affect the behaviour of the module via ``find_[path/library]()`` which -are NOT re-called (i.e., search for library is not repeated) if these variables -are set with valid values *in the CMake cache*. This means that if these -variables are set directly in the cache, either by the user in the CMake GUI, or -by the user passing ``-DVAR=VALUE`` directives to CMake when called (which -explicitly defines a cache variable), then they will be used verbatim, bypassing -the ``HINTS`` variables and other hard-coded search locations. - -``CXSparse_INCLUDE_DIR`` - Include directory for CXSparse, not including the include directory of any - dependencies. - -``CXSparse_LIBRARY`` - CXSparse library, not including the libraries of any dependencies. -]=======================================================================] - -if (NOT CXSparse_NO_CMAKE) - find_package (CXSparse NO_MODULE QUIET) -endif (NOT CXSparse_NO_CMAKE) - -if (CXSparse_FOUND) - return () -endif (CXSparse_FOUND) - -# Reset CALLERS_CMAKE_FIND_LIBRARY_PREFIXES to its value when -# FindCXSparse was invoked. -macro(CXSparse_RESET_FIND_LIBRARY_PREFIX) - if (MSVC) - set(CMAKE_FIND_LIBRARY_PREFIXES "${CALLERS_CMAKE_FIND_LIBRARY_PREFIXES}") - endif (MSVC) -endmacro(CXSparse_RESET_FIND_LIBRARY_PREFIX) - -# Called if we failed to find CXSparse or any of it's required dependencies, -# unsets all public (designed to be used externally) variables and reports -# error message at priority depending upon [REQUIRED/QUIET/<NONE>] argument. -macro(CXSparse_REPORT_NOT_FOUND REASON_MSG) - # Make results of search visible in the CMake GUI if CXSparse has not - # been found so that user does not have to toggle to advanced view. - mark_as_advanced(CLEAR CXSparse_INCLUDE_DIR - CXSparse_LIBRARY) - - cxsparse_reset_find_library_prefix() - - # Note <package>_FIND_[REQUIRED/QUIETLY] variables defined by FindPackage() - # use the camelcase library name, not uppercase. - if (CXSparse_FIND_QUIETLY) - message(STATUS "Failed to find CXSparse - " ${REASON_MSG} ${ARGN}) - elseif (CXSparse_FIND_REQUIRED) - message(FATAL_ERROR "Failed to find CXSparse - " ${REASON_MSG} ${ARGN}) - else() - # Neither QUIETLY nor REQUIRED, use no priority which emits a message - # but continues configuration and allows generation. - message("-- Failed to find CXSparse - " ${REASON_MSG} ${ARGN}) - endif () - return() -endmacro(CXSparse_REPORT_NOT_FOUND) - -# Handle possible presence of lib prefix for libraries on MSVC, see -# also CXSparse_RESET_FIND_LIBRARY_PREFIX(). -if (MSVC) - # Preserve the caller's original values for CMAKE_FIND_LIBRARY_PREFIXES - # s/t we can set it back before returning. - set(CALLERS_CMAKE_FIND_LIBRARY_PREFIXES "${CMAKE_FIND_LIBRARY_PREFIXES}") - # The empty string in this list is important, it represents the case when - # the libraries have no prefix (shared libraries / DLLs). - set(CMAKE_FIND_LIBRARY_PREFIXES "lib" "" "${CMAKE_FIND_LIBRARY_PREFIXES}") -endif (MSVC) - -# Additional suffixes to try appending to each search path. -list(APPEND CXSparse_CHECK_PATH_SUFFIXES - suitesparse) # Linux/Windows - -# Search supplied hint directories first if supplied. -find_path(CXSparse_INCLUDE_DIR - NAMES cs.h - PATH_SUFFIXES ${CXSparse_CHECK_PATH_SUFFIXES}) -if (NOT CXSparse_INCLUDE_DIR OR - NOT EXISTS ${CXSparse_INCLUDE_DIR}) - cxsparse_report_not_found( - "Could not find CXSparse include directory, set CXSparse_INCLUDE_DIR " - "to directory containing cs.h") -endif (NOT CXSparse_INCLUDE_DIR OR - NOT EXISTS ${CXSparse_INCLUDE_DIR}) - -find_library(CXSparse_LIBRARY NAMES cxsparse - PATH_SUFFIXES ${CXSparse_CHECK_PATH_SUFFIXES}) - -if (NOT CXSparse_LIBRARY OR - NOT EXISTS ${CXSparse_LIBRARY}) - cxsparse_report_not_found( - "Could not find CXSparse library, set CXSparse_LIBRARY " - "to full path to libcxsparse.") -endif (NOT CXSparse_LIBRARY OR - NOT EXISTS ${CXSparse_LIBRARY}) - -# Mark internally as found, then verify. CXSparse_REPORT_NOT_FOUND() unsets -# if called. -set(CXSparse_FOUND TRUE) - -# Extract CXSparse version from cs.h -if (CXSparse_INCLUDE_DIR) - set(CXSparse_VERSION_FILE ${CXSparse_INCLUDE_DIR}/cs.h) - if (NOT EXISTS ${CXSparse_VERSION_FILE}) - cxsparse_report_not_found( - "Could not find file: ${CXSparse_VERSION_FILE} " - "containing version information in CXSparse install located at: " - "${CXSparse_INCLUDE_DIR}.") - else (NOT EXISTS ${CXSparse_VERSION_FILE}) - file(READ ${CXSparse_INCLUDE_DIR}/cs.h CXSparse_VERSION_FILE_CONTENTS) - - string(REGEX MATCH "#define CS_VER [0-9]+" - CXSparse_VERSION_MAJOR "${CXSparse_VERSION_FILE_CONTENTS}") - string(REGEX REPLACE "#define CS_VER ([0-9]+)" "\\1" - CXSparse_VERSION_MAJOR "${CXSparse_VERSION_MAJOR}") - - string(REGEX MATCH "#define CS_SUBVER [0-9]+" - CXSparse_VERSION_MINOR "${CXSparse_VERSION_FILE_CONTENTS}") - string(REGEX REPLACE "#define CS_SUBVER ([0-9]+)" "\\1" - CXSparse_VERSION_MINOR "${CXSparse_VERSION_MINOR}") - - string(REGEX MATCH "#define CS_SUBSUB [0-9]+" - CXSparse_VERSION_PATCH "${CXSparse_VERSION_FILE_CONTENTS}") - string(REGEX REPLACE "#define CS_SUBSUB ([0-9]+)" "\\1" - CXSparse_VERSION_PATCH "${CXSparse_VERSION_PATCH}") - - # This is on a single line s/t CMake does not interpret it as a list of - # elements and insert ';' separators which would result in 3.;1.;2 nonsense. - set(CXSparse_VERSION "${CXSparse_VERSION_MAJOR}.${CXSparse_VERSION_MINOR}.${CXSparse_VERSION_PATCH}") - set(CXSparse_VERSION_COMPONENTS 3) - endif (NOT EXISTS ${CXSparse_VERSION_FILE}) -endif (CXSparse_INCLUDE_DIR) - -# Catch the case when the caller has set CXSparse_LIBRARY in the cache / GUI and -# thus FIND_LIBRARY was not called, but specified library is invalid, otherwise -# we would report CXSparse as found. -# TODO: This regex for CXSparse library is pretty primitive, we use lowercase -# for comparison to handle Windows using CamelCase library names, could -# this check be better? -string(TOLOWER "${CXSparse_LIBRARY}" LOWERCASE_CXSparse_LIBRARY) -if (CXSparse_LIBRARY AND - EXISTS ${CXSparse_LIBRARY} AND - NOT "${LOWERCASE_CXSparse_LIBRARY}" MATCHES ".*cxsparse[^/]*") - cxsparse_report_not_found( - "Caller defined CXSparse_LIBRARY: " - "${CXSparse_LIBRARY} does not match CXSparse.") -endif (CXSparse_LIBRARY AND - EXISTS ${CXSparse_LIBRARY} AND - NOT "${LOWERCASE_CXSparse_LIBRARY}" MATCHES ".*cxsparse[^/]*") - -cxsparse_reset_find_library_prefix() - -mark_as_advanced(CXSparse_INCLUDE_DIR CXSparse_LIBRARY) - -# Handle REQUIRED / QUIET optional arguments and version. -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(CXSparse - REQUIRED_VARS CXSparse_INCLUDE_DIR CXSparse_LIBRARY - VERSION_VAR CXSparse_VERSION) - -if (CXSparse_INCLUDE_DIR AND CXSparse_LIBRARY) - if (NOT TARGET CXSparse::CXSparse) - add_library (CXSparse::CXSparse IMPORTED UNKNOWN) - endif (NOT TARGET CXSparse::CXSparse) - - set_property (TARGET CXSparse::CXSparse PROPERTY - IMPORTED_LOCATION ${CXSparse_LIBRARY}) - set_property (TARGET CXSparse::CXSparse PROPERTY - INTERFACE_INCLUDE_DIRECTORIES ${CXSparse_INCLUDE_DIR}) -endif (CXSparse_INCLUDE_DIR AND CXSparse_LIBRARY)
diff --git a/cmake/config.h.in b/cmake/config.h.in index 028b62e..66a195a 100644 --- a/cmake/config.h.in +++ b/cmake/config.h.in
@@ -50,9 +50,6 @@ // If defined, Ceres was compiled without SuiteSparse. @CERES_NO_SUITESPARSE@ -// If defined, Ceres was compiled without CXSparse. -@CERES_NO_CXSPARSE@ - // If defined, Ceres was compiled without CUDA. @CERES_NO_CUDA@ @@ -61,7 +58,6 @@ #if defined(CERES_NO_SUITESPARSE) && \ defined(CERES_NO_ACCELERATE_SPARSE) && \ - defined(CERES_NO_CXSPARSE) && \ !defined(CERES_USE_EIGEN_SPARSE) // NOLINT // If defined Ceres was compiled without any sparse linear algebra support. #define CERES_NO_SPARSE @@ -109,9 +105,6 @@ #if !defined(CERES_NO_SUITESPARSE) #error CERES_NO_SPARSE requires CERES_NO_SUITESPARSE. #endif -#if !defined(CERES_NO_CXSPARSE) -#error CERES_NO_SPARSE requires CERES_NO_CXSPARSE -#endif #if !defined(CERES_NO_ACCELERATE_SPARSE) #error CERES_NO_SPARSE requires CERES_NO_ACCELERATE_SPARSE #endif
diff --git a/include/ceres/solver.h b/include/ceres/solver.h index 92cb495..6d58183 100644 --- a/include/ceres/solver.h +++ b/include/ceres/solver.h
@@ -378,16 +378,12 @@ DenseLinearAlgebraLibraryType dense_linear_algebra_library_type = EIGEN; // Ceres supports using multiple sparse linear algebra libraries for sparse - // matrix ordering and factorizations. Currently, SUITE_SPARSE and CX_SPARSE - // are the valid choices, depending on whether they are linked into Ceres at - // build time. + // matrix ordering and factorizations. SparseLinearAlgebraLibraryType sparse_linear_algebra_library_type = #if !defined(CERES_NO_SUITESPARSE) SUITE_SPARSE; #elif defined(CERES_USE_EIGEN_SPARSE) EIGEN_SPARSE; -#elif !defined(CERES_NO_CXSPARSE) - CX_SPARSE; #elif !defined(CERES_NO_ACCELERATE_SPARSE) ACCELERATE_SPARSE; #else @@ -413,7 +409,7 @@ // // Implementation status: // - // AMD works for SUITE_SPARSE, CX_SPARSE, EIGEN_SPARSE & + // AMD works for SUITE_SPARSE, EIGEN_SPARSE & // ACCELERATE_SPARSE. // // NESDIS currently works for SUITE_SPARSE when using
diff --git a/include/ceres/types.h b/include/ceres/types.h index 2fc5abc..c1e973a 100644 --- a/include/ceres/types.h +++ b/include/ceres/types.h
@@ -67,8 +67,7 @@ // Eigen. DENSE_QR, - // Solve the normal equations using a sparse cholesky solver; requires - // SuiteSparse or CXSparse. + // Solve the normal equations using a sparse cholesky solver; SPARSE_NORMAL_CHOLESKY, // Specialized solvers, specific to problems with a generalized @@ -165,11 +164,6 @@ // minimum degree ordering. SUITE_SPARSE, - // A lightweight replacement for SuiteSparse, which does not require - // a LAPACK/BLAS implementation. Consequently, its performance is - // also a bit lower than SuiteSparse. - CX_SPARSE, - // Eigen's sparse linear algebra routines. In particular Ceres uses // the Simplicial LDLT routines. EIGEN_SPARSE,
diff --git a/internal/ceres/CMakeLists.txt b/internal/ceres/CMakeLists.txt index e60b886..5b8c1ea 100644 --- a/internal/ceres/CMakeLists.txt +++ b/internal/ceres/CMakeLists.txt
@@ -120,12 +120,6 @@ SuiteSparse::SPQR) endif (SUITESPARSE AND SuiteSparse_FOUND) -if (CXSPARSE AND CXSparse_FOUND) - # Define version information for use in Solver::FullReport. - add_definitions(-DCERES_CXSPARSE_VERSION="${CXSparse_VERSION}") - list(APPEND CERES_LIBRARY_PRIVATE_DEPENDENCIES CXSparse::CXSparse) -endif (CXSPARSE AND CXSparse_FOUND) - if (ACCELERATESPARSE AND AccelerateSparse_FOUND) list(APPEND CERES_LIBRARY_PRIVATE_DEPENDENCIES ${AccelerateSparse_LIBRARIES}) endif() @@ -186,7 +180,6 @@ cost_function.cc covariance.cc covariance_impl.cc - cxsparse.cc dense_cholesky.cc dense_normal_cholesky_solver.cc dense_qr.cc @@ -202,7 +195,6 @@ evaluator.cc file.cc first_order_function.cc - float_cxsparse.cc float_suitesparse.cc function_sample.cc gradient_checking_cost_function.cc
diff --git a/internal/ceres/cxsparse.cc b/internal/ceres/cxsparse.cc deleted file mode 100644 index 46766ac..0000000 --- a/internal/ceres/cxsparse.cc +++ /dev/null
@@ -1,282 +0,0 @@ -// Ceres Solver - A fast non-linear least squares minimizer -// Copyright 2015 Google Inc. All rights reserved. -// http://ceres-solver.org/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must rep%roduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither the name of Google Inc. nor the names of its contributors may be -// used to endorse or promote products derived from this software without -// specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Author: strandmark@google.com (Petter Strandmark) - -// This include must come before any #ifndef check on Ceres compile options. -#include "ceres/internal/config.h" - -#ifndef CERES_NO_CXSPARSE - -#include <memory> -#include <string> -#include <vector> - -#include "ceres/compressed_col_sparse_matrix_utils.h" -#include "ceres/compressed_row_sparse_matrix.h" -#include "ceres/cxsparse.h" -#include "ceres/triplet_sparse_matrix.h" -#include "glog/logging.h" - -namespace ceres::internal { - -using std::vector; - -CXSparse::CXSparse() : scratch_(nullptr), scratch_size_(0) {} - -CXSparse::~CXSparse() { - if (scratch_size_ > 0) { - cs_di_free(scratch_); - } -} - -csn* CXSparse::Cholesky(cs_di* A, cs_dis* symbolic_factor) { - return cs_di_chol(A, symbolic_factor); -} - -void CXSparse::Solve(cs_dis* symbolic_factor, csn* numeric_factor, double* b) { - // Make sure we have enough scratch space available. - const int num_cols = numeric_factor->L->n; - if (scratch_size_ < num_cols) { - if (scratch_size_ > 0) { - cs_di_free(scratch_); - } - scratch_ = - reinterpret_cast<CS_ENTRY*>(cs_di_malloc(num_cols, sizeof(CS_ENTRY))); - scratch_size_ = num_cols; - } - - // When the Cholesky factor succeeded, these methods are - // guaranteed to succeeded as well. In the comments below, "x" - // refers to the scratch space. - // - // Set x = P * b. - CHECK(cs_di_ipvec(symbolic_factor->pinv, b, scratch_, num_cols)); - // Set x = L \ x. - CHECK(cs_di_lsolve(numeric_factor->L, scratch_)); - // Set x = L' \ x. - CHECK(cs_di_ltsolve(numeric_factor->L, scratch_)); - // Set b = P' * x. - CHECK(cs_di_pvec(symbolic_factor->pinv, scratch_, b, num_cols)); -} - -bool CXSparse::SolveCholesky(cs_di* lhs, double* rhs_and_solution) { - return cs_cholsol(1, lhs, rhs_and_solution); -} - -cs_dis* CXSparse::AnalyzeCholesky(cs_di* A) { - // order = 1 for Cholesky factor. - return cs_schol(1, A); -} - -cs_dis* CXSparse::AnalyzeCholeskyWithNaturalOrdering(cs_di* A) { - // order = 0 for Natural ordering. - return cs_schol(0, A); -} - -cs_dis* CXSparse::BlockAnalyzeCholesky(cs_di* A, - const vector<int>& row_blocks, - const vector<int>& col_blocks) { - const int num_row_blocks = row_blocks.size(); - const int num_col_blocks = col_blocks.size(); - - vector<int> block_rows; - vector<int> block_cols; - CompressedColumnScalarMatrixToBlockMatrix( - A->i, A->p, row_blocks, col_blocks, &block_rows, &block_cols); - cs_di block_matrix; - block_matrix.m = num_row_blocks; - block_matrix.n = num_col_blocks; - block_matrix.nz = -1; - block_matrix.nzmax = block_rows.size(); - block_matrix.p = &block_cols[0]; - block_matrix.i = &block_rows[0]; - block_matrix.x = nullptr; - - int* ordering = cs_amd(1, &block_matrix); - vector<int> block_ordering(num_row_blocks, -1); - std::copy(ordering, ordering + num_row_blocks, &block_ordering[0]); - cs_free(ordering); - - vector<int> scalar_ordering; - BlockOrderingToScalarOrdering(row_blocks, block_ordering, &scalar_ordering); - - auto* symbolic_factor = - reinterpret_cast<cs_dis*>(cs_calloc(1, sizeof(cs_dis))); - symbolic_factor->pinv = cs_pinv(&scalar_ordering[0], A->n); - cs* permuted_A = cs_symperm(A, symbolic_factor->pinv, 0); - - symbolic_factor->parent = cs_etree(permuted_A, 0); - int* postordering = cs_post(symbolic_factor->parent, A->n); - int* column_counts = - cs_counts(permuted_A, symbolic_factor->parent, postordering, 0); - cs_free(postordering); - cs_spfree(permuted_A); - - symbolic_factor->cp = static_cast<int*>(cs_malloc(A->n + 1, sizeof(int))); - symbolic_factor->lnz = cs_cumsum(symbolic_factor->cp, column_counts, A->n); - symbolic_factor->unz = symbolic_factor->lnz; - - cs_free(column_counts); - - if (symbolic_factor->lnz < 0) { - cs_sfree(symbolic_factor); - symbolic_factor = nullptr; - } - - return symbolic_factor; -} - -cs_di CXSparse::CreateSparseMatrixTransposeView(CompressedRowSparseMatrix* A) { - cs_di At; - At.m = A->num_cols(); - At.n = A->num_rows(); - At.nz = -1; - At.nzmax = A->num_nonzeros(); - At.p = A->mutable_rows(); - At.i = A->mutable_cols(); - At.x = A->mutable_values(); - return At; -} - -cs_di* CXSparse::CreateSparseMatrix(TripletSparseMatrix* tsm) { - cs_di_sparse tsm_wrapper; - tsm_wrapper.nzmax = tsm->num_nonzeros(); - tsm_wrapper.nz = tsm->num_nonzeros(); - tsm_wrapper.m = tsm->num_rows(); - tsm_wrapper.n = tsm->num_cols(); - tsm_wrapper.p = tsm->mutable_cols(); - tsm_wrapper.i = tsm->mutable_rows(); - tsm_wrapper.x = tsm->mutable_values(); - - return cs_compress(&tsm_wrapper); -} - -void CXSparse::ApproximateMinimumDegreeOrdering(cs_di* A, int* ordering) { - int* cs_ordering = cs_amd(1, A); - std::copy(cs_ordering, cs_ordering + A->m, ordering); - cs_free(cs_ordering); -} - -cs_di* CXSparse::TransposeMatrix(cs_di* A) { return cs_di_transpose(A, 1); } - -cs_di* CXSparse::MatrixMatrixMultiply(cs_di* A, cs_di* B) { - return cs_di_multiply(A, B); -} - -void CXSparse::Free(cs_di* sparse_matrix) { cs_di_spfree(sparse_matrix); } - -void CXSparse::Free(cs_dis* symbolic_factor) { cs_di_sfree(symbolic_factor); } - -void CXSparse::Free(csn* numeric_factor) { cs_di_nfree(numeric_factor); } - -std::unique_ptr<SparseCholesky> CXSparseCholesky::Create( - const OrderingType ordering_type) { - return std::unique_ptr<SparseCholesky>(new CXSparseCholesky(ordering_type)); -} - -CompressedRowSparseMatrix::StorageType CXSparseCholesky::StorageType() const { - return CompressedRowSparseMatrix::StorageType::LOWER_TRIANGULAR; -} - -CXSparseCholesky::CXSparseCholesky(const OrderingType ordering_type) - : ordering_type_(ordering_type), - symbolic_factor_(nullptr), - numeric_factor_(nullptr) {} - -CXSparseCholesky::~CXSparseCholesky() { - FreeSymbolicFactorization(); - FreeNumericFactorization(); -} - -LinearSolverTerminationType CXSparseCholesky::Factorize( - CompressedRowSparseMatrix* lhs, std::string* message) { - CHECK_EQ(lhs->storage_type(), StorageType()); - if (lhs == nullptr) { - *message = "Failure: Input lhs is nullptr."; - return LinearSolverTerminationType::FATAL_ERROR; - } - - cs_di cs_lhs = cs_.CreateSparseMatrixTransposeView(lhs); - - if (symbolic_factor_ == nullptr) { - if (ordering_type_ == OrderingType::NATURAL) { - symbolic_factor_ = cs_.AnalyzeCholeskyWithNaturalOrdering(&cs_lhs); - } else { - if (!lhs->col_blocks().empty() && !(lhs->row_blocks().empty())) { - symbolic_factor_ = cs_.BlockAnalyzeCholesky( - &cs_lhs, lhs->col_blocks(), lhs->row_blocks()); - } else { - symbolic_factor_ = cs_.AnalyzeCholesky(&cs_lhs); - } - } - - if (symbolic_factor_ == nullptr) { - *message = "CXSparse Failure : Symbolic factorization failed."; - return LinearSolverTerminationType::FATAL_ERROR; - } - } - - FreeNumericFactorization(); - numeric_factor_ = cs_.Cholesky(&cs_lhs, symbolic_factor_); - if (numeric_factor_ == nullptr) { - *message = "CXSparse Failure : Numeric factorization failed."; - return LinearSolverTerminationType::FAILURE; - } - - return LinearSolverTerminationType::SUCCESS; -} - -LinearSolverTerminationType CXSparseCholesky::Solve(const double* rhs, - double* solution, - std::string* message) { - CHECK(numeric_factor_ != nullptr) - << "Solve called without a call to Factorize first."; - const int num_cols = numeric_factor_->L->n; - memcpy(solution, rhs, num_cols * sizeof(*solution)); - cs_.Solve(symbolic_factor_, numeric_factor_, solution); - return LinearSolverTerminationType::SUCCESS; -} - -void CXSparseCholesky::FreeSymbolicFactorization() { - if (symbolic_factor_ != nullptr) { - cs_.Free(symbolic_factor_); - symbolic_factor_ = nullptr; - } -} - -void CXSparseCholesky::FreeNumericFactorization() { - if (numeric_factor_ != nullptr) { - cs_.Free(numeric_factor_); - numeric_factor_ = nullptr; - } -} - -} // namespace ceres::internal - -#endif // CERES_NO_CXSPARSE
diff --git a/internal/ceres/cxsparse.h b/internal/ceres/cxsparse.h deleted file mode 100644 index f4f1e4e..0000000 --- a/internal/ceres/cxsparse.h +++ /dev/null
@@ -1,180 +0,0 @@ -// Ceres Solver - A fast non-linear least squares minimizer -// Copyright 2015 Google Inc. All rights reserved. -// http://ceres-solver.org/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither the name of Google Inc. nor the names of its contributors may be -// used to endorse or promote products derived from this software without -// specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Author: strandmark@google.com (Petter Strandmark) - -#ifndef CERES_INTERNAL_CXSPARSE_H_ -#define CERES_INTERNAL_CXSPARSE_H_ - -// This include must come before any #ifndef check on Ceres compile options. -#include "ceres/internal/config.h" - -#ifndef CERES_NO_CXSPARSE - -#include <memory> -#include <string> -#include <vector> - -#include "ceres/internal/disable_warnings.h" -#include "ceres/linear_solver.h" -#include "ceres/sparse_cholesky.h" -#include "cs.h" - -namespace ceres::internal { - -class CompressedRowSparseMatrix; -class TripletSparseMatrix; - -// This object provides access to solving linear systems using Cholesky -// factorization with a known symbolic factorization. This features does not -// explicitly exist in CXSparse. The methods in the class are nonstatic because -// the class manages internal scratch space. -class CERES_NO_EXPORT CXSparse { - public: - CXSparse(); - ~CXSparse(); - - // Solve the system lhs * solution = rhs in place by using an - // approximate minimum degree fill reducing ordering. - bool SolveCholesky(cs_di* lhs, double* rhs_and_solution); - - // Solves a linear system given its symbolic and numeric factorization. - void Solve(cs_dis* symbolic_factor, - csn* numeric_factor, - double* rhs_and_solution); - - // Compute the numeric Cholesky factorization of A, given its - // symbolic factorization. - // - // Caller owns the result. - csn* Cholesky(cs_di* A, cs_dis* symbolic_factor); - - // Creates a sparse matrix from a compressed-column form. No memory is - // allocated or copied; the structure A is filled out with info from the - // argument. - cs_di CreateSparseMatrixTransposeView(CompressedRowSparseMatrix* A); - - // Creates a new matrix from a triplet form. Deallocate the returned matrix - // with Free. May return nullptr if the compression or allocation fails. - cs_di* CreateSparseMatrix(TripletSparseMatrix* A); - - // B = A' - // - // The returned matrix should be deallocated with Free when not used - // anymore. - cs_di* TransposeMatrix(cs_di* A); - - // C = A * B - // - // The returned matrix should be deallocated with Free when not used - // anymore. - cs_di* MatrixMatrixMultiply(cs_di* A, cs_di* B); - - // Computes a symbolic factorization of A that can be used in SolveCholesky. - // - // The returned matrix should be deallocated with Free when not used anymore. - cs_dis* AnalyzeCholesky(cs_di* A); - - // Computes a symbolic factorization of A that can be used in - // SolveCholesky, but does not compute a fill-reducing ordering. - // - // The returned matrix should be deallocated with Free when not used anymore. - cs_dis* AnalyzeCholeskyWithNaturalOrdering(cs_di* A); - - // Computes a symbolic factorization of A that can be used in - // SolveCholesky. The difference from AnalyzeCholesky is that this - // function first detects the block sparsity of the matrix using - // information about the row and column blocks and uses this block - // sparse matrix to find a fill-reducing ordering. This ordering is - // then used to find a symbolic factorization. This can result in a - // significant performance improvement AnalyzeCholesky on block - // sparse matrices. - // - // The returned matrix should be deallocated with Free when not used - // anymore. - cs_dis* BlockAnalyzeCholesky(cs_di* A, - const std::vector<int>& row_blocks, - const std::vector<int>& col_blocks); - - // Compute an fill-reducing approximate minimum degree ordering of - // the matrix A. ordering should be non-nullptr and should point to - // enough memory to hold the ordering for the rows of A. - void ApproximateMinimumDegreeOrdering(cs_di* A, int* ordering); - - void Free(cs_di* sparse_matrix); - void Free(cs_dis* symbolic_factorization); - void Free(csn* numeric_factorization); - - private: - // Cached scratch space - CS_ENTRY* scratch_; - int scratch_size_; -}; - -// An implementation of SparseCholesky interface using the CXSparse -// library. -class CERES_NO_EXPORT CXSparseCholesky final : public SparseCholesky { - public: - // Factory - static std::unique_ptr<SparseCholesky> Create(OrderingType ordering_type); - - // SparseCholesky interface. - ~CXSparseCholesky() override; - CompressedRowSparseMatrix::StorageType StorageType() const final; - LinearSolverTerminationType Factorize(CompressedRowSparseMatrix* lhs, - std::string* message) final; - LinearSolverTerminationType Solve(const double* rhs, - double* solution, - std::string* message) final; - - private: - explicit CXSparseCholesky(const OrderingType ordering_type); - void FreeSymbolicFactorization(); - void FreeNumericFactorization(); - - const OrderingType ordering_type_; - CXSparse cs_; - cs_dis* symbolic_factor_; - csn* numeric_factor_; -}; - -} // namespace ceres::internal - -#include "ceres/internal/reenable_warnings.h" - -#else - -typedef void cs_dis; - -class CXSparse { - public: - void Free(void* arg) {} -}; -#endif // CERES_NO_CXSPARSE - -#endif // CERES_INTERNAL_CXSPARSE_H_
diff --git a/internal/ceres/dynamic_sparse_normal_cholesky_solver.cc b/internal/ceres/dynamic_sparse_normal_cholesky_solver.cc index 3abfb29..992d48c 100644 --- a/internal/ceres/dynamic_sparse_normal_cholesky_solver.cc +++ b/internal/ceres/dynamic_sparse_normal_cholesky_solver.cc
@@ -39,7 +39,6 @@ #include "Eigen/SparseCore" #include "ceres/compressed_row_sparse_matrix.h" -#include "ceres/cxsparse.h" #include "ceres/internal/config.h" #include "ceres/internal/eigen.h" #include "ceres/linear_solver.h" @@ -86,9 +85,6 @@ case SUITE_SPARSE: summary = SolveImplUsingSuiteSparse(A, x); break; - case CX_SPARSE: - summary = SolveImplUsingCXSparse(A, x); - break; case EIGEN_SPARSE: summary = SolveImplUsingEigen(A, x); break; @@ -175,58 +171,6 @@ #endif // CERES_USE_EIGEN_SPARSE } -LinearSolver::Summary DynamicSparseNormalCholeskySolver::SolveImplUsingCXSparse( - CompressedRowSparseMatrix* A, double* rhs_and_solution) { -#ifdef CERES_NO_CXSPARSE - - LinearSolver::Summary summary; - summary.num_iterations = 0; - summary.termination_type = LinearSolverTerminationType::FATAL_ERROR; - summary.message = - "SPARSE_NORMAL_CHOLESKY cannot be used with CX_SPARSE " - "because Ceres was not built with support for CXSparse. " - "This requires enabling building with -DCXSPARSE=ON."; - - return summary; - -#else - EventLogger event_logger( - "DynamicSparseNormalCholeskySolver::CXSparse::Solve"); - - LinearSolver::Summary summary; - summary.num_iterations = 1; - summary.termination_type = LinearSolverTerminationType::SUCCESS; - summary.message = "Success."; - - CXSparse cxsparse; - - // Wrap the augmented Jacobian in a compressed sparse column matrix. - cs_di a_transpose = cxsparse.CreateSparseMatrixTransposeView(A); - - // Compute the normal equations. J'J delta = J'f and solve them - // using a sparse Cholesky factorization. Notice that when compared - // to SuiteSparse we have to explicitly compute the transpose of Jt, - // and then the normal equations before they can be - // factorized. CHOLMOD/SuiteSparse on the other hand can just work - // off of Jt to compute the Cholesky factorization of the normal - // equations. - cs_di* a = cxsparse.TransposeMatrix(&a_transpose); - cs_di* lhs = cxsparse.MatrixMatrixMultiply(&a_transpose, a); - cxsparse.Free(a); - event_logger.AddEvent("NormalEquations"); - - if (!cxsparse.SolveCholesky(lhs, rhs_and_solution)) { - summary.termination_type = LinearSolverTerminationType::FAILURE; - summary.message = "CXSparse::SolveCholesky failed"; - } - event_logger.AddEvent("Solve"); - - cxsparse.Free(lhs); - event_logger.AddEvent("TearDown"); - return summary; -#endif -} - LinearSolver::Summary DynamicSparseNormalCholeskySolver::SolveImplUsingSuiteSparse( CompressedRowSparseMatrix* A, double* rhs_and_solution) {
diff --git a/internal/ceres/dynamic_sparse_normal_cholesky_solver_test.cc b/internal/ceres/dynamic_sparse_normal_cholesky_solver_test.cc index 1852969..b0c218d 100644 --- a/internal/ceres/dynamic_sparse_normal_cholesky_solver_test.cc +++ b/internal/ceres/dynamic_sparse_normal_cholesky_solver_test.cc
@@ -124,12 +124,6 @@ #endif #endif -#ifndef CERES_NO_CXSPARSE -TEST_F(DynamicSparseNormalCholeskySolverTest, CXSparse) { - TestSolver(CX_SPARSE, OrderingType::AMD); -} -#endif - #ifdef CERES_USE_EIGEN_SPARSE TEST_F(DynamicSparseNormalCholeskySolverTest, EigenAMD) { TestSolver(EIGEN_SPARSE, OrderingType::AMD);
diff --git a/internal/ceres/dynamic_sparsity_test.cc b/internal/ceres/dynamic_sparsity_test.cc index 29cfb15..694a343 100644 --- a/internal/ceres/dynamic_sparsity_test.cc +++ b/internal/ceres/dynamic_sparsity_test.cc
@@ -368,7 +368,6 @@ TEST(DynamicSparsity, StaticAndDynamicSparsityProduceSameSolution) { // Skip test if there is no sparse linear algebra library. if (!IsSparseLinearAlgebraLibraryTypeAvailable(SUITE_SPARSE) && - !IsSparseLinearAlgebraLibraryTypeAvailable(CX_SPARSE) && !IsSparseLinearAlgebraLibraryTypeAvailable(EIGEN_SPARSE)) { return; }
diff --git a/internal/ceres/eigensparse.cc b/internal/ceres/eigensparse.cc index 7ef1210..3be222e 100644 --- a/internal/ceres/eigensparse.cc +++ b/internal/ceres/eigensparse.cc
@@ -34,10 +34,14 @@ #ifdef CERES_USE_EIGEN_SPARSE -#include <iostream> // This is needed because MetisSupport depends on iostream. #include <sstream> +#ifndef CERES_NO_METIS +#include <iostream> // This is needed because MetisSupport depends on iostream. + #include "Eigen/MetisSupport" +#endif + #include "Eigen/SparseCholesky" #include "Eigen/SparseCore" #include "ceres/compressed_row_sparse_matrix.h" @@ -146,9 +150,6 @@ using WithAMDOrdering = Eigen::SimplicialLDLT<Eigen::SparseMatrix<double>, Eigen::Upper, Eigen::AMDOrdering<int>>; - using WithMetisOrdering = Eigen::SimplicialLDLT<Eigen::SparseMatrix<double>, - Eigen::Upper, - Eigen::MetisOrdering<int>>; using WithNaturalOrdering = Eigen::SimplicialLDLT<Eigen::SparseMatrix<double>, Eigen::Upper, @@ -158,6 +159,10 @@ return std::make_unique<EigenSparseCholeskyTemplate<WithAMDOrdering>>(); #ifndef CERES_NO_METIS } else if (ordering_type == OrderingType::NESDIS) { + using WithMetisOrdering = Eigen::SimplicialLDLT<Eigen::SparseMatrix<double>, + Eigen::Upper, + Eigen::MetisOrdering<int>>; + return std::make_unique<EigenSparseCholeskyTemplate<WithMetisOrdering>>(); } #else @@ -179,9 +184,6 @@ using WithAMDOrdering = Eigen::SimplicialLDLT<Eigen::SparseMatrix<float>, Eigen::Upper, Eigen::AMDOrdering<int>>; - using WithMetisOrdering = Eigen::SimplicialLDLT<Eigen::SparseMatrix<float>, - Eigen::Upper, - Eigen::MetisOrdering<int>>; using WithNaturalOrdering = Eigen::SimplicialLDLT<Eigen::SparseMatrix<float>, Eigen::Upper, @@ -190,6 +192,10 @@ return std::make_unique<EigenSparseCholeskyTemplate<WithAMDOrdering>>(); #ifndef CERES_NO_METIS } else if (ordering_type == OrderingType::NESDIS) { + using WithMetisOrdering = Eigen::SimplicialLDLT<Eigen::SparseMatrix<float>, + Eigen::Upper, + Eigen::MetisOrdering<int>>; + return std::make_unique<EigenSparseCholeskyTemplate<WithMetisOrdering>>(); } #else
diff --git a/internal/ceres/float_cxsparse.cc b/internal/ceres/float_cxsparse.cc deleted file mode 100644 index f675307..0000000 --- a/internal/ceres/float_cxsparse.cc +++ /dev/null
@@ -1,47 +0,0 @@ -// Ceres Solver - A fast non-linear least squares minimizer -// Copyright 2018 Google Inc. All rights reserved. -// http://ceres-solver.org/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither the name of Google Inc. nor the names of its contributors may be -// used to endorse or promote products derived from this software without -// specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Author: sameeragarwal@google.com (Sameer Agarwal) - -#include "ceres/float_cxsparse.h" - -#include <memory> - -#if !defined(CERES_NO_CXSPARSE) - -namespace ceres::internal { - -std::unique_ptr<SparseCholesky> FloatCXSparseCholesky::Create( - OrderingType ordering_type) { - LOG(FATAL) << "FloatCXSparseCholesky is not available."; - return {}; -} - -} // namespace ceres::internal - -#endif // !defined(CERES_NO_CXSPARSE)
diff --git a/internal/ceres/float_cxsparse.h b/internal/ceres/float_cxsparse.h deleted file mode 100644 index 9c559d2..0000000 --- a/internal/ceres/float_cxsparse.h +++ /dev/null
@@ -1,57 +0,0 @@ -// Ceres Solver - A fast non-linear least squares minimizer -// Copyright 2018 Google Inc. All rights reserved. -// http://ceres-solver.org/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither the name of Google Inc. nor the names of its contributors may be -// used to endorse or promote products derived from this software without -// specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Author: sameeragarwal@google.com (Sameer Agarwal) - -#ifndef CERES_INTERNAL_FLOAT_CXSPARSE_H_ -#define CERES_INTERNAL_FLOAT_CXSPARSE_H_ - -// This include must come before any #ifndef check on Ceres compile options. -#include "ceres/internal/config.h" - -#if !defined(CERES_NO_CXSPARSE) - -#include <memory> - -#include "ceres/internal/export.h" -#include "ceres/sparse_cholesky.h" - -namespace ceres::internal { - -// Fake implementation of a single precision Sparse Cholesky using -// CXSparse. -class CERES_NO_EXPORT FloatCXSparseCholesky : public SparseCholesky { - public: - static std::unique_ptr<SparseCholesky> Create(OrderingType ordering_type); -}; - -} // namespace ceres::internal - -#endif // !defined(CERES_NO_CXSPARSE) - -#endif // CERES_INTERNAL_FLOAT_CXSPARSE_H_
diff --git a/internal/ceres/generate_bundle_adjustment_tests.py b/internal/ceres/generate_bundle_adjustment_tests.py index 566258b..6e60270 100644 --- a/internal/ceres/generate_bundle_adjustment_tests.py +++ b/internal/ceres/generate_bundle_adjustment_tests.py
@@ -52,11 +52,9 @@ # Linear solver Sparse backend ('SPARSE_NORMAL_CHOLESKY', 'SUITE_SPARSE'), ('SPARSE_NORMAL_CHOLESKY', 'EIGEN_SPARSE'), - ('SPARSE_NORMAL_CHOLESKY', 'CX_SPARSE'), ('SPARSE_NORMAL_CHOLESKY', 'ACCELERATE_SPARSE'), ('SPARSE_SCHUR', 'SUITE_SPARSE'), ('SPARSE_SCHUR', 'EIGEN_SPARSE'), - ('SPARSE_SCHUR', 'CX_SPARSE'), ('SPARSE_SCHUR', 'ACCELERATE_SPARSE'), ] @@ -66,11 +64,9 @@ ('ITERATIVE_SCHUR', 'NO_SPARSE', 'SCHUR_JACOBI'), ('ITERATIVE_SCHUR', 'SUITE_SPARSE', 'CLUSTER_JACOBI'), ('ITERATIVE_SCHUR', 'EIGEN_SPARSE', 'CLUSTER_JACOBI'), - ('ITERATIVE_SCHUR', 'CX_SPARSE', 'CLUSTER_JACOBI'), ('ITERATIVE_SCHUR', 'ACCELERATE_SPARSE','CLUSTER_JACOBI'), ('ITERATIVE_SCHUR', 'SUITE_SPARSE', 'CLUSTER_TRIDIAGONAL'), ('ITERATIVE_SCHUR', 'EIGEN_SPARSE', 'CLUSTER_TRIDIAGONAL'), - ('ITERATIVE_SCHUR', 'CX_SPARSE', 'CLUSTER_TRIDIAGONAL'), ('ITERATIVE_SCHUR', 'ACCELERATE_SPARSE','CLUSTER_TRIDIAGONAL'), ] @@ -85,7 +81,6 @@ NO_SPARSE='', # Omit sparse reference entirely for dense tests. SUITE_SPARSE='suitesparse', EIGEN_SPARSE='eigensparse', - CX_SPARSE='cxsparse', ACCELERATE_SPARSE='acceleratesparse', IDENTITY='identity', JACOBI='jacobi', @@ -212,9 +207,6 @@ if sparse_backend == 'SUITE_SPARSE': preprocessor_conditions_begin.append('#ifndef CERES_NO_SUITESPARSE') preprocessor_conditions_end.insert(0, '#endif // CERES_NO_SUITESPARSE') - elif sparse_backend == 'CX_SPARSE': - preprocessor_conditions_begin.append('#ifndef CERES_NO_CXSPARSE') - preprocessor_conditions_end.insert(0, '#endif // CERES_NO_CXSPARSE') elif sparse_backend == 'ACCELERATE_SPARSE': preprocessor_conditions_begin.append('#ifndef CERES_NO_ACCELERATE_SPARSE') preprocessor_conditions_end.insert(0, '#endif // CERES_NO_ACCELERATE_SPARSE')
diff --git a/internal/ceres/generated_bundle_adjustment_tests/CMakeLists.txt b/internal/ceres/generated_bundle_adjustment_tests/CMakeLists.txt index b0c672f..73fe3f5 100644 --- a/internal/ceres/generated_bundle_adjustment_tests/CMakeLists.txt +++ b/internal/ceres/generated_bundle_adjustment_tests/CMakeLists.txt
@@ -40,82 +40,66 @@ ceres_test(ba_denseschur_cuda_auto) ceres_test(ba_sparsecholesky_suitesparse_auto) ceres_test(ba_sparsecholesky_eigensparse_auto) -ceres_test(ba_sparsecholesky_cxsparse_auto) ceres_test(ba_sparsecholesky_acceleratesparse_auto) ceres_test(ba_sparseschur_suitesparse_auto) ceres_test(ba_sparseschur_eigensparse_auto) -ceres_test(ba_sparseschur_cxsparse_auto) ceres_test(ba_sparseschur_acceleratesparse_auto) ceres_test(ba_iterschur_jacobi_auto) ceres_test(ba_iterschur_schurjacobi_auto) ceres_test(ba_iterschur_suitesparse_clustjacobi_auto) ceres_test(ba_iterschur_eigensparse_clustjacobi_auto) -ceres_test(ba_iterschur_cxsparse_clustjacobi_auto) ceres_test(ba_iterschur_acceleratesparse_clustjacobi_auto) ceres_test(ba_iterschur_suitesparse_clusttri_auto) ceres_test(ba_iterschur_eigensparse_clusttri_auto) -ceres_test(ba_iterschur_cxsparse_clusttri_auto) ceres_test(ba_iterschur_acceleratesparse_clusttri_auto) ceres_test(ba_denseschur_eigen_auto_threads) ceres_test(ba_denseschur_lapack_auto_threads) ceres_test(ba_denseschur_cuda_auto_threads) ceres_test(ba_sparsecholesky_suitesparse_auto_threads) ceres_test(ba_sparsecholesky_eigensparse_auto_threads) -ceres_test(ba_sparsecholesky_cxsparse_auto_threads) ceres_test(ba_sparsecholesky_acceleratesparse_auto_threads) ceres_test(ba_sparseschur_suitesparse_auto_threads) ceres_test(ba_sparseschur_eigensparse_auto_threads) -ceres_test(ba_sparseschur_cxsparse_auto_threads) ceres_test(ba_sparseschur_acceleratesparse_auto_threads) ceres_test(ba_iterschur_jacobi_auto_threads) ceres_test(ba_iterschur_schurjacobi_auto_threads) ceres_test(ba_iterschur_suitesparse_clustjacobi_auto_threads) ceres_test(ba_iterschur_eigensparse_clustjacobi_auto_threads) -ceres_test(ba_iterschur_cxsparse_clustjacobi_auto_threads) ceres_test(ba_iterschur_acceleratesparse_clustjacobi_auto_threads) ceres_test(ba_iterschur_suitesparse_clusttri_auto_threads) ceres_test(ba_iterschur_eigensparse_clusttri_auto_threads) -ceres_test(ba_iterschur_cxsparse_clusttri_auto_threads) ceres_test(ba_iterschur_acceleratesparse_clusttri_auto_threads) ceres_test(ba_denseschur_eigen_user) ceres_test(ba_denseschur_lapack_user) ceres_test(ba_denseschur_cuda_user) ceres_test(ba_sparsecholesky_suitesparse_user) ceres_test(ba_sparsecholesky_eigensparse_user) -ceres_test(ba_sparsecholesky_cxsparse_user) ceres_test(ba_sparsecholesky_acceleratesparse_user) ceres_test(ba_sparseschur_suitesparse_user) ceres_test(ba_sparseschur_eigensparse_user) -ceres_test(ba_sparseschur_cxsparse_user) ceres_test(ba_sparseschur_acceleratesparse_user) ceres_test(ba_iterschur_jacobi_user) ceres_test(ba_iterschur_schurjacobi_user) ceres_test(ba_iterschur_suitesparse_clustjacobi_user) ceres_test(ba_iterschur_eigensparse_clustjacobi_user) -ceres_test(ba_iterschur_cxsparse_clustjacobi_user) ceres_test(ba_iterschur_acceleratesparse_clustjacobi_user) ceres_test(ba_iterschur_suitesparse_clusttri_user) ceres_test(ba_iterschur_eigensparse_clusttri_user) -ceres_test(ba_iterschur_cxsparse_clusttri_user) ceres_test(ba_iterschur_acceleratesparse_clusttri_user) ceres_test(ba_denseschur_eigen_user_threads) ceres_test(ba_denseschur_lapack_user_threads) ceres_test(ba_denseschur_cuda_user_threads) ceres_test(ba_sparsecholesky_suitesparse_user_threads) ceres_test(ba_sparsecholesky_eigensparse_user_threads) -ceres_test(ba_sparsecholesky_cxsparse_user_threads) ceres_test(ba_sparsecholesky_acceleratesparse_user_threads) ceres_test(ba_sparseschur_suitesparse_user_threads) ceres_test(ba_sparseschur_eigensparse_user_threads) -ceres_test(ba_sparseschur_cxsparse_user_threads) ceres_test(ba_sparseschur_acceleratesparse_user_threads) ceres_test(ba_iterschur_jacobi_user_threads) ceres_test(ba_iterschur_schurjacobi_user_threads) ceres_test(ba_iterschur_suitesparse_clustjacobi_user_threads) ceres_test(ba_iterschur_eigensparse_clustjacobi_user_threads) -ceres_test(ba_iterschur_cxsparse_clustjacobi_user_threads) ceres_test(ba_iterschur_acceleratesparse_clustjacobi_user_threads) ceres_test(ba_iterschur_suitesparse_clusttri_user_threads) ceres_test(ba_iterschur_eigensparse_clusttri_user_threads) -ceres_test(ba_iterschur_cxsparse_clusttri_user_threads) ceres_test(ba_iterschur_acceleratesparse_clusttri_user_threads)
diff --git a/internal/ceres/generated_bundle_adjustment_tests/ba_iterschur_cxsparse_clustjacobi_auto_test.cc b/internal/ceres/generated_bundle_adjustment_tests/ba_iterschur_cxsparse_clustjacobi_auto_test.cc deleted file mode 100644 index dedff9c..0000000 --- a/internal/ceres/generated_bundle_adjustment_tests/ba_iterschur_cxsparse_clustjacobi_auto_test.cc +++ /dev/null
@@ -1,63 +0,0 @@ -// Ceres Solver - A fast non-linear least squares minimizer -// Copyright 2022 Google Inc. All rights reserved. -// http://ceres-solver.org/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither the name of Google Inc. nor the names of its contributors may be -// used to endorse or promote products derived from this software without -// specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// ======================================== -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// ======================================== -// -// This file is generated using generate_bundle_adjustment_tests.py. - -#include "ceres/internal/config.h" -#include "bundle_adjustment_test_util.h" - -#ifndef CERES_NO_CXSPARSE - -namespace ceres::internal { - -TEST_F(BundleAdjustmentTest, - IterativeSchur_CxSparse_ClusterJacobi_AutomaticOrdering) { // NOLINT - BundleAdjustmentProblem bundle_adjustment_problem; - Solver::Options* options = bundle_adjustment_problem.mutable_solver_options(); - options->num_threads = 1; - options->linear_solver_type = ITERATIVE_SCHUR; - options->dense_linear_algebra_library_type = EIGEN; - options->sparse_linear_algebra_library_type = CX_SPARSE; - options->preconditioner_type = CLUSTER_JACOBI; - if (kAutomaticOrdering) { - options->linear_solver_ordering = nullptr; - } - Problem* problem = bundle_adjustment_problem.mutable_problem(); - RunSolverForConfigAndExpectResidualsMatch(*options, problem); -} - -} // namespace ceres::internal - -#endif // CERES_NO_CXSPARSE
diff --git a/internal/ceres/generated_bundle_adjustment_tests/ba_iterschur_cxsparse_clustjacobi_auto_threads_test.cc b/internal/ceres/generated_bundle_adjustment_tests/ba_iterschur_cxsparse_clustjacobi_auto_threads_test.cc deleted file mode 100644 index 3bcb11d..0000000 --- a/internal/ceres/generated_bundle_adjustment_tests/ba_iterschur_cxsparse_clustjacobi_auto_threads_test.cc +++ /dev/null
@@ -1,65 +0,0 @@ -// Ceres Solver - A fast non-linear least squares minimizer -// Copyright 2022 Google Inc. All rights reserved. -// http://ceres-solver.org/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither the name of Google Inc. nor the names of its contributors may be -// used to endorse or promote products derived from this software without -// specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// ======================================== -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// ======================================== -// -// This file is generated using generate_bundle_adjustment_tests.py. - -#include "ceres/internal/config.h" -#include "bundle_adjustment_test_util.h" - -#ifndef CERES_NO_CXSPARSE -#ifndef CERES_NO_THREADS - -namespace ceres::internal { - -TEST_F(BundleAdjustmentTest, - IterativeSchur_CxSparse_ClusterJacobi_AutomaticOrdering_Threads) { // NOLINT - BundleAdjustmentProblem bundle_adjustment_problem; - Solver::Options* options = bundle_adjustment_problem.mutable_solver_options(); - options->num_threads = 4; - options->linear_solver_type = ITERATIVE_SCHUR; - options->dense_linear_algebra_library_type = EIGEN; - options->sparse_linear_algebra_library_type = CX_SPARSE; - options->preconditioner_type = CLUSTER_JACOBI; - if (kAutomaticOrdering) { - options->linear_solver_ordering = nullptr; - } - Problem* problem = bundle_adjustment_problem.mutable_problem(); - RunSolverForConfigAndExpectResidualsMatch(*options, problem); -} - -} // namespace ceres::internal - -#endif // CERES_NO_THREADS -#endif // CERES_NO_CXSPARSE
diff --git a/internal/ceres/generated_bundle_adjustment_tests/ba_iterschur_cxsparse_clustjacobi_user_test.cc b/internal/ceres/generated_bundle_adjustment_tests/ba_iterschur_cxsparse_clustjacobi_user_test.cc deleted file mode 100644 index 5acbc66..0000000 --- a/internal/ceres/generated_bundle_adjustment_tests/ba_iterschur_cxsparse_clustjacobi_user_test.cc +++ /dev/null
@@ -1,63 +0,0 @@ -// Ceres Solver - A fast non-linear least squares minimizer -// Copyright 2022 Google Inc. All rights reserved. -// http://ceres-solver.org/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither the name of Google Inc. nor the names of its contributors may be -// used to endorse or promote products derived from this software without -// specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// ======================================== -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// ======================================== -// -// This file is generated using generate_bundle_adjustment_tests.py. - -#include "ceres/internal/config.h" -#include "bundle_adjustment_test_util.h" - -#ifndef CERES_NO_CXSPARSE - -namespace ceres::internal { - -TEST_F(BundleAdjustmentTest, - IterativeSchur_CxSparse_ClusterJacobi_UserOrdering) { // NOLINT - BundleAdjustmentProblem bundle_adjustment_problem; - Solver::Options* options = bundle_adjustment_problem.mutable_solver_options(); - options->num_threads = 1; - options->linear_solver_type = ITERATIVE_SCHUR; - options->dense_linear_algebra_library_type = EIGEN; - options->sparse_linear_algebra_library_type = CX_SPARSE; - options->preconditioner_type = CLUSTER_JACOBI; - if (kUserOrdering) { - options->linear_solver_ordering = nullptr; - } - Problem* problem = bundle_adjustment_problem.mutable_problem(); - RunSolverForConfigAndExpectResidualsMatch(*options, problem); -} - -} // namespace ceres::internal - -#endif // CERES_NO_CXSPARSE
diff --git a/internal/ceres/generated_bundle_adjustment_tests/ba_iterschur_cxsparse_clustjacobi_user_threads_test.cc b/internal/ceres/generated_bundle_adjustment_tests/ba_iterschur_cxsparse_clustjacobi_user_threads_test.cc deleted file mode 100644 index 9e0baea..0000000 --- a/internal/ceres/generated_bundle_adjustment_tests/ba_iterschur_cxsparse_clustjacobi_user_threads_test.cc +++ /dev/null
@@ -1,65 +0,0 @@ -// Ceres Solver - A fast non-linear least squares minimizer -// Copyright 2022 Google Inc. All rights reserved. -// http://ceres-solver.org/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither the name of Google Inc. nor the names of its contributors may be -// used to endorse or promote products derived from this software without -// specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// ======================================== -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// ======================================== -// -// This file is generated using generate_bundle_adjustment_tests.py. - -#include "ceres/internal/config.h" -#include "bundle_adjustment_test_util.h" - -#ifndef CERES_NO_CXSPARSE -#ifndef CERES_NO_THREADS - -namespace ceres::internal { - -TEST_F(BundleAdjustmentTest, - IterativeSchur_CxSparse_ClusterJacobi_UserOrdering_Threads) { // NOLINT - BundleAdjustmentProblem bundle_adjustment_problem; - Solver::Options* options = bundle_adjustment_problem.mutable_solver_options(); - options->num_threads = 4; - options->linear_solver_type = ITERATIVE_SCHUR; - options->dense_linear_algebra_library_type = EIGEN; - options->sparse_linear_algebra_library_type = CX_SPARSE; - options->preconditioner_type = CLUSTER_JACOBI; - if (kUserOrdering) { - options->linear_solver_ordering = nullptr; - } - Problem* problem = bundle_adjustment_problem.mutable_problem(); - RunSolverForConfigAndExpectResidualsMatch(*options, problem); -} - -} // namespace ceres::internal - -#endif // CERES_NO_THREADS -#endif // CERES_NO_CXSPARSE
diff --git a/internal/ceres/generated_bundle_adjustment_tests/ba_iterschur_cxsparse_clusttri_auto_test.cc b/internal/ceres/generated_bundle_adjustment_tests/ba_iterschur_cxsparse_clusttri_auto_test.cc deleted file mode 100644 index 5e5c2ab..0000000 --- a/internal/ceres/generated_bundle_adjustment_tests/ba_iterschur_cxsparse_clusttri_auto_test.cc +++ /dev/null
@@ -1,63 +0,0 @@ -// Ceres Solver - A fast non-linear least squares minimizer -// Copyright 2022 Google Inc. All rights reserved. -// http://ceres-solver.org/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither the name of Google Inc. nor the names of its contributors may be -// used to endorse or promote products derived from this software without -// specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// ======================================== -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// ======================================== -// -// This file is generated using generate_bundle_adjustment_tests.py. - -#include "ceres/internal/config.h" -#include "bundle_adjustment_test_util.h" - -#ifndef CERES_NO_CXSPARSE - -namespace ceres::internal { - -TEST_F(BundleAdjustmentTest, - IterativeSchur_CxSparse_ClusterTridiagonal_AutomaticOrdering) { // NOLINT - BundleAdjustmentProblem bundle_adjustment_problem; - Solver::Options* options = bundle_adjustment_problem.mutable_solver_options(); - options->num_threads = 1; - options->linear_solver_type = ITERATIVE_SCHUR; - options->dense_linear_algebra_library_type = EIGEN; - options->sparse_linear_algebra_library_type = CX_SPARSE; - options->preconditioner_type = CLUSTER_TRIDIAGONAL; - if (kAutomaticOrdering) { - options->linear_solver_ordering = nullptr; - } - Problem* problem = bundle_adjustment_problem.mutable_problem(); - RunSolverForConfigAndExpectResidualsMatch(*options, problem); -} - -} // namespace ceres::internal - -#endif // CERES_NO_CXSPARSE
diff --git a/internal/ceres/generated_bundle_adjustment_tests/ba_iterschur_cxsparse_clusttri_auto_threads_test.cc b/internal/ceres/generated_bundle_adjustment_tests/ba_iterschur_cxsparse_clusttri_auto_threads_test.cc deleted file mode 100644 index d9d9fff..0000000 --- a/internal/ceres/generated_bundle_adjustment_tests/ba_iterschur_cxsparse_clusttri_auto_threads_test.cc +++ /dev/null
@@ -1,65 +0,0 @@ -// Ceres Solver - A fast non-linear least squares minimizer -// Copyright 2022 Google Inc. All rights reserved. -// http://ceres-solver.org/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither the name of Google Inc. nor the names of its contributors may be -// used to endorse or promote products derived from this software without -// specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// ======================================== -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// ======================================== -// -// This file is generated using generate_bundle_adjustment_tests.py. - -#include "ceres/internal/config.h" -#include "bundle_adjustment_test_util.h" - -#ifndef CERES_NO_CXSPARSE -#ifndef CERES_NO_THREADS - -namespace ceres::internal { - -TEST_F(BundleAdjustmentTest, - IterativeSchur_CxSparse_ClusterTridiagonal_AutomaticOrdering_Threads) { // NOLINT - BundleAdjustmentProblem bundle_adjustment_problem; - Solver::Options* options = bundle_adjustment_problem.mutable_solver_options(); - options->num_threads = 4; - options->linear_solver_type = ITERATIVE_SCHUR; - options->dense_linear_algebra_library_type = EIGEN; - options->sparse_linear_algebra_library_type = CX_SPARSE; - options->preconditioner_type = CLUSTER_TRIDIAGONAL; - if (kAutomaticOrdering) { - options->linear_solver_ordering = nullptr; - } - Problem* problem = bundle_adjustment_problem.mutable_problem(); - RunSolverForConfigAndExpectResidualsMatch(*options, problem); -} - -} // namespace ceres::internal - -#endif // CERES_NO_THREADS -#endif // CERES_NO_CXSPARSE
diff --git a/internal/ceres/generated_bundle_adjustment_tests/ba_iterschur_cxsparse_clusttri_user_test.cc b/internal/ceres/generated_bundle_adjustment_tests/ba_iterschur_cxsparse_clusttri_user_test.cc deleted file mode 100644 index b3176d0..0000000 --- a/internal/ceres/generated_bundle_adjustment_tests/ba_iterschur_cxsparse_clusttri_user_test.cc +++ /dev/null
@@ -1,63 +0,0 @@ -// Ceres Solver - A fast non-linear least squares minimizer -// Copyright 2022 Google Inc. All rights reserved. -// http://ceres-solver.org/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither the name of Google Inc. nor the names of its contributors may be -// used to endorse or promote products derived from this software without -// specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// ======================================== -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// ======================================== -// -// This file is generated using generate_bundle_adjustment_tests.py. - -#include "ceres/internal/config.h" -#include "bundle_adjustment_test_util.h" - -#ifndef CERES_NO_CXSPARSE - -namespace ceres::internal { - -TEST_F(BundleAdjustmentTest, - IterativeSchur_CxSparse_ClusterTridiagonal_UserOrdering) { // NOLINT - BundleAdjustmentProblem bundle_adjustment_problem; - Solver::Options* options = bundle_adjustment_problem.mutable_solver_options(); - options->num_threads = 1; - options->linear_solver_type = ITERATIVE_SCHUR; - options->dense_linear_algebra_library_type = EIGEN; - options->sparse_linear_algebra_library_type = CX_SPARSE; - options->preconditioner_type = CLUSTER_TRIDIAGONAL; - if (kUserOrdering) { - options->linear_solver_ordering = nullptr; - } - Problem* problem = bundle_adjustment_problem.mutable_problem(); - RunSolverForConfigAndExpectResidualsMatch(*options, problem); -} - -} // namespace ceres::internal - -#endif // CERES_NO_CXSPARSE
diff --git a/internal/ceres/generated_bundle_adjustment_tests/ba_iterschur_cxsparse_clusttri_user_threads_test.cc b/internal/ceres/generated_bundle_adjustment_tests/ba_iterschur_cxsparse_clusttri_user_threads_test.cc deleted file mode 100644 index 1922835..0000000 --- a/internal/ceres/generated_bundle_adjustment_tests/ba_iterschur_cxsparse_clusttri_user_threads_test.cc +++ /dev/null
@@ -1,65 +0,0 @@ -// Ceres Solver - A fast non-linear least squares minimizer -// Copyright 2022 Google Inc. All rights reserved. -// http://ceres-solver.org/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither the name of Google Inc. nor the names of its contributors may be -// used to endorse or promote products derived from this software without -// specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// ======================================== -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// ======================================== -// -// This file is generated using generate_bundle_adjustment_tests.py. - -#include "ceres/internal/config.h" -#include "bundle_adjustment_test_util.h" - -#ifndef CERES_NO_CXSPARSE -#ifndef CERES_NO_THREADS - -namespace ceres::internal { - -TEST_F(BundleAdjustmentTest, - IterativeSchur_CxSparse_ClusterTridiagonal_UserOrdering_Threads) { // NOLINT - BundleAdjustmentProblem bundle_adjustment_problem; - Solver::Options* options = bundle_adjustment_problem.mutable_solver_options(); - options->num_threads = 4; - options->linear_solver_type = ITERATIVE_SCHUR; - options->dense_linear_algebra_library_type = EIGEN; - options->sparse_linear_algebra_library_type = CX_SPARSE; - options->preconditioner_type = CLUSTER_TRIDIAGONAL; - if (kUserOrdering) { - options->linear_solver_ordering = nullptr; - } - Problem* problem = bundle_adjustment_problem.mutable_problem(); - RunSolverForConfigAndExpectResidualsMatch(*options, problem); -} - -} // namespace ceres::internal - -#endif // CERES_NO_THREADS -#endif // CERES_NO_CXSPARSE
diff --git a/internal/ceres/generated_bundle_adjustment_tests/ba_sparsecholesky_cxsparse_auto_test.cc b/internal/ceres/generated_bundle_adjustment_tests/ba_sparsecholesky_cxsparse_auto_test.cc deleted file mode 100644 index 17b96296..0000000 --- a/internal/ceres/generated_bundle_adjustment_tests/ba_sparsecholesky_cxsparse_auto_test.cc +++ /dev/null
@@ -1,63 +0,0 @@ -// Ceres Solver - A fast non-linear least squares minimizer -// Copyright 2022 Google Inc. All rights reserved. -// http://ceres-solver.org/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither the name of Google Inc. nor the names of its contributors may be -// used to endorse or promote products derived from this software without -// specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// ======================================== -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// ======================================== -// -// This file is generated using generate_bundle_adjustment_tests.py. - -#include "ceres/internal/config.h" -#include "bundle_adjustment_test_util.h" - -#ifndef CERES_NO_CXSPARSE - -namespace ceres::internal { - -TEST_F(BundleAdjustmentTest, - SparseNormalCholesky_CxSparse_AutomaticOrdering) { // NOLINT - BundleAdjustmentProblem bundle_adjustment_problem; - Solver::Options* options = bundle_adjustment_problem.mutable_solver_options(); - options->num_threads = 1; - options->linear_solver_type = SPARSE_NORMAL_CHOLESKY; - options->dense_linear_algebra_library_type = EIGEN; - options->sparse_linear_algebra_library_type = CX_SPARSE; - options->preconditioner_type = IDENTITY; - if (kAutomaticOrdering) { - options->linear_solver_ordering = nullptr; - } - Problem* problem = bundle_adjustment_problem.mutable_problem(); - RunSolverForConfigAndExpectResidualsMatch(*options, problem); -} - -} // namespace ceres::internal - -#endif // CERES_NO_CXSPARSE
diff --git a/internal/ceres/generated_bundle_adjustment_tests/ba_sparsecholesky_cxsparse_auto_threads_test.cc b/internal/ceres/generated_bundle_adjustment_tests/ba_sparsecholesky_cxsparse_auto_threads_test.cc deleted file mode 100644 index bd454ac..0000000 --- a/internal/ceres/generated_bundle_adjustment_tests/ba_sparsecholesky_cxsparse_auto_threads_test.cc +++ /dev/null
@@ -1,65 +0,0 @@ -// Ceres Solver - A fast non-linear least squares minimizer -// Copyright 2022 Google Inc. All rights reserved. -// http://ceres-solver.org/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither the name of Google Inc. nor the names of its contributors may be -// used to endorse or promote products derived from this software without -// specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// ======================================== -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// ======================================== -// -// This file is generated using generate_bundle_adjustment_tests.py. - -#include "ceres/internal/config.h" -#include "bundle_adjustment_test_util.h" - -#ifndef CERES_NO_CXSPARSE -#ifndef CERES_NO_THREADS - -namespace ceres::internal { - -TEST_F(BundleAdjustmentTest, - SparseNormalCholesky_CxSparse_AutomaticOrdering_Threads) { // NOLINT - BundleAdjustmentProblem bundle_adjustment_problem; - Solver::Options* options = bundle_adjustment_problem.mutable_solver_options(); - options->num_threads = 4; - options->linear_solver_type = SPARSE_NORMAL_CHOLESKY; - options->dense_linear_algebra_library_type = EIGEN; - options->sparse_linear_algebra_library_type = CX_SPARSE; - options->preconditioner_type = IDENTITY; - if (kAutomaticOrdering) { - options->linear_solver_ordering = nullptr; - } - Problem* problem = bundle_adjustment_problem.mutable_problem(); - RunSolverForConfigAndExpectResidualsMatch(*options, problem); -} - -} // namespace ceres::internal - -#endif // CERES_NO_THREADS -#endif // CERES_NO_CXSPARSE
diff --git a/internal/ceres/generated_bundle_adjustment_tests/ba_sparsecholesky_cxsparse_user_test.cc b/internal/ceres/generated_bundle_adjustment_tests/ba_sparsecholesky_cxsparse_user_test.cc deleted file mode 100644 index f071f57..0000000 --- a/internal/ceres/generated_bundle_adjustment_tests/ba_sparsecholesky_cxsparse_user_test.cc +++ /dev/null
@@ -1,63 +0,0 @@ -// Ceres Solver - A fast non-linear least squares minimizer -// Copyright 2022 Google Inc. All rights reserved. -// http://ceres-solver.org/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither the name of Google Inc. nor the names of its contributors may be -// used to endorse or promote products derived from this software without -// specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// ======================================== -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// ======================================== -// -// This file is generated using generate_bundle_adjustment_tests.py. - -#include "ceres/internal/config.h" -#include "bundle_adjustment_test_util.h" - -#ifndef CERES_NO_CXSPARSE - -namespace ceres::internal { - -TEST_F(BundleAdjustmentTest, - SparseNormalCholesky_CxSparse_UserOrdering) { // NOLINT - BundleAdjustmentProblem bundle_adjustment_problem; - Solver::Options* options = bundle_adjustment_problem.mutable_solver_options(); - options->num_threads = 1; - options->linear_solver_type = SPARSE_NORMAL_CHOLESKY; - options->dense_linear_algebra_library_type = EIGEN; - options->sparse_linear_algebra_library_type = CX_SPARSE; - options->preconditioner_type = IDENTITY; - if (kUserOrdering) { - options->linear_solver_ordering = nullptr; - } - Problem* problem = bundle_adjustment_problem.mutable_problem(); - RunSolverForConfigAndExpectResidualsMatch(*options, problem); -} - -} // namespace ceres::internal - -#endif // CERES_NO_CXSPARSE
diff --git a/internal/ceres/generated_bundle_adjustment_tests/ba_sparsecholesky_cxsparse_user_threads_test.cc b/internal/ceres/generated_bundle_adjustment_tests/ba_sparsecholesky_cxsparse_user_threads_test.cc deleted file mode 100644 index 129247b..0000000 --- a/internal/ceres/generated_bundle_adjustment_tests/ba_sparsecholesky_cxsparse_user_threads_test.cc +++ /dev/null
@@ -1,65 +0,0 @@ -// Ceres Solver - A fast non-linear least squares minimizer -// Copyright 2022 Google Inc. All rights reserved. -// http://ceres-solver.org/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither the name of Google Inc. nor the names of its contributors may be -// used to endorse or promote products derived from this software without -// specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// ======================================== -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// ======================================== -// -// This file is generated using generate_bundle_adjustment_tests.py. - -#include "ceres/internal/config.h" -#include "bundle_adjustment_test_util.h" - -#ifndef CERES_NO_CXSPARSE -#ifndef CERES_NO_THREADS - -namespace ceres::internal { - -TEST_F(BundleAdjustmentTest, - SparseNormalCholesky_CxSparse_UserOrdering_Threads) { // NOLINT - BundleAdjustmentProblem bundle_adjustment_problem; - Solver::Options* options = bundle_adjustment_problem.mutable_solver_options(); - options->num_threads = 4; - options->linear_solver_type = SPARSE_NORMAL_CHOLESKY; - options->dense_linear_algebra_library_type = EIGEN; - options->sparse_linear_algebra_library_type = CX_SPARSE; - options->preconditioner_type = IDENTITY; - if (kUserOrdering) { - options->linear_solver_ordering = nullptr; - } - Problem* problem = bundle_adjustment_problem.mutable_problem(); - RunSolverForConfigAndExpectResidualsMatch(*options, problem); -} - -} // namespace ceres::internal - -#endif // CERES_NO_THREADS -#endif // CERES_NO_CXSPARSE
diff --git a/internal/ceres/generated_bundle_adjustment_tests/ba_sparseschur_cxsparse_auto_test.cc b/internal/ceres/generated_bundle_adjustment_tests/ba_sparseschur_cxsparse_auto_test.cc deleted file mode 100644 index 22bed0e..0000000 --- a/internal/ceres/generated_bundle_adjustment_tests/ba_sparseschur_cxsparse_auto_test.cc +++ /dev/null
@@ -1,63 +0,0 @@ -// Ceres Solver - A fast non-linear least squares minimizer -// Copyright 2022 Google Inc. All rights reserved. -// http://ceres-solver.org/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither the name of Google Inc. nor the names of its contributors may be -// used to endorse or promote products derived from this software without -// specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// ======================================== -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// ======================================== -// -// This file is generated using generate_bundle_adjustment_tests.py. - -#include "ceres/internal/config.h" -#include "bundle_adjustment_test_util.h" - -#ifndef CERES_NO_CXSPARSE - -namespace ceres::internal { - -TEST_F(BundleAdjustmentTest, - SparseSchur_CxSparse_AutomaticOrdering) { // NOLINT - BundleAdjustmentProblem bundle_adjustment_problem; - Solver::Options* options = bundle_adjustment_problem.mutable_solver_options(); - options->num_threads = 1; - options->linear_solver_type = SPARSE_SCHUR; - options->dense_linear_algebra_library_type = EIGEN; - options->sparse_linear_algebra_library_type = CX_SPARSE; - options->preconditioner_type = IDENTITY; - if (kAutomaticOrdering) { - options->linear_solver_ordering = nullptr; - } - Problem* problem = bundle_adjustment_problem.mutable_problem(); - RunSolverForConfigAndExpectResidualsMatch(*options, problem); -} - -} // namespace ceres::internal - -#endif // CERES_NO_CXSPARSE
diff --git a/internal/ceres/generated_bundle_adjustment_tests/ba_sparseschur_cxsparse_auto_threads_test.cc b/internal/ceres/generated_bundle_adjustment_tests/ba_sparseschur_cxsparse_auto_threads_test.cc deleted file mode 100644 index 53d06c6..0000000 --- a/internal/ceres/generated_bundle_adjustment_tests/ba_sparseschur_cxsparse_auto_threads_test.cc +++ /dev/null
@@ -1,65 +0,0 @@ -// Ceres Solver - A fast non-linear least squares minimizer -// Copyright 2022 Google Inc. All rights reserved. -// http://ceres-solver.org/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither the name of Google Inc. nor the names of its contributors may be -// used to endorse or promote products derived from this software without -// specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// ======================================== -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// ======================================== -// -// This file is generated using generate_bundle_adjustment_tests.py. - -#include "ceres/internal/config.h" -#include "bundle_adjustment_test_util.h" - -#ifndef CERES_NO_CXSPARSE -#ifndef CERES_NO_THREADS - -namespace ceres::internal { - -TEST_F(BundleAdjustmentTest, - SparseSchur_CxSparse_AutomaticOrdering_Threads) { // NOLINT - BundleAdjustmentProblem bundle_adjustment_problem; - Solver::Options* options = bundle_adjustment_problem.mutable_solver_options(); - options->num_threads = 4; - options->linear_solver_type = SPARSE_SCHUR; - options->dense_linear_algebra_library_type = EIGEN; - options->sparse_linear_algebra_library_type = CX_SPARSE; - options->preconditioner_type = IDENTITY; - if (kAutomaticOrdering) { - options->linear_solver_ordering = nullptr; - } - Problem* problem = bundle_adjustment_problem.mutable_problem(); - RunSolverForConfigAndExpectResidualsMatch(*options, problem); -} - -} // namespace ceres::internal - -#endif // CERES_NO_THREADS -#endif // CERES_NO_CXSPARSE
diff --git a/internal/ceres/generated_bundle_adjustment_tests/ba_sparseschur_cxsparse_user_test.cc b/internal/ceres/generated_bundle_adjustment_tests/ba_sparseschur_cxsparse_user_test.cc deleted file mode 100644 index 0f4d00a..0000000 --- a/internal/ceres/generated_bundle_adjustment_tests/ba_sparseschur_cxsparse_user_test.cc +++ /dev/null
@@ -1,63 +0,0 @@ -// Ceres Solver - A fast non-linear least squares minimizer -// Copyright 2022 Google Inc. All rights reserved. -// http://ceres-solver.org/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither the name of Google Inc. nor the names of its contributors may be -// used to endorse or promote products derived from this software without -// specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// ======================================== -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// ======================================== -// -// This file is generated using generate_bundle_adjustment_tests.py. - -#include "ceres/internal/config.h" -#include "bundle_adjustment_test_util.h" - -#ifndef CERES_NO_CXSPARSE - -namespace ceres::internal { - -TEST_F(BundleAdjustmentTest, - SparseSchur_CxSparse_UserOrdering) { // NOLINT - BundleAdjustmentProblem bundle_adjustment_problem; - Solver::Options* options = bundle_adjustment_problem.mutable_solver_options(); - options->num_threads = 1; - options->linear_solver_type = SPARSE_SCHUR; - options->dense_linear_algebra_library_type = EIGEN; - options->sparse_linear_algebra_library_type = CX_SPARSE; - options->preconditioner_type = IDENTITY; - if (kUserOrdering) { - options->linear_solver_ordering = nullptr; - } - Problem* problem = bundle_adjustment_problem.mutable_problem(); - RunSolverForConfigAndExpectResidualsMatch(*options, problem); -} - -} // namespace ceres::internal - -#endif // CERES_NO_CXSPARSE
diff --git a/internal/ceres/generated_bundle_adjustment_tests/ba_sparseschur_cxsparse_user_threads_test.cc b/internal/ceres/generated_bundle_adjustment_tests/ba_sparseschur_cxsparse_user_threads_test.cc deleted file mode 100644 index 49418c4..0000000 --- a/internal/ceres/generated_bundle_adjustment_tests/ba_sparseschur_cxsparse_user_threads_test.cc +++ /dev/null
@@ -1,65 +0,0 @@ -// Ceres Solver - A fast non-linear least squares minimizer -// Copyright 2022 Google Inc. All rights reserved. -// http://ceres-solver.org/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither the name of Google Inc. nor the names of its contributors may be -// used to endorse or promote products derived from this software without -// specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// ======================================== -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// ======================================== -// -// This file is generated using generate_bundle_adjustment_tests.py. - -#include "ceres/internal/config.h" -#include "bundle_adjustment_test_util.h" - -#ifndef CERES_NO_CXSPARSE -#ifndef CERES_NO_THREADS - -namespace ceres::internal { - -TEST_F(BundleAdjustmentTest, - SparseSchur_CxSparse_UserOrdering_Threads) { // NOLINT - BundleAdjustmentProblem bundle_adjustment_problem; - Solver::Options* options = bundle_adjustment_problem.mutable_solver_options(); - options->num_threads = 4; - options->linear_solver_type = SPARSE_SCHUR; - options->dense_linear_algebra_library_type = EIGEN; - options->sparse_linear_algebra_library_type = CX_SPARSE; - options->preconditioner_type = IDENTITY; - if (kUserOrdering) { - options->linear_solver_ordering = nullptr; - } - Problem* problem = bundle_adjustment_problem.mutable_problem(); - RunSolverForConfigAndExpectResidualsMatch(*options, problem); -} - -} // namespace ceres::internal - -#endif // CERES_NO_THREADS -#endif // CERES_NO_CXSPARSE
diff --git a/internal/ceres/reorder_program.cc b/internal/ceres/reorder_program.cc index b19a1b4..9f89c4b 100644 --- a/internal/ceres/reorder_program.cc +++ b/internal/ceres/reorder_program.cc
@@ -31,13 +31,11 @@ #include "ceres/reorder_program.h" #include <algorithm> -#include <iostream> // Need this because MetisSupport refers to std::cerr. #include <memory> #include <numeric> #include <vector> #include "Eigen/SparseCore" -#include "ceres/cxsparse.h" #include "ceres/internal/config.h" #include "ceres/internal/export.h" #include "ceres/ordered_groups.h" @@ -52,7 +50,13 @@ #include "ceres/types.h" #ifdef CERES_USE_EIGEN_SPARSE + +#ifndef CERES_NO_METIS +#include <iostream> // Need this because MetisSupport refers to std::cerr. + #include "Eigen/MetisSupport" +#endif + #include "Eigen/OrderingMethods" #endif @@ -158,36 +162,6 @@ #endif // CERES_NO_SUITESPARSE } -void OrderingForSparseNormalCholeskyUsingCXSparse( - const LinearSolverOrderingType linear_solver_ordering_type, - const TripletSparseMatrix& tsm_block_jacobian_transpose, - int* ordering) { -#ifdef CERES_NO_CXSPARSE - LOG(FATAL) << "Congratulations, you found a Ceres bug! " - << "Please report this error to the developers."; -#else - CHECK_NE(linear_solver_ordering_type, NESDIS) - << "Congratulations, you found a Ceres bug! " - << "Please report this error to the developers."; - - // CXSparse works with J'J instead of J'. So compute the block - // sparsity for J'J and compute an approximate minimum degree - // ordering. - CXSparse cxsparse; - cs_di* block_jacobian_transpose; - block_jacobian_transpose = cxsparse.CreateSparseMatrix( - const_cast<TripletSparseMatrix*>(&tsm_block_jacobian_transpose)); - cs_di* block_jacobian = cxsparse.TransposeMatrix(block_jacobian_transpose); - cs_di* block_hessian = - cxsparse.MatrixMatrixMultiply(block_jacobian_transpose, block_jacobian); - cxsparse.Free(block_jacobian); - cxsparse.Free(block_jacobian_transpose); - - cxsparse.ApproximateMinimumDegreeOrdering(block_hessian, ordering); - cxsparse.Free(block_hessian); -#endif // CERES_NO_CXSPARSE -} - void OrderingForSparseNormalCholeskyUsingEigenSparse( const LinearSolverOrderingType linear_solver_ordering_type, const TripletSparseMatrix& tsm_block_jacobian_transpose, @@ -218,10 +192,10 @@ amd_ordering(block_hessian, perm); } else { #ifndef CERES_NO_METIS - perm.setIdentity(block_hessian.rows()); -#else Eigen::MetisOrdering<int> metis_ordering; metis_ordering(block_hessian, perm); +#else + perm.setIdentity(block_hessian.rows()); #endif } @@ -427,10 +401,10 @@ amd_ordering(block_schur_complement, perm); } else { #ifndef CERES_NO_METIS - perm.setIdentity(block_schur_complement.rows()); -#else Eigen::MetisOrdering<int> metis_ordering; metis_ordering(block_schur_complement, perm); +#else + perm.setIdentity(block_schur_complement.rows()); #endif } @@ -578,10 +552,6 @@ parameter_blocks, parameter_block_ordering, &ordering[0]); - } else if (sparse_linear_algebra_library_type == CX_SPARSE) { - OrderingForSparseNormalCholeskyUsingCXSparse(linear_solver_ordering_type, - *tsm_block_jacobian_transpose, - &ordering[0]); } else if (sparse_linear_algebra_library_type == ACCELERATE_SPARSE) { // Accelerate does not provide a function to perform reordering without // performing a full symbolic factorisation. As such, we have nothing @@ -652,18 +622,6 @@ return false; } - if (sparse_linear_algebra_library_type == ceres::CX_SPARSE) { - if (linear_solver_ordering_type == ceres::NESDIS) { - return false; - } - - if (linear_solver_type == SPARSE_NORMAL_CHOLESKY || - (linear_solver_type == CGNR && preconditioner_type == SUBSET)) { - return true; - } - return false; - } - return false; }
diff --git a/internal/ceres/schur_complement_solver_test.cc b/internal/ceres/schur_complement_solver_test.cc index fe7a6b3..233a599 100644 --- a/internal/ceres/schur_complement_solver_test.cc +++ b/internal/ceres/schur_complement_solver_test.cc
@@ -233,24 +233,6 @@ #endif // CERES_NO_METIS #endif // CERES_NO_SUITESPARSE -#ifndef CERES_NO_CXSPARSE -// TODO(sameeragarwal): Extend these tests for NATURAL & NESDIS, once the linear -// solver supports it. -TEST_F(SchurComplementSolverTest, SparseSchurWithCXSparseSmallProblem) { - ComputeAndCompareSolutions( - 2, false, SPARSE_SCHUR, EIGEN, CX_SPARSE, OrderingType::AMD); - ComputeAndCompareSolutions( - 2, true, SPARSE_SCHUR, EIGEN, CX_SPARSE, OrderingType::AMD); -} - -TEST_F(SchurComplementSolverTest, SparseSchurWithCXSparseLargeProblem) { - ComputeAndCompareSolutions( - 3, false, SPARSE_SCHUR, EIGEN, CX_SPARSE, OrderingType::AMD); - ComputeAndCompareSolutions( - 3, true, SPARSE_SCHUR, EIGEN, CX_SPARSE, OrderingType::AMD); -} -#endif // CERES_NO_CXSPARSE - #ifndef CERES_NO_ACCELERATE_SPARSE TEST_F(SchurComplementSolverTest, SparseSchurWithAccelerateSparseSmallProblemAMD) {
diff --git a/internal/ceres/solver_utils.cc b/internal/ceres/solver_utils.cc index d1bac1a..56bad63 100644 --- a/internal/ceres/solver_utils.cc +++ b/internal/ceres/solver_utils.cc
@@ -63,10 +63,6 @@ value += "-suitesparse-(" + std::string(CERES_SUITESPARSE_VERSION) + ")"; #endif -#ifndef CERES_NO_CXSPARSE - value += "-cxsparse-(" + std::string(CERES_CXSPARSE_VERSION) + ")"; -#endif - #ifndef CERES_NO_ACCELERATE_SPARSE value += "-acceleratesparse"; #endif
diff --git a/internal/ceres/sparse_cholesky.cc b/internal/ceres/sparse_cholesky.cc index c68b833..fe7412c 100644 --- a/internal/ceres/sparse_cholesky.cc +++ b/internal/ceres/sparse_cholesky.cc
@@ -33,9 +33,7 @@ #include <memory> #include "ceres/accelerate_sparse.h" -#include "ceres/cxsparse.h" #include "ceres/eigensparse.h" -#include "ceres/float_cxsparse.h" #include "ceres/float_suitesparse.h" #include "ceres/iterative_refiner.h" #include "ceres/suitesparse.h" @@ -74,18 +72,6 @@ << "Eigen's sparse Cholesky factorization routines."; #endif - case CX_SPARSE: -#ifndef CERES_NO_CXSPARSE - if (options.use_mixed_precision_solves) { - sparse_cholesky = FloatCXSparseCholesky::Create(options.ordering_type); - } else { - sparse_cholesky = CXSparseCholesky::Create(options.ordering_type); - } - break; -#else - LOG(FATAL) << "Ceres was compiled without support for CXSparse."; -#endif - case ACCELERATE_SPARSE: #ifndef CERES_NO_ACCELERATE_SPARSE if (options.use_mixed_precision_solves) {
diff --git a/internal/ceres/sparse_cholesky_test.cc b/internal/ceres/sparse_cholesky_test.cc index bc728e7..785f2e9 100644 --- a/internal/ceres/sparse_cholesky_test.cc +++ b/internal/ceres/sparse_cholesky_test.cc
@@ -202,17 +202,6 @@ ParamInfoToString); #endif -#ifndef CERES_NO_CXSPARSE -INSTANTIATE_TEST_SUITE_P( - CXSparseCholesky, - SparseCholeskyTest, - ::testing::Combine(::testing::Values(CX_SPARSE), - ::testing::Values(OrderingType::AMD, - OrderingType::NATURAL), - ::testing::Values(true, false)), - ParamInfoToString); -#endif - #ifndef CERES_NO_ACCELERATE_SPARSE INSTANTIATE_TEST_SUITE_P( AccelerateSparseCholesky,
diff --git a/internal/ceres/sparse_normal_cholesky_solver_test.cc b/internal/ceres/sparse_normal_cholesky_solver_test.cc index 39d9d82..b7d4a39 100644 --- a/internal/ceres/sparse_normal_cholesky_solver_test.cc +++ b/internal/ceres/sparse_normal_cholesky_solver_test.cc
@@ -129,30 +129,6 @@ } #endif -#ifndef CERES_NO_CXSPARSE -TEST_F(SparseNormalCholeskySolverTest, - SparseNormalCholeskyUsingCXSparsePreOrdering) { - LinearSolver::Options options; - options.sparse_linear_algebra_library_type = CX_SPARSE; - options.type = SPARSE_NORMAL_CHOLESKY; - options.ordering_type = OrderingType::NATURAL; - ContextImpl context; - options.context = &context; - TestSolver(options); -} - -TEST_F(SparseNormalCholeskySolverTest, - SparseNormalCholeskyUsingCXSparsePostOrdering) { - LinearSolver::Options options; - options.sparse_linear_algebra_library_type = CX_SPARSE; - options.type = SPARSE_NORMAL_CHOLESKY; - options.ordering_type = OrderingType::AMD; - ContextImpl context; - options.context = &context; - TestSolver(options); -} -#endif - #ifndef CERES_NO_ACCELERATE_SPARSE TEST_F(SparseNormalCholeskySolverTest, SparseNormalCholeskyUsingAccelerateSparsePreOrdering) {
diff --git a/internal/ceres/subset_preconditioner_test.cc b/internal/ceres/subset_preconditioner_test.cc index 0596bc7..2f5e044 100644 --- a/internal/ceres/subset_preconditioner_test.cc +++ b/internal/ceres/subset_preconditioner_test.cc
@@ -181,14 +181,6 @@ ParamInfoToString); #endif -#ifndef CERES_NO_CXSPARSE -INSTANTIATE_TEST_SUITE_P(SubsetPreconditionerWithCXSparse, - SubsetPreconditionerTest, - ::testing::Combine(::testing::Values(CX_SPARSE), - ::testing::Values(true, false)), - ParamInfoToString); -#endif - #ifndef CERES_NO_ACCELERATE_SPARSE INSTANTIATE_TEST_SUITE_P( SubsetPreconditionerWithAccelerateSparse,
diff --git a/internal/ceres/system_test.cc b/internal/ceres/system_test.cc index 89be241..6978d9b 100644 --- a/internal/ceres/system_test.cc +++ b/internal/ceres/system_test.cc
@@ -186,17 +186,6 @@ } #endif // CERES_NO_SUITESPARSE -#ifndef CERES_NO_CXSPARSE -TEST_F(PowellTest, SparseNormalCholeskyUsingCXSparse) { - PowellsFunction powells_function; - Solver::Options* options = powells_function.mutable_solver_options(); - options->linear_solver_type = SPARSE_NORMAL_CHOLESKY; - options->sparse_linear_algebra_library_type = CX_SPARSE; - RunSolverForConfigAndExpectResidualsMatch(*options, - powells_function.mutable_problem()); -} -#endif // CERES_NO_CXSPARSE - #ifndef CERES_NO_ACCELERATE_SPARSE TEST_F(PowellTest, SparseNormalCholeskyUsingAccelerateSparse) { PowellsFunction powells_function;
diff --git a/internal/ceres/types.cc b/internal/ceres/types.cc index eea0312..5d1bcea 100644 --- a/internal/ceres/types.cc +++ b/internal/ceres/types.cc
@@ -104,7 +104,6 @@ SparseLinearAlgebraLibraryType type) { switch (type) { CASESTR(SUITE_SPARSE); - CASESTR(CX_SPARSE); CASESTR(EIGEN_SPARSE); CASESTR(ACCELERATE_SPARSE); CASESTR(NO_SPARSE); @@ -117,7 +116,6 @@ string value, SparseLinearAlgebraLibraryType* type) { UpperCase(&value); STRENUM(SUITE_SPARSE); - STRENUM(CX_SPARSE); STRENUM(EIGEN_SPARSE); STRENUM(ACCELERATE_SPARSE); STRENUM(NO_SPARSE); @@ -404,14 +402,6 @@ #endif } - if (type == CX_SPARSE) { -#ifdef CERES_NO_CXSPARSE - return false; -#else - return true; -#endif - } - if (type == ACCELERATE_SPARSE) { #ifdef CERES_NO_ACCELERATE_SPARSE return false;