Polynomial.cc
Go to the documentation of this file.
1 #include <utl/Polynomial.h>
2 #include <iterator>
3 
4 
5 namespace utl {
6 
7  using namespace std;
8 
9 
10  template<typename T>
11  istream&
12  operator>>(istream& is, vector<T>& v)
13  {
14  v.clear();
15  copy(istream_iterator<T>(is), istream_iterator<T>(), back_inserter(v));
16  return is;
17  }
18 
19 
20  template<typename T>
21  ostream&
22  operator<<(ostream& os, const vector<T>& v)
23  {
24  copy(v.begin(), v.end(), ostream_iterator<T>(os, " "));
25  return os;
26  }
27 
28 
29  istream&
30  operator>>(istream& is, Polynomial& p)
31  {
32  vector<double> c;
33  if ((is >> c).bad())
34  c.clear();
35  p = Polynomial(c);
36  return is;
37  }
38 
39 
40  ostream&
41  operator<<(ostream& os, const Polynomial& p)
42  {
43  return os << p.GetCoefficients();
44  }
45 
46 }
std::istream & operator>>(std::istream &is, SVector< n, T > &v)
Definition: SVector.h:346
Simple polynomial container.
Definition: Polynomial.h:22
bool is(const double a, const double b)
Definition: testlib.cc:113
Stream & operator<<(Stream &s, MessageLoggerConfig &mlc)
Applies the configuration to the given stream.
const std::vector< double > & GetCoefficients() const
Definition: Polynomial.h:34

, generated on Tue Sep 26 2023.