commit | 1f374a9fe53e362ab76fb36e1dc53f6609991009 | [log] [tgz] |
---|---|---|
author | Sergiu Deitsch <sergiu.deitsch@gmail.com> | Sun Nov 21 15:26:45 2021 +0100 |
committer | Sergiu Deitsch <sergiu.deitsch@gmail.com> | Mon Nov 29 21:33:28 2021 +0100 |
tree | 8ca1ef5f89d6afd7ea5f83fa7eb0ad1d121632bf | |
parent | 06e68dbc5a0895ba18da8dc8123a845648108e33 [diff] |
Support promotion in comparison between Jet and scalars Previously, Jet did not allow comparison between its value and a scalar of another type. Specifically, the comparison was limited to scalars of the same type effectively disabling standard promotion rules. Instead, users would be required either to cast values to target Jet arithmetic type or explicitly construct a Jet instance that can be eventually used for comparison purposes. However, such a behavior is not intuitive and causes problems with types that rely on standard promotion rules (e.g., std::complex in some implementations). This changeset extends the comparison operators by enabling logical comparisons between a Jet and values compatible to the underlying scalar type (e.g., int). To be as generic as possible, the types allowed to be passed to comparison operators are constrained using SFINAE. This in turn allows a recursive expansion of jets and therefore the comparison of a nested jets with a scalar. The changes alleviate problems described in #414 and also allow the use of special functions from Boost.Math, e.g., for computing the reciprocal using boost::math::pow<-1>(...). Change-Id: I3625791e6c8c2c0bfbffbbdb09e179a32e57f306
Ceres Solver is an open source C++ library for modeling and solving large, complicated optimization problems. It is a feature rich, mature and performant library which has been used in production at Google since 2010. Ceres Solver can solve two kinds of problems.
Please see ceres-solver.org for more information.