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

Added << operator

parent 45904440
No related branches found
No related tags found
No related merge requests found
......@@ -74,8 +74,18 @@ public:
void MultiContract();
/// Update the indicies for best, worst and 2nd to worst points.
void UpdateRankIndicies();
// Prints out the points of the simplex and the associated function values
// Global function. Prints out the points of the simplex and the associated function values
friend ostream& operator<<(ostream& op, const Simplex& smplx);
{
op << "Simplex = " << endl;
for (unsigned int i=0; i<smplx._smx.size(); i++) {
for (unsigned int j=1; j<smplx._smx.size(); j++) {
op << std::setw(10) << std::setprecision(4) << smplx._smx[i](j);
}
op << " | " << std::setw(10) << std::setprecision(4) << smplx._fv[i] << endl;
}
return(op);
}
private:
const MISCMATHS::NonlinCF& _cf;
const NEWMAT::ColumnVector _sp;
......@@ -90,19 +100,6 @@ private:
void calculate_reflexion_point(unsigned int ii);
};
// Global function, friend of Simplex
ostream& operator<<(ostream& op, const Simplex& smplx)
{
op << "Simplex = " << endl;
for (unsigned int i=0; i<smplx._smx.size(); i++) {
for (unsigned int j=1; j<smplx._smx.size(); j++) {
op << std::setw(10) << std::setprecision(4) << smplx._smx[i](j);
}
op << " | " << std::setw(10) << std::setprecision(4) << smplx._fv[i] << endl;
}
return(op);
}
} // End namespace MISCMATHS
#endif // End #ifndef Simplex_h
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