-
Notifications
You must be signed in to change notification settings - Fork 0
/
read_csv.h
executable file
·36 lines (30 loc) · 1.75 KB
/
read_csv.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//------------------------------------------------------------------------------
//
// READ CSV UTILS
// Methods to read data form a csv file
//
//------------------------------------------------------------------------------
#ifndef READ_CSV
#define READ_CSV
//STD libs
#include<fstream>
#include<iostream>
#include<string>
#include<vector>
//OpenMP libs
#include"omp.h"
//Eigen libs
#include "Eigen/Dense"
#include "Eigen/Core"
#include "Eigen/Sparse"
#include "Eigen/Eigenvalues"
//Read data (features and output data) from "filename".csv. Saves the features in x_data and the outputs in y_data. Separating char is the separating char of the csv file; num_cols the total number of columns of the csv file and x_len the length of the features vector
//Read features (numbers) and outputs (strings)
void read_data_from_csv(std::vector<std::vector<double>> &x_data, std::vector<std::string> &y_data, std::string filename, char separating_char, int num_cols, int x_len);
//Read features (numbers) and outputs (numbers)
void read_data_from_csv(std::vector<std::vector<double>> &x_data, std::vector<std::vector<double>> &y_data, std::string filename, char separating_char, int num_cols, int x_len);
//Read features (numbers) and outputs (numbers)
void read_data_from_csv(std::vector<Eigen::VectorXd> &x_data, std::vector<Eigen::VectorXd> &y_data, std::string filename, char separating_char, int num_cols, int x_len);
//Read the features from "filename".csv. Saves the features in x_data. Separating char is the separating char of the csv file; num_cols the total number of columns, correspoding to the length of the features vector
void read_double_x_from_csv(std::vector<std::vector<double>> &x_data, std::string filename, char separating_char, int num_cols);
#endif /* READ_CSV */