40(
const valid_err_variant& var)
44 return std::visit([](
auto&& arg) -> Rcpp::List
47 using T = std::decay_t<
decltype(arg)>;
50 if constexpr (std::is_same_v<T, std::vector<double>>)
52 return Rcpp::List::create(Rcpp::Named(
"Errors") = Rcpp::wrap(arg));
55 else if constexpr (std::is_same_v<T, std::vector<std::vector<double>>>)
57 Rcpp::List res(arg.size());
58 for (
size_t i = 0; i < arg.size(); ++i)
60 res[i] = Rcpp::wrap(arg[i]);
63 return Rcpp::List::create(Rcpp::Named(
"Errors") = res);
68 Rcpp::stop(
"Wrong type in variant!");
96 return Eigen::Map<const KO_Traits::StoringMatrix>(col.data(),rows,cols);
112 if(row_ret.size()==0){
return pred;}
115 pred_comp.setConstant(std::numeric_limits<double>::quiet_NaN());
119 std::for_each(row_ret.cbegin(),row_ret.cend(),[&pred_comp,&pred,&counter](
int el){pred_comp[el]=pred[counter]; counter++;});
Eigen::VectorXd StoringVector
Vector data structure.
Definition traits_ko.hpp:51
Eigen::MatrixXd StoringMatrix
Matrix data structure.
Definition traits_ko.hpp:49
Contains customized types and enumerator for customized template parameters, exploited in the algorit...
KO_Traits::StoringMatrix from_col_to_matrix(const KO_Traits::StoringVector &col, int rows, int cols)
Function to map a column vector into a matrix, column by column.
Definition utils.hpp:94
KO_Traits::StoringVector add_nans_vec(const KO_Traits::StoringVector &pred, const std::vector< int > &row_ret, int complete_size)
Function to add dummy NaNs to the curve/surface.
Definition utils.hpp:110
Rcpp::List valid_err_disp(const valid_err_variant &var)
Function to dispacth the error type depending on if cv is performed on one or two parameters,...
Definition utils.hpp:40
KO_Traits::StoringVector from_matrix_to_col(const KO_Traits::StoringMatrix &mat)
Function to map a matrix into a column vector, column by column.
Definition utils.hpp:80