Skip to content
This repository has been archived by the owner on Oct 26, 2018. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
…solver

# By Sameer Agarwal
# Via Sameer Agarwal
* 'master' of https://ceres-solver.googlesource.com/ceres-solver:
  Lint cleanup from William Rucklidge.
  Lint cleanup from Jim Roseborough.
  • Loading branch information
Yuliy Schwartzburg committed May 1, 2014
2 parents 387ad8f + 31b5037 commit c204174
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 30 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ IF (MSVC)
OPTION(MSVC_USE_STATIC_CRT
"MS Visual Studio: Use static C-Run Time Library in place of shared." OFF)

IF ( BUILD_TESTING AND BUILD_SHARED_LIBS)
IF (BUILD_TESTING AND BUILD_SHARED_LIBS)
MESSAGE(
"-- Disabling tests. The flags BUILD_TESTING and BUILD_SHARED_LIBS"
" are incompatible with MSVC."
Expand Down
6 changes: 3 additions & 3 deletions docs/source/version_history.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ New Features
(Alex Stewart)
#. LBFGS is faster due to fewer memory copies.
#. Parameter blocks are not restricted to be less than 32k in size,
they can be upto 2G in size.
they can be up to 2G in size.
#. Faster ``SPARSE_NORMAL_CHOLESKY`` solver when using ``CX_SPARSE``
as the sparse linear algebra library.
#. ``Problem::IsParameterBlockPresent`` can be used to check if a
parameter block is already present in the problem.
#. ``Problem::GetParameterzation`` can be used to access the
#. ``Problem::GetParameterization`` can be used to access the
parameterization associated with a parameter block.
#. Added the (2,4,9) template specialization for PartitionedMatrixView
and SchurEliminator.
Expand Down Expand Up @@ -98,7 +98,7 @@ Bug Fixes
column blocks. (Richard Bowen)
#. Better error checking when ``Problem::RemoveResidualBlock`` is
called. (Alex Stewart)
#. Fixed a memory leack in ``SchurComplementSolver``.
#. Fixed a memory leak in ``SchurComplementSolver``.
#. Added ``epsilon()`` method to ``NumTraits<ceres::Jet<T, N> >``. (Filippo
Basso)
#. Fixed a bug in `CompressedRowSparseMatrix::AppendRows`` and
Expand Down
24 changes: 15 additions & 9 deletions include/ceres/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -378,9 +378,9 @@ enum DumpFormatType {
TEXTFILE
};

// For SizedCostFunction and AutoDiffCostFunction, DYNAMIC can be specified for
// the number of residuals. If specified, then the number of residuas for that
// cost function can vary at runtime.
// For SizedCostFunction and AutoDiffCostFunction, DYNAMIC can be
// specified for the number of residuals. If specified, then the
// number of residuas for that cost function can vary at runtime.
enum DimensionType {
DYNAMIC = -1
};
Expand All @@ -402,13 +402,17 @@ enum CovarianceAlgorithmType {
SPARSE_QR
};

CERES_EXPORT const char* LinearSolverTypeToString(LinearSolverType type);
CERES_EXPORT bool StringToLinearSolverType(string value, LinearSolverType* type);
CERES_EXPORT const char* LinearSolverTypeToString(
LinearSolverType type);
CERES_EXPORT bool StringToLinearSolverType(string value,
LinearSolverType* type);

CERES_EXPORT const char* PreconditionerTypeToString(PreconditionerType type);
CERES_EXPORT bool StringToPreconditionerType(string value, PreconditionerType* type);
CERES_EXPORT bool StringToPreconditionerType(string value,
PreconditionerType* type);

CERES_EXPORT const char* VisibilityClusteringTypeToString(VisibilityClusteringType type);
CERES_EXPORT const char* VisibilityClusteringTypeToString(
VisibilityClusteringType type);
CERES_EXPORT bool StringToVisibilityClusteringType(string value,
VisibilityClusteringType* type);

Expand All @@ -424,7 +428,8 @@ CERES_EXPORT bool StringToDenseLinearAlgebraLibraryType(
string value,
DenseLinearAlgebraLibraryType* type);

