103
103
static LinearSolver* CreateLinearSolver(Solver::Options* options,
106
// Reorder the parameter blocks in program using the ordering. A
107
// return value of true indicates success and false indicates an
108
// error was encountered whose cause is logged to LOG(ERROR).
109
static bool ApplyUserOrdering(const ProblemImpl::ParameterMap& parameter_map,
110
const ParameterBlockOrdering* ordering,
115
106
// Reorder the residuals for program, if necessary, so that the
116
107
// residuals involving e block (i.e., the first num_eliminate_block
117
108
// parameter blocks) occur together. This is a necessary condition
163
154
static void AlternateLinearSolverForSchurTypeLinearSolver(
164
155
Solver::Options* options);
157
// Create a TripletSparseMatrix which contains the zero-one
158
// structure corresponding to the block sparsity of the transpose of
159
// the Jacobian matrix.
161
// Caller owns the result.
162
static TripletSparseMatrix* CreateJacobianBlockSparsityTranspose(
163
const Program* program);
165
// Reorder the parameter blocks in program using the ordering
166
static bool ApplyUserOrdering(
167
const ProblemImpl::ParameterMap& parameter_map,
168
const ParameterBlockOrdering* parameter_block_ordering,
172
// Sparse cholesky factorization routines when doing the sparse
173
// cholesky factorization of the Jacobian matrix, reorders its
174
// columns to reduce the fill-in. Compute this permutation and
175
// re-order the parameter blocks.
177
// If the parameter_block_ordering contains more than one
178
// elimination group and support for constrained fill-reducing
179
// ordering is available in the sparse linear algebra library
180
// (SuiteSparse version >= 4.2.0) then the fill reducing
181
// ordering will take it into account, otherwise it will be ignored.
182
static bool ReorderProgramForSparseNormalCholesky(
183
const SparseLinearAlgebraLibraryType sparse_linear_algebra_library_type,
184
const ParameterBlockOrdering* parameter_block_ordering,
166
188
// Schur type solvers require that all parameter blocks eliminated
167
189
// by the Schur eliminator occur before others and the residuals be
168
190
// sorted in lexicographic order of their parameter blocks.
170
// If ordering has atleast two groups, then apply the ordering,
171
// otherwise compute a new ordering using a Maximal Independent Set
172
// algorithm and apply it.
192
// If the parameter_block_ordering only contains one elimination
193
// group then a maximal independent set is computed and used as the
194
// first elimination group, otherwise the user's ordering is used.
196
// If the linear solver type is SPARSE_SCHUR and support for
197
// constrained fill-reducing ordering is available in the sparse
198
// linear algebra library (SuiteSparse version >= 4.2.0) then
199
// columns of the schur complement matrix are ordered to reduce the
200
// fill-in the Cholesky factorization.
174
202
// Upon return, ordering contains the parameter block ordering that
175
203
// was used to order the program.
176
204
static bool ReorderProgramForSchurTypeLinearSolver(
205
const LinearSolverType linear_solver_type,
206
const SparseLinearAlgebraLibraryType sparse_linear_algebra_library_type,
177
207
const ProblemImpl::ParameterMap& parameter_map,
178
ParameterBlockOrdering* ordering,
208
ParameterBlockOrdering* parameter_block_ordering,
179
209
Program* program,
182
// CHOLMOD when doing the sparse cholesky factorization of the
183
// Jacobian matrix, reorders its columns to reduce the
184
// fill-in. Compute this permutation and re-order the parameter
187
static void ReorderProgramForSparseNormalCholesky(Program* program);
189
// Create a TripletSparseMatrix which contains the zero-one
190
// structure corresponding to the block sparsity of the transpose of
191
// the Jacobian matrix.
193
// Caller owns the result.
194
static TripletSparseMatrix* CreateJacobianBlockSparsityTranspose(
195
const Program* program);
212
// array contains a list of (possibly repeating) non-negative
213
// integers. Let us assume that we have constructed another array
214
// `p` by sorting and uniqueing the entries of array.
215
// CompactifyArray replaces each entry in "array" with its position
217
static void CompactifyArray(vector<int>* array);
198
220
} // namespace internal