44 lines
1.1 KiB
C++
44 lines
1.1 KiB
C++
//
|
|
// Created by baiguwen on 2022/4/20.
|
|
//
|
|
#include <iostream>
|
|
#include "step.h"
|
|
#include <fstream>
|
|
#include <string>
|
|
#include <sstream>
|
|
#include <vector>
|
|
|
|
int main() {
|
|
step algorithm;
|
|
|
|
algorithm.set_config(
|
|
{
|
|
{"STEP_AMPLITUDE_BASE", 10}
|
|
}
|
|
);
|
|
std::vector <std::vector<double>> user_arr;
|
|
std::ifstream fp("C:/data/user_data.csv");
|
|
std::string line;
|
|
getline(fp,line);
|
|
while (getline(fp,line)){
|
|
std::vector <double> data_line;
|
|
std::string number;
|
|
std::istringstream readstr(line);
|
|
for(int j = 0;j < 2814;j++){
|
|
getline(readstr,number,',');
|
|
data_line.push_back(atof(number.c_str()));
|
|
}
|
|
user_arr.push_back(data_line);
|
|
}
|
|
std::ofstream outfile;
|
|
outfile.open("C:/data/user_data6.csv", std::ios::out);
|
|
outfile<<"origin"<<','<<"step"<<std::endl;
|
|
for (int i = 0; i <2814; ++i) {
|
|
user_arr[i][1]=algorithm.eval(user_arr[i][0]);
|
|
std::cout << i << "\t" << user_arr[i][1] << std::endl;
|
|
outfile<<user_arr[i][0]<<','<<user_arr[i][1]<<std::endl;
|
|
}
|
|
outfile.close();
|
|
|
|
return 0;
|
|
} |