Re: [eigen] Permuted Matrix

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


Benoit Jacob wrote:
> 2010/7/20 Christoph Hertzberg <chtz@xxxxxxxxxxxxxxxxxxxxxxxx>:
>> Christoph Hertzberg wrote:
>>> template<class Derived>
>>> void access_test(const MatrixBase<Derived>& m1) {
>>>       MatrixBase<Derived> m2 = m1;
>>>       m2 += m1;
>>> }
>>>
>>> int main(void) {
>>>       Matrix3d A, B;
>>>       access_test(A*B);
>>> }
>> with Eigen2 this actually compiles, but (as it seems) gets stuck in some
>> infinite loop ...
> 
> Just for the record --- these infinite loops are a known problem with
> Eigen2 that's been fixed in Eigen3.

I wasn't aware of that, though I guessed so as it doesn't compile in
Eigen3 anymore. But you could still easily prohibit many occurrences of
this (also in the 2.0 branch) by protecting the copy constructor.

> Also for the record --- your code above,
> 
>    MatrixBase<Derived> m2 = m1;
> 
> is not going to work anyway since m2 is declared as MatrixBase i.e. as
> an empty object. We have added some safeguards against constructing
> bad MatrixBase objects but apparently we need some more. Maybe we
> could actually make the copy constructor private?

I am aware that here the correct code would be
	typename MatrixBase<Derived>::PlainObject m2 = m1; //or: m2(m1)
I was just pointing out that some bogus code is compiling



-- 
----------------------------------------------
Dipl.-Inf. Christoph Hertzberg
Cartesium 0.051
Universität Bremen
Enrique-Schmidt-Straße 5
28359 Bremen

Tel: (+49) 421-218-64252
----------------------------------------------



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