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 (46) and others
# Via Sameer Agarwal
* 'master' of https://ceres-solver.googlesource.com/ceres-solver: (60 commits)
  Variety of changes to documentation and example code.
  Add missing template specializations to the NDK build.
  Suppport for MSVC DLLs.
  Add missing files to Android.mk
  Fix compilation error when using G++ compiler
  Fix the documentation for RandNormal.
  Add dynamic_sparsity option.
  More NDK fixes.
  Change the defaults for shared_ptr.
  Solver::Options uses shared_ptr to handle ownership.
  Added a simplified robotics example for DynamicAutoDiffCostFunction.
  Remove a comment from conf.py
  Merge landing page with introduction.
  Cleanup block_structure.h/cc
  Refactor the landing page to be a bit more compact.
  Rework Ceres documentation as new website
  Added support and tests: row and column blocks for sparse matrix transpose.
  Add Problem::IsParameterBlockPresent.
  Fix spacing in building.rst
  Changes documentation to reflect changes in output format.
  ...
  • Loading branch information
Yuliy Schwartzburg committed Apr 30, 2014
2 parents 6f7d063 + b166806 commit 387ad8f
Show file tree
Hide file tree
Showing 141 changed files with 4,928 additions and 2,230 deletions.
82 changes: 47 additions & 35 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -104,18 +104,24 @@ OPTION(CUSTOM_BLAS
# Multithreading using OpenMP
OPTION(OPENMP "Enable threaded solving in Ceres (requires OpenMP)" ON)

# Line search minimizer is useful for large scale problems or when
# sparse linear algebra libraries are not available. If compile time,
# binary size or compiler performance is an issue, consider disabling
# this.
OPTION(LINE_SEARCH_MINIMIZER "Enable the line search minimizer." ON)
OPTION(BUILD_TESTING "Enable tests" ON)
OPTION(BUILD_DOCUMENTATION "Build User's Guide (html)" OFF)
OPTION(BUILD_EXAMPLES "Build examples" ON)
OPTION(BUILD_SHARED_LIBS "Build Ceres as a shared library." OFF)
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)
MESSAGE(
"-- Disabling tests. The flags BUILD_TESTING and BUILD_SHARED_LIBS"
" are incompatible with MSVC."
)
# Retain the help string associated with the BUILD_TESTING option
# and turn testing off.
GET_PROPERTY(HELP_STRING CACHE BUILD_TESTING PROPERTY HELPSTRING)
SET(BUILD_TESTING OFF CACHE BOOL "${HELP_STRING}" FORCE)
ENDIF (BUILD_TESTING AND BUILD_SHARED_LIBS)
ENDIF (MSVC)

# Prior to October 2013, Ceres used some non-CMake standardised variables to
Expand Down Expand Up @@ -355,11 +361,6 @@ IF (NOT SCHUR_SPECIALIZATIONS)
MESSAGE("-- Disabling Schur specializations (faster compiles)")
ENDIF (NOT SCHUR_SPECIALIZATIONS)

IF (NOT LINE_SEARCH_MINIMIZER)
ADD_DEFINITIONS(-DCERES_NO_LINE_SEARCH_MINIMIZER)
MESSAGE("-- Disabling line search minimizer")
ENDIF (NOT LINE_SEARCH_MINIMIZER)

IF (NOT CUSTOM_BLAS)
ADD_DEFINITIONS(-DCERES_NO_CUSTOM_BLAS)
MESSAGE("-- Disabling custom blas")
Expand Down Expand Up @@ -405,31 +406,28 @@ ENDIF (OPENMP)
INCLUDE(CheckIncludeFileCXX)
CHECK_INCLUDE_FILE_CXX(unordered_map HAVE_STD_UNORDERED_MAP_HEADER)
IF (HAVE_STD_UNORDERED_MAP_HEADER)
# Even so we've found unordered_map header file it doesn't
# mean unordered_map and unordered_set will be declared in
# std namespace.
# Finding the unordered_map header doesn't mean that unordered_map
# is in std namespace.
#
# Namely, MSVC 2008 have unordered_map header which declares
# unordered_map class in std::tr1 namespace. In order to support
# this, we do extra check to see which exactly namespace is
# to be used.

