12 #ifndef ECL_LINEAR_ALGEBRA_FORMATTERS_HPP_ 13 #define ECL_LINEAR_ALGEBRA_FORMATTERS_HPP_ 40 template <
typename Derived,
typename Scalar,
typename Enable =
void>
60 template<
typename Derived>
74 tmp_formatting(false),
75 ready_to_format(false),
122 int width() {
return format.width(); }
142 ready_to_format =
true;
166 tmp_formatting =
true;
167 ready_to_format =
true;
184 template <
typename OutputStream,
typename Derived_ >
185 friend OutputStream& operator << ( OutputStream& ostream, FloatMatrixFormatter<Derived_> & formatter );
196 template <
typename OutputStream,
typename Derived_ >
197 OutputStream& operator << (OutputStream& ostream, FloatMatrixFormatter< Derived_ > & formatter )
200 "_matrix was not initialised " 201 "please pass the your matrix through () operator") );
203 "either there is no data available, or you have tried to use the " 204 "formatter more than once in a single streaming operation. " 205 "C++ produces unspecified results when functors are used multiply " 206 "in the same stream sequence, so this is not permitted here.") );
209 if ( formatter.ready_to_format ) {
210 unsigned int prm_precision = formatter.format.precision();;
211 int prm_width = formatter.format.width();
212 if ( formatter.tmp_formatting ) {
213 formatter.format.precision(formatter.tmp_precision);
214 formatter.format.width(formatter.tmp_width);
223 int rows = formatter._matrix->rows();
224 int cols = formatter._matrix->cols();
225 for(
int i=0; i<rows; i++ )
227 for(
int j=0; j<cols; j++ )
229 ostream << formatter.format(formatter._matrix->coeff( i, j )) <<
" ";
236 if ( formatter.tmp_formatting ) {
237 formatter.format.precision(prm_precision);
238 formatter.format.width(prm_width);
239 formatter.tmp_formatting =
false;
241 formatter.ready_to_format =
false;
250 template <
typename Derived,
typename Scalar>
#define ecl_assert_throw(expression, exception)