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