当前位置: 首页 > news >正文

网站建设论文模板公司简介概况怎么写

网站建设论文模板,公司简介概况怎么写,网站开发文档范例,网红推广团队去哪里找C中读取与保存不同维度的csv数据 一、保存csv数据1.1 一维vector1.2 二维vector1.3 三维vector1.4 五维vector 二、读取csv数据2.1 一维vector2.2 二维vector2.3 三维vector2.4 五维vector 一、保存csv数据 1.1 一维vector #include <iostream> #include <fstream&g…

C++中读取与保存不同维度的csv数据

  • 一、保存csv数据
    • 1.1 一维vector
    • 1.2 二维vector
    • 1.3 三维vector
    • 1.4 五维vector
  • 二、读取csv数据
    • 2.1 一维vector
    • 2.2 二维vector
    • 2.3 三维vector
    • 2.4 五维vector

一、保存csv数据

1.1 一维vector

#include <iostream>
#include <fstream>
#include <direct.h>
#include <io.h>
using namespace std;void Save_bias(vector<double> &bias, string names)
{string folderPath = "..//parameter_bias//" + names;if (0 != _access(folderPath.c_str(), 0)){_mkdir(folderPath.c_str());}ofstream pxData;pxData.open(folderPath + "//0.csv", std::ios::out | std::ios::trunc);for (int i = 0; i < bias.size(); i++){if (i == bias.size() - 1){pxData << bias[i] << std::endl;}else{pxData << bias[i] << ",";}}pxData.close();
}

1.2 二维vector

#include <iostream>
#include <fstream>
#include <direct.h>
#include <io.h>
using namespace std;void Save_means(vector<vector<double>> &means, string names)
{string folderPath = "..//parameter_mpvs//" + names;if (0 != _access(folderPath.c_str(), 0)){_mkdir(folderPath.c_str());}ofstream pxData;pxData.open(folderPath + "//0.csv", std::ios::out | std::ios::trunc);for (int i = 0; i < means.size(); i++){for (int j = 0; j < means[i].size(); j++){if (j == means[i].size() - 1){pxData << means[i][j] << std::endl;}else{pxData << means[i][j] << ",";}}}pxData.close();
}

1.3 三维vector

#include <iostream>
#include <fstream>
#include <direct.h>
#include <io.h>
using namespace std;void Save_weight(vector<vector<vector<double>>> &weight, string names)
{string folderPath = "..//parameter_weight//" + names;if (0 != _access(folderPath.c_str(), 0)){_mkdir(folderPath.c_str());}for (int j = 0; j < weight.size(); j++){ofstream pxData;if (j < 10){pxData.open(folderPath + "//0" + to_string(j) + ".csv", std::ios::out | std::ios::trunc);}else{pxData.open(folderPath + "//" + to_string(j) + ".csv", std::ios::out | std::ios::trunc);}for (int p = 0; p < weight[j].size(); p++){for (int q = 0; q < weight[j][p].size(); q++){if (q == weight[j][p].size() - 1){pxData << weight[j][p][q] << std::endl;}else{pxData << weight[j][p][q] << ",";}}}pxData.close();}
}

1.4 五维vector

#include <iostream>
#include <fstream>
#include <direct.h>
#include <io.h>
using namespace std;void Save_weight(vector<vector<vector<vector<vector<double>>>>> weight, string names)
{string init_file = "..//parameter_weight";if (0 != _access(init_file.c_str(), 0)){_mkdir(init_file.c_str());}string folderPath = init_file + "//" + names;if (0 != _access(folderPath.c_str(), 0)){_mkdir(folderPath.c_str());}for (int i = 0; i < weight.size(); i++){string folderPaths = folderPath + "//" + to_string(i);if (0 != _access(folderPaths.c_str(), 0)){_mkdir(folderPaths.c_str());}for (int j = 0; j < weight[i].size()*weight[i][0].size(); j++){ofstream pxData;if (j < 10 && weight[i].size()*weight[i][0].size() > 9){pxData.open(folderPaths + "//0" + to_string(j) + ".csv", std::ios::out | std::ios::trunc);}else{pxData.open(folderPaths + "//" + to_string(j) + ".csv", std::ios::out | std::ios::trunc);}for (int p = 0; p < weight[i][j / weight[i].size()][j % weight[i][0].size()].size(); p++){for (int q = 0; q < weight[i][j / weight[i].size()][j % weight[i][0].size()][p].size(); q++){if (q == weight[i][j / weight[i].size()][j % weight[i][0].size()][p].size() - 1){pxData << weight[i][j / weight[i].size()][j % weight[i][0].size()][p][q] << std::endl;}else{pxData << weight[i][j / weight[i].size()][j % weight[i][0].size()][p][q] << ",";}}}pxData.close();}}
}

