Re: [eigen] "May be used uninitialized" warning...

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


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
>



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