Skip to content
Snippets Groups Projects
Commit b7e5c6f6 authored by Jesper Andersson's avatar Jesper Andersson
Browse files

Added Save as alias to Print (for MJ's benefit)

parent d9ee2145
No related branches found
No related tags found
No related merge requests found
......@@ -99,6 +99,9 @@ public:
unsigned int NZ() const {return(_nz);}
NEWMAT::ReturnMatrix AsNEWMAT() const;
void Save(const std::string& fname,
unsigned int precision) const;
void Save(const std::string& fname) const {Save(fname,8);}
void Print(const std::string& fname,
unsigned int precision) const;
void Print(const std::string& fname) const {Print(fname,8);}
......@@ -381,6 +384,24 @@ NEWMAT::ReturnMatrix SpMat<T>::AsNEWMAT() const
return(M);
}
/////////////////////////////////////////////////////////////////////
//
// Saves matrix in a row col val format that is useful for
// exporting it to Matlab (use Matlab function spconvert).
// Is really the same as Print below, but only writes to
// file as opposed to Print that optionally prints to the
// screen.
//
/////////////////////////////////////////////////////////////////////
template<class T>
void SpMat<T>::Save(const std::string& fname,
unsigned int precision) const
{
if (!fname.length()) throw SpMatException("SpMat::Save: Must specify filename");
else Print(fname,precision);
}
/////////////////////////////////////////////////////////////////////
//
// Prints matrix in a row col val format that is useful for
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment