Re: [eigen] default printing format

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


OK, so:

for the alignment proposal, i didn't see an objection, so let's go for it.

for the full precision idea, there are opinions on both sides, but i
didn't see an answer to what i think is the biggest objection: c++
stream do not show full precision by default, so there would be a
discrepancy if suddenly we made them use full precision when they're
used with matrices. For example:

cout << "matrix:\n" << matrix << "determinant\n" <<
matrix.determinant() << endl;

here the determinant should be printed with the same precision as the matrix!

We can mention stream::precision() in the documentation; and we
already mention in the IOFormat documentation the ability to set the
precision level.

Moreover, already in Eigen 2.0 one can set once and for all a default
IOFormat different from the "default default":

#define EIGEN_DEFAULT_IO_FORMAT Eigen::IOFormat(16)
before #including eigen.

However, there was still missing an option for "full precision".
Indeed, passing 16 is only satisfactory if you always use double, but
not for float. So let's add another special value (say -2, but they'll
be named anyway) for automatically determining the full precision,
based on the epsilon().

So if you want full precision, you'll just have to do:
#define EIGEN_DEFAULT_IO_FORMAT Eigen::IOFormat(Eigen::FullPrecision)

(name subject to change)

Benoit

2009/8/13 Thomas Capricelli <orzel@xxxxxxxxxxxxxxx>:
> In data venerdì 14 agosto 2009 02:02:33, Tim Hutt ha scritto:
> : > Full precision is usually excessive for debugging purposes. You'll get
>> silly matrices like this:
>>
>> 12.3243598603956866 23.397783900968423 4.39399971202043945
>> 2.35459959006778223 3.5969699400049499 -6.2333456797887965
>
> Pretty much what i love to get ! But i'm ok with a shorter default, now that i
> now about precision()..
>
> Thomas
> --
> Thomas Capricelli <orzel@xxxxxxxxxxxxxxx>
> http://www.freehackers.org/thomas
>
>
>



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/