10ae28bd5885b5daa526898fcf7c323dc2c3e1963Angus Kong// Ceres Solver - A fast non-linear least squares minimizer
279397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez// Copyright 2013 Google Inc. All rights reserved.
30ae28bd5885b5daa526898fcf7c323dc2c3e1963Angus Kong// http://code.google.com/p/ceres-solver/
40ae28bd5885b5daa526898fcf7c323dc2c3e1963Angus Kong//
50ae28bd5885b5daa526898fcf7c323dc2c3e1963Angus Kong// Redistribution and use in source and binary forms, with or without
60ae28bd5885b5daa526898fcf7c323dc2c3e1963Angus Kong// modification, are permitted provided that the following conditions are met:
70ae28bd5885b5daa526898fcf7c323dc2c3e1963Angus Kong//
80ae28bd5885b5daa526898fcf7c323dc2c3e1963Angus Kong// * Redistributions of source code must retain the above copyright notice,
90ae28bd5885b5daa526898fcf7c323dc2c3e1963Angus Kong//   this list of conditions and the following disclaimer.
100ae28bd5885b5daa526898fcf7c323dc2c3e1963Angus Kong// * Redistributions in binary form must reproduce the above copyright notice,
110ae28bd5885b5daa526898fcf7c323dc2c3e1963Angus Kong//   this list of conditions and the following disclaimer in the documentation
120ae28bd5885b5daa526898fcf7c323dc2c3e1963Angus Kong//   and/or other materials provided with the distribution.
130ae28bd5885b5daa526898fcf7c323dc2c3e1963Angus Kong// * Neither the name of Google Inc. nor the names of its contributors may be
140ae28bd5885b5daa526898fcf7c323dc2c3e1963Angus Kong//   used to endorse or promote products derived from this software without
150ae28bd5885b5daa526898fcf7c323dc2c3e1963Angus Kong//   specific prior written permission.
160ae28bd5885b5daa526898fcf7c323dc2c3e1963Angus Kong//
170ae28bd5885b5daa526898fcf7c323dc2c3e1963Angus Kong// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
180ae28bd5885b5daa526898fcf7c323dc2c3e1963Angus Kong// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
190ae28bd5885b5daa526898fcf7c323dc2c3e1963Angus Kong// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
200ae28bd5885b5daa526898fcf7c323dc2c3e1963Angus Kong// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
210ae28bd5885b5daa526898fcf7c323dc2c3e1963Angus Kong// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
220ae28bd5885b5daa526898fcf7c323dc2c3e1963Angus Kong// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
230ae28bd5885b5daa526898fcf7c323dc2c3e1963Angus Kong// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
240ae28bd5885b5daa526898fcf7c323dc2c3e1963Angus Kong// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
250ae28bd5885b5daa526898fcf7c323dc2c3e1963Angus Kong// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
260ae28bd5885b5daa526898fcf7c323dc2c3e1963Angus Kong// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
270ae28bd5885b5daa526898fcf7c323dc2c3e1963Angus Kong// POSSIBILITY OF SUCH DAMAGE.
280ae28bd5885b5daa526898fcf7c323dc2c3e1963Angus Kong//
290ae28bd5885b5daa526898fcf7c323dc2c3e1963Angus Kong// Author: sameeragarwal@google.com (Sameer Agarwal)
3079397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez//
3179397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez// Template specialization of PartitionedMatrixView.
3279397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez//
3379397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez// ========================================
3479397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez// THIS FILE IS AUTOGENERATED. DO NOT EDIT.
3579397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez// THIS FILE IS AUTOGENERATED. DO NOT EDIT.
3679397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez// THIS FILE IS AUTOGENERATED. DO NOT EDIT.
3779397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez// THIS FILE IS AUTOGENERATED. DO NOT EDIT.
3879397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez//=========================================
3979397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez//
4079397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez// This file is generated using generate_partitioned_matrix_view_specializations.py.
4179397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez// Editing it manually is not recommended.
420ae28bd5885b5daa526898fcf7c323dc2c3e1963Angus Kong
4379397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez#include "ceres/linear_solver.h"
440ae28bd5885b5daa526898fcf7c323dc2c3e1963Angus Kong#include "ceres/partitioned_matrix_view.h"
450ae28bd5885b5daa526898fcf7c323dc2c3e1963Angus Kong#include "ceres/internal/eigen.h"
460ae28bd5885b5daa526898fcf7c323dc2c3e1963Angus Kong
470ae28bd5885b5daa526898fcf7c323dc2c3e1963Angus Kongnamespace ceres {
480ae28bd5885b5daa526898fcf7c323dc2c3e1963Angus Kongnamespace internal {
490ae28bd5885b5daa526898fcf7c323dc2c3e1963Angus Kong
5079397c21138f54fcff6ec067b44b847f1f7e0e98Carlos HernandezPartitionedMatrixViewBase*
5179397c21138f54fcff6ec067b44b847f1f7e0e98Carlos HernandezPartitionedMatrixViewBase::Create(const LinearSolver::Options& options,
5279397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez                                  const BlockSparseMatrix& matrix) {
5379397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez#ifndef CERES_RESTRICT_SCHUR_SPECIALIZATION
5479397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez  if ((options.row_block_size == 2) &&
5579397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez      (options.e_block_size == 2) &&
5679397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez      (options.f_block_size == 2)) {
5779397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez    return new PartitionedMatrixView<2, 2, 2>(
5879397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez                 matrix, options.elimination_groups[0]);
590ae28bd5885b5daa526898fcf7c323dc2c3e1963Angus Kong  }
6079397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez  if ((options.row_block_size == 2) &&
6179397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez      (options.e_block_size == 2) &&
6279397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez      (options.f_block_size == 3)) {
6379397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez    return new PartitionedMatrixView<2, 2, 3>(
6479397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez                 matrix, options.elimination_groups[0]);
650ae28bd5885b5daa526898fcf7c323dc2c3e1963Angus Kong  }
6679397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez  if ((options.row_block_size == 2) &&
6779397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez      (options.e_block_size == 2) &&
6879397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez      (options.f_block_size == 4)) {
6979397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez    return new PartitionedMatrixView<2, 2, 4>(
7079397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez                 matrix, options.elimination_groups[0]);
710ae28bd5885b5daa526898fcf7c323dc2c3e1963Angus Kong  }
7279397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez  if ((options.row_block_size == 2) &&
7379397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez      (options.e_block_size == 2) &&
7479397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez      (options.f_block_size == Eigen::Dynamic)) {
7579397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez    return new PartitionedMatrixView<2, 2, Eigen::Dynamic>(
7679397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez                 matrix, options.elimination_groups[0]);
770ae28bd5885b5daa526898fcf7c323dc2c3e1963Angus Kong  }
7879397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez  if ((options.row_block_size == 2) &&
7979397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez      (options.e_block_size == 3) &&
8079397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez      (options.f_block_size == 3)) {
8179397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez    return new PartitionedMatrixView<2, 3, 3>(
8279397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez                 matrix, options.elimination_groups[0]);
830ae28bd5885b5daa526898fcf7c323dc2c3e1963Angus Kong  }
8479397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez  if ((options.row_block_size == 2) &&
8579397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez      (options.e_block_size == 3) &&
8679397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez      (options.f_block_size == 4)) {
8779397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez    return new PartitionedMatrixView<2, 3, 4>(
8879397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez                 matrix, options.elimination_groups[0]);
890ae28bd5885b5daa526898fcf7c323dc2c3e1963Angus Kong  }
9079397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez  if ((options.row_block_size == 2) &&
9179397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez      (options.e_block_size == 3) &&
9279397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez      (options.f_block_size == 9)) {
9379397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez    return new PartitionedMatrixView<2, 3, 9>(
9479397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez                 matrix, options.elimination_groups[0]);
950ae28bd5885b5daa526898fcf7c323dc2c3e1963Angus Kong  }
9679397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez  if ((options.row_block_size == 2) &&
9779397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez      (options.e_block_size == 3) &&
9879397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez      (options.f_block_size == Eigen::Dynamic)) {
9979397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez    return new PartitionedMatrixView<2, 3, Eigen::Dynamic>(
10079397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez                 matrix, options.elimination_groups[0]);
1010ae28bd5885b5daa526898fcf7c323dc2c3e1963Angus Kong  }
10279397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez  if ((options.row_block_size == 2) &&
10379397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez      (options.e_block_size == 4) &&
10479397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez      (options.f_block_size == 3)) {
10579397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez    return new PartitionedMatrixView<2, 4, 3>(
10679397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez                 matrix, options.elimination_groups[0]);
10779397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez  }
10879397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez  if ((options.row_block_size == 2) &&
10979397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez      (options.e_block_size == 4) &&
11079397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez      (options.f_block_size == 4)) {
11179397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez    return new PartitionedMatrixView<2, 4, 4>(
11279397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez                 matrix, options.elimination_groups[0]);
11379397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez  }
11479397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez  if ((options.row_block_size == 2) &&
11579397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez      (options.e_block_size == 4) &&
11679397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez      (options.f_block_size == 8)) {
11779397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez    return new PartitionedMatrixView<2, 4, 8>(
11879397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez                 matrix, options.elimination_groups[0]);
11979397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez  }
12079397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez  if ((options.row_block_size == 2) &&
12179397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez      (options.e_block_size == 4) &&
12279397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez      (options.f_block_size == 9)) {
12379397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez    return new PartitionedMatrixView<2, 4, 9>(
12479397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez                 matrix, options.elimination_groups[0]);
12579397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez  }
12679397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez  if ((options.row_block_size == 2) &&
12779397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez      (options.e_block_size == 4) &&
12879397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez      (options.f_block_size == Eigen::Dynamic)) {
12979397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez    return new PartitionedMatrixView<2, 4, Eigen::Dynamic>(
13079397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez                 matrix, options.elimination_groups[0]);
13179397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez  }
13279397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez  if ((options.row_block_size == 2) &&
13379397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez      (options.e_block_size == Eigen::Dynamic) &&
13479397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez      (options.f_block_size == Eigen::Dynamic)) {
13579397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez    return new PartitionedMatrixView<2, Eigen::Dynamic, Eigen::Dynamic>(
13679397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez                 matrix, options.elimination_groups[0]);
1370ae28bd5885b5daa526898fcf7c323dc2c3e1963Angus Kong  }
13879397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez  if ((options.row_block_size == 4) &&
13979397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez      (options.e_block_size == 4) &&
14079397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez      (options.f_block_size == 2)) {
14179397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez    return new PartitionedMatrixView<4, 4, 2>(
14279397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez                 matrix, options.elimination_groups[0]);
14379397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez  }
14479397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez  if ((options.row_block_size == 4) &&
14579397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez      (options.e_block_size == 4) &&
14679397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez      (options.f_block_size == 3)) {
14779397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez    return new PartitionedMatrixView<4, 4, 3>(
14879397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez                 matrix, options.elimination_groups[0]);
14979397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez  }
15079397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez  if ((options.row_block_size == 4) &&
15179397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez      (options.e_block_size == 4) &&
15279397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez      (options.f_block_size == 4)) {
15379397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez    return new PartitionedMatrixView<4, 4, 4>(
15479397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez                 matrix, options.elimination_groups[0]);
15579397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez  }
15679397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez  if ((options.row_block_size == 4) &&
15779397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez      (options.e_block_size == 4) &&
15879397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez      (options.f_block_size == Eigen::Dynamic)) {
15979397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez    return new PartitionedMatrixView<4, 4, Eigen::Dynamic>(
16079397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez                 matrix, options.elimination_groups[0]);
16179397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez  }
16279397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez  if ((options.row_block_size == Eigen::Dynamic) &&
16379397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez      (options.e_block_size == Eigen::Dynamic) &&
16479397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez      (options.f_block_size == Eigen::Dynamic)) {
16579397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez    return new PartitionedMatrixView<Eigen::Dynamic, Eigen::Dynamic, Eigen::Dynamic>(
16679397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez                 matrix, options.elimination_groups[0]);
16779397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez  }
16879397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez
16979397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez#endif
17079397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez  VLOG(1) << "Template specializations not found for <"
17179397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez          << options.row_block_size << ","
17279397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez          << options.e_block_size << ","
17379397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez          << options.f_block_size << ">";
17479397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez  return new PartitionedMatrixView<Eigen::Dynamic, Eigen::Dynamic, Eigen::Dynamic>(
17579397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez               matrix, options.elimination_groups[0]);
17679397c21138f54fcff6ec067b44b847f1f7e0e98Carlos Hernandez};
1770ae28bd5885b5daa526898fcf7c323dc2c3e1963Angus Kong
1780ae28bd5885b5daa526898fcf7c323dc2c3e1963Angus Kong}  // namespace internal
1790ae28bd5885b5daa526898fcf7c323dc2c3e1963Angus Kong}  // namespace ceres
180