MSVC rightfully issues warning C4305: 'if': truncation from 'size_t' to
'bool' in a static_assert condition that implicitly converts sizeof
result to a boolean.
Change-Id: Ie3b913288bfeaa7a4b362ef7f83d2505ed368641
Previously they were defined in manifold.h but their implementations
were in the internal directory and to prevent circular dependencies
the implementation headers were pushed to the bottom of manifold.h
This started out as one header and has become progressively worse
as more manifolds are templated.
This change moves the two manifolds into their own headers which
also contain their implementations.
Change-Id: I671da0279a47cd2ff1f52c69a1d159426f55bd80
Disable the definition of `min`/`max` macros by defining `NOMINMAX`
and prevent macro substitution in the public interface.
Also, quiet floating-point comparisons are defined as template functions
by the MSVC STL which causes compilation errors due to ambiguities in
resolving the template parameter types.
Fixes#668Fixes#716Fixes#718
Change-Id: I5fe7832a6a3a7ad0421a2557527528c34b88e9c7
Currently, the logic for exporting symbols is rather complicated: when
tests are enabled internal symbols are exported in addition to the
public symbols. Such logic causes several problems. (1) Test binaries
link against a Ceres build that is different from the final release
since fewer optimizations are applied if more symbols are exported. (2)
Also, some toolchains hide symbols by default breaking the existing
logic eventually causing linker errors.
Since internal symbols are not intended to be used outside of the
project, we can compile them into object files and use exactly the same
binary code both for the final build and the tests without relying on
conditionals.
By default, all symbols are now hidden unless annotated as public.
Internal symbols are explicitly marked as not being exported in case
users chose not to hide symbols by default.
Change-Id: I589dd10be2f6f438508783cf99d141af0120057b
This change is needed because compiler attributes and c++
annotations like [[deprecated]] do not mix well and we need that
for our public API.
https://github.com/ceres-solver/ceres-solver/issues/749
Change-Id: I79eda795f2912f9af9ab36ee24b8428b47104743
This MR ports the LineParameterization of manifolds. The unit test are
rewritten to use the manifold test facilities.
The LineManifold is extended so that it can also handle dynamic size
ambient space dimensions.
Change-Id: I1fe3cd34b56f74b72ca028c34f5368e9df9fe4d7
This MR adds SphereManifold ported from
HomogeneousVectorParameterization. Additionally the minus operator
and jacobian evaluation was implemented.
The unit tests were almost completly reimplemented and uses the
test facilities provided for manifolds.
Change-Id: Iccf72a2333bc921ff24c4d831db35020c653ee86
Complete support for all floating-point classification functions
(fpclassify, signbit) and consistently apply all overloads recursively
to the scalar part of a Jet only. This is now inline with how comparison
operators work. Sanity checks of derivatives should be performed
explicitly on the dual part of a Jet due an ambiguity on reducing the
classification results of multiple values.
Provide an fdim overload (in addition to fmin and fmax) and support
quiet versions of comparison operators also applied recursively to the
scalar part of a Jet but without type promotion.
Additionally, deprecate Ceres legacy classification functions. New code
should use C++11 function names for consistency.
Finally, simplify expressions using introduced scalar classification and
comparison.
Change-Id: I397e37425760717b991eb7ae5da0892f20c5a365
This is needed to add a layer of indirection which will allow
us to use gflags in the public version and absl inside Google.
Change-Id: I32f3da23200a01c9b658bbf8aaa66cb8fddc2cc3
- ensure all public headers files adhere to clang-format
- preserve one-per-line for enums by adding trailing comma
- preserve include order for en/disable_warning.h
Change-Id: I78dbd0527a294ab2ec5f074fb426e48b20c393e6
- Removes all workarounds for pre-C++14 versions
- Removes '11' qualifier from C++ threading option and associated
defines.
- Fix missing inclusion of 'Multithreading' in reported Ceres components
when C++ threading model is enabled.
- Update Sphinx documentation to specify C++14 as minimum requirement.
Change-Id: I706c8b367b3221e3c4d1a0aaf669a8f9c911e438
- Raised as issue #551
- Also adds C++20 to the set of ALLOWED_CXX_STANDARDS, although this
will require a version of CMake >= 3.12.
Change-Id: I0f13c72e93a35391fd2d18590b4243a329a2322c
- This results in the same performance as the original solution of
increasing -inline-threshold, but this approach is more viable to
incorporate in a large code base as its effects are more targeted.
Change-Id: Id798dbca7d3050de0ea847a5ecc69484ac78a2cf
A recent change made this function templated and MSVC 16 has trouble
doing automatic argument deduction, so the type of the template is
simplified and all callsites are explicitly annotated with the type
of the arguments.
Change-Id: I83cd0269e6e82c4a8f4e391f5fc03b92c942f74d
This CL adds a local parameterization for a n-dimensional
line, which is represented as an origin point and a direction.
The line direction is updated in the same way as a
homogeneous vector and the origin point is updated
perpendicular to the line direction.
Change-Id: I733f395e5cc4250abf9778c26fe0a5ae1de6b624
Inlining the Jet initialzation is mandatory for good performance
in autodiff, because all the constants in the dual part can be
propagated into the cost functor.
This patch unrolls the initialization loop with templates and adds
EIGEN_ALWAYS_INLINE to the constructors.
Change-Id: Ic89d645984f3e1df6c63948236da823ba60d9620
The class ArraySelector is now used in autodiff to store the
parameters and residuals. This reduces overhead of FixedArray
for fixed-sized residuals and allows more optimizations due
to inlining and unrolling.
Change-Id: Ibadc5644e64d672f7a555e250fb1f8da262f9d4f
The compile-time constant kNumResiduals is now passed to the
autodiff functions as a template parameter. This will be used
by future patches to optimize autodiff performance.
Change-Id: Ia2b2cc99b88752e8f12f4ce2542b1963bda552f5
This CL improves the build experience with MSVC:
- It adds the build flag '/bigobj' otherwise the build of
the unit test fails.
- It adds the flag '/wd4267' to suppress signed / unsigned int
conversions (size_t to int).
- It removes the use of std::aligned_storage from FixedArray.
This has been done from the Abseil Team and is in the
absl::FixedArray. Those changes has been ported to ceres.
This fixes the alignemnt for older MSVC versions due to a
bug in the implementation of std::aligned_storage, and
prevents the use of the macro '_ENABLE_EXTENDED_ALIGNED_STORAGE'
for newer MSVC versions, which is problematic as it could affect
user code.
- Fix of the fixed array unit test. Due to the use of std::tuple
instead of absl::tuple in ceres::internal::FixedArray, the
unit test needs to reflect that change as well.
- Replaces 'add_definitions' with 'add_compile_options' for
compiler flags as suggested by the cmake documentation.
Change-Id: I63f08cd6c0a8db8c9931289b909b4deafd75b039
User defined cost functors have to include this new header
instead of internal/expression_ref.h. This hides some
complexity of ExpressionRef and reduces compile time outside
of code generation mode.
This patch also removes the dependency ExpressionRef->Jet.
Change-Id: Ie3f93648775e14881dc5cfab213bbc983c6cfeee
The move constructor of ExpressionRef now implements the copy
elision, which was incorrectly done by the copy constructor.
This patch also updates the CMakeList to only add the
Expression tests for gcc. This is currently required, because
the AutoDiffCodeGen system relies on implementation defined
behaviour. (Evalution order + copy elision)
Change-Id: Ib17aeb22bd4d81de6d838b55c1b6497fb3740d0e
Currently there is a bug in the copy constructor of ExpressionRef.
Fixing this bug, will create new expressions each time a copy is
executed. To reduce the amount of copy expression we pass
ExpressionRef by const reference now.
Change-Id: I0f81fb3d08aa4c66b9191f3138650f17023af67e
This functions allows the insertion of new expression anywhere into
the graph. All references are updated. This will be used by semantic
expression testing and by the optimizer.
Change-Id: Ieafcfec7672f6328106dc0511c85d6fb5bd64d97
- Add operator== for comparing Expressions and ExpressionGraphs.
- Remove the broken Jet-test for now. (Will be added again later)
Change-Id: I3ee1599e8a0b50fa61c16f30812c78db7333f273
Due to the removed definition, calling this method will result
in a compile-time error instead of a run-time error.
Change-Id: Iac2514c05d79a66fcbad124587d08eb9309aa6a5
- Remove TERNARY (replaced by function call)
- Combine PARAMETER and RUNTIME_CONSTANT into INPUT_ASSIGNMENT
Change-Id: Id35fb45da08a9f80c1ac0dab7008deb0b3922835
- Add missing copy constructor
- Add make functions for input/output expressions
- Add missing ExpressionRef overload for MakeRuntimeConstant
- Add ExpressionRef overloads for common functions (cos,exp,...)
- Make ExpressionRef constructor from double implicit
- Add simple test for using ExpressionRef in Jets.
- Rename expression test macro
Change-Id: I071dc6717e4034a281662021998a91e80636da27
- Expression types for if/else blocks
- CERES_IF/ELSE macros
- Multiple assignment to the same variable
Change-Id: If529516f243f31823d1ef7b8827bb6f2390e418d
This patch adds the 'Expression' class, which is a fundamental
building block of automatic code generation. The expressions can
be used as scalar types for cost functors as well as Jets.
Dynamic branching is not yet supported.
Change-Id: I8c61bee5c307e0eec20fd39382683ea90f720dff
For proper alignment on the heap Eigen needs to have a custom
allocator. There are two forms, new and in-place new. To make sure
that memory is aligned using new, one needs to overload new by
adding EIGEN_MAKE_ALIGNED_OPERATOR_NEW to any struct which contains a
fixed size Eigen type either through inheritance or as a direct or
indirect member. For the in-place new one need to use the
Eigen::aligned_allocator (e.g. for std::vector, std::list,
FixedArray, etc.). For more details see:
https://eigen.tuxfamily.org/dox/group__DenseMatrixManipulation__Alignement.html
This CL adds EIGEN_MAKE_ALIGNED_OPERATOR_NEW to all structs, which
contain fixed-size Eigen types and uses the Eigen::aligned_allocator
for containers which stores structs of fixed-size Eigen types.
Change-Id: I06c6c4fc74a6835918d5d1c571b7814a14c029d8
This PR changes the implementation of the current fixed array to the
abseil one, which has proper allocator support.
Some minor changes are made to make the fixed array implementation
self-contained (no dependent to abseil):
- No address sanitizer support (red zones, etc.)
- Remove of noexecpt specified for copy and move constructor.
- Remove of 'at' function as Ceres does not use exceptions.
- Use std::tuple instead of absl::CompressedTuple as it uses the abseil
utility header which includes a whole bunch of other headers.
Change-Id: I43445b42c37f944509b5353a587d0efce74cbccf
This is to FirstOrderFunction, what AutoDiffCostFunction is to CostFunction.
This allows users of GradientSolver to be able to define objective functions
without requiring them to define the derivatives.
The implementation uses the same Jet objects for computing the gradient as
is used by AutoDiffCostFunction.
Change-Id: Ide6e60532a3adab9be9899ba9b368dc267fd2dbb
This CL fixes a regression bug in numeric differentiation where the
differentiation is called even if the parameter block is hold constant.
This resulted into a write to a nullptr.
A unit test is added for Jacobian evaluation of constant parameters.
Change-Id: Ia0f7c6cc7ef18f0f2cd6d758a839729b8ff606a0
This PR changes the interface of sized_cost_fucntion,
autodiff_cost_function and numeric_diff_costfunction from using ten
hardcoded parameter blocks to a variable number of parameter blocks
using variadic templates.
Trailing parameter blocks of size zero are now considered as error.
Change-Id: I37b9a0a420ef0eda6476a46672bbf6bd57e19760