本文整理汇总了C++中eigen::MatrixXcd::data方法的典型用法代码示例。如果您正苦于以下问题:C++ MatrixXcd::data方法的具体用法?C++ MatrixXcd::data怎么用?C++ MatrixXcd::data使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eigen::MatrixXcd
的用法示例。
在下文中一共展示了MatrixXcd::data方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: write_eig_sys_bin
void write_eig_sys_bin(const char* prefix, const int config_i, const int t, const int nb_ev, Eigen::MatrixXcd& V) {
const int V3 = pars -> get_int("V3");
std::string path = pars -> get_path("res");
//set up filename
char file [200];
sprintf(file, "%s/%s.%04d.%03d", path.c_str(), prefix, config_i, t);
//sprintf(file, "%s.%04d.%03d", prefix, config_i, t);
if(check_trace(V, nb_ev) != true){
std::cout << "Timeslice: " << t << ": Eigenvectors damaged, abort writing" << std::endl;
exit(1);
}
std::cout << "Writing to file:" << file << std::endl;
std::ofstream outfile(file, std::ofstream::binary);
std::streamsize begin = outfile.tellp();
std::streamsize eigsys_bytes =2*3*V3*nb_ev*sizeof(double);
outfile.write(reinterpret_cast<char*> (V.data()), eigsys_bytes);
std::streamsize end = outfile.tellp();
if ( (end - begin)/eigsys_bytes != 1 ){
std::cout << "Timeslice: " << t << " Error: write incomplete, exiting" << std::endl;
std::cout << (end-begin) << " bytes instead of expected "<< eigsys_bytes << " bytes" << std::endl;
exit(1);
}
//std::cout << end - begin << " bytes written" << std::endl;
outfile.close();
}
示例2: cmplxMatrixString
std::string cmplxMatrixString(const Eigen::MatrixXcd& m)
{
// Make a string from the bytes
return std::string((char *) m.data(), m.size() * sizeof(m(0, 0)));
}