CERES_EXPORT const char* TrustRegionStrategyTypeToString(TrustRegionStrategyType type);
CERES_EXPORT const char* TrustRegionStrategyTypeToString(
TrustRegionStrategyType type);
CERES_EXPORT bool StringToTrustRegionStrategyType(string value,
TrustRegionStrategyType* type);

Expand All @@ -434,7 +439,8 @@ CERES_EXPORT bool StringToDoglegType(string value, DoglegType* type);
CERES_EXPORT const char* MinimizerTypeToString(MinimizerType type);
CERES_EXPORT bool StringToMinimizerType(string value, MinimizerType* type);

CERES_EXPORT const char* LineSearchDirectionTypeToString(LineSearchDirectionType type);
CERES_EXPORT const char* LineSearchDirectionTypeToString(
LineSearchDirectionType type);
CERES_EXPORT bool StringToLineSearchDirectionType(string value,
LineSearchDirectionType* type);

Expand Down
37 changes: 20 additions & 17 deletions internal/ceres/compressed_row_jacobian_writer.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,41 +50,44 @@ class CompressedRowJacobianWriter {
: program_(program) {
}

// `PopulateJacobianRowAndColumnBlockVectors` sets `col_blocks` and
// `row_blocks` for a `CompressedRowSparseMatrix`, based on the parameter
// block sizes and residual sizes respectively from the program. This is
// useful when Solver::Options::use_block_amd = true;
// PopulateJacobianRowAndColumnBlockVectors sets col_blocks and
// row_blocks for a CompressedRowSparseMatrix, based on the
// parameter block sizes and residual sizes respectively from the
// program. This is useful when Solver::Options::use_block_amd =
// true;
//
// This function is static so that it is available to other jacobian
// writers which use `CompressedRowSparseMatrix` (or derived types).
// writers which use CompressedRowSparseMatrix (or derived types).
// (Jacobian writers do not fall under any type hierarchy; they only
// have to provide an interface as specified in program_evaluator.h).
static void PopulateJacobianRowAndColumnBlockVectors(
const Program* program,
CompressedRowSparseMatrix* jacobian);

// It is necessary to determine the order of the jacobian blocks before
// copying them into a `CompressedRowSparseMatrix` (or derived type).
// Just because a cost function uses parameter blocks 1 after 2 in its
// arguments does not mean that the block 1 occurs before block 2 in the
// column layout of the jacobian. Thus, `GetOrderedParameterBlocks`
// determines the order by sorting the jacobian blocks by their position in
// the state vector.
// It is necessary to determine the order of the jacobian blocks
// before copying them into a CompressedRowSparseMatrix (or derived
// type). Just because a cost function uses parameter blocks 1
// after 2 in its arguments does not mean that the block 1 occurs
// before block 2 in the column layout of the jacobian. Thus,
// GetOrderedParameterBlocks determines the order by sorting the
// jacobian blocks by their position in the state vector.
//
// This function is static so that it is available to other jacobian
// writers which use `CompressedRowSparseMatrix` (or derived types).
// writers which use CompressedRowSparseMatrix (or derived types).
// (Jacobian writers do not fall under any type hierarchy; they only
// have to provide an interface as specified in program_evaluator.h).
// have to provide an interface as specified in
// program_evaluator.h).
static void GetOrderedParameterBlocks(
const Program* program,
int residual_id,
vector<pair<int, int> >* evaluated_jacobian_blocks);

// JacobianWriter interface.

// Since the compressed row matrix has different layout than that assumed by
// the cost functions, use scratch space to store the jacobians temporarily
// then copy them over to the larger jacobian in the Write() function.
// Since the compressed row matrix has different layout than that
// assumed by the cost functions, use scratch space to store the
// jacobians temporarily then copy them over to the larger jacobian
// in the Write() function.
ScratchEvaluatePreparer* CreateEvaluatePreparers(int num_threads) {
return ScratchEvaluatePreparer::Create(*program_, num_threads);
}
Expand Down

0 comments on commit c204174

Please sign in to comment.