1 // Ceres Solver - A fast non-linear least squares minimizer
2 // Copyright 2017 Google Inc. All rights reserved.
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 SchurEliminator.
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 
42 #include "ceres/linear_solver.h"
43 #include "ceres/schur_eliminator.h"
44 #include "ceres/internal/eigen.h"
45 
46 namespace ceres {
47 namespace internal {
48 
49 SchurEliminatorBase*
Create(const LinearSolver::Options & options)50 SchurEliminatorBase::Create(const LinearSolver::Options& options) {
51 #ifndef CERES_RESTRICT_SCHUR_SPECIALIZATION
52  if ((options.row_block_size == 2) &&
53      (options.e_block_size == 2) &&
54      (options.f_block_size == 2)) {
55    return new SchurEliminator<2, 2, 2>(options);
56  }
57  if ((options.row_block_size == 2) &&
58      (options.e_block_size == 2) &&
59      (options.f_block_size == 3)) {
60    return new SchurEliminator<2, 2, 3>(options);
61  }
62  if ((options.row_block_size == 2) &&
63      (options.e_block_size == 2) &&
64      (options.f_block_size == 4)) {
65    return new SchurEliminator<2, 2, 4>(options);
66  }
67  if ((options.row_block_size == 2) &&
68      (options.e_block_size == 2)) {
69    return new SchurEliminator<2, 2, Eigen::Dynamic>(options);
70  }
71  if ((options.row_block_size == 2) &&
72      (options.e_block_size == 3) &&
73      (options.f_block_size == 3)) {
74    return new SchurEliminator<2, 3, 3>(options);
75  }
76  if ((options.row_block_size == 2) &&
77      (options.e_block_size == 3) &&
78      (options.f_block_size == 4)) {
79    return new SchurEliminator<2, 3, 4>(options);
80  }
81  if ((options.row_block_size == 2) &&
82      (options.e_block_size == 3) &&
83      (options.f_block_size == 6)) {
84    return new SchurEliminator<2, 3, 6>(options);
85  }
86  if ((options.row_block_size == 2) &&
87      (options.e_block_size == 3) &&
88      (options.f_block_size == 9)) {
89    return new SchurEliminator<2, 3, 9>(options);
90  }
91  if ((options.row_block_size == 2) &&
92      (options.e_block_size == 3)) {
93    return new SchurEliminator<2, 3, Eigen::Dynamic>(options);
94  }
95  if ((options.row_block_size == 2) &&
96      (options.e_block_size == 4) &&
97      (options.f_block_size == 3)) {
98    return new SchurEliminator<2, 4, 3>(options);
99  }
100  if ((options.row_block_size == 2) &&
101      (options.e_block_size == 4) &&
102      (options.f_block_size == 4)) {
103    return new SchurEliminator<2, 4, 4>(options);
104  }
105  if ((options.row_block_size == 2) &&
106      (options.e_block_size == 4) &&
107      (options.f_block_size == 8)) {
108    return new SchurEliminator<2, 4, 8>(options);
109  }
110  if ((options.row_block_size == 2) &&
111      (options.e_block_size == 4) &&
112      (options.f_block_size == 9)) {
113    return new SchurEliminator<2, 4, 9>(options);
114  }
115  if ((options.row_block_size == 2) &&
116      (options.e_block_size == 4)) {
117    return new SchurEliminator<2, 4, Eigen::Dynamic>(options);
118  }
119  if (options.row_block_size == 2){
120    return new SchurEliminator<2, Eigen::Dynamic, Eigen::Dynamic>(options);
121  }
122  if ((options.row_block_size == 4) &&
123      (options.e_block_size == 4) &&
124      (options.f_block_size == 2)) {
125    return new SchurEliminator<4, 4, 2>(options);
126  }
127  if ((options.row_block_size == 4) &&
128      (options.e_block_size == 4) &&
129      (options.f_block_size == 3)) {
130    return new SchurEliminator<4, 4, 3>(options);
131  }
132  if ((options.row_block_size == 4) &&
133      (options.e_block_size == 4) &&
134      (options.f_block_size == 4)) {
135    return new SchurEliminator<4, 4, 4>(options);
136  }
137  if ((options.row_block_size == 4) &&
138      (options.e_block_size == 4)) {
139    return new SchurEliminator<4, 4, Eigen::Dynamic>(options);
140  }
141 
142 #endif
143   VLOG(1) << "Template specializations not found for <"
144           << options.row_block_size << ","
145           << options.e_block_size << ","
146           << options.f_block_size << ">";
147   return new SchurEliminator<Eigen::Dynamic, Eigen::Dynamic, Eigen::Dynamic>(options);
148 }
149 
150 }  // namespace internal
151 }  // namespace ceres
152