|
Ublas : |
Subject: Re: [ublas] matrix console output
From: Michael (ublas_at_[hidden])
Date: 2009-06-09 07:16:34
Maik Beckmann wrote:
> Michael schrieb am Dienstag 09 Juni 2009 um 09:18:
>
>> Ok, let me explain then. I'm trying to write an algorithm to compute an
>> orthonormal basis for the column space of a particular matrix A. For
>> debugging purposes, I will need to print the intermediate results to a
>> console. Since the output the existing code is barely readable, I've
>> rewritten part of the io.hpp, so that the output is easier to interpret
>> by the programmer.
>>
>
> Thank you!
>
> main.cpp fails to compile with
> {{{
> In file included from main.cpp:13:
> io.hpp:16: error: redefinition of 'template<class E, class T, class ME>
> basic_ostream<_CharT, _Traits> & boost::numeric::ublas::operator<<(
> basic_ostream<_CharT, _Traits> &
> , const boost::numeric::ublas::matrix_expression<E2> &
> )'
> /usr/include/boost/numeric/ublas/io.hpp:84: error: 'template<
> class E, class T, class ME
> > basic_ostream<_CharT, _Traits> & boost::numeric::ublas::operator<<(
> basic_ostream<_CharT, _Traits> &
> , const boost::numeric::ublas::matrix_expression<E2> &
> )' previously declared here
> }}}
> because your and boost's io.hpp are both included.
>
> I attached a modified version which switches by using a PP definition
> {{{
> #ifdef USE_OLD_IO
> # include <boost/numeric/ublas/io.hpp>
> #else
> # include "io.hpp"
> #endif
> }}}
>
> $ g++ -DUSE_OLD_IO main.cpp -o old_io
> $ g++ main.cpp -o new_io
> $ echo "old_io" > log
> $ ./old_io >> log
> $ echo "" >> log
> $ echo "" >> log
> $ echo "new_io" >> log
> $ ./new_io >> log
>
> The result
> - (log) http://pastebin.com/f12152515
> shows that the proposed new output code does indeed am much better job, IMHO.
>
>
> -- Maik
>
>
You're welcome :)