27 #ifndef MPBLOCKS_POLYNOMIAL_OSTREAM_H_
28 #define MPBLOCKS_POLYNOMIAL_OSTREAM_H_
37 namespace polynomial {
41 template <
typename Scalar,
class Exp>
42 std::ostream&
print( std::ostream& out,
44 const std::string& var =
"x")
46 for(
int i=0; i < p.
size(); i++)
58 template <
typename Scalar,
class Exp>
59 std::ostream&
print( std::ostream& out,
61 const std::vector<int>& spec,
62 const std::string& var =
"x")
64 std::stringstream strm;
65 for(
int i=0; i < p.
size(); i++)
71 out << std::setw(spec[i])
81 template <
typename Scalar,
class Exp>
84 const std::string& var =
"x")
86 std::stringstream out;
87 if( spec.size() < p.
size() )
88 spec.resize( p.
size(), 0 );
90 for(
int i=0; i < p.
size(); i++)
96 if( out.str().size() > spec[i] )
97 spec[i] = out.str().size();
102 template <
typename Scalar,
class Exp>
109 template <
typename Scalar>
110 std::ostream&
print( std::ostream& out,
112 const std::string& var=
"x")
114 std::vector<int> spec( seq[0].size(), 0 );
116 for(
int i=0; i < seq.
size(); i++)
118 for(
int i=0; i < seq.
size(); i++)
119 print(out,seq[i],spec,var) <<
"\n";
123 template <
typename Scalar>
127 return print(out,seq);
146 #endif // IOSTREAM_H_
void preprint(std::vector< int > &spec, RValue< Scalar, Exp > const &p, const std::string &var="x")
std::ostream & print(std::ostream &out, RValue< Scalar, Exp > const &p, const std::string &var="x")
Size_t size() const
return the size for a vector
std::ostream & operator<<(std::ostream &out, RValue< Scalar, Exp > const &p)
expression template for rvalues