| Sameer Agarwal | d76da16 | 2014-09-07 18:42:49 -0700 | [diff] [blame] | 1 | // Ceres Solver - A fast non-linear least squares minimizer |
| Sameer Agarwal | 5a30cae | 2023-09-19 15:29:34 -0700 | [diff] [blame] | 2 | // Copyright 2023 Google Inc. All rights reserved. |
| Keir Mierle | 7492b0d | 2015-03-17 22:30:16 -0700 | [diff] [blame] | 3 | // http://ceres-solver.org/ |
| Sameer Agarwal | d76da16 | 2014-09-07 18:42:49 -0700 | [diff] [blame] | 4 | // |
| 5 | // Redistribution and use in source and binary forms, with or without |
| 6 | // modification, are permitted provided that the following conditions are met: |
| 7 | // |
| 8 | // * Redistributions of source code must retain the above copyright notice, |
| 9 | // this list of conditions and the following disclaimer. |
| 10 | // * Redistributions in binary form must reproduce the above copyright notice, |
| 11 | // this list of conditions and the following disclaimer in the documentation |
| 12 | // and/or other materials provided with the distribution. |
| 13 | // * Neither the name of Google Inc. nor the names of its contributors may be |
| 14 | // used to endorse or promote products derived from this software without |
| 15 | // specific prior written permission. |
| 16 | // |
| 17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 18 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 19 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 20 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
| 21 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 22 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 23 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 24 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 25 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 26 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 27 | // POSSIBILITY OF SUCH DAMAGE. |
| 28 | // |
| 29 | // Author: sameeragarwal@google.com (Sameer Agarwal) |
| 30 | |
| Nikolaus Demmel | 7b8f675 | 2020-09-20 21:45:24 +0200 | [diff] [blame] | 31 | #include "ceres/solver_utils.h" |
| 32 | |
| Sameer Agarwal | 10cbe85 | 2015-04-05 23:35:04 -0700 | [diff] [blame] | 33 | #include "Eigen/Core" |
| Nikolaus Demmel | 7b8f675 | 2020-09-20 21:45:24 +0200 | [diff] [blame] | 34 | #include "ceres/internal/config.h" |
| Sergiu Deitsch | f90833f | 2022-02-07 23:43:19 +0100 | [diff] [blame] | 35 | #include "ceres/internal/export.h" |
| Sameer Agarwal | d76da16 | 2014-09-07 18:42:49 -0700 | [diff] [blame] | 36 | #include "ceres/version.h" |
| Joydeep Biswas | 36d6d86 | 2022-02-03 08:09:10 -0600 | [diff] [blame] | 37 | #ifndef CERES_NO_CUDA |
| 38 | #include "cuda_runtime.h" |
| Mark Shachkov | 6fb3dae | 2024-05-01 11:00:58 +0200 | [diff] [blame] | 39 | #ifndef CERES_NO_CUDSS |
| 40 | #include "cudss.h" |
| 41 | #endif // CERES_NO_CUDSS |
| Joydeep Biswas | 36d6d86 | 2022-02-03 08:09:10 -0600 | [diff] [blame] | 42 | #endif // CERES_NO_CUDA |
| Sameer Agarwal | d76da16 | 2014-09-07 18:42:49 -0700 | [diff] [blame] | 43 | |
| Sameer Agarwal | caf614a | 2022-04-21 17:41:10 -0700 | [diff] [blame] | 44 | namespace ceres::internal { |
| Sameer Agarwal | d76da16 | 2014-09-07 18:42:49 -0700 | [diff] [blame] | 45 | |
| Sergiu Deitsch | 786866d | 2022-05-28 01:07:49 +0200 | [diff] [blame] | 46 | constexpr char kVersion[] = |
| 47 | // clang-format off |
| Mark Shachkov | 522210a | 2024-05-07 01:47:41 +0200 | [diff] [blame] | 48 | CERES_VERSION_STRING "-eigen-(" |
| 49 | CERES_SEMVER_VERSION(EIGEN_WORLD_VERSION, |
| 50 | EIGEN_MAJOR_VERSION, |
| 51 | EIGEN_MINOR_VERSION) ")" |
| Alex Stewart | 857c18a | 2015-04-05 14:25:25 +0100 | [diff] [blame] | 52 | |
| Sameer Agarwal | d76da16 | 2014-09-07 18:42:49 -0700 | [diff] [blame] | 53 | #ifdef CERES_NO_LAPACK |
| Sergiu Deitsch | 786866d | 2022-05-28 01:07:49 +0200 | [diff] [blame] | 54 | "-no_lapack" |
| Sameer Agarwal | d76da16 | 2014-09-07 18:42:49 -0700 | [diff] [blame] | 55 | #else |
| Sergiu Deitsch | 786866d | 2022-05-28 01:07:49 +0200 | [diff] [blame] | 56 | "-lapack" |
| Sameer Agarwal | d76da16 | 2014-09-07 18:42:49 -0700 | [diff] [blame] | 57 | #endif |
| 58 | |
| 59 | #ifndef CERES_NO_SUITESPARSE |
| Sergiu Deitsch | 786866d | 2022-05-28 01:07:49 +0200 | [diff] [blame] | 60 | "-suitesparse-(" CERES_SUITESPARSE_VERSION ")" |
| Sameer Agarwal | d76da16 | 2014-09-07 18:42:49 -0700 | [diff] [blame] | 61 | #endif |
| 62 | |
| Alex Stewart | 5de77f3 | 2022-06-22 19:20:40 +0100 | [diff] [blame] | 63 | #if !defined(CERES_NO_EIGEN_METIS) || !defined(CERES_NO_CHOLMOD_PARTITION) |
| Sergiu Deitsch | 0c88301 | 2022-05-15 22:26:18 +0200 | [diff] [blame] | 64 | "-metis-(" CERES_METIS_VERSION ")" |
| 65 | #endif |
| Sergiu Deitsch | 786866d | 2022-05-28 01:07:49 +0200 | [diff] [blame] | 66 | |
| Alex Stewart | 8f41ca6 | 2018-06-23 20:17:34 +0100 | [diff] [blame] | 67 | #ifndef CERES_NO_ACCELERATE_SPARSE |
| Sergiu Deitsch | 786866d | 2022-05-28 01:07:49 +0200 | [diff] [blame] | 68 | "-acceleratesparse" |
| Alex Stewart | 8f41ca6 | 2018-06-23 20:17:34 +0100 | [diff] [blame] | 69 | #endif |
| 70 | |
| Sameer Agarwal | d76da16 | 2014-09-07 18:42:49 -0700 | [diff] [blame] | 71 | #ifdef CERES_USE_EIGEN_SPARSE |
| Sergiu Deitsch | 786866d | 2022-05-28 01:07:49 +0200 | [diff] [blame] | 72 | "-eigensparse" |
| Sameer Agarwal | d76da16 | 2014-09-07 18:42:49 -0700 | [diff] [blame] | 73 | #endif |
| 74 | |
| 75 | #ifdef CERES_RESTRUCT_SCHUR_SPECIALIZATIONS |
| Sergiu Deitsch | 786866d | 2022-05-28 01:07:49 +0200 | [diff] [blame] | 76 | "-no_schur_specializations" |
| Sameer Agarwal | d76da16 | 2014-09-07 18:42:49 -0700 | [diff] [blame] | 77 | #endif |
| 78 | |
| Sameer Agarwal | d76da16 | 2014-09-07 18:42:49 -0700 | [diff] [blame] | 79 | #ifdef CERES_NO_CUSTOM_BLAS |
| Sergiu Deitsch | 786866d | 2022-05-28 01:07:49 +0200 | [diff] [blame] | 80 | "-no_custom_blas" |
| Sameer Agarwal | d76da16 | 2014-09-07 18:42:49 -0700 | [diff] [blame] | 81 | #endif |
| 82 | |
| Joydeep Biswas | 36d6d86 | 2022-02-03 08:09:10 -0600 | [diff] [blame] | 83 | #ifndef CERES_NO_CUDA |
| Sergiu Deitsch | 786866d | 2022-05-28 01:07:49 +0200 | [diff] [blame] | 84 | "-cuda-(" CERES_TO_STRING(CUDART_VERSION) ")" |
| Mark Shachkov | 6fb3dae | 2024-05-01 11:00:58 +0200 | [diff] [blame] | 85 | #ifndef CERES_NO_CUDSS |
| 86 | "-cudss-(" CERES_SEMVER_VERSION(CUDSS_VERSION_MAJOR, |
| 87 | CUDSS_VERSION_MINOR, |
| 88 | CUDSS_VERSION_PATCH) ")" |
| 89 | #endif // CERES_NO_CUDSS |
| Joydeep Biswas | 36d6d86 | 2022-02-03 08:09:10 -0600 | [diff] [blame] | 90 | #endif |
| Sergiu Deitsch | 786866d | 2022-05-28 01:07:49 +0200 | [diff] [blame] | 91 | ; |
| 92 | // clang-format on |
| Joydeep Biswas | 36d6d86 | 2022-02-03 08:09:10 -0600 | [diff] [blame] | 93 | |
| Sameer Agarwal | 4aa57d8 | 2024-08-09 17:02:53 -0700 | [diff] [blame] | 94 | std::string VersionString() { return kVersion; } |
| Sameer Agarwal | d76da16 | 2014-09-07 18:42:49 -0700 | [diff] [blame] | 95 | |
| Sameer Agarwal | caf614a | 2022-04-21 17:41:10 -0700 | [diff] [blame] | 96 | } // namespace ceres::internal |