- Required after updates to use Eigen's own Eigen3Config.cmake instead
of our original FindEigen.cmake module.
Change-Id: I9b5ad43fa153713c64fc01d638611e9bae3a169b
The autodiff code generator is extended in the following ways:
- Evaluate the complete jacobian into a temporary array
- Copy the temporary jacobian to the result if != NULL
Change-Id: If5ed0bff3b31e93a2d7d5dc718862cb648dba474
Before this patch the return type was implicitly defined by the
ExpressionType. This patch separates this connection and allows
each Expression to have one of the predefined types (scalar,
boolean, void).
This patch is required to add support for the functions isfinite,
isinf, isnan, and isnormal. These are function taking a double and
returning a bool.
This also moves some complexity of the code generator to the
Expression, because the generator can direclty get the c++ type.
Change-Id: I8b32bab1bfab2f668875e506d6f3b789a5d1f3fd
- Move codegen tests to a sub directory
- Add tests for all functions of Expression, ExpressionRef, and ExpressionGraph
- Respect dependencies during tests: The ExpressionGraph test doesn't
use ExpressionRef anymore.
The new tests revealed a few bugs so the following changes were made:
- Expression::MakeNop now resets the current expression with the default
constructed NOP expression
- ExpressionGraph::Insert now updates the lhs_id the same way as
InsertBack()
Change-Id: I6a18925c1e4d972c29ec1219f2073b4eaf2df737
Objects of 'Expression' can now be freely created and copied around.
This creation does NOT add them to the active ExpressionGraph any
more. The insertion into the graph is now done by ExpressionRef,
which explicitly call graph.add(...) in each operation.
This change brings the following advantages:
1. 'Expression' is now stand-alone and side-effect free
- Remove the dependency Expression->ExpressionGraph
- Expressions can be created by the optimizer
2. Explicit graph insertion
- Previously CreateCompileTimeConstant not only created an
expression, but also inserted it into the active graph. Now
this insertion is done explicitly by ExpressionRef
3. It is now easier to insert new types and members
- Should be straight forward now, because we got rid of the
3-way dependency
- This is a preparation patch for the new return-type member in
https://ceres-solver-review.googlesource.com/c/ceres-solver/+/16224
Change-Id: Icef2fe529a4db001a10d1fb6816c9dc681b14ff2
After this patch, users have to add -DCODE_GENERATION=ON to the
cmake command, if they want to compile the code generation module.
A warning is printed if they enable code generation.
This informs the users that the code generation is still under
development and should be used with care. Also, we don't break
the master branch immediately if one of the bigger codegen
patches fails to build on some platform.
When this system is finished, we can enable it by default or
remove this option again.
Change-Id: Ib26498f0d5bd8b3c165807ffd774c057c2d21d39
when using the command target_link_libraries explicitly state if the
linked library needs to be linked publicly or only private
Change-Id: I44eb7cb7ed06fdab12412963e6ce705b1fb718b4
The public API for the Autodiff Codegen system consist of a single
function, GenerateCodeForFunctor. This function takes as template
argument a cost functor type and the residual/parameter structure.
The output is the C++ for the residual and derivative. This class
mainly serves as a wrapper for the different codegen modules.
Change-Id: I8ee974199219805d54eed5e07c0e8d1394940779
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
- Fix Homebrew Ruby errors by forcing brew update before install.
- Remove use of custom Eigen 3.3.4 on Linux in favour of default Bionic
3.3.4 package.
- Update Android NDK version to R20b and build for arm64-v8.
- Fix erroneous string -> STRING in iOS toolchain file.
Change-Id: I041c2a08b92b8307c12bd8967159beb6984e3c65
- As detailed in a previous CL, Xcode 11.0-1 exhibited a -fstack-check
bug on 10.15 Catalina that broke alignment for at least AVX
instructions causing segfaults from within Eigen.
- As Xcode 11.2 fixes this issue, and is probably a more reliable fix
than -fno-stack-check, we now require the user update in this case.
Change-Id: I482748fe5f40f82e7daf4da133cdfabbd95ffc89
- Expression types for if/else blocks
- CERES_IF/ELSE macros
- Multiple assignment to the same variable
Change-Id: If529516f243f31823d1ef7b8827bb6f2390e418d
- On macOS 10.15 and Xcode 11 -fstack-check is enabled by default. This
breaks SIMD alignment (and other alignment) as detailed here:
https://forums.developer.apple.com/thread/121887 resulting in random
segfaults from within Eigen.
- The underlying problem also exists with earlier OS versions running
Xcode 11 if -fstack-check is explicitly enabled.
- This CL explicitly disables -fstack-check on affected versions of
macOS 10.15 and Xcode 11.
Change-Id: I74d964281c360710d5fb722ac59e6930b0fdcc41
In the docs, `Solver::Options::gradient_check_relative_precision` is
documented to have a default precision of 1e08. That is incorrect, it
should be 1e-8.
Change-Id: Ib6b29e356738de4b555c77f7ffd1224d0cae4b6a
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
A number of algorithms like the SchurEliminator do not need
access to the full BlockSparseMatrix interface. They only
need read only access to the values array and the block structure.
This change introduces, BlockSparseDataMatrix a struct that carries
these two bits of information and modifies the Schur type algorithms
to use it.
What this change will allow us to do, in a subsequent CL is to
take the values array of a BlockSparseMatrix and pair it with
a different blocks structure for subset preconditioning.
Change-Id: I1808f12531b586c9ff4d6a70b3d390c7b0d9f441
The CHECK was to see if SuiteSparseQR returns a non-null QR
factorization. However this can cause problems in production, so its
better to return false and let the user deal with the failure in
factorization.
Change-Id: I4e67f343e30547f4257d0315d507df9864c06dcc
1. Mismatched variable names in local_parameterization.h/cc
2. Add missing final directives in iterative_refiner_test.cc
Change-Id: I954ef00d74c3b5d99f3659cc5c6ee2293fa9ff92
Also run clang-format on schur_complement_solver.cc.
A more elaborate integration is not done, because it will cause
binary bloat.
Change-Id: Idf4e9e1794f7401a39f05fb145ec06459209a1e1
If Ceres is compiled without a LAPACK implementation, there is
no need to declare these function signatures.
Thanks to David Sinuela for reporting this.
Change-Id: I048d1f9d38cef55368d33e74d363cd39f425dbf4
Now that we are using c++11, it is safer to use override in subclasses
instead of virtual.
This CL does it for the interface, a follow up CL will do it for
other parts of the code base.
Change-Id: Ice8d0f4355cb700019d7a9c1566fbff0099e97d6
- Maintain scratch workspaces for solving/refactoring instead of
forcing Sparse[Refactor/Solve]() to reallocate space on each call.
Change-Id: Idb9eda9c9c6cc7570cfdf851e59e5bf6b39521ce