Align Jet matrices where supported

We currently don't align the infinitesimal part of a Jet to a 16-byte
boundary (and thus force Eigen to avoid using SSE ops)--as a member of a
larger struct, we couldn't guarantee Jets would be allocated on
appropriately-aligned boundaries.  However, C++11 adds better support
for requesting alignment: we can use it to guarantee the members will be
properly aligned, and tell Eigen to vectorize.

There is a significant gotcha here: the standard gives wide latitude to
implementations as to which alignments they choose to support.  If we
ask for 16 and the system only supports 8, we may have misaligned
Jets. So we test (using alignof(std::max_align_t)) that the current
system supports 16-byte aligned values; if not, we fall back to the
current solution.

Two other small notes:
- This is obviously gated on C++11 support, and
  thus we put the logic in port.h and export some useful #defines.

- GCC 4.8.x has a
  bug (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56019) that has
  max_align_t in the wrong namespace.  This will not be a problem with a
  modern GCC, but add a small workaround since many systems still ship 4.8.

This results (on a x86 workstation) in a 60% speedup in Jacobian
evaluation on bin/simple_bundle_adjuster problem-16-22106-pre.txt.

Change-Id: I169b637a1e2a106956b536c41d6a514a266e7cc0
2 files changed
tree: 1d83181e28d32972dd8c4d43bc22cd338a4bef64
  1. cmake/
  2. config/
  3. data/
  4. docs/
  5. examples/
  6. include/
  7. internal/
  8. jni/
  9. scripts/
  10. .gitignore
  11. CMakeLists.txt
  12. LICENSE
  13. README.md
README.md

Ceres Solver - A non-linear least squares minimizer

Please see ceres-solver.org for more information.

WARNING - Do not make GitHub pull requests!

Ceres development happens on Gerrit, including both repository hosting and code reviews. The GitHub Repository is a continuously updated mirror which is primarily meant for issue tracking. Please see our Contributing to Ceres Guide for more details.

The upstream Gerrit repository is

https://ceres-solver.googlesource.com/ceres-solver