Work around MinGW32 manifold_test segfault

Converting fixed size vectors to dynamic ones allows to avoid
segmentation faults in Eigen's packet math if the corresponding
expressions are invoked within GMock matchers.

Fixes #996

Change-Id: I7da5599883825ab0e580678d3d55de19095b41b1
This commit is contained in:
Sergiu Deitsch
2023-09-07 21:54:49 +02:00
parent 5e4b22f7fc
commit de9cbde95d
+4 -4
View File
@@ -1,5 +1,5 @@
// Ceres Solver - A fast non-linear least squares minimizer
// Copyright 2022 Google Inc. All rights reserved.
// Copyright 2023 Google Inc. All rights reserved.
// http://ceres-solver.org/
//
// Redistribution and use in source and binary forms, with or without
@@ -99,7 +99,7 @@ MATCHER_P2(XPlusZeroIsXAt, x, tolerance, "") {
Vector actual = Vector::Zero(ambient_size);
Vector zero = Vector::Zero(tangent_size);
EXPECT_TRUE(arg.Plus(x.data(), zero.data(), actual.data()));
const double n = (actual - x).norm();
const double n = (actual - Vector{x}).norm();
const double d = x.norm();
const double diffnorm = (d == 0.0) ? n : (n / d);
if (diffnorm > tolerance) {
@@ -189,7 +189,7 @@ MATCHER_P3(MinusPlusIsIdentityAt, x, delta, tolerance, "") {
Vector actual = Vector::Zero(tangent_size);
EXPECT_TRUE(arg.Minus(x_plus_delta.data(), x.data(), actual.data()));
const double n = (actual - delta).norm();
const double n = (actual - Vector{delta}).norm();
const double d = delta.norm();
const double diffnorm = (d == 0.0) ? n : (n / d);
if (diffnorm > tolerance) {
@@ -214,7 +214,7 @@ MATCHER_P3(PlusMinusIsIdentityAt, x, y, tolerance, "") {
Vector actual = Vector::Zero(ambient_size);
EXPECT_TRUE(arg.Plus(x.data(), y_minus_x.data(), actual.data()));
const double n = (actual - y).norm();
const double n = (actual - Vector{y}).norm();
const double d = y.norm();
const double diffnorm = (d == 0.0) ? n : (n / d);
if (diffnorm > tolerance) {