Austin Schuh | 70cc955 | 2019-01-21 19:46:48 -0800 | [diff] [blame] | 1 | // Ceres Solver - A fast non-linear least squares minimizer |
Austin Schuh | 3de38b0 | 2024-06-25 18:25:10 -0700 | [diff] [blame^] | 2 | // Copyright 2023 Google Inc. All rights reserved. |
Austin Schuh | 70cc955 | 2019-01-21 19:46:48 -0800 | [diff] [blame] | 3 | // http://ceres-solver.org/ |
| 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 | // |
| 31 | // Template specialization of PartitionedMatrixView. |
| 32 | // |
| 33 | // ======================================== |
| 34 | // THIS FILE IS AUTOGENERATED. DO NOT EDIT. |
| 35 | // THIS FILE IS AUTOGENERATED. DO NOT EDIT. |
| 36 | // THIS FILE IS AUTOGENERATED. DO NOT EDIT. |
| 37 | // THIS FILE IS AUTOGENERATED. DO NOT EDIT. |
| 38 | //========================================= |
| 39 | // |
| 40 | // This file is generated using generate_template_specializations.py. |
| 41 | |
Austin Schuh | 3de38b0 | 2024-06-25 18:25:10 -0700 | [diff] [blame^] | 42 | #include <memory> |
| 43 | |
Austin Schuh | 70cc955 | 2019-01-21 19:46:48 -0800 | [diff] [blame] | 44 | #include "ceres/linear_solver.h" |
| 45 | #include "ceres/partitioned_matrix_view.h" |
Austin Schuh | 70cc955 | 2019-01-21 19:46:48 -0800 | [diff] [blame] | 46 | |
Austin Schuh | 3de38b0 | 2024-06-25 18:25:10 -0700 | [diff] [blame^] | 47 | namespace ceres::internal { |
Austin Schuh | 70cc955 | 2019-01-21 19:46:48 -0800 | [diff] [blame] | 48 | |
Austin Schuh | 3de38b0 | 2024-06-25 18:25:10 -0700 | [diff] [blame^] | 49 | PartitionedMatrixViewBase::~PartitionedMatrixViewBase() = default; |
| 50 | |
| 51 | std::unique_ptr<PartitionedMatrixViewBase> PartitionedMatrixViewBase::Create( |
Austin Schuh | 1d1e6ea | 2020-12-23 21:56:30 -0800 | [diff] [blame] | 52 | const LinearSolver::Options& options, const BlockSparseMatrix& matrix) { |
Austin Schuh | 70cc955 | 2019-01-21 19:46:48 -0800 | [diff] [blame] | 53 | #ifndef CERES_RESTRICT_SCHUR_SPECIALIZATION |
Austin Schuh | 1d1e6ea | 2020-12-23 21:56:30 -0800 | [diff] [blame] | 54 | if ((options.row_block_size == 2) && |
Austin Schuh | 70cc955 | 2019-01-21 19:46:48 -0800 | [diff] [blame] | 55 | (options.e_block_size == 2) && |
| 56 | (options.f_block_size == 2)) { |
Austin Schuh | 3de38b0 | 2024-06-25 18:25:10 -0700 | [diff] [blame^] | 57 | return std::make_unique<PartitionedMatrixView<2,2, 2>>( |
| 58 | options, matrix); |
Austin Schuh | 1d1e6ea | 2020-12-23 21:56:30 -0800 | [diff] [blame] | 59 | } |
| 60 | if ((options.row_block_size == 2) && |
Austin Schuh | 70cc955 | 2019-01-21 19:46:48 -0800 | [diff] [blame] | 61 | (options.e_block_size == 2) && |
| 62 | (options.f_block_size == 3)) { |
Austin Schuh | 3de38b0 | 2024-06-25 18:25:10 -0700 | [diff] [blame^] | 63 | return std::make_unique<PartitionedMatrixView<2,2, 3>>( |
| 64 | options, matrix); |
Austin Schuh | 1d1e6ea | 2020-12-23 21:56:30 -0800 | [diff] [blame] | 65 | } |
| 66 | if ((options.row_block_size == 2) && |
Austin Schuh | 70cc955 | 2019-01-21 19:46:48 -0800 | [diff] [blame] | 67 | (options.e_block_size == 2) && |
| 68 | (options.f_block_size == 4)) { |
Austin Schuh | 3de38b0 | 2024-06-25 18:25:10 -0700 | [diff] [blame^] | 69 | return std::make_unique<PartitionedMatrixView<2,2, 4>>( |
| 70 | options, matrix); |
Austin Schuh | 1d1e6ea | 2020-12-23 21:56:30 -0800 | [diff] [blame] | 71 | } |
| 72 | if ((options.row_block_size == 2) && |
Austin Schuh | 70cc955 | 2019-01-21 19:46:48 -0800 | [diff] [blame] | 73 | (options.e_block_size == 2)) { |
Austin Schuh | 3de38b0 | 2024-06-25 18:25:10 -0700 | [diff] [blame^] | 74 | return std::make_unique<PartitionedMatrixView<2,2, Eigen::Dynamic>>( |
| 75 | options, matrix); |
Austin Schuh | 1d1e6ea | 2020-12-23 21:56:30 -0800 | [diff] [blame] | 76 | } |
| 77 | if ((options.row_block_size == 2) && |
Austin Schuh | 70cc955 | 2019-01-21 19:46:48 -0800 | [diff] [blame] | 78 | (options.e_block_size == 3) && |
| 79 | (options.f_block_size == 3)) { |
Austin Schuh | 3de38b0 | 2024-06-25 18:25:10 -0700 | [diff] [blame^] | 80 | return std::make_unique<PartitionedMatrixView<2,3, 3>>( |
| 81 | options, matrix); |
Austin Schuh | 1d1e6ea | 2020-12-23 21:56:30 -0800 | [diff] [blame] | 82 | } |
| 83 | if ((options.row_block_size == 2) && |
Austin Schuh | 70cc955 | 2019-01-21 19:46:48 -0800 | [diff] [blame] | 84 | (options.e_block_size == 3) && |
| 85 | (options.f_block_size == 4)) { |
Austin Schuh | 3de38b0 | 2024-06-25 18:25:10 -0700 | [diff] [blame^] | 86 | return std::make_unique<PartitionedMatrixView<2,3, 4>>( |
| 87 | options, matrix); |
Austin Schuh | 1d1e6ea | 2020-12-23 21:56:30 -0800 | [diff] [blame] | 88 | } |
| 89 | if ((options.row_block_size == 2) && |
Austin Schuh | 70cc955 | 2019-01-21 19:46:48 -0800 | [diff] [blame] | 90 | (options.e_block_size == 3) && |
| 91 | (options.f_block_size == 6)) { |
Austin Schuh | 3de38b0 | 2024-06-25 18:25:10 -0700 | [diff] [blame^] | 92 | return std::make_unique<PartitionedMatrixView<2,3, 6>>( |
| 93 | options, matrix); |
Austin Schuh | 1d1e6ea | 2020-12-23 21:56:30 -0800 | [diff] [blame] | 94 | } |
| 95 | if ((options.row_block_size == 2) && |
Austin Schuh | 70cc955 | 2019-01-21 19:46:48 -0800 | [diff] [blame] | 96 | (options.e_block_size == 3) && |
| 97 | (options.f_block_size == 9)) { |
Austin Schuh | 3de38b0 | 2024-06-25 18:25:10 -0700 | [diff] [blame^] | 98 | return std::make_unique<PartitionedMatrixView<2,3, 9>>( |
| 99 | options, matrix); |
Austin Schuh | 1d1e6ea | 2020-12-23 21:56:30 -0800 | [diff] [blame] | 100 | } |
| 101 | if ((options.row_block_size == 2) && |
Austin Schuh | 70cc955 | 2019-01-21 19:46:48 -0800 | [diff] [blame] | 102 | (options.e_block_size == 3)) { |
Austin Schuh | 3de38b0 | 2024-06-25 18:25:10 -0700 | [diff] [blame^] | 103 | return std::make_unique<PartitionedMatrixView<2,3, Eigen::Dynamic>>( |
| 104 | options, matrix); |
Austin Schuh | 1d1e6ea | 2020-12-23 21:56:30 -0800 | [diff] [blame] | 105 | } |
| 106 | if ((options.row_block_size == 2) && |
Austin Schuh | 70cc955 | 2019-01-21 19:46:48 -0800 | [diff] [blame] | 107 | (options.e_block_size == 4) && |
| 108 | (options.f_block_size == 3)) { |
Austin Schuh | 3de38b0 | 2024-06-25 18:25:10 -0700 | [diff] [blame^] | 109 | return std::make_unique<PartitionedMatrixView<2,4, 3>>( |
| 110 | options, matrix); |
Austin Schuh | 1d1e6ea | 2020-12-23 21:56:30 -0800 | [diff] [blame] | 111 | } |
| 112 | if ((options.row_block_size == 2) && |
Austin Schuh | 70cc955 | 2019-01-21 19:46:48 -0800 | [diff] [blame] | 113 | (options.e_block_size == 4) && |
| 114 | (options.f_block_size == 4)) { |
Austin Schuh | 3de38b0 | 2024-06-25 18:25:10 -0700 | [diff] [blame^] | 115 | return std::make_unique<PartitionedMatrixView<2,4, 4>>( |
| 116 | options, matrix); |
Austin Schuh | 1d1e6ea | 2020-12-23 21:56:30 -0800 | [diff] [blame] | 117 | } |
| 118 | if ((options.row_block_size == 2) && |
Austin Schuh | 70cc955 | 2019-01-21 19:46:48 -0800 | [diff] [blame] | 119 | (options.e_block_size == 4) && |
| 120 | (options.f_block_size == 6)) { |
Austin Schuh | 3de38b0 | 2024-06-25 18:25:10 -0700 | [diff] [blame^] | 121 | return std::make_unique<PartitionedMatrixView<2,4, 6>>( |
| 122 | options, matrix); |
Austin Schuh | 1d1e6ea | 2020-12-23 21:56:30 -0800 | [diff] [blame] | 123 | } |
| 124 | if ((options.row_block_size == 2) && |
Austin Schuh | 70cc955 | 2019-01-21 19:46:48 -0800 | [diff] [blame] | 125 | (options.e_block_size == 4) && |
| 126 | (options.f_block_size == 8)) { |
Austin Schuh | 3de38b0 | 2024-06-25 18:25:10 -0700 | [diff] [blame^] | 127 | return std::make_unique<PartitionedMatrixView<2,4, 8>>( |
| 128 | options, matrix); |
Austin Schuh | 1d1e6ea | 2020-12-23 21:56:30 -0800 | [diff] [blame] | 129 | } |
| 130 | if ((options.row_block_size == 2) && |
Austin Schuh | 70cc955 | 2019-01-21 19:46:48 -0800 | [diff] [blame] | 131 | (options.e_block_size == 4) && |
| 132 | (options.f_block_size == 9)) { |
Austin Schuh | 3de38b0 | 2024-06-25 18:25:10 -0700 | [diff] [blame^] | 133 | return std::make_unique<PartitionedMatrixView<2,4, 9>>( |
| 134 | options, matrix); |
Austin Schuh | 1d1e6ea | 2020-12-23 21:56:30 -0800 | [diff] [blame] | 135 | } |
| 136 | if ((options.row_block_size == 2) && |
Austin Schuh | 70cc955 | 2019-01-21 19:46:48 -0800 | [diff] [blame] | 137 | (options.e_block_size == 4)) { |
Austin Schuh | 3de38b0 | 2024-06-25 18:25:10 -0700 | [diff] [blame^] | 138 | return std::make_unique<PartitionedMatrixView<2,4, Eigen::Dynamic>>( |
| 139 | options, matrix); |
Austin Schuh | 1d1e6ea | 2020-12-23 21:56:30 -0800 | [diff] [blame] | 140 | } |
| 141 | if (options.row_block_size == 2) { |
Austin Schuh | 3de38b0 | 2024-06-25 18:25:10 -0700 | [diff] [blame^] | 142 | return std::make_unique<PartitionedMatrixView<2,Eigen::Dynamic, Eigen::Dynamic>>( |
| 143 | options, matrix); |
Austin Schuh | 1d1e6ea | 2020-12-23 21:56:30 -0800 | [diff] [blame] | 144 | } |
| 145 | if ((options.row_block_size == 3) && |
| 146 | (options.e_block_size == 3) && |
| 147 | (options.f_block_size == 3)) { |
Austin Schuh | 3de38b0 | 2024-06-25 18:25:10 -0700 | [diff] [blame^] | 148 | return std::make_unique<PartitionedMatrixView<3,3, 3>>( |
| 149 | options, matrix); |
Austin Schuh | 1d1e6ea | 2020-12-23 21:56:30 -0800 | [diff] [blame] | 150 | } |
| 151 | if ((options.row_block_size == 4) && |
Austin Schuh | 70cc955 | 2019-01-21 19:46:48 -0800 | [diff] [blame] | 152 | (options.e_block_size == 4) && |
| 153 | (options.f_block_size == 2)) { |
Austin Schuh | 3de38b0 | 2024-06-25 18:25:10 -0700 | [diff] [blame^] | 154 | return std::make_unique<PartitionedMatrixView<4,4, 2>>( |
| 155 | options, matrix); |
Austin Schuh | 1d1e6ea | 2020-12-23 21:56:30 -0800 | [diff] [blame] | 156 | } |
| 157 | if ((options.row_block_size == 4) && |
Austin Schuh | 70cc955 | 2019-01-21 19:46:48 -0800 | [diff] [blame] | 158 | (options.e_block_size == 4) && |
| 159 | (options.f_block_size == 3)) { |
Austin Schuh | 3de38b0 | 2024-06-25 18:25:10 -0700 | [diff] [blame^] | 160 | return std::make_unique<PartitionedMatrixView<4,4, 3>>( |
| 161 | options, matrix); |
Austin Schuh | 1d1e6ea | 2020-12-23 21:56:30 -0800 | [diff] [blame] | 162 | } |
| 163 | if ((options.row_block_size == 4) && |
Austin Schuh | 70cc955 | 2019-01-21 19:46:48 -0800 | [diff] [blame] | 164 | (options.e_block_size == 4) && |
| 165 | (options.f_block_size == 4)) { |
Austin Schuh | 3de38b0 | 2024-06-25 18:25:10 -0700 | [diff] [blame^] | 166 | return std::make_unique<PartitionedMatrixView<4,4, 4>>( |
| 167 | options, matrix); |
Austin Schuh | 1d1e6ea | 2020-12-23 21:56:30 -0800 | [diff] [blame] | 168 | } |
| 169 | if ((options.row_block_size == 4) && |
Austin Schuh | 70cc955 | 2019-01-21 19:46:48 -0800 | [diff] [blame] | 170 | (options.e_block_size == 4)) { |
Austin Schuh | 3de38b0 | 2024-06-25 18:25:10 -0700 | [diff] [blame^] | 171 | return std::make_unique<PartitionedMatrixView<4,4, Eigen::Dynamic>>( |
| 172 | options, matrix); |
Austin Schuh | 1d1e6ea | 2020-12-23 21:56:30 -0800 | [diff] [blame] | 173 | } |
Austin Schuh | 70cc955 | 2019-01-21 19:46:48 -0800 | [diff] [blame] | 174 | |
| 175 | #endif |
| 176 | VLOG(1) << "Template specializations not found for <" |
Austin Schuh | 1d1e6ea | 2020-12-23 21:56:30 -0800 | [diff] [blame] | 177 | << options.row_block_size << "," << options.e_block_size << "," |
Austin Schuh | 70cc955 | 2019-01-21 19:46:48 -0800 | [diff] [blame] | 178 | << options.f_block_size << ">"; |
Austin Schuh | 3de38b0 | 2024-06-25 18:25:10 -0700 | [diff] [blame^] | 179 | return std::make_unique<PartitionedMatrixView<Eigen::Dynamic, |
| 180 | Eigen::Dynamic, |
| 181 | Eigen::Dynamic>>( |
| 182 | options, matrix); |
Austin Schuh | 70cc955 | 2019-01-21 19:46:48 -0800 | [diff] [blame] | 183 | }; |
| 184 | |
Austin Schuh | 3de38b0 | 2024-06-25 18:25:10 -0700 | [diff] [blame^] | 185 | } // namespace ceres::internal |