diff options
author | YimingWu <xp8110@outlook.com> | 2021-03-10 02:59:23 +0300 |
---|---|---|
committer | YimingWu <xp8110@outlook.com> | 2021-03-10 02:59:23 +0300 |
commit | 9166075cbeb4163566bf943f7844759702147a8a (patch) | |
tree | 1109502274df385ceabfbb3707a56e164c121edc /intern/libmv/libmv/numeric/function_derivative_test.cc | |
parent | 10c097eff0416368bf769c3349e9c81c12f19d5f (diff) | |
parent | 53b82efed66baddff3b7ef6c93a919ef10f4ef42 (diff) |
Merge remote-tracking branch 'origin/master' into lanpr-under-gp
Diffstat (limited to 'intern/libmv/libmv/numeric/function_derivative_test.cc')
-rw-r--r-- | intern/libmv/libmv/numeric/function_derivative_test.cc | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/intern/libmv/libmv/numeric/function_derivative_test.cc b/intern/libmv/libmv/numeric/function_derivative_test.cc index 8d976d3e9a0..defeedaa8a4 100644 --- a/intern/libmv/libmv/numeric/function_derivative_test.cc +++ b/intern/libmv/libmv/numeric/function_derivative_test.cc @@ -18,9 +18,9 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS // IN THE SOFTWARE. -#include "testing/testing.h" -#include "libmv/numeric/numeric.h" #include "libmv/numeric/function_derivative.h" +#include "libmv/numeric/numeric.h" +#include "testing/testing.h" using namespace libmv; @@ -30,22 +30,22 @@ class F { public: typedef Vec2 FMatrixType; typedef Vec3 XMatrixType; - Vec2 operator()(const Vec3 &x) const { + Vec2 operator()(const Vec3& x) const { Vec2 fx; - fx << 0.19*x(0) + 0.19*x(1)*x(1) + x(2), - 3*sin(x(0)) + 2*cos(x(1)); + fx << 0.19 * x(0) + 0.19 * x(1) * x(1) + x(2), + 3 * sin(x(0)) + 2 * cos(x(1)); return fx; } - Mat23 J(const Vec3 &x) const { + Mat23 J(const Vec3& x) const { Mat23 jacobian; - jacobian << 0.19, 2*0.19*x(1), 1.0, - 3*cos(x(0)), -2*sin(x(1)), 0; + jacobian << 0.19, 2 * 0.19 * x(1), 1.0, 3 * cos(x(0)), -2 * sin(x(1)), 0; return jacobian; } }; TEST(FunctionDerivative, SimpleCase) { - Vec3 x; x << 0.76026643, 0.01799744, 0.55192142; + Vec3 x; + x << 0.76026643, 0.01799744, 0.55192142; F f; NumericJacobian<F, CENTRAL> J(f); EXPECT_MATRIX_NEAR(f.J(x), J(x), 1e-8); |