二、读取csv数据

2.1 一维vector

#include <iostream>
#include <fstream>
using namespace std;void Read_bias(vector<double> &bias, string names)
{string folderPath = "..//parameter_bias//" + names;ifstream infile(folderPath + "//0.csv", ifstream::_Nocreate);string line, number;while (std::getline(infile, line)){istringstream is(line);vector<double> lineArray;while (std::getline(is, number, ',')){lineArray.push_back(atof(number.c_str()));}bias = lineArray;}
}

2.2 二维vector

#include <iostream>
#include <fstream>
using namespace std;void Read_means(vector<vector<double>> &means, string names)
{string folderPath = "..//parameter_means//" + names;ifstream infile(folderPath + "//0.csv", ifstream::_Nocreate);string line, number;while (std::getline(infile, line)){istringstream is(line);vector<double> lineArray;while (std::getline(is, number, ',')){lineArray.push_back(atof(number.c_str()));}means.push_back(lineArray);}
}

2.3 三维vector

#include <iostream>
#include <fstream>
using namespace std;void Read_weight(vector<vector<vector<double>>> &weight, string names)
{string folderPath = "..//parameter_weight//" + names;string dir;for (int j = 0; j < weight.size(); j++){ofstream pxData;if (j < 10){dir = folderPath + "//0" + to_string(j) + ".csv";}else{dir = folderPath + "//" + to_string(j) + ".csv";}ifstream infile(dir, ifstream::_Nocreate);string line, number;vector<vector<double>> x;while (std::getline(infile, line)){istringstream is(line);vector<double> lineArray;while (std::getline(is, number, ',')){lineArray.push_back(atof(number.c_str()));}x.push_back(lineArray);}weight[j] = x;}
}

2.4 五维vector

#include <iostream>
#include <fstream>
using namespace std;void Read_weight(vector<vector<vector<vector<vector<double>>>>> &_weight, string names)
{string dir_path = "..//parameter_weight";for (int i = 0; i < _weight.size(); i++){for (int j = 0; j < _weight[i].size()*_weight[i][0].size(); j++){string dir;if (j < 10 && _weight[i].size()*_weight[i][0].size() > 9){dir = dir_path + "//" + names + "//" + to_string(i) + "//0" + to_string(j) + ".csv";}else{dir = dir_path + "//" + names + "//" + to_string(i) + "//" + to_string(j) + ".csv";}ifstream infile(dir, ifstream::_Nocreate);string line, number;vector<vector<double>> x;while (std::getline(infile, line)){istringstream is(line);vector<double> lineArray;while (std::getline(is, number, ',')){lineArray.push_back(atof(number.c_str()));}x.push_back(lineArray);}_weight[i][j / _weight[i].size()][j % _weight[i][0].size()] = x;}}
}
http://www.dtcms.com/a/604425.html

相关文章:

  • 公司管理的三大系统百度关键词优化软件排名
  • 编写软件wordpress优化教程
  • 购买了网站如何使用吗网站备案黑名单
  • 北京建设协会网站淄博网站客户
  • 网站建设教程菜鸟物流打造龙头建设示范
  • 怎么做网站软文投放平台有哪些
  • 请列举常见的网站推广方法推广计划表
  • 湛江做建站软仿网站公司建设网站首页
  • 提供佛山网站制作网站建设 业务员
  • 建网站所需材料百度推广一个月多少钱
  • 南昌网站seo做网站月入100万
  • 网络设计方案是如何体现网络设计需求的?网站优化需要工具
  • 广州网站建设网站建设白云鄂博矿区网站建设
  • 莱芜中医院网站wordpress thecontent
  • 网站表现形式长沙网站托管公司排名
  • led营销型网站建设内蒙古建设厅设计处网站
  • 如何建立网站建设规划搭建网站的平台有哪些
  • 购物网站建设方案书企业网站建设调查问卷
  • 网站开发工程师学什么区别58同城网
  • 网站搭建系列教程抖音seo优化公司
  • 宿迁市住房和城乡建设局网站网站换空间的流程
  • 视频网站主持人win10必做的优化
  • 上海做网站哪家公司好开网店需要什么条件和哪些手续?
  • 给别人做设计的网站百度竞价专员
  • 户外保险网站可以自己设计logo的软件
  • 手机网站数据加载oa办公系统下载安装
  • 昆明找工作哪个网站好php网站只能打开首页
  • asp.net网站制作视频教程现在网站一般做多大的
  • 购物网站 英文介绍长沙网页制作网站
  • 深圳响应式建站无锡网站排名优化费用