# In particular, MSVC 2008 has unordered_map declared in std::tr1.
# In order to support this, we do an extra check to see which
# namespace should be used.
INCLUDE(CheckCXXSourceCompiles)
CHECK_CXX_SOURCE_COMPILES("#include <unordered_map>
int main() {
std::unordered_map<int, int> map;
return 0;
}"
int main() {
std::unordered_map<int, int> map;
return 0;
}"
HAVE_UNORDERED_MAP_IN_STD_NAMESPACE)
IF (HAVE_UNORDERED_MAP_IN_STD_NAMESPACE)
ADD_DEFINITIONS(-DCERES_STD_UNORDERED_MAP)
MESSAGE("-- Found unordered_map/set in std namespace.")
ELSE (HAVE_UNORDERED_MAP_IN_STD_NAMESPACE)
CHECK_CXX_SOURCE_COMPILES("#include <unordered_map>
int main() {
std::tr1::unordered_map<int, int> map;
return 0;
}"
int main() {
std::tr1::unordered_map<int, int> map;
return 0;
}"
HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE)
IF (HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE)
ADD_DEFINITIONS(-DCERES_STD_UNORDERED_MAP_IN_TR1_NAMESPACE)
Expand All @@ -442,17 +440,30 @@ IF (HAVE_STD_UNORDERED_MAP_HEADER)
ENDIF (HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE)
ENDIF (HAVE_UNORDERED_MAP_IN_STD_NAMESPACE)
ELSE (HAVE_STD_UNORDERED_MAP_HEADER)
CHECK_INCLUDE_FILE_CXX("tr1/unordered_map" UNORDERED_MAP_IN_TR1_NAMESPACE)
IF (UNORDERED_MAP_IN_TR1_NAMESPACE)
CHECK_INCLUDE_FILE_CXX("tr1/unordered_map" HAVE_TR1_UNORDERED_MAP_HEADER)
IF (HAVE_TR1_UNORDERED_MAP_HEADER)
ADD_DEFINITIONS(-DCERES_TR1_UNORDERED_MAP)
MESSAGE("-- Found tr1/unordered_map/set in std::tr1 namespace.")
ELSE (UNORDERED_MAP_IN_TR1_NAMESPACE)
ELSE (HAVE_TR1_UNORDERED_MAP_HEADE)
MESSAGE("-- Unable to find <unordered_map> or <tr1/unordered_map>. ")
MESSAGE("-- Replacing unordered_map/set with map/set (warning: slower!)")
ADD_DEFINITIONS(-DCERES_NO_UNORDERED_MAP)
ENDIF (UNORDERED_MAP_IN_TR1_NAMESPACE)
ENDIF (HAVE_TR1_UNORDERED_MAP_HEADER)
ENDIF (HAVE_STD_UNORDERED_MAP_HEADER)

INCLUDE(FindSharedPtr)
FIND_SHARED_PTR()
IF (SHARED_PTR_FOUND)
IF (SHARED_PTR_TR1_MEMORY_HEADER)
ADD_DEFINITIONS(-DCERES_TR1_MEMORY_HEADER)
ENDIF (SHARED_PTR_TR1_MEMORY_HEADER)
IF (SHARED_PTR_TR1_NAMESPACE)
ADD_DEFINITIONS(-DCERES_TR1_SHARED_PTR)
ENDIF (SHARED_PTR_TR1_NAMESPACE)
ELSE (SHARED_PTR_FOUND)
MESSAGE(FATAL_ERROR "Unable to find shared_ptr.")
ENDIF (SHARED_PTR_FOUND)

