From a90eaba499dc45f05f76629c19d25552f55c8c87 Mon Sep 17 00:00:00 2001 From: gmweaver Date: Tue, 25 Jun 2024 21:39:37 -0700 Subject: [PATCH] fix Eigen::Map for empty matrix in CV entrypoint --- src/rcpp_wrappers_cv.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/rcpp_wrappers_cv.cpp b/src/rcpp_wrappers_cv.cpp index dda734d..04f0baa 100644 --- a/src/rcpp_wrappers_cv.cpp +++ b/src/rcpp_wrappers_cv.cpp @@ -184,7 +184,7 @@ Eigen::VectorXd fitModelCVRcpp(SEXP x, ); else { Rcpp::NumericMatrix ext_mat(ext); - MapMat extmap((const double *) &ext_mat[0], ext_mat.rows(), ext_mat.cols()); + MapMat extmap = createEigenMapFromRcppNumericMatrix(ext); return fitModelCV( xmap, is_sparse_x, y, extmap, fixed, weights_user, intr, stnd, penalty_type, @@ -211,7 +211,7 @@ Eigen::VectorXd fitModelCVRcpp(SEXP x, } else { Rcpp::NumericMatrix ext_mat(ext); - MapMat extmap((const double *) &ext_mat[0], ext_mat.rows(), ext_mat.cols()); + MapMat extmap = createEigenMapFromRcppNumericMatrix(ext); return fitModelCV( xmap, is_sparse_x, y, extmap, fixed, weights_user, intr, stnd, penalty_type, cmult, @@ -235,7 +235,7 @@ Eigen::VectorXd fitModelCVRcpp(SEXP x, } else { Rcpp::NumericMatrix ext_mat(ext); - MapMat extmap((const double *) &ext_mat[0], ext_mat.rows(), ext_mat.cols()); + MapMat extmap = createEigenMapFromRcppNumericMatrix(ext); return fitModelCV( Rcpp::as(x), is_sparse_x, y, extmap, fixed, weights_user, intr, stnd, penalty_type, cmult,