blob: d745a9b358dc5c7168092ce4eb1139811afa65ca [file] [log] [blame]
Angus Kong0ae28bd2013-02-13 14:56:04 -08001// Ceres Solver - A fast non-linear least squares minimizer
Carlos Hernandez79397c22014-08-07 17:51:38 -07002// Copyright 2013 Google Inc. All rights reserved.
Angus Kong0ae28bd2013-02-13 14:56:04 -08003// 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)
Carlos Hernandez79397c22014-08-07 17:51:38 -070030//
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_partitioned_matrix_view_specializations.py.
41// Editing it manually is not recommended.
Angus Kong0ae28bd2013-02-13 14:56:04 -080042
Carlos Hernandez79397c22014-08-07 17:51:38 -070043#include "ceres/linear_solver.h"
Angus Kong0ae28bd2013-02-13 14:56:04 -080044#include "ceres/partitioned_matrix_view.h"
Angus Kong0ae28bd2013-02-13 14:56:04 -080045#include "ceres/internal/eigen.h"
Angus Kong0ae28bd2013-02-13 14:56:04 -080046
47namespace ceres {
48namespace internal {
49
Carlos Hernandez79397c22014-08-07 17:51:38 -070050PartitionedMatrixViewBase*
51PartitionedMatrixViewBase::Create(const LinearSolver::Options& options,
52 const BlockSparseMatrix& matrix) {
53#ifndef CERES_RESTRICT_SCHUR_SPECIALIZATION
54 if ((options.row_block_size == 2) &&
55 (options.e_block_size == 2) &&
56 (options.f_block_size == 2)) {
57 return new PartitionedMatrixView<2, 2, 2>(
58 matrix, options.elimination_groups[0]);
59 }
60 if ((options.row_block_size == 2) &&
61 (options.e_block_size == 2) &&
62 (options.f_block_size == 3)) {
63 return new PartitionedMatrixView<2, 2, 3>(
64 matrix, options.elimination_groups[0]);
65 }
66 if ((options.row_block_size == 2) &&
67 (options.e_block_size == 2) &&
68 (options.f_block_size == 4)) {
69 return new PartitionedMatrixView<2, 2, 4>(
70 matrix, options.elimination_groups[0]);
71 }
72 if ((options.row_block_size == 2) &&
73 (options.e_block_size == 2) &&
74 (options.f_block_size == Eigen::Dynamic)) {
75 return new PartitionedMatrixView<2, 2, Eigen::Dynamic>(
76 matrix, options.elimination_groups[0]);
77 }
78 if ((options.row_block_size == 2) &&
79 (options.e_block_size == 3) &&
80 (options.f_block_size == 3)) {
81 return new PartitionedMatrixView<2, 3, 3>(
82 matrix, options.elimination_groups[0]);
83 }
84 if ((options.row_block_size == 2) &&
85 (options.e_block_size == 3) &&
86 (options.f_block_size == 4)) {
87 return new PartitionedMatrixView<2, 3, 4>(
88 matrix, options.elimination_groups[0]);
89 }
90 if ((options.row_block_size == 2) &&
91 (options.e_block_size == 3) &&
92 (options.f_block_size == 9)) {
93 return new PartitionedMatrixView<2, 3, 9>(
94 matrix, options.elimination_groups[0]);
95 }
96 if ((options.row_block_size == 2) &&
97 (options.e_block_size == 3) &&
98 (options.f_block_size == Eigen::Dynamic)) {
99 return new PartitionedMatrixView<2, 3, Eigen::Dynamic>(
100 matrix, options.elimination_groups[0]);
101 }
102 if ((options.row_block_size == 2) &&
103 (options.e_block_size == 4) &&
104 (options.f_block_size == 3)) {
105 return new PartitionedMatrixView<2, 4, 3>(
106 matrix, options.elimination_groups[0]);
107 }
108 if ((options.row_block_size == 2) &&
109 (options.e_block_size == 4) &&
110 (options.f_block_size == 4)) {
111 return new PartitionedMatrixView<2, 4, 4>(
112 matrix, options.elimination_groups[0]);
113 }
114 if ((options.row_block_size == 2) &&
115 (options.e_block_size == 4) &&
116 (options.f_block_size == 8)) {
117 return new PartitionedMatrixView<2, 4, 8>(
118 matrix, options.elimination_groups[0]);
119 }
120 if ((options.row_block_size == 2) &&
121 (options.e_block_size == 4) &&
122 (options.f_block_size == 9)) {
123 return new PartitionedMatrixView<2, 4, 9>(
124 matrix, options.elimination_groups[0]);
125 }
126 if ((options.row_block_size == 2) &&
127 (options.e_block_size == 4) &&
128 (options.f_block_size == Eigen::Dynamic)) {
129 return new PartitionedMatrixView<2, 4, Eigen::Dynamic>(
130 matrix, options.elimination_groups[0]);
131 }
132 if ((options.row_block_size == 2) &&
133 (options.e_block_size == Eigen::Dynamic) &&
134 (options.f_block_size == Eigen::Dynamic)) {
135 return new PartitionedMatrixView<2, Eigen::Dynamic, Eigen::Dynamic>(
136 matrix, options.elimination_groups[0]);
137 }
138 if ((options.row_block_size == 4) &&
139 (options.e_block_size == 4) &&
140 (options.f_block_size == 2)) {
141 return new PartitionedMatrixView<4, 4, 2>(
142 matrix, options.elimination_groups[0]);
143 }
144 if ((options.row_block_size == 4) &&
145 (options.e_block_size == 4) &&
146 (options.f_block_size == 3)) {
147 return new PartitionedMatrixView<4, 4, 3>(
148 matrix, options.elimination_groups[0]);
149 }
150 if ((options.row_block_size == 4) &&
151 (options.e_block_size == 4) &&
152 (options.f_block_size == 4)) {
153 return new PartitionedMatrixView<4, 4, 4>(
154 matrix, options.elimination_groups[0]);
155 }
156 if ((options.row_block_size == 4) &&
157 (options.e_block_size == 4) &&
158 (options.f_block_size == Eigen::Dynamic)) {
159 return new PartitionedMatrixView<4, 4, Eigen::Dynamic>(
160 matrix, options.elimination_groups[0]);
161 }
162 if ((options.row_block_size == Eigen::Dynamic) &&
163 (options.e_block_size == Eigen::Dynamic) &&
164 (options.f_block_size == Eigen::Dynamic)) {
165 return new PartitionedMatrixView<Eigen::Dynamic, Eigen::Dynamic, Eigen::Dynamic>(
166 matrix, options.elimination_groups[0]);
Angus Kong0ae28bd2013-02-13 14:56:04 -0800167 }
168
Carlos Hernandez79397c22014-08-07 17:51:38 -0700169#endif
170 VLOG(1) << "Template specializations not found for <"
171 << options.row_block_size << ","
172 << options.e_block_size << ","
173 << options.f_block_size << ">";
174 return new PartitionedMatrixView<Eigen::Dynamic, Eigen::Dynamic, Eigen::Dynamic>(
175 matrix, options.elimination_groups[0]);
176};
Angus Kong0ae28bd2013-02-13 14:56:04 -0800177
178} // namespace internal
179} // namespace ceres