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

Default behaviour is now that warnings are turned off

parent 7fdf2c85
No related branches found
No related tags found
No related merge requests found
...@@ -89,8 +89,8 @@ template<class T> ...@@ -89,8 +89,8 @@ template<class T>
class SpMat class SpMat
{ {
public: public:
SpMat() : _m(0), _n(0), _nz(0), _ri(0), _val(0) {} SpMat() : _m(0), _n(0), _nz(0), _ri(0), _val(0), _pw(false) {}
SpMat(unsigned int m, unsigned int n) : _m(m), _n(n), _nz(0), _ri(n), _val(n) {} SpMat(unsigned int m, unsigned int n) : _m(m), _n(n), _nz(0), _ri(n), _val(n), _pw(false) {}
SpMat(unsigned int m, unsigned int n, const unsigned int *irp, const unsigned int *jcp, const double *sp); SpMat(unsigned int m, unsigned int n, const unsigned int *irp, const unsigned int *jcp, const double *sp);
SpMat(const NEWMAT::GeneralMatrix& M); SpMat(const NEWMAT::GeneralMatrix& M);
SpMat(const std::string& fname); SpMat(const std::string& fname);
...@@ -109,6 +109,8 @@ public: ...@@ -109,6 +109,8 @@ public:
void Print(const std::string& fname) const {Print(fname,8);} void Print(const std::string& fname) const {Print(fname,8);}
void Print(unsigned int precision) const {Print(std::string(""),precision);} void Print(unsigned int precision) const {Print(std::string(""),precision);}
void Print() const {Print(8);} void Print() const {Print(8);}
void WarningsOn() {_pw=true;}
void WarningsOff() {_pw=false;}
T Peek(unsigned int r, unsigned int c) const; T Peek(unsigned int r, unsigned int c) const;
...@@ -173,6 +175,7 @@ private: ...@@ -173,6 +175,7 @@ private:
unsigned long _nz; unsigned long _nz;
std::vector<std::vector<unsigned int> > _ri; std::vector<std::vector<unsigned int> > _ri;
std::vector<std::vector<T> > _val; std::vector<std::vector<T> > _val;
bool _pw; // Print Warnings
bool found(const std::vector<unsigned int>& ri, unsigned int key, int& pos) const; bool found(const std::vector<unsigned int>& ri, unsigned int key, int& pos) const;
T& here(unsigned int r, unsigned int c); T& here(unsigned int r, unsigned int c);
...@@ -305,7 +308,7 @@ private: ...@@ -305,7 +308,7 @@ private:
template<class T> template<class T>
SpMat<T>::SpMat(unsigned int m, unsigned int n, const unsigned int *irp, const unsigned int *jcp, const double *sp) SpMat<T>::SpMat(unsigned int m, unsigned int n, const unsigned int *irp, const unsigned int *jcp, const double *sp)
: _m(m), _n(n), _nz(0), _ri(n), _val(n) : _m(m), _n(n), _nz(0), _ri(n), _val(n), _pw(false)
{ {
_nz = jcp[n]; _nz = jcp[n];
unsigned long nz = 0; unsigned long nz = 0;
...@@ -335,7 +338,7 @@ SpMat<T>::SpMat(unsigned int m, unsigned int n, const unsigned int *irp, const u ...@@ -335,7 +338,7 @@ SpMat<T>::SpMat(unsigned int m, unsigned int n, const unsigned int *irp, const u
template<class T> template<class T>
SpMat<T>::SpMat(const NEWMAT::GeneralMatrix& M) SpMat<T>::SpMat(const NEWMAT::GeneralMatrix& M)
: _m(M.Nrows()), _n(M.Ncols()), _nz(0), _ri(M.Ncols()), _val(M.Ncols()) : _m(M.Nrows()), _n(M.Ncols()), _nz(0), _ri(M.Ncols()), _val(M.Ncols()), _pw(false)
{ {
double *m = static_cast<double *>(M.Store()); double *m = static_cast<double *>(M.Store());
...@@ -371,7 +374,7 @@ SpMat<T>::SpMat(const NEWMAT::GeneralMatrix& M) ...@@ -371,7 +374,7 @@ SpMat<T>::SpMat(const NEWMAT::GeneralMatrix& M)
template<class T> template<class T>
SpMat<T>::SpMat(const std::string& fname) SpMat<T>::SpMat(const std::string& fname)
: _m(0), _n(0), _nz(0), _ri(0), _val(0) : _m(0), _n(0), _nz(0), _ri(0), _val(0), _pw(false)
{ {
// First read data into (nz+1)x3 NEWMAT matrix // First read data into (nz+1)x3 NEWMAT matrix
NEWMAT::Matrix rcv; NEWMAT::Matrix rcv;
...@@ -573,7 +576,7 @@ NEWMAT::ReturnMatrix SpMat<T>::SolveForx(const NEWMAT::ColumnVector& ...@@ -573,7 +576,7 @@ NEWMAT::ReturnMatrix SpMat<T>::SolveForx(const NEWMAT::ColumnVector&
throw SpMatException("SolveForx: No idea how you got here. But you shouldn't be here, punk."); throw SpMatException("SolveForx: No idea how you got here. But you shouldn't be here, punk.");
} }
if (status) { if (status && _pw) {
cout << "SpMat::SolveForx: Warning requested tolerence not obtained." << endl; cout << "SpMat::SolveForx: Warning requested tolerence not obtained." << endl;
cout << "Requested tolerance was " << ltol << ", and achieved tolerance was " << tol << endl; cout << "Requested tolerance was " << ltol << ", and achieved tolerance was " << tol << endl;
cout << "This may or may not be a problem in your application, but you should look into it" << endl; cout << "This may or may not be a problem in your application, but you should look into it" << endl;
......
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