12 #ifndef ECL_LINEAR_ALGEBRA_FORMATTERS_HPP_    13 #define ECL_LINEAR_ALGEBRA_FORMATTERS_HPP_    19 #include <ecl/exceptions/standard_exception.hpp>    20 #include <ecl/formatters.hpp>    21 #include <ecl/mpl/enable_if.hpp>    22 #include <ecl/type_traits/fundamental_types.hpp>    40 template <
typename Derived, 
typename Scalar, 
typename Enable = 
void>
    41 class MatrixFormatter {
    60 template<
typename Derived>
    61 class FloatMatrixFormatter {
    73         FloatMatrixFormatter(
const int &w = -1, 
const unsigned int &p = 2) :
    74                 tmp_formatting(false),
    75                 ready_to_format(false),
    81         virtual ~FloatMatrixFormatter() {}
    94         FloatMatrixFormatter<Derived>& precision( 
const unsigned int &p ) {
   107         FloatMatrixFormatter<Derived>& width( 
const int &w ) {
   116         unsigned int precision() { 
return format.precision(); }
   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_ >
   190                 unsigned int tmp_precision;
   192                 bool ready_to_format;
   193                 const Derived *_matrix;
   196 template <
typename OutputStream, 
typename Derived_ >
   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 LOC
Stringify the line of code you are at. 
#define ecl_assert_throw(expression, exception)
Debug mode throw with a logical condition check. 
Standard exception type, provides code location and error string. 
#define ecl_assert_throw_decl(exception)
Assure throw exception declaration.