save.hpp
Go to the documentation of this file.
1 
14 #ifndef MLPACK_CORE_DATA_SAVE_HPP
15 #define MLPACK_CORE_DATA_SAVE_HPP
16 
17 #include <mlpack/core/util/log.hpp>
18 #include <mlpack/core/arma_extend/arma_extend.hpp> // Includes Armadillo.
19 #include <string>
20 
21 #include "format.hpp"
22 #include "image_info.hpp"
23 
24 namespace mlpack {
25 namespace data {
26 
62 template<typename eT>
63 bool Save(const std::string& filename,
64  const arma::Mat<eT>& matrix,
65  const bool fatal = false,
66  bool transpose = true,
67  arma::file_type inputSaveType = arma::auto_detect);
68 
94 template<typename eT>
95 bool Save(const std::string& filename,
96  const arma::SpMat<eT>& matrix,
97  const bool fatal = false,
98  bool transpose = true);
99 
125 template<typename T>
126 bool Save(const std::string& filename,
127  const std::string& name,
128  T& t,
129  const bool fatal = false,
131 
141 template<typename eT>
142 bool Save(const std::string& filename,
143  arma::Mat<eT>& matrix,
144  ImageInfo& info,
145  const bool fatal = false);
146 
156 template<typename eT>
157 bool Save(const std::vector<std::string>& files,
158  arma::Mat<eT>& matrix,
159  ImageInfo& info,
160  const bool fatal = false);
161 
165 bool SaveImage(const std::string& filename,
166  arma::Mat<unsigned char>& image,
167  ImageInfo& info,
168  const bool fatal = false);
169 
170 } // namespace data
171 } // namespace mlpack
172 
173 // Include implementation.
174 #include "save_impl.hpp"
175 
176 #endif
Linear algebra utility functions, generally performed on matrices or vectors.
bool SaveImage(const std::string &filename, arma::Mat< unsigned char > &image, ImageInfo &info, const bool fatal=false)
Helper function to save files.
format
Define the formats we can read through cereal.
Definition: format.hpp:20
bool Save(const std::string &filename, const arma::Mat< eT > &matrix, const bool fatal=false, bool transpose=true, arma::file_type inputSaveType=arma::auto_detect)
Saves a matrix to file, guessing the filetype from the extension.