INCLUDE_DIRECTORIES(
include
internal
Expand All @@ -474,6 +485,7 @@ ENDIF (GFLAGS)

IF (BUILD_SHARED_LIBS)
MESSAGE("-- Building Ceres as a shared library.")
ADD_DEFINITIONS(-DCERES_BUILDING_SHARED_LIBRARY)
ELSE (BUILD_SHARED_LIBS)
MESSAGE("-- Building Ceres as a static library.")
ENDIF (BUILD_SHARED_LIBS)
Expand Down Expand Up @@ -523,16 +535,16 @@ IF (CMAKE_BUILD_TYPE STREQUAL "Release")
ENDIF (CMAKE_SYSTEM_NAME MATCHES "Darwin")
ENDIF (CMAKE_COMPILER_IS_GNUCXX)
IF (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
# Use of -O4 requires use of gold linker & LLVM-gold plugin, which might
# Use of -flto requires use of gold linker & LLVM-gold plugin, which might
# well not be present / in use and without which files will compile, but
# not link ('file not recognized') so explicitly check for support
INCLUDE(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-O4" HAVE_LTO_SUPPORT)
CHECK_CXX_COMPILER_FLAG("-flto" HAVE_LTO_SUPPORT)
IF (HAVE_LTO_SUPPORT)
MESSAGE(STATUS "Enabling link-time optimization (-O4)")
SET(CERES_CXX_FLAGS "${CERES_CXX_FLAGS} -O4")
MESSAGE(STATUS "Enabling link-time optimization (-flto)")
SET(CERES_CXX_FLAGS "${CERES_CXX_FLAGS} -flto")
ELSE ()
MESSAGE(STATUS "Compiler/linker does not support link-time optimization (-O4), disabling.")
MESSAGE(STATUS "Compiler/linker does not support link-time optimization (-flto), disabling.")
ENDIF (HAVE_LTO_SUPPORT)
ENDIF ()
ENDIF (CMAKE_BUILD_TYPE STREQUAL "Release")
Expand Down
99 changes: 99 additions & 0 deletions cmake/FindSharedPtr.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# Ceres Solver - A fast non-linear least squares minimizer
# Copyright 2014 Google Inc. All rights reserved.
# http://code.google.com/p/ceres-solver/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name of Google Inc. nor the names of its contributors may be
# used to endorse or promote products derived from this software without
# specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
# Author: [email protected] (Sergey Sharybin)
#

# FindSharedPtr.cmake - Find shared pointer header and namespace.
#
# This module defines the following variables:
#
# SHARED_PTR_FOUND: TRUE if shared_ptr found.
# SHARED_PTR_TR1_MEMORY_HEADER: True if <tr1/memory> header is to be used
# for the shared_ptr object, otherwise use <memory>.
# SHARED_PTR_TR1_NAMESPACE: TRUE if shared_ptr is defined in std::tr1 namespace,
# otherwise it's assumed to be defined in std namespace.

MACRO(FIND_SHARED_PTR)
SET(SHARED_PTR_FOUND FALSE)
CHECK_INCLUDE_FILE_CXX(memory HAVE_STD_MEMORY_HEADER)
IF (HAVE_STD_MEMORY_HEADER)
# Finding the memory header doesn't mean that shared_ptr is in std
# namespace.
#
# In particular, MSVC 2008 has shared_ptr declared in std::tr1. In
# order to support this, we do an extra check to see which namespace
# should be used.
INCLUDE(CheckCXXSourceCompiles)
CHECK_CXX_SOURCE_COMPILES("#include <memory>
int main() {
std::shared_ptr<int> int_ptr;
return 0;
}"
HAVE_SHARED_PTR_IN_STD_NAMESPACE)

IF (HAVE_SHARED_PTR_IN_STD_NAMESPACE)
MESSAGE("-- Found shared_ptr in std namespace using <memory> header.")
SET(SHARED_PTR_FOUND TRUE)
ELSE (HAVE_SHARED_PTR_IN_STD_NAMESPACE)
CHECK_CXX_SOURCE_COMPILES("#include <memory>
int main() {
std::tr1::shared_ptr<int> int_ptr;
return 0;
}"
HAVE_SHARED_PTR_IN_TR1_NAMESPACE)
IF (HAVE_SHARED_PTR_IN_TR1_NAMESPACE)
MESSAGE("-- Found shared_ptr in std::tr1 namespace using <memory> header.")
SET(SHARED_PTR_TR1_NAMESPACE TRUE)
SET(SHARED_PTR_FOUND TRUE)
ENDIF (HAVE_SHARED_PTR_IN_TR1_NAMESPACE)
ENDIF (HAVE_SHARED_PTR_IN_STD_NAMESPACE)
ENDIF (HAVE_STD_MEMORY_HEADER)

IF (NOT SHARED_PTR_FOUND)
# Further, gcc defines shared_ptr in std::tr1 namespace and
# <tr1/memory> is to be included for this. And what makes things
# even more tricky is that gcc does have <memory> header, so
# all the checks above wouldn't find shared_ptr.
CHECK_INCLUDE_FILE_CXX("tr1/memory" HAVE_TR1_MEMORY_HEADER)
IF (HAVE_TR1_MEMORY_HEADER)
CHECK_CXX_SOURCE_COMPILES("#include <tr1/memory>
int main() {
std::tr1::shared_ptr<int> int_ptr;
return 0;
}"
HAVE_SHARED_PTR_IN_TR1_NAMESPACE_FROM_TR1_MEMORY_HEADER)
IF (HAVE_SHARED_PTR_IN_TR1_NAMESPACE_FROM_TR1_MEMORY_HEADER)
MESSAGE("-- Found shared_ptr in std::tr1 namespace using <tr1/memory> header.")
SET(SHARED_PTR_TR1_MEMORY_HEADER TRUE)
SET(SHARED_PTR_TR1_NAMESPACE TRUE)
SET(SHARED_PTR_FOUND TRUE)
ENDIF (HAVE_SHARED_PTR_IN_TR1_NAMESPACE_FROM_TR1_MEMORY_HEADER)
ENDIF (HAVE_TR1_MEMORY_HEADER)
ENDIF (NOT SHARED_PTR_FOUND)
ENDMACRO(FIND_SHARED_PTR)
2 changes: 2 additions & 0 deletions cmake/FindSuiteSparse.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -523,8 +523,10 @@ FIND_LIBRARY(METIS_LIBRARY NAMES metis
PATHS ${SUITESPARSE_CHECK_LIBRARY_DIRS})
IF (EXISTS ${METIS_LIBRARY})
MESSAGE(STATUS "Found METIS library: ${METIS_LIBRARY}.")
set(METIS_FOUND TRUE)
ELSE (EXISTS ${METIS_LIBRARY})
MESSAGE(STATUS "Did not find METIS library (optional SuiteSparse dependency)")
set(METIS_FOUND FALSE)
ENDIF (EXISTS ${METIS_LIBRARY})
MARK_AS_ADVANCED(METIS_LIBRARY)

Expand Down
13 changes: 13 additions & 0 deletions docs/source/_templates/layout.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{% extends "!layout.html" %}

{% block footer %}
{{ super() }}
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-49769510-1', 'ceres-solver.org');
ga('send', 'pageview');
</script>
{% endblock %}
26 changes: 0 additions & 26 deletions docs/source/_themes/armstrong/LICENSE

This file was deleted.

11 changes: 0 additions & 11 deletions docs/source/_themes/armstrong/globaltoc.html

This file was deleted.

80 changes: 0 additions & 80 deletions docs/source/_themes/armstrong/layout.html

This file was deleted.

Loading

0 comments on commit 387ad8f

Please sign in to comment.