Solver::Options::ordering* are dead.
Remove the old ordering API, and modify solver_impl.cc
to use the new API everywhere.
In the process also clean up the linear solver instantion
logic in solver_impl.cc a bit too.
Change-Id: Ia66898abc7f622070b184b21fce8cc6140c4cebf
diff --git a/include/ceres/ordering.h b/include/ceres/ordering.h
index b3cd1b1..c302aad 100644
--- a/include/ceres/ordering.h
+++ b/include/ceres/ordering.h
@@ -109,13 +109,15 @@
// block is not known to the Ordering, calling this method results
// in a crash.
int GroupIdForParameterBlock(double* parameter_block) const;
- int NumParameterBlocks() const;
- int NumGroups() const;
// This function always succeeds. For a group_id unknown to the
// ordering is treated as empty groups and the function returns
// zero.
int GroupSize(int group_id) const;
+
+ bool ContainsParameterBlock(double* parameter_block) const;
+ int NumParameterBlocks() const;
+ int NumGroups() const;
const map<int, set<double*> >& group_id_to_parameter_blocks() const;
private:
diff --git a/include/ceres/solver.h b/include/ceres/solver.h
index 0e94ee8..95d6ba0 100644
--- a/include/ceres/solver.h
+++ b/include/ceres/solver.h
@@ -90,17 +90,13 @@
#endif
num_linear_solver_threads = 1;
- use_new_ordering_api = false;
- ordering_new_api = NULL;
- num_eliminate_blocks = 0;
- ordering_type = NATURAL;
#if defined(CERES_NO_SUITESPARSE)
use_block_amd = false;
#else
use_block_amd = true;
#endif
-
+ ordering = NULL;
linear_solver_min_num_iterations = 1;
linear_solver_max_num_iterations = 500;
eta = 1e-1;
@@ -121,6 +117,7 @@
update_state_every_iteration = false;
}
+ ~Options();
// Minimizer options ----------------------------------------
TrustRegionStrategyType trust_region_strategy_type;
@@ -232,41 +229,10 @@
// using this setting.
int num_linear_solver_threads;
- // Whether the old or the new ordering API should be used. If this
- // is true, all assignments to Solve::Options::ordering_type,
- // Solver::Options::ordering and
- // Solver::Options::num_eliminate_blocks are ignored.
- bool use_new_ordering_api;
-
- // Ordering object for the new ordering API. If NULL, then all
- // parameter blocks are assumed to be in the same group and the
- // solver is free to decide the best ordering. (See ordering.h for
- // more details).
- Ordering* ordering_new_api;
-
- // For Schur reduction based methods, the first 0 to num blocks are
- // eliminated using the Schur reduction. For example, when solving
- // traditional structure from motion problems where the parameters are in
- // two classes (cameras and points) then num_eliminate_blocks would be the
- // number of points.
- //
- // This parameter is used in conjunction with the ordering.
- // Applies to: Preprocessor and linear least squares solver.
- int num_eliminate_blocks;
-
- // Internally Ceres reorders the parameter blocks to help the
- // various linear solvers. This parameter allows the user to
- // influence the re-ordering strategy used. For structure from
- // motion problems use SCHUR, for other problems NATURAL (default)
- // is a good choice. In case you wish to specify your own ordering
- // scheme, for example in conjunction with num_eliminate_blocks,
- // use USER.
- OrderingType ordering_type;
-
- // The ordering of the parameter blocks. The solver pays attention
- // to it if the ordering_type is set to USER and the vector is
- // non-empty.
- vector<double*> ordering;
+ // If NULL, then all parameter blocks are assumed to be in the
+ // same group and the solver is free to decide the best
+ // ordering. (See ordering.h for more details).
+ Ordering* ordering;
// By virtue of the modeling layer in Ceres being block oriented,
// all the matrices used by Ceres are also block oriented. When
@@ -523,7 +489,6 @@
LinearSolverType linear_solver_type_used;
PreconditionerType preconditioner_type;
- OrderingType ordering_type;
TrustRegionStrategyType trust_region_strategy_type;
DoglegType dogleg_type;
diff --git a/include/ceres/types.h b/include/ceres/types.h
index 30dcada..888e9b0 100644
--- a/include/ceres/types.h
+++ b/include/ceres/types.h
@@ -145,18 +145,6 @@
FAILURE
};
-enum OrderingType {
- // The order in which the parameter blocks were defined.
- NATURAL,
-
- // Use the ordering specificed in the vector ordering.
- USER,
-
- // Automatically figure out the best ordering to use the schur
- // complement based solver.
- SCHUR
-};
-
// Logging options
// The options get progressively noisier.
enum LoggingType {
@@ -310,9 +298,6 @@
string value,
SparseLinearAlgebraLibraryType* type);
-const char* OrderingTypeToString(OrderingType type);
-bool StringToOrderingType(string value, OrderingType* type);
-
const char* TrustRegionStrategyTypeToString(TrustRegionStrategyType type);
bool StringToTrustRegionStrategyType(string value,
TrustRegionStrategyType* type);