From 15fc8816fc4aac5dde9325cb67b3fd6c16aaa6db Mon Sep 17 00:00:00 2001 From: Michael Chirico Date: Thu, 31 Mar 2022 14:56:19 -0700 Subject: [PATCH] initialize variables for the case X.empty() As flagged by the clang warning `-Wsometimes-uninitialized` --- src/RcppPseudoApprox.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/RcppPseudoApprox.cpp b/src/RcppPseudoApprox.cpp index fd877bc4..c8bcca27 100644 --- a/src/RcppPseudoApprox.cpp +++ b/src/RcppPseudoApprox.cpp @@ -9,7 +9,7 @@ float LinearInterpolation ( const Eigen::Map & X , const Eigen //Y : vector containing the Y variables of the interpolant //PointOfInterest : Point of X to estimate the new point of Y - float xk, xkp1, yk, ykp1 = 0; //Points adjecent to the point of interpolation + float xk = 0, xkp1 = 0, yk = 0, ykp1 = 0; //Points adjecent to the point of interpolation if ( X.size() != Y.size() ){ Rcpp::stop("Problem with unequal vector sizes when doing linear interpolation.");} //cout << " X(0): " << X(0) <<" X(Y.size()-1): " <