20#ifndef KO_READ_DATA_HPP
21#define KO_READ_DATA_HPP
56std::pair<KO_Traits::StoringMatrix,std::vector<int>>
68 std::vector<int> row_removed;
69 return std::make_pair(x,row_removed);
76 std::vector<int> temp;
77 temp.resize(X.nrow());
78 std::iota(temp.begin(),temp.end(),
static_cast<int>(0));
79 std::set<int> all_rows(temp.begin(),temp.end());
82 std::set<int> rows_to_be_removed;
83 std::set_difference(all_rows.begin(),all_rows.end(),
84 rows_to_be_retained.begin(),rows_to_be_retained.end(),
85 std::inserter(rows_to_be_removed,rows_to_be_removed.begin()));
91 std::vector<int> rows_retained(rows_to_be_retained.begin(),rows_to_be_retained.end());
98 auto check_nan = std::find_if(x.reshaped().cbegin(),x.reshaped().cend(),[](T el){return std::isnan(el);});
101 if (check_nan!=x.reshaped().end())
107 return std::make_pair(data_clean.
data(),rows_retained);
113 return std::make_pair(data_clean.
data(),rows_retained);
117 return std::make_pair(x,rows_retained);
Template class for removing NaNs from an Eigen::Matrix.
Definition removing_nan.hpp:64
void remove_nan()
Function to remove the row (dummy NaNs)
Definition removing_nan.hpp:115
KO_Traits::StoringMatrix data() const
Getter for the data matrix.
Definition removing_nan.hpp:103
std::pair< KO_Traits::StoringMatrix, std::vector< int > > reader_data(Rcpp::NumericMatrix X, REM_NAN MA_t)
Function that reads data from R containers, substitute actual NaNs, handle dummy NaNs,...
Definition data_reader.hpp:57
Contains methods to check and wrap R-inputs into PPCKO-coherent ones.
REM_NAN
The available strategy for removing non-dummy NaNs.
Definition parameters_wrapper.hpp:366
@ ZR
Replacing nans with 0s (could change the sd of the distribution)
Definition parameters_wrapper.hpp:369
@ MR
Replacing nans with mean (could change the mean of the distribution)
Definition parameters_wrapper.hpp:368
@ NR
Not replacing NaN: not to be used by the user, necessary for handling dummy NaNs.
Definition parameters_wrapper.hpp:367
Contains the class to remove (dummy and not dummy) NaNs.
std::set< int > rows_entire_NaNs(const Rcpp::NumericMatrix &x)
Identifying rows of only NaNs.
Definition removing_nan_cleaner_imp.hpp:54
Rcpp::NumericMatrix removing_NaNS_entire_rows(const Rcpp::NumericMatrix &x, const std::set< int > &rows_to_be_kept)
Removing rows of only NaNs.
Definition removing_nan_cleaner_imp.hpp:87
Eigen::MatrixXd StoringMatrix
Matrix data structure.
Definition traits_ko.hpp:49
Contains customized types and enumerator for customized template parameters, exploited in the algorit...