Re: [eigen] "May be used uninitialized" warning... |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] "May be used uninitialized" warning...
- From: Jose Luis Blanco <joseluisblancoc@xxxxxxxxx>
- Date: Fri, 10 Dec 2010 00:05:22 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=M1GfcCknrObkOjTT9eNMzLemWR6wvTyGz4yO8g6WUng=; b=bFiBMJNI2kdTDXai8NFUuYqx73exPWfPv7DYWp3RgOE5j5tzezl1QjHsBkTs08yruw ji5ZNmrueC17ZPA8Nw3mGU7g1EciIFtxxBto8dCbIf7D2wq43PTjoAZ8vnX5+VMiLgBA 1r/ninXrHBVjpXebdLfEPK7iYma/zvAF+TKrE=
- 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=MgCvhSYxc5gND2itTMW5jrAHGLkdLvQo4dR6WAqodxkgvM5T5rN83jx5iIxhSKR4RJ rjNc8raguDcFf734tLbQR/n3qHYJ8j33TmSC8RSrxDAt6uFXoqWSotswfj16qkAuxHqo h6VFEzFMBk5mAHi/21BrSX70LcnKJ8611zfeU=
Hi Benoit,
Mmm... sorry for the bad example. Of course I found the issue on
properly initialized matrices, and the same warnings come out.
Instead of the previous example, take this one:
int main()
{
Eigen::Matrix<double,4,4> M = Eigen::Matrix<double,4,4>::Random();
Eigen::EigenSolver< Eigen::Matrix<double,4,4> > es(M, true);
cout << "M: "<< M << endl << endl;
cout << "evecs: "<< es.eigenvectors() << endl;
cout << "evals: "<< es.eigenvalues() << endl;
return 0;
}
The warnings also appear there (for -Wall -DNDEBUG), and the output is
apparently OK:
============== OUTPUT ===================
M: 0.680375 0.823295 -0.444451 -0.270431
-0.211234 -0.604897 0.10794 0.0268018
0.566198 -0.329554 -0.0452059 0.904459
0.59688 0.536459 0.257742 0.83239
evecs: (0.349378,0.540657) (0.349378,-0.540657)
(-0.0377618,-0.222364) (-0.0377618,0.222364)
(-0.0630065,-0.0993635) (-0.0630065,0.0993635)
(-0.179376,0.000711027) (-0.179376,-0.000711027)
(0.313002,-0.372126) (0.313002,0.372126)
(-0.594828,-0.663136) (-0.594828,0.663136)
(0.252229,-0.521263) (0.252229,0.521263)
(0.212017,0.280057) (0.212017,-0.280057)
evals: (0.754819,0.527518)
(0.754819,-0.527518)
(-0.323488,0.0964571)
(-0.323488,-0.0964571)
============== END OF OUTPUT ===================
Perhaps that's a silly GCC warning, but just wanted to let you know!
Best,
JL
On Thu, Dec 9, 2010 at 10:48 PM, Benoit Jacob <jacob.benoit.1@xxxxxxxxx> wrote:
>> that one gets compiling something like:
>>
>> int main()
>> {
>> Eigen::Matrix<double,4,4> M;
>> Eigen::EigenSolver< Eigen::Matrix<double,4,4> > es(M, true);
>> return 0;
>> }
>
> This code is computing the eigendecomposition of an uninitialized
> matrix M. Eigen Matrix default constructors leave the coefficients
> uninitialized. So of course this warning is legitimate, but the
> problem is in your code!
>
> Benoit
>