diff --git a/gtsam/linear/HessianFactor-inl.h b/gtsam/linear/HessianFactor-inl.h index 31a327bb8..4a21ab0ff 100644 --- a/gtsam/linear/HessianFactor-inl.h +++ b/gtsam/linear/HessianFactor-inl.h @@ -26,7 +26,7 @@ namespace gtsam { GaussianFactor(keys), info_(augmentedInformation) { // Check number of variables - if(Base::keys_.size() != augmentedInformation.nBlocks() - 1) + if((DenseIndex)Base::keys_.size() != augmentedInformation.nBlocks() - 1) throw std::invalid_argument( "Error in HessianFactor constructor input. Number of provided keys plus\n" "one for the information vector must equal the number of provided matrix blocks."); @@ -38,4 +38,4 @@ namespace gtsam { "must be the information vector, but the last provided block had more than one column."); } -} \ No newline at end of file +} diff --git a/gtsam/linear/HessianFactor.cpp b/gtsam/linear/HessianFactor.cpp index d865bf589..f73b2b531 100644 --- a/gtsam/linear/HessianFactor.cpp +++ b/gtsam/linear/HessianFactor.cpp @@ -387,9 +387,9 @@ void HessianFactor::updateATA(const HessianFactor& update, const Scatter& scatte // Apply updates to the upper triangle gttic(update); for(DenseIndex j2=0; j2info_.nBlocks()-1 : slots[j2]; + DenseIndex slot2 = (j2 == (DenseIndex)update.size()) ? this->info_.nBlocks()-1 : slots[j2]; for(DenseIndex j1=0; j1<=j2; ++j1) { - DenseIndex slot1 = (j1 == update.size()) ? this->info_.nBlocks()-1 : slots[j1]; + DenseIndex slot1 = (j1 == (DenseIndex)update.size()) ? this->info_.nBlocks()-1 : slots[j1]; if(slot2 > slot1) info_(slot1, slot2).noalias() += update.info_(j1, j2); else if(slot1 > slot2) diff --git a/gtsam/linear/JacobianFactor-inl.h b/gtsam/linear/JacobianFactor-inl.h index fb9582f24..d703cde9f 100644 --- a/gtsam/linear/JacobianFactor-inl.h +++ b/gtsam/linear/JacobianFactor-inl.h @@ -39,11 +39,11 @@ namespace gtsam { Base(keys), Ab_(augmentedMatrix) { // Check noise model dimension - if(model && model->dim() != augmentedMatrix.rows()) + if(model && (DenseIndex)model->dim() != augmentedMatrix.rows()) throw InvalidNoiseModel(augmentedMatrix.rows(), model->dim()); // Check number of variables - if(Base::keys_.size() != augmentedMatrix.nBlocks() - 1) + if((DenseIndex)Base::keys_.size() != augmentedMatrix.nBlocks() - 1) throw std::invalid_argument( "Error in JacobianFactor constructor input. Number of provided keys plus\n" "one for the RHS vector must equal the number of provided matrix blocks.");