Re: [eigen] default printing format |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] default printing format
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Thu, 13 Aug 2009 21:52:08 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=uaAnMtPC95u/xvgxiNZdRsEAJMOL/M7aD7OnAIgwB7E=; b=DzFDUp900eJiNBo2QPDT6LLPfkQJohx157xoqfTk//4MgL2DmWs6lkLuuTQlrLg2Ie i8bXAgcjT4HDN8Yxxmq1iD+35jdSzMTFTtFGJR+HO1mfchTNq1COjCpheVrKmPoPqSOt HWdGr8p9ZO7vErrZ2HNd9M+YOX98wTm7ml1ts=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=bLGZOK6PgJ6aji/eWOu7PQe5RmL9bVX0AHJZH7wFvG6F6Q07wJ42DrQdLbsmdCcm5P XpKWmPdIHlpzWoq7oAQ/n98L4ZAEEh4prGdNCpKJ4v2+tHbMFlsbOqt9vG88hncfIuwI e0KVeiv8/sKAh4Gpp2OHEI5PMkev02XvEIwMQ=
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
>
>
>