1#include "../include/utils.h"
12 std::vector<int> data_vec;
15 std::stringstream ss(str);
21 std::getline(ss, substr,
',');
22 data_vec.push_back(std::stoi(substr));
37 std::vector<double> data_vec;
40 std::stringstream ss(str);
46 std::getline(ss, substr,
',');
47 data_vec.push_back(std::stod(substr));
62 std::vector<double> matrix_entries;
65 std::ifstream matrix_data_file(filename);
68 std::string matrix_row_string;
71 std::string matrix_entry;
74 int matrix_row_number = 0;
78 while (std::getline(matrix_data_file, matrix_row_string))
81 std::stringstream matrix_row_string_stream(matrix_row_string);
86 while (std::getline(matrix_row_string_stream, matrix_entry,
','))
90 matrix_entries.push_back(stod(matrix_entry));
102 return Eigen::Map< Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic,
103 Eigen::RowMajor>>(matrix_entries.data(), matrix_row_number,
104 matrix_entries.size() / matrix_row_number);
static Eigen::MatrixXd load_matrix_data(std::string filename)
Load Eigen double matrix from csv file.
static std::vector< double > analog_str_buf_to_double_vec(const std::string &str)
Convert comma-delimited string to double vector of analog values.
static std::vector< int > analog_str_buf_to_int_vec(const std::string &str)
Convert comma-delimited string to int vector of analog values.