mirror of
https://github.com/ceres-solver/ceres-solver.git
synced 2026-08-29 08:34:37 +08:00
Improvements to Schur template specializations
1. Refactor the python code that generates the template specializations to remove code duplication. 2. Improved the logic for template specialization selection where Eigen::Dynamic now serves as a wildcard. 3. Added schur_templates.h/cc which allows querying the set of available template specializations without instantiating a linear solver. 4. Added Solver::Summary::schur_structre_given and Solver::Summary::schur_structure_used and expose them in Solver::Summary::FullReport for better performance debugging. 5. Updated the templates with newer dates and some minor comments cleanup which lead to the the template specializations to be re-generated. Change-Id: Iaf3c6f714353597899916c300465da01f151c3de
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// Ceres Solver - A fast non-linear least squares minimizer
|
||||
// Copyright 2015 Google Inc. All rights reserved.
|
||||
// Copyright 2017 Google Inc. All rights reserved.
|
||||
// http://ceres-solver.org/
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
@@ -37,8 +37,7 @@
|
||||
// THIS FILE IS AUTOGENERATED. DO NOT EDIT.
|
||||
//=========================================
|
||||
//
|
||||
// This file is generated using generate_partitioned_matrix_view_specializations.py.
|
||||
// Editing it manually is not recommended.
|
||||
// This file is generated using generate_template_specializations.py.
|
||||
|
||||
#include "ceres/linear_solver.h"
|
||||
#include "ceres/partitioned_matrix_view.h"
|
||||
@@ -51,126 +50,95 @@ PartitionedMatrixViewBase*
|
||||
PartitionedMatrixViewBase::Create(const LinearSolver::Options& options,
|
||||
const BlockSparseMatrix& matrix) {
|
||||
#ifndef CERES_RESTRICT_SCHUR_SPECIALIZATION
|
||||
if ((options.row_block_size == 2) &&
|
||||
(options.e_block_size == 2) &&
|
||||
(options.f_block_size == 2)) {
|
||||
return new PartitionedMatrixView<2, 2, 2>(
|
||||
matrix, options.elimination_groups[0]);
|
||||
}
|
||||
if ((options.row_block_size == 2) &&
|
||||
(options.e_block_size == 2) &&
|
||||
(options.f_block_size == 3)) {
|
||||
return new PartitionedMatrixView<2, 2, 3>(
|
||||
matrix, options.elimination_groups[0]);
|
||||
}
|
||||
if ((options.row_block_size == 2) &&
|
||||
(options.e_block_size == 2) &&
|
||||
(options.f_block_size == 4)) {
|
||||
return new PartitionedMatrixView<2, 2, 4>(
|
||||
matrix, options.elimination_groups[0]);
|
||||
}
|
||||
if ((options.row_block_size == 2) &&
|
||||
(options.e_block_size == 2) &&
|
||||
(options.f_block_size == Eigen::Dynamic)) {
|
||||
return new PartitionedMatrixView<2, 2, Eigen::Dynamic>(
|
||||
matrix, options.elimination_groups[0]);
|
||||
}
|
||||
if ((options.row_block_size == 2) &&
|
||||
(options.e_block_size == 3) &&
|
||||
(options.f_block_size == 3)) {
|
||||
return new PartitionedMatrixView<2, 3, 3>(
|
||||
matrix, options.elimination_groups[0]);
|
||||
}
|
||||
if ((options.row_block_size == 2) &&
|
||||
(options.e_block_size == 3) &&
|
||||
(options.f_block_size == 4)) {
|
||||
return new PartitionedMatrixView<2, 3, 4>(
|
||||
matrix, options.elimination_groups[0]);
|
||||
}
|
||||
if ((options.row_block_size == 2) &&
|
||||
(options.e_block_size == 3) &&
|
||||
(options.f_block_size == 6)) {
|
||||
return new PartitionedMatrixView<2, 3, 6>(
|
||||
matrix, options.elimination_groups[0]);
|
||||
}
|
||||
if ((options.row_block_size == 2) &&
|
||||
(options.e_block_size == 3) &&
|
||||
(options.f_block_size == 9)) {
|
||||
return new PartitionedMatrixView<2, 3, 9>(
|
||||
matrix, options.elimination_groups[0]);
|
||||
}
|
||||
if ((options.row_block_size == 2) &&
|
||||
(options.e_block_size == 3) &&
|
||||
(options.f_block_size == Eigen::Dynamic)) {
|
||||
return new PartitionedMatrixView<2, 3, Eigen::Dynamic>(
|
||||
matrix, options.elimination_groups[0]);
|
||||
}
|
||||
if ((options.row_block_size == 2) &&
|
||||
(options.e_block_size == 4) &&
|
||||
(options.f_block_size == 3)) {
|
||||
return new PartitionedMatrixView<2, 4, 3>(
|
||||
matrix, options.elimination_groups[0]);
|
||||
}
|
||||
if ((options.row_block_size == 2) &&
|
||||
(options.e_block_size == 4) &&
|
||||
(options.f_block_size == 4)) {
|
||||
return new PartitionedMatrixView<2, 4, 4>(
|
||||
matrix, options.elimination_groups[0]);
|
||||
}
|
||||
if ((options.row_block_size == 2) &&
|
||||
(options.e_block_size == 4) &&
|
||||
(options.f_block_size == 8)) {
|
||||
return new PartitionedMatrixView<2, 4, 8>(
|
||||
matrix, options.elimination_groups[0]);
|
||||
}
|
||||
if ((options.row_block_size == 2) &&
|
||||
(options.e_block_size == 4) &&
|
||||
(options.f_block_size == 9)) {
|
||||
return new PartitionedMatrixView<2, 4, 9>(
|
||||
matrix, options.elimination_groups[0]);
|
||||
}
|
||||
if ((options.row_block_size == 2) &&
|
||||
(options.e_block_size == 4) &&
|
||||
(options.f_block_size == Eigen::Dynamic)) {
|
||||
return new PartitionedMatrixView<2, 4, Eigen::Dynamic>(
|
||||
matrix, options.elimination_groups[0]);
|
||||
}
|
||||
if ((options.row_block_size == 2) &&
|
||||
(options.e_block_size == Eigen::Dynamic) &&
|
||||
(options.f_block_size == Eigen::Dynamic)) {
|
||||
return new PartitionedMatrixView<2, Eigen::Dynamic, Eigen::Dynamic>(
|
||||
matrix, options.elimination_groups[0]);
|
||||
}
|
||||
if ((options.row_block_size == 4) &&
|
||||
(options.e_block_size == 4) &&
|
||||
(options.f_block_size == 2)) {
|
||||
return new PartitionedMatrixView<4, 4, 2>(
|
||||
matrix, options.elimination_groups[0]);
|
||||
}
|
||||
if ((options.row_block_size == 4) &&
|
||||
(options.e_block_size == 4) &&
|
||||
(options.f_block_size == 3)) {
|
||||
return new PartitionedMatrixView<4, 4, 3>(
|
||||
matrix, options.elimination_groups[0]);
|
||||
}
|
||||
if ((options.row_block_size == 4) &&
|
||||
(options.e_block_size == 4) &&
|
||||
(options.f_block_size == 4)) {
|
||||
return new PartitionedMatrixView<4, 4, 4>(
|
||||
matrix, options.elimination_groups[0]);
|
||||
}
|
||||
if ((options.row_block_size == 4) &&
|
||||
(options.e_block_size == 4) &&
|
||||
(options.f_block_size == Eigen::Dynamic)) {
|
||||
return new PartitionedMatrixView<4, 4, Eigen::Dynamic>(
|
||||
matrix, options.elimination_groups[0]);
|
||||
}
|
||||
if ((options.row_block_size == Eigen::Dynamic) &&
|
||||
(options.e_block_size == Eigen::Dynamic) &&
|
||||
(options.f_block_size == Eigen::Dynamic)) {
|
||||
return new PartitionedMatrixView<Eigen::Dynamic, Eigen::Dynamic, Eigen::Dynamic>(
|
||||
matrix, options.elimination_groups[0]);
|
||||
}
|
||||
if ((options.row_block_size == 2) &&
|
||||
(options.e_block_size == 2) &&
|
||||
(options.f_block_size == 2)) {
|
||||
return new PartitionedMatrixView<2, 2, 2>(matrix, options.elimination_groups[0]);
|
||||
}
|
||||
if ((options.row_block_size == 2) &&
|
||||
(options.e_block_size == 2) &&
|
||||
(options.f_block_size == 3)) {
|
||||
return new PartitionedMatrixView<2, 2, 3>(matrix, options.elimination_groups[0]);
|
||||
}
|
||||
if ((options.row_block_size == 2) &&
|
||||
(options.e_block_size == 2) &&
|
||||
(options.f_block_size == 4)) {
|
||||
return new PartitionedMatrixView<2, 2, 4>(matrix, options.elimination_groups[0]);
|
||||
}
|
||||
if ((options.row_block_size == 2) &&
|
||||
(options.e_block_size == 2)) {
|
||||
return new PartitionedMatrixView<2, 2, Eigen::Dynamic>(matrix, options.elimination_groups[0]);
|
||||
}
|
||||
if ((options.row_block_size == 2) &&
|
||||
(options.e_block_size == 3) &&
|
||||
(options.f_block_size == 3)) {
|
||||
return new PartitionedMatrixView<2, 3, 3>(matrix, options.elimination_groups[0]);
|
||||
}
|
||||
if ((options.row_block_size == 2) &&
|
||||
(options.e_block_size == 3) &&
|
||||
(options.f_block_size == 4)) {
|
||||
return new PartitionedMatrixView<2, 3, 4>(matrix, options.elimination_groups[0]);
|
||||
}
|
||||
if ((options.row_block_size == 2) &&
|
||||
(options.e_block_size == 3) &&
|
||||
(options.f_block_size == 6)) {
|
||||
return new PartitionedMatrixView<2, 3, 6>(matrix, options.elimination_groups[0]);
|
||||
}
|
||||
if ((options.row_block_size == 2) &&
|
||||
(options.e_block_size == 3) &&
|
||||
(options.f_block_size == 9)) {
|
||||
return new PartitionedMatrixView<2, 3, 9>(matrix, options.elimination_groups[0]);
|
||||
}
|
||||
if ((options.row_block_size == 2) &&
|
||||
(options.e_block_size == 3)) {
|
||||
return new PartitionedMatrixView<2, 3, Eigen::Dynamic>(matrix, options.elimination_groups[0]);
|
||||
}
|
||||
if ((options.row_block_size == 2) &&
|
||||
(options.e_block_size == 4) &&
|
||||
(options.f_block_size == 3)) {
|
||||
return new PartitionedMatrixView<2, 4, 3>(matrix, options.elimination_groups[0]);
|
||||
}
|
||||
if ((options.row_block_size == 2) &&
|
||||
(options.e_block_size == 4) &&
|
||||
(options.f_block_size == 4)) {
|
||||
return new PartitionedMatrixView<2, 4, 4>(matrix, options.elimination_groups[0]);
|
||||
}
|
||||
if ((options.row_block_size == 2) &&
|
||||
(options.e_block_size == 4) &&
|
||||
(options.f_block_size == 8)) {
|
||||
return new PartitionedMatrixView<2, 4, 8>(matrix, options.elimination_groups[0]);
|
||||
}
|
||||
if ((options.row_block_size == 2) &&
|
||||
(options.e_block_size == 4) &&
|
||||
(options.f_block_size == 9)) {
|
||||
return new PartitionedMatrixView<2, 4, 9>(matrix, options.elimination_groups[0]);
|
||||
}
|
||||
if ((options.row_block_size == 2) &&
|
||||
(options.e_block_size == 4)) {
|
||||
return new PartitionedMatrixView<2, 4, Eigen::Dynamic>(matrix, options.elimination_groups[0]);
|
||||
}
|
||||
if (options.row_block_size == 2){
|
||||
return new PartitionedMatrixView<2, Eigen::Dynamic, Eigen::Dynamic>(matrix, options.elimination_groups[0]);
|
||||
}
|
||||
if ((options.row_block_size == 4) &&
|
||||
(options.e_block_size == 4) &&
|
||||
(options.f_block_size == 2)) {
|
||||
return new PartitionedMatrixView<4, 4, 2>(matrix, options.elimination_groups[0]);
|
||||
}
|
||||
if ((options.row_block_size == 4) &&
|
||||
(options.e_block_size == 4) &&
|
||||
(options.f_block_size == 3)) {
|
||||
return new PartitionedMatrixView<4, 4, 3>(matrix, options.elimination_groups[0]);
|
||||
}
|
||||
if ((options.row_block_size == 4) &&
|
||||
(options.e_block_size == 4) &&
|
||||
(options.f_block_size == 4)) {
|
||||
return new PartitionedMatrixView<4, 4, 4>(matrix, options.elimination_groups[0]);
|
||||
}
|
||||
if ((options.row_block_size == 4) &&
|
||||
(options.e_block_size == 4)) {
|
||||
return new PartitionedMatrixView<4, 4, Eigen::Dynamic>(matrix, options.elimination_groups[0]);
|
||||
}
|
||||
|
||||
#endif
|
||||
VLOG(1) << "Template specializations not found for <"
|
||||
|
||||
Reference in New Issue
Block a user