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
diff --git a/include/ceres/manifold_test_utils.h b/include/ceres/manifold_test_utils.h index f8ed557..3e61457 100644 --- a/include/ceres/manifold_test_utils.h +++ b/include/ceres/manifold_test_utils.h
@@ -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 @@ 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 @@ 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 @@ 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) {