mirror of
https://github.com/ceres-solver/ceres-solver.git
synced 2026-08-29 08:34:37 +08:00
Changes from William Rucklidge
Change-Id: Ia5d724edef947870fe13050a71aa1cba878352a8
This commit is contained in:
@@ -2156,7 +2156,7 @@ The three arrays will be:
|
||||
|
||||
.. member:: std::string Solver::Summary::schur_structure_given
|
||||
|
||||
For Schur type linear solvers, this string describes, the template
|
||||
For Schur type linear solvers, this string describes the template
|
||||
specialization which was detected in the problem and should be
|
||||
used.
|
||||
|
||||
|
||||
@@ -953,8 +953,9 @@ class CERES_EXPORT Solver {
|
||||
// parameter blocks.
|
||||
std::vector<int> linear_solver_ordering_used;
|
||||
|
||||
// For Schur type linear solvers, this string describes, the
|
||||
// template specialization which was detected in the problem and should be used.
|
||||
// For Schur type linear solvers, this string describes the
|
||||
// template specialization which was detected in the problem and
|
||||
// should be used.
|
||||
std::string schur_structure_given;
|
||||
|
||||
// This is the Schur template specialization that was actually
|
||||
|
||||
@@ -35,20 +35,23 @@
|
||||
# compilation into separate compilation unit rather than one large cc
|
||||
# file which takes 2+GB of RAM to compile.
|
||||
#
|
||||
# This script creates two sets of files.
|
||||
# This script creates three sets of files.
|
||||
#
|
||||
# 1. schur_eliminator_x_x_x.cc
|
||||
# 1. schur_eliminator_x_x_x.cc and partitioned_matrix_view_x_x_x.cc
|
||||
# where, the x indicates the template parameters and
|
||||
#
|
||||
# 2. schur_eliminator.cc
|
||||
# 2. schur_eliminator.cc & partitioned_matrix_view.cc
|
||||
#
|
||||
# that contains a factory function for instantiating these classes
|
||||
# based on runtime parameters.
|
||||
#
|
||||
# The list of tuples, specializations indicates the set of
|
||||
# 3. schur_templates.cc
|
||||
#
|
||||
# that contains a function which can be queried to determine what
|
||||
# template specializations are available.
|
||||
#
|
||||
# The following list of tuples, specializations indicates the set of
|
||||
# specializations that is generated.
|
||||
|
||||
# Set of template specializations to generate
|
||||
SPECIALIZATIONS = [(2, 2, 2),
|
||||
(2, 2, 3),
|
||||
(2, 2, 4),
|
||||
@@ -96,42 +99,35 @@ def GenerateFactoryConditional(row_block_size, e_block_size, f_block_size):
|
||||
if (len(conditionals) == 1):
|
||||
return " if " + conditionals[0] + "{\n %s\n }\n"
|
||||
|
||||
return " if (" + " &&\n ".join(conditionals) + ") {\n %s\n }\n"
|
||||
return " if (" + " &&\n ".join(conditionals) + ") {\n %s\n }\n"
|
||||
|
||||
def Specialize(name, data):
|
||||
"""
|
||||
Generate specialization code and the conditionals to instantiate it.
|
||||
"""
|
||||
f = open(name + ".cc", "w")
|
||||
f.write(data["HEADER"])
|
||||
f.write(data["FACTORY_FILE_HEADER"])
|
||||
|
||||
# Specialization files
|
||||
for row_block_size, e_block_size, f_block_size in SPECIALIZATIONS:
|
||||
output = SpecializationFilename("generated/" + name,
|
||||
row_block_size,
|
||||
e_block_size,
|
||||
f_block_size) + ".cc"
|
||||
fptr = open(output, "w")
|
||||
fptr.write(data["HEADER"])
|
||||
|
||||
template = data["SPECIALIZATION_FILE"]
|
||||
if (row_block_size == "Eigen::Dynamic" and
|
||||
e_block_size == "Eigen::Dynamic" and
|
||||
f_block_size == "Eigen::Dynamic"):
|
||||
template = data["DYNAMIC_FILE"]
|
||||
|
||||
fptr.write(template % (row_block_size, e_block_size, f_block_size))
|
||||
fptr.close()
|
||||
|
||||
FACTORY_CONDITIONAL =
|
||||
GenerateFactoryConditional(row_block_size, e_block_size, f_block_size)
|
||||
f.write(FACTORY_CONDITIONAL % data["FACTORY"] %
|
||||
(row_block_size, e_block_size, f_block_size));
|
||||
|
||||
f.write(data["FACTORY_FOOTER"])
|
||||
f.close()
|
||||
output = SpecializationFilename("generated/" + name,
|
||||
row_block_size,
|
||||
e_block_size,
|
||||
f_block_size) + ".cc"
|
||||
|
||||
with open(output, "w") as f:
|
||||
f.write(data["HEADER"])
|
||||
f.write(data["SPECIALIZATION_FILE"] %
|
||||
(row_block_size, e_block_size, f_block_size))
|
||||
|
||||
# Factory
|
||||
with open(name + ".cc", "w") as f:
|
||||
f.write(data["HEADER"])
|
||||
f.write(data["FACTORY_FILE_HEADER"])
|
||||
for row_block_size, e_block_size, f_block_size in SPECIALIZATIONS:
|
||||
factory_conditional = GenerateFactoryConditional(
|
||||
row_block_size, e_block_size, f_block_size)
|
||||
factory = data["FACTORY"] % (row_block_size, e_block_size, f_block_size)
|
||||
f.write(factory_conditional % factory);
|
||||
f.write(data["FACTORY_FOOTER"])
|
||||
|
||||
QUERY_HEADER = """// Ceres Solver - A fast non-linear least squares minimizer
|
||||
// Copyright 2017 Google Inc. All rights reserved.
|
||||
@@ -204,28 +200,30 @@ QUERY_FOOTER = """
|
||||
} // namespace ceres
|
||||
"""
|
||||
|
||||
QUERY_ACTION = """*row_block_size = %s;
|
||||
*e_block_size = %s;
|
||||
*f_block_size = %s;
|
||||
QUERY_ACTION = """ *row_block_size = %s;
|
||||
*e_block_size = %s;
|
||||
*f_block_size = %s;
|
||||
return;"""
|
||||
|
||||
def GenerateQueryFile():
|
||||
"""
|
||||
Generate specialization code and the conditionals to instantiate it.
|
||||
Generate file that allows querying for available template specializations.
|
||||
"""
|
||||
f = open("schur_templates.cc", "w")
|
||||
f.write(QUERY_HEADER)
|
||||
f.write(QUERY_FILE_HEADER)
|
||||
|
||||
for row_block_size, e_block_size, f_block_size in SPECIALIZATIONS:
|
||||
FACTORY_CONDITIONAL = GenerateFactoryConditional(row_block_size, e_block_size, f_block_size)
|
||||
f.write(FACTORY_CONDITIONAL % QUERY_ACTION % (row_block_size, e_block_size, f_block_size));
|
||||
|
||||
f.write(QUERY_FOOTER)
|
||||
f.close()
|
||||
with open("schur_templates.cc", "w") as f:
|
||||
f.write(QUERY_HEADER)
|
||||
f.write(QUERY_FILE_HEADER)
|
||||
for row_block_size, e_block_size, f_block_size in SPECIALIZATIONS:
|
||||
factory_conditional = GenerateFactoryConditional(
|
||||
row_block_size, e_block_size, f_block_size)
|
||||
action = QUERY_ACTION % (row_block_size, e_block_size, f_block_size)
|
||||
f.write(factory_conditional % action)
|
||||
f.write(QUERY_FOOTER)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
Specialize("schur_eliminator", schur_eliminator_template.__dict__)
|
||||
Specialize("partitioned_matrix_view", partitioned_matrix_view_template.__dict__)
|
||||
Specialize("schur_eliminator",
|
||||
schur_eliminator_template.__dict__)
|
||||
Specialize("partitioned_matrix_view",
|
||||
partitioned_matrix_view_template.__dict__)
|
||||
GenerateQueryFile()
|
||||
|
||||
@@ -51,93 +51,93 @@ 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]);
|
||||
(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]);
|
||||
(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]);
|
||||
(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]);
|
||||
(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]);
|
||||
(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]);
|
||||
(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]);
|
||||
(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]);
|
||||
(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]);
|
||||
(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]);
|
||||
(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]);
|
||||
(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]);
|
||||
(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]);
|
||||
(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]);
|
||||
(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]);
|
||||
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]);
|
||||
(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]);
|
||||
(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]);
|
||||
(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]);
|
||||
(options.e_block_size == 4)) {
|
||||
return new PartitionedMatrixView<4, 4, Eigen::Dynamic>(matrix, options.elimination_groups[0]);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -135,7 +135,7 @@ PartitionedMatrixViewBase::Create(const LinearSolver::Options& options,
|
||||
const BlockSparseMatrix& matrix) {
|
||||
#ifndef CERES_RESTRICT_SCHUR_SPECIALIZATION
|
||||
"""
|
||||
FACTORY = """return new PartitionedMatrixView<%s, %s, %s>(matrix, options.elimination_groups[0]);"""
|
||||
FACTORY = """ return new PartitionedMatrixView<%s, %s, %s>(matrix, options.elimination_groups[0]);"""
|
||||
|
||||
FACTORY_FOOTER = """
|
||||
#endif
|
||||
|
||||
@@ -50,93 +50,93 @@ SchurEliminatorBase*
|
||||
SchurEliminatorBase::Create(const LinearSolver::Options& options) {
|
||||
#ifndef CERES_RESTRICT_SCHUR_SPECIALIZATION
|
||||
if ((options.row_block_size == 2) &&
|
||||
(options.e_block_size == 2) &&
|
||||
(options.f_block_size == 2)) {
|
||||
return new SchurEliminator<2, 2, 2>(options);
|
||||
(options.e_block_size == 2) &&
|
||||
(options.f_block_size == 2)) {
|
||||
return new SchurEliminator<2, 2, 2>(options);
|
||||
}
|
||||
if ((options.row_block_size == 2) &&
|
||||
(options.e_block_size == 2) &&
|
||||
(options.f_block_size == 3)) {
|
||||
return new SchurEliminator<2, 2, 3>(options);
|
||||
(options.e_block_size == 2) &&
|
||||
(options.f_block_size == 3)) {
|
||||
return new SchurEliminator<2, 2, 3>(options);
|
||||
}
|
||||
if ((options.row_block_size == 2) &&
|
||||
(options.e_block_size == 2) &&
|
||||
(options.f_block_size == 4)) {
|
||||
return new SchurEliminator<2, 2, 4>(options);
|
||||
(options.e_block_size == 2) &&
|
||||
(options.f_block_size == 4)) {
|
||||
return new SchurEliminator<2, 2, 4>(options);
|
||||
}
|
||||
if ((options.row_block_size == 2) &&
|
||||
(options.e_block_size == 2)) {
|
||||
return new SchurEliminator<2, 2, Eigen::Dynamic>(options);
|
||||
(options.e_block_size == 2)) {
|
||||
return new SchurEliminator<2, 2, Eigen::Dynamic>(options);
|
||||
}
|
||||
if ((options.row_block_size == 2) &&
|
||||
(options.e_block_size == 3) &&
|
||||
(options.f_block_size == 3)) {
|
||||
return new SchurEliminator<2, 3, 3>(options);
|
||||
(options.e_block_size == 3) &&
|
||||
(options.f_block_size == 3)) {
|
||||
return new SchurEliminator<2, 3, 3>(options);
|
||||
}
|
||||
if ((options.row_block_size == 2) &&
|
||||
(options.e_block_size == 3) &&
|
||||
(options.f_block_size == 4)) {
|
||||
return new SchurEliminator<2, 3, 4>(options);
|
||||
(options.e_block_size == 3) &&
|
||||
(options.f_block_size == 4)) {
|
||||
return new SchurEliminator<2, 3, 4>(options);
|
||||
}
|
||||
if ((options.row_block_size == 2) &&
|
||||
(options.e_block_size == 3) &&
|
||||
(options.f_block_size == 6)) {
|
||||
return new SchurEliminator<2, 3, 6>(options);
|
||||
(options.e_block_size == 3) &&
|
||||
(options.f_block_size == 6)) {
|
||||
return new SchurEliminator<2, 3, 6>(options);
|
||||
}
|
||||
if ((options.row_block_size == 2) &&
|
||||
(options.e_block_size == 3) &&
|
||||
(options.f_block_size == 9)) {
|
||||
return new SchurEliminator<2, 3, 9>(options);
|
||||
(options.e_block_size == 3) &&
|
||||
(options.f_block_size == 9)) {
|
||||
return new SchurEliminator<2, 3, 9>(options);
|
||||
}
|
||||
if ((options.row_block_size == 2) &&
|
||||
(options.e_block_size == 3)) {
|
||||
return new SchurEliminator<2, 3, Eigen::Dynamic>(options);
|
||||
(options.e_block_size == 3)) {
|
||||
return new SchurEliminator<2, 3, Eigen::Dynamic>(options);
|
||||
}
|
||||
if ((options.row_block_size == 2) &&
|
||||
(options.e_block_size == 4) &&
|
||||
(options.f_block_size == 3)) {
|
||||
return new SchurEliminator<2, 4, 3>(options);
|
||||
(options.e_block_size == 4) &&
|
||||
(options.f_block_size == 3)) {
|
||||
return new SchurEliminator<2, 4, 3>(options);
|
||||
}
|
||||
if ((options.row_block_size == 2) &&
|
||||
(options.e_block_size == 4) &&
|
||||
(options.f_block_size == 4)) {
|
||||
return new SchurEliminator<2, 4, 4>(options);
|
||||
(options.e_block_size == 4) &&
|
||||
(options.f_block_size == 4)) {
|
||||
return new SchurEliminator<2, 4, 4>(options);
|
||||
}
|
||||
if ((options.row_block_size == 2) &&
|
||||
(options.e_block_size == 4) &&
|
||||
(options.f_block_size == 8)) {
|
||||
return new SchurEliminator<2, 4, 8>(options);
|
||||
(options.e_block_size == 4) &&
|
||||
(options.f_block_size == 8)) {
|
||||
return new SchurEliminator<2, 4, 8>(options);
|
||||
}
|
||||
if ((options.row_block_size == 2) &&
|
||||
(options.e_block_size == 4) &&
|
||||
(options.f_block_size == 9)) {
|
||||
return new SchurEliminator<2, 4, 9>(options);
|
||||
(options.e_block_size == 4) &&
|
||||
(options.f_block_size == 9)) {
|
||||
return new SchurEliminator<2, 4, 9>(options);
|
||||
}
|
||||
if ((options.row_block_size == 2) &&
|
||||
(options.e_block_size == 4)) {
|
||||
return new SchurEliminator<2, 4, Eigen::Dynamic>(options);
|
||||
(options.e_block_size == 4)) {
|
||||
return new SchurEliminator<2, 4, Eigen::Dynamic>(options);
|
||||
}
|
||||
if (options.row_block_size == 2){
|
||||
return new SchurEliminator<2, Eigen::Dynamic, Eigen::Dynamic>(options);
|
||||
return new SchurEliminator<2, Eigen::Dynamic, Eigen::Dynamic>(options);
|
||||
}
|
||||
if ((options.row_block_size == 4) &&
|
||||
(options.e_block_size == 4) &&
|
||||
(options.f_block_size == 2)) {
|
||||
return new SchurEliminator<4, 4, 2>(options);
|
||||
(options.e_block_size == 4) &&
|
||||
(options.f_block_size == 2)) {
|
||||
return new SchurEliminator<4, 4, 2>(options);
|
||||
}
|
||||
if ((options.row_block_size == 4) &&
|
||||
(options.e_block_size == 4) &&
|
||||
(options.f_block_size == 3)) {
|
||||
return new SchurEliminator<4, 4, 3>(options);
|
||||
(options.e_block_size == 4) &&
|
||||
(options.f_block_size == 3)) {
|
||||
return new SchurEliminator<4, 4, 3>(options);
|
||||
}
|
||||
if ((options.row_block_size == 4) &&
|
||||
(options.e_block_size == 4) &&
|
||||
(options.f_block_size == 4)) {
|
||||
return new SchurEliminator<4, 4, 4>(options);
|
||||
(options.e_block_size == 4) &&
|
||||
(options.f_block_size == 4)) {
|
||||
return new SchurEliminator<4, 4, 4>(options);
|
||||
}
|
||||
if ((options.row_block_size == 4) &&
|
||||
(options.e_block_size == 4)) {
|
||||
return new SchurEliminator<4, 4, Eigen::Dynamic>(options);
|
||||
(options.e_block_size == 4)) {
|
||||
return new SchurEliminator<4, 4, Eigen::Dynamic>(options);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -139,7 +139,7 @@ SchurEliminatorBase::Create(const LinearSolver::Options& options) {
|
||||
#ifndef CERES_RESTRICT_SCHUR_SPECIALIZATION
|
||||
"""
|
||||
|
||||
FACTORY = """return new SchurEliminator<%s, %s, %s>(options);"""
|
||||
FACTORY = """ return new SchurEliminator<%s, %s, %s>(options);"""
|
||||
|
||||
FACTORY_FOOTER = """
|
||||
#endif
|
||||
|
||||
@@ -57,149 +57,149 @@ void GetBestSchurTemplateSpecialization(int* row_block_size,
|
||||
*f_block_size = Eigen::Dynamic;
|
||||
#ifndef CERES_RESTRICT_SCHUR_SPECIALIZATION
|
||||
if ((options.row_block_size == 2) &&
|
||||
(options.e_block_size == 2) &&
|
||||
(options.f_block_size == 2)) {
|
||||
*row_block_size = 2;
|
||||
*e_block_size = 2;
|
||||
*f_block_size = 2;
|
||||
(options.e_block_size == 2) &&
|
||||
(options.f_block_size == 2)) {
|
||||
*row_block_size = 2;
|
||||
*e_block_size = 2;
|
||||
*f_block_size = 2;
|
||||
return;
|
||||
}
|
||||
if ((options.row_block_size == 2) &&
|
||||
(options.e_block_size == 2) &&
|
||||
(options.f_block_size == 3)) {
|
||||
*row_block_size = 2;
|
||||
*e_block_size = 2;
|
||||
*f_block_size = 3;
|
||||
(options.e_block_size == 2) &&
|
||||
(options.f_block_size == 3)) {
|
||||
*row_block_size = 2;
|
||||
*e_block_size = 2;
|
||||
*f_block_size = 3;
|
||||
return;
|
||||
}
|
||||
if ((options.row_block_size == 2) &&
|
||||
(options.e_block_size == 2) &&
|
||||
(options.f_block_size == 4)) {
|
||||
*row_block_size = 2;
|
||||
*e_block_size = 2;
|
||||
*f_block_size = 4;
|
||||
(options.e_block_size == 2) &&
|
||||
(options.f_block_size == 4)) {
|
||||
*row_block_size = 2;
|
||||
*e_block_size = 2;
|
||||
*f_block_size = 4;
|
||||
return;
|
||||
}
|
||||
if ((options.row_block_size == 2) &&
|
||||
(options.e_block_size == 2)) {
|
||||
*row_block_size = 2;
|
||||
*e_block_size = 2;
|
||||
*f_block_size = Eigen::Dynamic;
|
||||
(options.e_block_size == 2)) {
|
||||
*row_block_size = 2;
|
||||
*e_block_size = 2;
|
||||
*f_block_size = Eigen::Dynamic;
|
||||
return;
|
||||
}
|
||||
if ((options.row_block_size == 2) &&
|
||||
(options.e_block_size == 3) &&
|
||||
(options.f_block_size == 3)) {
|
||||
*row_block_size = 2;
|
||||
*e_block_size = 3;
|
||||
*f_block_size = 3;
|
||||
(options.e_block_size == 3) &&
|
||||
(options.f_block_size == 3)) {
|
||||
*row_block_size = 2;
|
||||
*e_block_size = 3;
|
||||
*f_block_size = 3;
|
||||
return;
|
||||
}
|
||||
if ((options.row_block_size == 2) &&
|
||||
(options.e_block_size == 3) &&
|
||||
(options.f_block_size == 4)) {
|
||||
*row_block_size = 2;
|
||||
*e_block_size = 3;
|
||||
*f_block_size = 4;
|
||||
(options.e_block_size == 3) &&
|
||||
(options.f_block_size == 4)) {
|
||||
*row_block_size = 2;
|
||||
*e_block_size = 3;
|
||||
*f_block_size = 4;
|
||||
return;
|
||||
}
|
||||
if ((options.row_block_size == 2) &&
|
||||
(options.e_block_size == 3) &&
|
||||
(options.f_block_size == 6)) {
|
||||
*row_block_size = 2;
|
||||
*e_block_size = 3;
|
||||
*f_block_size = 6;
|
||||
(options.e_block_size == 3) &&
|
||||
(options.f_block_size == 6)) {
|
||||
*row_block_size = 2;
|
||||
*e_block_size = 3;
|
||||
*f_block_size = 6;
|
||||
return;
|
||||
}
|
||||
if ((options.row_block_size == 2) &&
|
||||
(options.e_block_size == 3) &&
|
||||
(options.f_block_size == 9)) {
|
||||
*row_block_size = 2;
|
||||
*e_block_size = 3;
|
||||
*f_block_size = 9;
|
||||
(options.e_block_size == 3) &&
|
||||
(options.f_block_size == 9)) {
|
||||
*row_block_size = 2;
|
||||
*e_block_size = 3;
|
||||
*f_block_size = 9;
|
||||
return;
|
||||
}
|
||||
if ((options.row_block_size == 2) &&
|
||||
(options.e_block_size == 3)) {
|
||||
*row_block_size = 2;
|
||||
*e_block_size = 3;
|
||||
*f_block_size = Eigen::Dynamic;
|
||||
(options.e_block_size == 3)) {
|
||||
*row_block_size = 2;
|
||||
*e_block_size = 3;
|
||||
*f_block_size = Eigen::Dynamic;
|
||||
return;
|
||||
}
|
||||
if ((options.row_block_size == 2) &&
|
||||
(options.e_block_size == 4) &&
|
||||
(options.f_block_size == 3)) {
|
||||
*row_block_size = 2;
|
||||
*e_block_size = 4;
|
||||
*f_block_size = 3;
|
||||
(options.e_block_size == 4) &&
|
||||
(options.f_block_size == 3)) {
|
||||
*row_block_size = 2;
|
||||
*e_block_size = 4;
|
||||
*f_block_size = 3;
|
||||
return;
|
||||
}
|
||||
if ((options.row_block_size == 2) &&
|
||||
(options.e_block_size == 4) &&
|
||||
(options.f_block_size == 4)) {
|
||||
*row_block_size = 2;
|
||||
*e_block_size = 4;
|
||||
*f_block_size = 4;
|
||||
(options.e_block_size == 4) &&
|
||||
(options.f_block_size == 4)) {
|
||||
*row_block_size = 2;
|
||||
*e_block_size = 4;
|
||||
*f_block_size = 4;
|
||||
return;
|
||||
}
|
||||
if ((options.row_block_size == 2) &&
|
||||
(options.e_block_size == 4) &&
|
||||
(options.f_block_size == 8)) {
|
||||
*row_block_size = 2;
|
||||
*e_block_size = 4;
|
||||
*f_block_size = 8;
|
||||
(options.e_block_size == 4) &&
|
||||
(options.f_block_size == 8)) {
|
||||
*row_block_size = 2;
|
||||
*e_block_size = 4;
|
||||
*f_block_size = 8;
|
||||
return;
|
||||
}
|
||||
if ((options.row_block_size == 2) &&
|
||||
(options.e_block_size == 4) &&
|
||||
(options.f_block_size == 9)) {
|
||||
*row_block_size = 2;
|
||||
*e_block_size = 4;
|
||||
*f_block_size = 9;
|
||||
(options.e_block_size == 4) &&
|
||||
(options.f_block_size == 9)) {
|
||||
*row_block_size = 2;
|
||||
*e_block_size = 4;
|
||||
*f_block_size = 9;
|
||||
return;
|
||||
}
|
||||
if ((options.row_block_size == 2) &&
|
||||
(options.e_block_size == 4)) {
|
||||
*row_block_size = 2;
|
||||
*e_block_size = 4;
|
||||
*f_block_size = Eigen::Dynamic;
|
||||
(options.e_block_size == 4)) {
|
||||
*row_block_size = 2;
|
||||
*e_block_size = 4;
|
||||
*f_block_size = Eigen::Dynamic;
|
||||
return;
|
||||
}
|
||||
if (options.row_block_size == 2){
|
||||
*row_block_size = 2;
|
||||
*e_block_size = Eigen::Dynamic;
|
||||
*f_block_size = Eigen::Dynamic;
|
||||
*row_block_size = 2;
|
||||
*e_block_size = Eigen::Dynamic;
|
||||
*f_block_size = Eigen::Dynamic;
|
||||
return;
|
||||
}
|
||||
if ((options.row_block_size == 4) &&
|
||||
(options.e_block_size == 4) &&
|
||||
(options.f_block_size == 2)) {
|
||||
*row_block_size = 4;
|
||||
*e_block_size = 4;
|
||||
*f_block_size = 2;
|
||||
(options.e_block_size == 4) &&
|
||||
(options.f_block_size == 2)) {
|
||||
*row_block_size = 4;
|
||||
*e_block_size = 4;
|
||||
*f_block_size = 2;
|
||||
return;
|
||||
}
|
||||
if ((options.row_block_size == 4) &&
|
||||
(options.e_block_size == 4) &&
|
||||
(options.f_block_size == 3)) {
|
||||
*row_block_size = 4;
|
||||
*e_block_size = 4;
|
||||
*f_block_size = 3;
|
||||
(options.e_block_size == 4) &&
|
||||
(options.f_block_size == 3)) {
|
||||
*row_block_size = 4;
|
||||
*e_block_size = 4;
|
||||
*f_block_size = 3;
|
||||
return;
|
||||
}
|
||||
if ((options.row_block_size == 4) &&
|
||||
(options.e_block_size == 4) &&
|
||||
(options.f_block_size == 4)) {
|
||||
*row_block_size = 4;
|
||||
*e_block_size = 4;
|
||||
*f_block_size = 4;
|
||||
(options.e_block_size == 4) &&
|
||||
(options.f_block_size == 4)) {
|
||||
*row_block_size = 4;
|
||||
*e_block_size = 4;
|
||||
*f_block_size = 4;
|
||||
return;
|
||||
}
|
||||
if ((options.row_block_size == 4) &&
|
||||
(options.e_block_size == 4)) {
|
||||
*row_block_size = 4;
|
||||
*e_block_size = 4;
|
||||
*f_block_size = Eigen::Dynamic;
|
||||
(options.e_block_size == 4)) {
|
||||
*row_block_size = 4;
|
||||
*e_block_size = 4;
|
||||
*f_block_size = Eigen::Dynamic;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -463,7 +463,7 @@ std::string SchurStructureToString(const int row_block_size,
|
||||
(f_block_size == Eigen::Dynamic)
|
||||
? "d" : internal::StringPrintf("%d", f_block_size);
|
||||
|
||||
return internal::StringPrintf("%s,%s,%s",row.c_str(), e.c_str(), f.c_str());
|
||||
return internal::StringPrintf("%s,%s,%s", row.c_str(), e.c_str(), f.c_str());
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user