本文整理汇总了C++中arma::mat::save方法的典型用法代码示例。如果您正苦于以下问题:C++ mat::save方法的具体用法?C++ mat::save怎么用?C++ mat::save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类arma::mat
的用法示例。
在下文中一共展示了mat::save方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: writeMDS
// Also saves sample information
void writeMDS(const std::string& file_name, const std::vector<Sample>& sample_names, const arma::mat& MDS)
{
if (MDS.n_rows == sample_names.size())
{
MDS.save(file_name, arma::hdf5_binary);
std::string sample_file_name = file_name + sample_suffix;
std::ofstream sample_names_file(sample_file_name.c_str());
// Write out the sample name order
if (!sample_names_file)
{
std::cerr << "Could not write used sample names to " << sample_file_name << std::endl;
}
else
{
for (auto sample_it = sample_names.begin(); sample_it != sample_names.end(); ++sample_it)
{
sample_names_file << sample_it->iid() << std::endl;
}
}
}
else
{
throw std::logic_error("When writing matrix to " + file_name + " the number samples in the .pheno file did not match the number of columns or rows");
}
}
示例2: SaveText
bool Vespucci::SaveText(std::string basename, const arma::mat &spectra, const arma::vec &x, const arma::vec &y, const arma::vec &abscissa, arma::file_type type)
{
std::string extension;
switch (type){
case arma::csv_ascii:
extension = ".csv";
case arma::raw_ascii: default:
extension = ".txt";
}
bool x_success, y_success, spectra_success, abscissa_success;
spectra_success = spectra.save(basename + "_spectra" + extension, type);
abscissa_success = abscissa.save(basename + "_abscissa" + extension, type);
x_success = x.save(basename + "_x" + extension, type);
y_success = y.save(basename + "_y" + extension, type);
return (x_success && y_success && spectra_success && abscissa_success);
}
示例3: writeDistances
void writeDistances(const std::string& file_name, const arma::mat& distances)
{
distances.save(file_name, arma::csv_ascii);
}