From 24f8d696879c1016bbcd51a087be1175a82eb6dc Mon Sep 17 00:00:00 2001
From: ShuangLiu1992 <ShuangLiu1992@users.noreply.github.com>
Date: Sat, 29 Apr 2023 22:24:28 +0100
Subject: [PATCH 3/3] Update HessianFactor.cpp

add static_cast to make compiler happy
---
 gtsam/linear/HessianFactor.cpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/gtsam/linear/HessianFactor.cpp b/gtsam/linear/HessianFactor.cpp
index 8980b5030..3c3050f90 100644
--- a/gtsam/linear/HessianFactor.cpp
+++ b/gtsam/linear/HessianFactor.cpp
@@ -72,7 +72,7 @@ HessianFactor::HessianFactor() :
 
 /* ************************************************************************* */
 HessianFactor::HessianFactor(Key j, const Matrix& G, const Vector& g, double f)
-    : GaussianFactor(KeyVector{j}), info_(Dims{G.cols(), 1}) {
+    : GaussianFactor(KeyVector{j}), info_(Dims{static_cast<Key>(G.cols()), 1}) {
   if (G.rows() != G.cols() || G.rows() != g.size())
     throw invalid_argument(
         "Attempting to construct HessianFactor with inconsistent matrix and/or vector dimensions");
@@ -85,7 +85,7 @@ HessianFactor::HessianFactor(Key j, const Matrix& G, const Vector& g, double f)
 // error is 0.5*(x-mu)'*inv(Sigma)*(x-mu) = 0.5*(x'*G*x - 2*x'*G*mu + mu'*G*mu)
 // where G = inv(Sigma), g = G*mu, f = mu'*G*mu = mu'*g
 HessianFactor::HessianFactor(Key j, const Vector& mu, const Matrix& Sigma)
-    : GaussianFactor(KeyVector{j}), info_(Dims{Sigma.cols(), 1}) {
+    : GaussianFactor(KeyVector{j}), info_(Dims{static_cast<Key>(Sigma.cols()), 1}) {
   if (Sigma.rows() != Sigma.cols() || Sigma.rows() != mu.size())
     throw invalid_argument(
         "Attempting to construct HessianFactor with inconsistent matrix and/or vector dimensions");
@@ -99,7 +99,7 @@ HessianFactor::HessianFactor(Key j1, Key j2, const Matrix& G11,
     const Matrix& G12, const Vector& g1, const Matrix& G22, const Vector& g2,
     double f) :
     GaussianFactor(KeyVector{j1,j2}), info_(
-        Dims{G11.cols(),G22.cols(),1}) {
+        Dims{static_cast<Key>(G11.cols()),static_cast<Key>(G22.cols()),1}) {
   info_.setDiagonalBlock(0, G11);
   info_.setOffDiagonalBlock(0, 1, G12);
   info_.setDiagonalBlock(1, G22);
@@ -113,7 +113,7 @@ HessianFactor::HessianFactor(Key j1, Key j2, Key j3, const Matrix& G11,
     const Matrix& G23, const Vector& g2, const Matrix& G33, const Vector& g3,
     double f) :
     GaussianFactor(KeyVector{j1,j2,j3}), info_(
-        Dims{G11.cols(),G22.cols(),G33.cols(),1}) {
+        Dims{static_cast<Key>(G11.cols()),static_cast<Key>(G22.cols()),static_cast<Key>(G33.cols()),1}) {
   if (G11.rows() != G11.cols() || G11.rows() != G12.rows()
       || G11.rows() != G13.rows() || G11.rows() != g1.size()
       || G22.cols() != G12.cols() || G33.cols() != G13.cols()
-- 
2.37.2

